1 |
systemctl start firewalld |
2 |
systemctl enable firewalld |
3 |
firewall-cmd --permanent --zone=public --add-interface=eth0 |
4 |
firewall-cmd --reload |
5 |
|
6 |
yum install stunnel -y |
7 |
|
8 |
cat > /etc/stunnel/stunnel.conf << EOF |
9 |
cert = /etc/pki/tls/certs/stunnel.pem |
10 |
; Allow only TLS, thus avoiding SSL |
11 |
sslVersion = TLSv1 |
12 |
chroot = /var/run/stunnel |
13 |
setuid = stunnel |
14 |
setgid = stunnel |
15 |
pid = /stunnel.pid |
16 |
socket = l:TCP_NODELAY=1 |
17 |
socket = r:TCP_NODELAY=1 |
18 |
|
19 |
[redis] |
20 |
client = yes |
21 |
accept = 127.0.0.0.1:6379 |
22 |
connect = 10.1.100.1:6379 |
23 |
TIMEOUTclose = 0 |
24 |
EOF |
25 |
|
26 |
cat > /etc/systemd/system/stunnel.service << EOF |
27 |
[Unit] |
28 |
Description=SSL tunnel |
29 |
After=syslog.target |
30 |
|
31 |
[Service] |
32 |
ExecStart=/usr/bin/stunnel /etc/stunnel/stunnel.conf |
33 |
ExecStop=/bin/kill -9 |
34 |
ExecStatus=pgrep stunnel |
35 |
Type=forking |
36 |
|
37 |
[Install] |
38 |
WantedBy=multi-user.target |
39 |
EOF |
40 |
|
41 |
systemctl start stunnel |
42 |
systemctl enable stunnel |
43 |
|