Skip to main content

UCSPI-TCP

Posted in

ucspi-tcp is djb's implementation of UNIX Client-Server Program Interface using TCP.

ucspi-tcp is djb's implementation of UNIX Client-Server Program Interface using TCP. It's used on our server to manage what IPs are allowed to connect to the SMTP service(s) as well as passing any environment variables that those IPs might want to use.

Installation
Download the source tarball:

cd /extra/src
wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
tar xvzf ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88

Fix the "errno" problem with glibc-2.3 or higher:
sed -i '/extern int errno/{s/^/\/* /;s/$/ *\//;G;s/$/#include <errno.h>/;}' error.h

Compile and install the program:
make setup check

Make the directory to hold the tcpserver access rules:
mkdir /etc/tcp

Configuration for SMTP server
Edit /etc/tcp/smtp and add some rules:

127.:allow,RELAYCLIENT=""
192.168.0.:allow,RELAYCLIENT=""

Make the cdb file from the text file:
tcprules /etc/tcp/smtp.cdb /etc/tcp/smtp.tmp < /etc/tcp/smtp
chmod 644 /etc/tcp/smtp.cdb

Rather than having to remember how to do this every time, create /etc/tcp/Makefile with (NOTE: The spacing before the "tcprules" command should be a TAB!!!!):
smtp.cdb:smtp
      tcprules /etc/tcp/smtp.cdb /etc/tcp/smtp.tmp < /etc/tcp/smtp

Then, to recreate compile the CDB file, you simply have to run:
make

ucspi-ssl
http://www.superscript.com/ucspi-ssl/intro.html

cd /extra/src
wget http://www.superscript.com/ucspi-ssl/ucspi-ssl-0.70.tar.gz
tar xvzf ucspi-ssl-0.70.tar.gz
cd host/superscript.com/net/ucspi-ssl-0.70
package/compile
package/install