SWAKS on macOS

SWAKS is my favorite SMTP debugging tool.

A new SMTP server I’m building loses pipelining synchronization when connecting via TLS, and I’m sure the bug will be simple to spot if I can send some test messages in to it and watch the sequence of commands. SWAKS is perfect for that.

But … SWAKS has been broken on macOS for a while, at least if you want to use STARTTLS. It’s written in perl, and it depends on the perl module Net::SSLeay. And Net::SSLeay depends on openssl, and doesn’t build cleanly using openssl as installed by homebrew cleanly. You can persuade it to build by overriding the path it uses to find openssl, but the tests fail for silly reasons like different whitespace in obscure functions that you didn’t care about anyway.

Net::SSLeay tests were fixed in January, at least in it’s git repo. Those changes haven’t been pushed to CPAN yet, so version 1.94 - the latest version - doesn’t build cleanly.

If you’re on macOS, want to use SWAKS and have homebrew and XCode tools installed you can build everything fairly cleanly.

Install openssl and swaks using homebrew:

brew install openssl swaks

Clone a local copy of the Net::SSLeay source tree:

git clone https://github.com/radiator-software/p5-net-ssleay.git

Configure, build, test and install Net::SSLeay:

cd p5-net-ssleay
export OPENSSL_PREFIX=/opt/homebrew/opt/openssl@3.5
perl Makefile.pl
make
make test
sudo make install

And then swaks should be able to use STARTTLS.

Now, back to my pipelining problem…

Related Posts

Sending email

I did a class at M3AAWG teaching the basic mechanics of sending an email, both really by hand using dig and netcat, and using SWAKS. No slides, but if you’re interested in the script I’ve posted a very rough copy of my working notes here.

Read More

SWAKS: the SMTP Swiss Army Knife

flash_m_laser_1200_900
SWAKS is a general purpose testing tool for SMTP. For basic SMTP testing it’s a more convenient, scriptable alternative to running a transaction by hand, but it also lets you test things that are difficult to do manually, such as authentication or TLS encryption.
It’s a perl script that installs fairly easily on OS X or any Linux/unix system (and can be installed on Windows, if you have perl installed there).
It’s pretty well documented, but it can be a bit overwhelming to start with. Here are some simple recipes:
Send a test email:

Read More

SWAKS: Test your SMTP

We’ve mentioned SWAKS here a few times – but I always use it for delivering test mail directly to a recipient’s MX.

Read More