Author Topic: controlling stunnel as if it were a daemon  (Read 6569 times)

Tom L

  • Guest
controlling stunnel as if it were a daemon
« on: May 17, 2021, 02:40:06 pm »
Hi guys, I have a serious issue on a production system, I would appreciate any help anyone can give.

I am using Paul's stunnel port on ArcaOS 5 to provide TLS to a http server. Everything works well, except, occasionally, CPU will spike to 100% and stunnel has to be restarted. Then things are fine again for a couple of hours. I tried newer versions of the stunnel port, but they only make it worse.

I will open a ticket with Paul, but I need a workaround. On OS/2, stunnel will not run as a daemon/service, so I presume I cannot assign a PID to it and then kill it at will. I am launching it like this: stunnel.exe stunnel.conf

Even with debug = 7 (highest), there is nothing in the log that would as much as hint at what might be turning stunnel into a CPU hog.  :(

Is there a way I could automate the restarts? What I am doing now is: log on thru VNC, click in the stunnel window, press Ctrl-C and run it again.

Meta:

ArcaOS 5.0.6 EN
stunnel 5.50 on i386-pc-os2-emx
Lotus Domino Go 4.6.2.5

Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: controlling stunnel as if it were a daemon
« Reply #1 on: May 17, 2021, 03:08:13 pm »
On OS/2, stunnel will not run as a daemon/service, so I presume I cannot assign a PID to it and then kill it at will.
Yes, you can, if there's an executable. The PID is not assigned by you, but by the system whenever a process is started. You may want to check it with Top. Another useful tool to kill a process without knowing the PID and much more is Pgmcntrl.
« Last Edit: May 17, 2021, 03:22:55 pm by Andreas Schnellbacher »

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1024
  • Karma: +24/-0
    • View Profile
    • Blonde Guy
Re: controlling stunnel as if it were a daemon
« Reply #2 on: May 17, 2021, 03:28:35 pm »
Can you post the relevant part of stunnel.conf? I'm trying to do something like that, too.
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Tom L

  • Guest
Re: controlling stunnel as if it were a daemon
« Reply #3 on: May 17, 2021, 04:07:51 pm »
Thank you, Andreas, that looks very promising! I'll check that out and post back.

Neil, here you go. Domino runs on localhost:8443, stunnel listens on :443 and just passes requests to Domino.

--- cut ---
[https]
accept  = x.x.x.x:443
connect = 127.0.0.1:8443
cert = webcrt.pem
sslVersion = TLSv1.2
ciphers = ECDHE-ECDSA-AES128-GCM-SHA256
--- cut ---

Andi B.

  • Hero Member
  • *****
  • Posts: 811
  • Karma: +11/-2
    • View Profile
Re: controlling stunnel as if it were a daemon
« Reply #4 on: May 17, 2021, 05:04:53 pm »
If you want to find out the PID you can use something like
Code: [Select]
pstat /C |find /I "clipview"Use your process name (stunnel?) instead clipview from my example.

Tom L

  • Guest
Re: controlling stunnel as if it were a daemon
« Reply #5 on: May 17, 2021, 06:34:48 pm »
What a community! Thank you all for sharing your ideas and teaching me new commands.
I now use a combination of pgmcntrl and the program object scheduler in ArcaOS to restart stunnel every couple of hours.

For whoever finds this post and wants to do something similar:

I am closing stunnel by sending it SIGINT...

Code: [Select]
c:\pgmcntrl\pgmcntrl /close /exename:stunnel.exe
...and then I'm immediately starting it in a new session thru...

Code: [Select]
start "stunnel" /PGM c:\stunnel\bin\stunnel.cmd

Sean Casey

  • Full Member
  • ***
  • Posts: 122
  • Karma: +2/-0
    • View Profile
Re: controlling stunnel as if it were a daemon
« Reply #6 on: May 18, 2021, 03:33:27 am »

I am closing stunnel by sending it SIGINT...

Code: [Select]
c:\pgmcntrl\pgmcntrl /close /exename:stunnel.exe

That works, and to add to Andi's tip, you could also use the following to kill the stunnel process.  xargs is provided with the findutils rpm package.

           plist |grep STUNNEL | cut -c18-20 | xargs kill -9

           (Note: STUNNEL is case sensitive)