Archive for the 'Linux' Category

Enabling remote connections to a MySQL server

Tuesday, October 24th, 2006

By default MySQL only permits connections from the server on which it resides. Although this makes for good security there may be times when you need to access the database from elsewhere. This might be using ODBC from your office or maybe a script running on a separate web server.

Using a SSH client like PuTTY connect to your MySQL server. You then need to edit /etc/my.cnf (# vi /etc/my.cnf).

Under the [mysqld] section comment or remove the skip-networking line and add the bind-address=IP_of_MYSQLserver line e.g.

[mysqld]
datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.socket
bind-address=192.168.99.99
# skip-networking

Save the file then restart the MySQL service (# /etc/init.d/mysqld restart) 

Now using the MySQL admin tool of your choice create your user accounts but specify the host that they will be connecting from. For example if you are creating a user that connects from the IP address 80.65.35.43 the username will be in this format: username@80.65.35.43

Using Qmail as a store and forward service

Friday, August 4th, 2006

I have a stake in a London based fire protection company and sometimes get involved with their IT. Being a small company they run MS Small Business Server 2003 and connect to the internet using ADSL and a fixed IP address. For their email the MX reccord points to their internal server via a port mapping on their firewall. I also wanted to give them a secondary MX record with a store and forward service in case their server or Internet connection is down for a prolonged period. I looked at various commercial services but eventually decided to make use of their dedicated web server hosted by their ISP. The server runs Fedora Core and includes Qmail as part of the build.

I’m far from being skilled in Linux/Qmail but I can stumble my way through when necessary. There’s a plethora of resource material on the Internet and I use a little Unix and Sendmail at work. Dave Sill has produced the excellent Life With Qmail guide that will get you started with Qmail.

Firstly you’ll need an SSH client. I use PuTTY. Once logged in to your server navigate to /var/qmail/control.

Next vi the rcpthosts file. (I’m sure there are other editors but I learnt the basics of vi back at university on VAX/VMS systems so stick with what I know.) Add to the file the domain you want to store and forward for e.g. griffinfire.co.uk. Save your changes and exit.

Now vi the smtproutes file. Here you need to add the SMTP domain and destination host in the following format SMTPdomainname:FQDNofdestinationhost e.g. griffinfire.co.uk:mail.griffinfire.co.uk. Save and exit.

And that’s all there is to it.

You can’t adjust the delivery retry intervals in Qmail but it will keep the messages for 1 week before expiring. This is longer than the defaults for some other messaging systems (Exchange 2003 defaults to 48 hours, MIMEsweeper is 72 hours) and therefore ideal for a store and forward service.

With some slight further configuration it should also be possible to access the stored email via a web interface which would be useful in a DR scenario. This is on my to-do list and I’ll blog the process once done.

Technorati Tags: