1

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


Edit :
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.

| improve this question | | | | |
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
| improve this answer | | | | |
-1

Check the /var/run/stunnel directory. There might be a /var/run/stunnel/pid file (as opposed to /var/run/stunnel/stunnel.pid). Or some other similar file. If there is - simply change your command to kill `cat /var/run/stunnel/pid` or something similar depending on the file name.

| improve this answer | | | | |
  • /var/run/stunnel > There is no such directory. – SilverLight Feb 18 '19 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.