Westhost Tips and Tricks

This is a series of papers on working with Westhost servers. It only applies to you if you are a Westhost customer. Any additions, corrections, feedback: email 'wh @ gnomedia.com'.

I'm occasionally available for contract or consultation work, contact me via the gnome above if you have a request.

Read the introduction first, it contains important information and warnings!

Miscellaneous Tips and Tricks

[Odds and Sods that didn't fit anywhere else.]

21/02/05 — Added rsync package

Formmail.pl won’t deliver emails, nor will PHP’s mail()

Trying to send email from a script sometimes fails for no apparent reason. In the log files are the lines:
[...] SYSERR(root) forward: no home
If the email is sent to an offsite mail address, then everything works fine.

Solution: when you create the email account that will receive the email, the home directory is only created if you enable FTP. You can immediately disable FTP access, the home directory will remain.

A client complained that she couldn’t connect to her email (using Entourage on her Mac).

It had worked until she had received a very large email, which she had stopped downloading, gone in to Neomail, deleted the email and then logged out. Then Entourage gave the error of an invalid login or password.

The first thing to do in this situation is to check if the error really exists or if something has changed on her home computer. I logged on to her email through Neomail and everything went smoothly so I logged out.
The next thing is to log on to the POP3 server and see what the errors are. The best way to troubleshoot the POP3 server is to use telnet. Logging on using telnet allows us to step through the process and see exactly what is causing the error.
Here is the conversation:

$ telnet thedomain.com 110
Trying 219.36.169.25...
Connected to thedomain.com.
Escape character is '^]'.
+OK Qpopper (version 4.0.4, modified by Sphera Technologies) ready. <21860.1077722216@sphera>
USER janedoe@thedomain.com
+OK Password required for janedoe.
PASS topsecret
-ERR [SYS/PERM] Unable to process From lines (envelopes) in /var/spool/mail/janedoe; change recognition mode or check for corrupted mail drop.
+OK Pop server at thedomain.com signing off.
Connection closed by foreign host.

Aha, a corrupted mail drop file! So, SSH into the server, edit the file at /var/spool/mail/janedoe and I find the first three lines of the file are random garbage, followed by a blank line and the “From …” indicating the start of a valid email item. Deleted the first three lines of the file and saved, went back and telnet’ed in to the server as before and all is fine:

$ telnet thedomain.com 110
Trying 69.36.162.5...
Connected to thedomain.com.
Escape character is '^]'.
+OK Qpopper (version 4.0.4, modified by Sphera Technologies) ready.
USER janedoe@thedomain.com
+OK Password required for janedoe.
PASS topsecret
+OK janedoe has 5 visible messages (0 hidden) in 39867 octets.
LIST
+OK 5 visible messages (39867 octets)
1 8132
2 10101
3 11861
4 5710
5 4063
.
QUIT
+OK Pop server at thedomain.com signing off.
Connection closed by foreign host.
Success!
Telnet is a useful protocol for checking daemons and servers at a low level. In this situation I only need to know three commands: USER, PASS and LIST. For a full set of commands, just do a search on “pop3 commands”, a number of pages will show up with details. You can, if you want, read your mail through telnet, but there are of course, far better ways.

My Apache error_log is full of "…caught SIGTERM" errors!

Checking through the logs at /var/log/httpd I’ve noticed a lot of lines such as:

[Tue Sep 16 06:10:54 2003] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Tue Sep 16 06:20:45 2003] [notice] caught SIGTERM, shutting down

This should only happen on name-based VPS’s, not on IP based VPS’s.
Apache is setup to shut itself down if it is not needed for a certain period of time. As soon as a new page request comes in then it is restarted again.
Nothing to worry about!

Reseller Manager, transferring a domain: how do the DNS entries get created when I create an account in Reseller Manager? Do I have to do anything else?

Creating an account in Reseller Manager should create entries in the Westhost DNS servers. Once these entries are created, then the domain registrar for the domain can be contacted to transfer the domain to these nameservers.

Once the account is created, there seems to be a time delay of up to four hours until the entry appears in ns1.west-datacenter.net. ns2.west-datacenter.net should be updated a couple of hours later. If, after six hours, there is no entry in the nameservers, contact Westhost.
If you are transferring a domain that has a ‘.de’ extension (and possibly some other countries) the registrar will refuse to transfer the domain because the two name servers (ns1. and ns2.) are on the ’same sub-net’. If this happens, then you need to ask Westhost directly to make an entry for the domain in ns4.west-datacenter.net, as this is on a different sub-net.
Westhost has a bunch of nameservers, but the official ones to be used are:
ns1.west-datacenter.net 69.36.161.11
ns2.west-datacenter.net 69.36.161.12
ns3.west-datacenter.net 69.36.161.13
ns4.west-datacenter.net 69.36.165.2

I get "root@mydomain.com" permission denied errors.

