Protecting services with client certificates using Haproxy
What we want to achieve
We want to be able to connect to services inside a private network using client certificates, in this example we will be connecting to Redis.
Install or compile Haproxy
I am using Debian, so this is what I use to compile Haproxy for testing out this setup.
apt-get -y install make gcc g++ libssl-dev
wget http://www.haproxy.org/download/1.8/src/haproxy-1.8.4.tar.gz
tar xzf haproxy-1.8.4.tar.gz
cd haproxy-1.8.4
make TARGET=generic USE_OPENSSL=1
make install PREFIX=/usr/local
Install and configure firewall
I am testing with a Redis-server, but it can be anything. First firewall off everything except for port 22 (ssh) and port 88 (our external redis port):
apt-get -y install ufw
ufw default deny incoming
ufw default allow outgoing
ufw allow 22
ufw allow 88
Install Redis
apt-get -y install redis-server
Since Debian and Debian-related distros have the...