February 2nd, 2010 by David
Virtualisation has moved on from being a fad to being a mature, established platform. Before virtualisation became popular, you could only get shared hosting or dedicated hosting. Shared hosting is cheap but you have no control over how the physical server is configured. Dedicated hosting is expensive but far more flexible – you have control over everything on the server and can install whatever you want. However, with virtualisation, you get the best of both worlds – prices closer to shared hosting but with most of the flexibility of a dedicated server. So how does it work then?
Read the rest of this entry »
Posted in Linux | No Comments »
February 2nd, 2010 by David
I, like most people who like to test out new website applications/scripts or do some personal dev work, have a webserver installed on my computer. A grumbling I’ve heard often (most recently was last night, at the time of writing) is that they always have to have the script in a subdirectory, eg localhost/blahblah. Sure, they say, you can have your own domains, but only if you set up a DNS server. Which they don’t want to maintain.
Uh…. no you don’t. Just use your hosts file. How do you think your computer knows how to resolve localhost anyway? This little file is often overlooked, which is a shame. Just slap the domains in there and you’ll be able to host multiple sites on your computer (obviously you’ll need to configure the webserver to handle the domains). On Linux, the file is usually /etc/hosts, on Windows it’s C:\windows\system32\drivers\etc\hosts and on the Mac (Mac OS 10.2 and later) it’s /private/etc/hosts. They all follow the same format ([ip address] [domain name], eg 127.0.0.1 localhost).
Once edited, the domain will start resolving immediately. Trust me, it’ll work. Yeah, DNS is more feature-full, etc, etc, however for purely internal use the humble hosts file is still the best way to do things.
Posted in Linux | No Comments »
December 10th, 2009 by David
By default, Postfix doesn’t log the subject lines of emails that it handles. There’s nothing wrong with this, however sometimes a user will want to know if an email came in (or was sent), and you’ll almost never have the message ID on hand to search for.
Luckily, Postfix does allow you to log warning messages for subject lines, and so we’ll use this to simply log a warning message for any subject line. It’s a bit of a ‘hack’, but works and doesn’t cause any problems (Postfix doesn’t block or alter the emails).
Firstly, edit the main.cf file and add the following line:
header_checks = regexp:/etc/postfix/header_checks
Next, create the /etc/postfix/header_checks file and add the following line:
/^subject:/ WARN
Reload/restart Postfix and send a test message. You’ll see something like the following in your logs:
Dec 10 10:57:01 localhost postfix/cleanup[22492]: 2290326720: warning: header subject: test email from localhost[127.0.0.1]; from= to= proto=SMTP helo=
Notice the “warning: header subject” bit. Now, every subject line will be logged :) It makes life a lot easier when doing email troubleshooting on a mail server.
Posted in Postfix | No Comments »
November 1st, 2009 by David
I have a couple of Ubuntu 8.04 OpenVZ VPSes, and I use the Deny Hosts script to block hackers trying to bruteforce SSH. However, the other day I noticed two files in /var/ on one of my VPSes: logauth.log and logmail.err. Logauth.log was sitting at 105 megabytes! Not only was the info being logged to the wrong file, but the log wouldn’t be rotated (meaning that it would eventually become so bloated that it’d take forever to read).
As quite a few of my VPSes were affected, I guess there’s a bug with some of the OpenVZ Ubuntu 8.04 images where SSH logins (and mail errors) are logged to the wrong file. Easy enough to fix – just edit /etc/syslog.conf and change any instance of /var/logauth.log to read /var/log/auth.log. While we’re at it, change /var/logmail.err Instance to say /var/log/mail.err.
Restarting sysklogd should load up the new values, but if you want to be paranoid I suppose you could just reboot the VPS (shouldn’t be necessary, but if you do rather use the hosting company’s control panel to do it)
Posted in Ubuntu | 1 Comment »
October 12th, 2009 by David
The annoying thing about Ubuntu’s version of Sarg is that the cronjobs used to generate the reports are buggy – the weekly and monthly jobs only show some of the days :( Here is how I fix it. It’s not difficult at all, really, as you’re only modifying the contents of 4 files and removing a now-redundant one :)
Read the rest of this entry »
Posted in Ubuntu | No Comments »
September 27th, 2009 by David
One of our clients requested that we block specific email attachments that come in – their large network was starting to suffer under the storm of non-work emails flying around the company – funny video clips, songs, etc, etc. Not only that, several gullible people had infected their PCs with viruses and malware.
Luckily, blocking specific mail attachments in Postfix is pretty straightforward and only takes a minute or two to set up.
Read the rest of this entry »
Posted in Linux | No Comments »
September 27th, 2009 by David
This is a nice quick one. I run an Ubuntu quad-core at home and I was looking to find a way to get it to start faster by making use of the multiple cores better. So, I was looking through /etc/init.d/rc, which is a config file for the program that handles the startup and shutdown of daemons on an Ubuntu box, and found this line:
Read the rest of this entry »
Posted in Ubuntu | No Comments »
September 27th, 2009 by David
Ever since Ubuntu 7.10, my sound in Ubuntu has been very muted. Normally I just shrugged and jacked the volume up, however recently I was forced to use headphones to hear my music and I noticed that the sound was unbearably soft. I did a bit of looking around, and found the solution here: https://answers.launchpad.net/ubuntu/+question/15851:
try running alsamixer in a console and check everything is unmuted and maxed. (use arrow keys to move/adjust , M key to mute/unmute and ESC to save and exit)
Worked 100% for me, though that’s because I’m using ALSA as my playback device.
Posted in Ubuntu | No Comments »
September 27th, 2009 by David
I’ll Be Back
Unfortunately, my old host went and deleted the site for no apparent reason and there aren’t any backups.
As such, I’m moving the site to a new host and am recovering as much data as possible.
Please bear with me while I sort this out. I couldn’t recover a lot of the old posts, unfortunately.
Posted in Uncategorized | No Comments »