Filed under: linux

Turnkey Linux + Postfix + Gmail SMTP Relay

My Turnkey Linux Postfix version, well a slightly modified version for TKL

  1. No need to generate new CSR, Turnkey appliance is pre-configured with the CSR, etc.
  2. Modify your Postfix /etc/postfix/main.cf (see original blog post section below) or you may use my main.cf (see attached file)
  3. Create /etc/postfix/sasl_passwd file
    Copy this text and edit with your account details then highlight and copy.
          gmail-smtp.l.google.com your-gmail-username@gmail.com:your-gmail-password
          smtp.gmail.com your-gmail-username@gmail.com:your-gmail-password
  4. $ postmap /etc/postfix/sasl_passwd
  5. $ /etc/init.d/postfix reload or restart
  6. Test your setup with a sample script http://www.php.net/mail
  7. Check your logs :
    $ tail -f /var/log/mail.log 
  8. Done.

My Turnkey Linux Setup 

  • Host OS : MacOSX Snow Leopard
  • LAMP Stack Appliance
  • Version 2009.10-2 (Ubuntu 8.04.4 LTS)
  • Running on Sun/Oracle VirtualBox v3.2.8 r64453 
main.cf
Click here to download:
main.cf.doc (1 KB)
(download)

Original blog post  

Firstly you need postfix compiled with SASL and ssl support.

Enter this command into your shell.


ldd /usr/lib/postfix/smtp

Here is the output:

linux-gate.so.1 => (0xffffe000)
libpostfix-master.so.1 => /usr/lib/libpostfix-master.so.1 (0xb7f43000)
libpostfix-tls.so.1 => /usr/lib/libpostfix-tls.so.1 (0xb7f38000)
libpostfix-dns.so.1 => /usr/lib/libpostfix-dns.so.1 (0xb7f33000)
libpostfix-global.so.1 => /usr/lib/libpostfix-global.so.1 (0xb7f0c000)
libpostfix-util.so.1 => /usr/lib/libpostfix-util.so.1 (0xb7ee6000)
libssl.so.0.9.8 => /usr/lib/i686/cmov/libssl.so.0.9.8 (0xb7ea9000)
libcrypto.so.0.9.8 => /usr/lib/i686/cmov/libcrypto.so.0.9.8 (0xb7d7b000) libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0xb7d67000)
libdb-4.3.so => /usr/lib/libdb-4.3.so (0xb7c8a000)
libnsl.so.1 => /lib/tls/i686/cmov/libnsl.so.1 (0xb7c75000)
libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2 (0xb7c62000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7b33000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7b30000)
libz.so.1 => /usr/lib/libz.so.1 (0xb7b1b000)
/lib/ld-linux.so.2 (0xb7f59000)


If you dont see libssl and libsasl, this wont work, and you’ll need to recompile with support.

Generate a CSR for this server


openssl genrsa -out itchy.key 1024
openssl req -new -key itchy.key -out itchy.csr
openssl ca -out itchy.pem -infiles itchy.csr

Now include these main.cf modifications:

relayhost = [smtp.gmail.com]:587

#auth
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

#tls
smtp_use_tls = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_note_starttls_offer = yes
tls_random_source = dev:/dev/urandom
smtp_tls_scert_verifydepth = 5
smtp_tls_key_file=/etc/postfix/certs/itchy.key
smtp_tls_cert_file=/etc/postfix/certs/itchy.pem
smtpd_tls_ask_ccert = yes
smtpd_tls_req_ccert =no
smtp_tls_enforce_peername = no

Create /etc/postfix/sasl_passwd file

This is the format of the sasl_passwd file.

Copy this text and edit with your account details then highlight and copy.

gmail-smtp.l.google.com user@gmail.com:password
smtp.gmail.com user@gmail.com:password

Enter these commands line by line and press enter after each line.


vim /etc/postfix/sasl_passwd
a
ctr + shift + v
esc
!wq
postmap /etc/postfix/sasl_passwd
/etc/init.d/postfix reload

That should work. Thanks to IMamba for original.

read more at bookmarks.honewatson.com

FreeBSD and the GPL

Linux and BSD

The first free Unix-like operating system available on the IBM PC was 386BSD, of which Linus Torvalds said in 1993: "If 386BSD had been available when I started on Linux, Linux would probably never have happened."

386BSD was a direct descendant of Bill Joy's Berkeley Software Distribution, which was the core of SunOS and other proprietary Unix distributions. 386BSD and the patchkit for the port to the Intel chip formed the basis for FreeBSD, NetBSD and OpenBSD, which have carried the torch for BSD and open source Unix to this day.

Lars Wirzenius, a student friend of Linus Torvalds, recalled: "FreeBSD didn't exist then. 386BSD did, but it wouldn't have worked on my computer, since it required a 387 co-processor. I used SCO Xenix from fall 1991 to spring or summer of 1992, until Linux matured enough to be a usable environment for writing code."

Alan Cox tells a similar story. When he saw the 386BSD announce he thought "Woah! - finally there is something worth running on a PC."

The trouble was that 386BSD needed floating point hardware, and Linux didn't. "I hadn't got the floating point chip, which was 70 quid at the time, so I installed Linux," he said.

386BSD was a long time coming. The first public release (Version 0.0) was on St. Patrick's Day, 1991, and was barely functional. Most users had to wait until Bastille Day, 1992 for the first functional release (Version 0.1).

A year or two earlier, a couple of small fixes, and Linux may never have seen the light of day.

What ifs

The most popular of the BSDs is FreeBSD. FreeBSD, like the other BSDs, had a 15 year start on Linux, based as it was on BSD Unix, which had played a large part in defining the standards for operating systems and networking that have held good to the present day. For much of its early history, FreeBSD was technically superior to Linux and still retains an enviable reputation for reliability.

So it is interesting to speculate why Linux, and not FreeBSD, became the flag bearer, not only for free software, but for Unix-like operating systems.

BSD had been around for a long time, and Linux grew from small beginnings. Most of the early contributors to Linux and the projects that sprang from the early success of Linux, were hobbyists and students with no great history in computing, yet GNU/Linux, not FreeBSD, was adopted by the traditional Unix companies to become the universal operating system that Unix had promised to be.

Could have been a contender

FreeBSD didn't stagnate, or lose, and is probably healthier that it ever was, big on networking devices, friendly with web hosting companies and big with Apple, but hasn't had the impact of Linux on the rest of the computing industry, despite an enviable record for technical excellence.

Any number of reasons can be given for this. During the period 1992-1994, when GNU/Linux was beginning to emerge as a viable option for Intel servers, the BSDs were the subject of a copyright dispute between USL and BSDi, which was indisputably a setback to uptake and development, but the BSDs bounced back from this setback and were the favoured solution for many web and ftp servers during the dotcom boom.

In 1999, "Walnut Creek CD-ROM set the world record for most bytes of network traffic processed in 24 hours by a single host: One single-processor PII box (a then-famous FreeBSD ftp server) handled 1.39 terabytes. (This burst of traffic was, ironically, occasioned by the release on that machine of Slackware 4.0.)"

 

1 of 1
Posterous theme by Cory Watilo