2

I've installed stunnel 4.5 on centos 7.6.

sudo yum -y install stunnel

Now i want to stop-start-restart-status stunnel as a service on centos 7.6.
The command below does not work :

systemctl start stunnel

How can i do that?


Take a look at this link = starting_stopping_restarting_stunnel :
The command
stunnel /etc/stunnel/stunnel.conf

Works.
But the command

kill `cat /var/run/stunnel/stunnel.pid`

Does not work.It tells :

cat: /var/run/stunnel/stunnel.pid: No such file or directory


Here is stunnel.conf file that i've created in this path (/etc/stunnel/stunnel.conf).

client = no
[squid]
accept  = 1800
connect = 127.0.0.1:8080
cert = /etc/stunnel/stunnel.pem

It works fine.

SilverLight
  • 1,384

1 Answers1

2

I found solution here :
centos-with-selinux-systemd-and-stunnel
and here :
centos-stunnel-systemd


And here is stunnel.service changes for centos 7.6 :
[Unit]
Description=SSL tunnel for network daemons
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target
Alias=stunnel.target

[Service]
Type=forking
ExecStart=/usr/bin/stunnel /etc/stunnel/stunnel.conf
ExecStop=/usr/bin/pkill stunnel

# Give up if ping don't get an answer
TimeoutSec=600

Restart=always
PrivateTmp=false

Now you can start-enable-stop stunnel as a service :

sudo systemctl start stunnel.service
sudo systemctl enable stunnel.service
sudo systemctl stop stunnel.service
SilverLight
  • 1,384