Sometimes when I send out a bunch of emails and they bounce back, sendmail tries to deliver them to "root" and then creates an error mail (to postmaster@mydomain.com) when it can’t find it. The error looks like:

 ----- The following addresses had permanent fatal errors -----
root
(reason: permission denied)

----- Transcript of session follows -----
procmail: Insufficient privileges
550 5.0.0 root... Insufficient permission

You need to create an alias for root.
In the file /etc/mail/aliases add the line:
root:username (where ‘username’ is the account to redirect to).
Then (this is in SSH) run the command:
$ newaliases (which will rebuild the ‘aliases’ database).

How do I password protect directories and/or files?

When a web browser enters a directory or tries to view a particular file, we want to popup a dialog that will ask him to enter a user name and password before showing the page (or pages).

This is done by installing a file named .htaccess in the directory that you want to protect. This file contains information on the user name, where to find the password file and what is being protected.
There are a variety of ways that we can create this file, the simplest method is the one provided by Westhost: In the Site Manager is an application called WebPassword that will automate the process for you.
In the forums, Alejandro has mentioned a nice application, HTEdit, that also does a good job of setting up the .htaccess files. It can be found at:
cgi-central.net
And, of course, it is possible to use the old fashioned traditional way of creating the file in the shell by using the program ‘htpasswd’. (see htpasswd for further details).
Note that WebPassword will store the password file in a directory outside of the web site directories, HTEdit will store the password in the actual directory with the .htaccess file itself. While this may appear to be a security risk, the web server won’t allow access to either file. However, if you are feeling paranoid, then the .htpasswd file can be moved elsewhere and the path in the .htaccess file adjusted to point to it.

Where is neomail???

Neomail is the web mail front-end supplied by Westhost. Its advantage is that it is small and lightweight and deals with the mail in the mail box, without moving it around. But it’s hard to remember where it lives. I have a hard time remembering that it is at "mydomain.com/cgi-plugins/neomail/neomail.pl", my customers have no chance.

Solution:
Create a directory in the root of your website, for example, /webmail. In that directory, create an html file name index.html, containing:

<html><head><title>Webmail redirect</title></head>
<meta http-equiv="refresh" content="1;url=/cgi-bin/plugins/neomail/neomail.pl">
<body>
<a href="/cgi-bin/plugins/neomail/neomail.pl">Webmail here</a>
</body>
</html>

Now, you can check email on the web by surfing to: http://www.mydomain.com/webmail/

Is Neomail any good, and are there any alternative webmail clients?

I’m in two minds about Neomail. On the one hand it is small, simple and fast, which is very useful when one is in a small Internet cafe in the back of beyond, which I often am. And it doesn’t remove your email from the mail queue, so that when I get home, I can still download my emails.
On the other hand, it is very basic, and, so far, one of my customers would like something more ‘full featured’. The icons are not self explanatory, which confuses people. The address book slows to a crawl when there are a large number of addresses, and they are all in one page anyway.
So, I’m on the look out for something else, but not urgently. If I find anything, I’ll post the details up here. Its important that it doesn’t create its own mail box structure, is easy to use and install.
For now, here are a couple of things I found trying to upload the address book. Trying to import an address book is frustrating and slow. Neomail insists that the first line be literally "Name,E-mail Address" and nothing else. And there must not be any commas in any field, as that is used as a separator. And it takes forever to import.
The address book is in fact a simple file, that lives at /var/neomail/username/addressbook. Once you’ve massaged your address list into the right format, its just as simple to upload it into that place and Neomail will recognize it. And, before uploading, sort it in alphabetical order and it will load (slightly) faster. Oh, and the uploaded file should not have "Name,E-mail Address" as the first line.

The programs ’scp’ and ’sftp’ seem to be missing, where can I get them?

On the Westhost 1 setup, there were some programs installed that aren’t on the Westhost 2 servers. These are two of the more important and useful ones.

Solution: Download the wh-utils.tgz package. There is a README file with instructions in the archive. Includes the programs ’scp’,’sftp’,’ssh’ and ’sort’.

What other apps can we add to Westhost?

Westhost2 servers allow us to add whatever apps we need (withing certain limitations) so its really up to you what you want to add.

Applications will need to be compiled for the distribution that Westhost uses, so you normally cannot just copy the application up to the site and have it work. There are two possibilities here, either wait for someone else to create applications that work and upload them (such as the “wh-utils”, see above) or install the GCC toolkit and compile them yourself. Note that applications that require root permissions to work correctly will be tricky, if not impossible, to set up.
Matt Domsch has compiled a bunch of applications that work on Westhost2 and you can read the instructions at his web site. So far he has rsync, mailman, emacs, imapd, ncurses, mutt, gnupg and xinted.

Update: I’ve just added a binary of rsync, available at gnomedia ftp. Copy it into your server root directory and unpack the file…

You’ve got it wrong/made a mistake! How do I tell you???

I love to get any feedback, suggestions, improvements or simply praise, send an email to wh @ gnomedia.com