Fetching remote content with curl

Lately I see lots of problems with bunch of website scripts still using fopen() function to retrieve remote urls. Usually problem isn’t in scripts themselves but in the mere fact that url_functions are more and more often disabled in webhost’s php configuration. I can’t say I blame them, pure thought off all the possible script exploits that are using url_fopen isn’t very comforting. What bothers me is php developers not wanting to accept new ways of retrieving remote content. I’m pretty sure that almost all webhosts have curl enabled, and curl is one powerful function in php. But still we can find tons of fopen functions wanting to retrieve remote content in almost all popular content management systems.

In the rest of the post I will present you with alternatives to fopen, as some examples and guidelines for retrieving remote url content. Post is a bit longer but bear with me. Read more

Multiple network interfaces in Xen

By default xen tools comes with only one network interface enabled for your dom0 and domU machines. So what if you want to add some more? It’s actually very simple.

All you need to do is run:

/etc/xen/scripts/network-bridge start vifnum=1 netdev=eth1 bridge=xenbr1

This will effectively create one extra xenbr attached to eth1 interface. You can repeat the above command for all your interfaces, and you can stop them in the same manner, just replace start with stop.

To enable this automatically you can create file named, let’s say multi-network-bridge…

Read more

Vodafone mobile and Ubuntu

A while a go, I’ve tried a Vodafone’s Mobile connect pciexpress card on my laptop running Ubuntu, it worked perfectly! I’ve installed the Betavine’s vodafone linux driver and managed to get online without a sweat. While in testing I managed to physically hurt my pciexpress slot since it’s very poorly placed. So I’ve decided for usb variant insted, again I tested it, worked like a charm. After ordering it from our vendor, and a bit longer waiting than usual, I finally got it, but a slightly different model, Huawei K3520.

So I sad, hey let’s plug it in and try to connect. At first attempt it returned some error about not enough serial interfaces… ofc. I ignored it, looked at dmesg, usb modem correctly initialized, so I figured “must be bug in software”. I reinserted the stick, and tried again, this time with success.

Next time I’ve inserted the stick same error returned. And it wasn’t solvable with reinserting this time. Read more

Preventing ip conflicts in xen

So lately I’m playing with xen kernel and virtualization, and I came across one relatively big problem. Let’s say i want to share my guest machines to… let’s say clients. You must give them root… because that’s whats vps-es all all about… having root access to OS without having to purchase expensive hardware. So having that in mind they are by default untrusted and unpredictable, they can do god knows what in there!

So what caught my eye?

By default xen, and all those tools, cpanels and stuff don’t really have a way of sorting out ip conflicts. So basically you have some bunch of scripts that will setup clients ip address during his machine startup, you have vif ip statment in vm_xen.conf file. But what’s really holds clients from entering:

ifconfig eth0 xxx.xxx.xxx.xxx 

(where xxx is ip of some super important server in same netmask).
Luckily for me I came across this problem while still in testing, but here’s what I found and came up with after 3 days intensive googling. Read more