News » Linux
/usr/portage on a LAN
Prevent Hotlinking images
Ever saw those pictures telling you that hotlinking is not allowed? Some websites seems to run some code that prevents you from seeing the pictures that are located on their servers. You can only see the pictures when surfing on their site. You thought you're the clever one and you might have taken the picture's URL from their source and pasted it on your own website, resulting in another photograph than you intended. Now, did they do that? The URL you used, makes perfect sense, but still there is another one appearing.
What you are trying to do, is stealing their bandwidth and they don't like that. So before offering the picture to you, they check the referrer. If it matches their site, the correct picture is offered, if not they present you with something else or nothing at all.
Now you might have a picture gallery yourself and you realize that people are posting pictures, that are located in your gallery, all over the internet. Well, you too can prevent that. Here's how:
All you'll need, is the mod_rewrite Apache module to do that. The module is built in by default, however some ISP's might have taken it out. Contact your ISP administrator if it's not available.
The trick to the puzzle is no more than an .htaccess file. Should you have access to your Apache config file, you can also put the code there. Have look at its content:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC]
RewriteRule \.(gif|jpg|png)$ - [F]
Let's explain. First we enable the Rewrite Engine and reformat the referrer string. Next we check the referrer string against a regular expression, representing our domainname (Be sure to replace <ins>example.com</ins> with your own domainname). If it's not us, then we deny access to anything with the gif, jpg or png extension. The image on the hotlinking website will then show up as not existing.
Seems we're almost there. Instead of denying access, we could also reformat the string and have it point to another picture. Look at the following:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC]
RewriteRule \.(gif|jpg|png)$ http://www.othersite.com/nasty.gif [R,L]
Of course the nasty.gif needs to be located elsewhere or that one too will be blocked by our rule.
Should you want to use your pictures on other websites, just add a new ReWriteCond and they should become available on that website as well.
More information on how mod_rewrite is to be used, can be found here:http://httpd.apache.org/docs/mod/mod_rewrite.html.
Make movies brighter with mencoder
You bought a little camera that can make video's? Some of these camera's perfom very bad when there is not much light. Sometimes it's even impossible to recognize what the video represents. There must be a way to make these home video's a little brighter.
Mplayer includes a video encoder called Mencoder. With Mencoder you can also process the video before encoding. You can try this to make the clips brighter (and also noisy):
mencoder dark_video.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -vf eq=75:100 -o out.avi
In the example, the result video is in Divx 4/5 format. Try varying brightness/contrast values. Also, trying eq2 would be worth it, since it can adjust eg. gamma, brightness, saturation, and rgb channels independently. Eg this way (rgb not treated in this):
mencoder dark_video.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -vf eq2=0.5:1.9:1.1 -o out.avi
Happy encoding!
Photoshop for Linux = Gimpshop
Emulating an OS with qemu
When you want to emulate a PC with a complete operating system on your computer, the most heard answer would be VMWare. Sure, for Linux, there is wine, but that package is targeted to handle only window$ and not all programs are supported. No, I'm talking about simulating a complete OS on a virtual PC with virtual hardware.
Although VMware does an almost perfect job at it, it isn't free software. Time to see what the Open Source community has to offer. That's when I stumbled upon qemu. Let's have a look at the possibilities.
But what is it actually? Well, qemu emulates a processor. You can then add-on virtual peripherals and we have a virtual PC on which we can install any OS (Check here for all supported OS's). On Linux we can also have qemu run programs that were actually compiled for another processor that the one that resides in your box. qemu is available for Linux, FreeBSD, MacOS and even window$.
Let's see whether we can have ie XP running as a guest OS on our Linux host with access to both the internet and the local network. A little screenshot as a preview:
Now, qemu doesn't have a nice interface from which to start. It's a command line tool. It has several options with which you can specify peripherals of your choice.
It now also has a kernel module with which you can speed up the emulation. Quite impressive at that too. Unfortunately, this module only work with the current CVS code. Check it out at savannah.gnu.org. Don't forget to modprobe the new kernel module. Should you need any help building the code, I'd suggest getting it at the IRC channel #qemu on freenode.net. For Gentoo users, there is currently an experimental ebuild. Have a look at this forum post.
Writing udev rules
The next line in /etc/udev/rules.d/10-local.rules, did the trick:
BUS="scsi", SYSFS{model}="UsbFlashDisk", KERNEL="sd?1", NAME="%k", SYMLINK="usbstick"It creates a symlink, called 'usbstick', to my usb scsi device which got added by hotplug.
Fedora 3 far from complete
I found a little website that can help you make your desktop completely multimedia ready:http://home.gagme.com/greg/linux/fc3-tips.php. A quite easy-to-follow guide to help you get your machine ready.
Gaming on Linux
And for the unsupported games, you might wanna take a look at the UnOfficial TransGaming Wiki on how to get them running too. Indeed, a vast resource of games 4 u to play under Linux. Try a piece of this!! :P.
NFS on Windows
Linux humor
The Linux History
Why mickey$oft?
http://www.euronet.nl/users/frankvw/rants/microsoft/IhateMS.html
http://www.msversus.org/
The wireless story (continued)
The wireless story (DWL-G650+ on Linux)
So I plugged in a D-Link access point (DWL-2000AP+) into the switch and got that up and running pretty quickly. However then the trouble began.
I got myself a DWL-G650+ (Note the +). After searching the prism54.org website I found this card to be supported at least I thought it was. Great, a native linux kernel module. This module is even already in the gentoo-dev-sources(Gentoo's 2.6 kernel) that I use on my laptop. However, after compiling, there was no card detected. Seems that little plus ment that there is a complete different chipset on that card. What I would have needed(and did ask for at the store) was a DWL-G650 A1. Ok whatever, I can get this card to work too, right? So I started searching for a suitable driver. Seems the guys at http://acx100.sf.net were willing to do this. So let's get this card up and running. That's pretty much how far I got. It ran, but without wep encryption. This module doesn't seems to support that part "yet".
Time to head to the store again tomorrow and see whether I can change it for the one that I asked for in the first place.... I'll keep you posted.
Setting up Oracle on Linux
Wine on a Linux kernel v2.6.9
After Googling 'round a bit, I found the solution.
It seems that adding the following line to your /etc/sysctl.conf did the trick:
vm.legacy_va_layout = 1
Now you want to run
sysctl -p
to load the parameter.
Now all your beloved games should run perfectly on a 2.6.9 Linux kernel.
Building a fullblown webserver - Part 2
Once that is done and you have your webserver up and running, let's have a look at virtual hosts in order to run multiple websites on one server. The "Include" word comes to mind. We also want to log everything in order to have webalizer generate graphs of our web traffic.
Now how are we going to get stuff onto the webserver? Well the classic way, through an ftp server. Its logs can also be parsed by webalizer.
And that should about cover it.
Building a fullblown webserver - Part 1
Now that would be great if it all was for just one domain, but that's not the case. You want your server to able to handle multiple domains, that means multiple email addresses, more FTP accounts, etc....
Now there are some packages available for doing just that. One of them is Plesk (http://www.sw-soft.com). Tough part is that they only support some Linux distributions, but not Gentoo (my favorite!).
So I wanted to have a go at it and tried looking to get it going. Soon I noticed that that would takes why to much patching and altering, making it so difficult for you as administrator to keep track and what when they upgrade. You'd have to do it all again. No, I prefered configuring the server myself.
And so I'm now, configuring the server myself. Today I took on the battle of the mail server, using postfix and courier-imap, which turned out to be configurable in MySQL. Ain't that great ?
Anyways more to follow next time.
Installing a secure webserver.
Hope this will guide you to setting up a working secure webserver. Using such a secure server (for let's say banktransactions

