You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I am currently working on improvements of my servers configuration, I realized another problem.
I am starting sslh now on systemd-free systems, via the sysv-init /etc/initd.d/sslh start script.
And when I restart sslh from a terminal after a configuration change, I get status messages messages from sslh written into my terminal window.
When researching this close, I figured out, that there is a debian-bug pending since 2019, describing the same issue. Systemd users are not aware of this, as systemd catches all output from stdout and stderr.
The discussion in the debian bug-report seems not to find the cause, as one of the discussionists couldn't reproduce. So i started myself some research, I wished to share.
First of all, I think, that finally a code change may appropriate, as a daemon should detach from stdout/stdin/stderr, when backgrounding.
The connections should stay connected, when started with the -f parameter.
But now my findings:
On a system without systemd (devuan), the filehandles of sslh are looking like:
So, this fits to my observation, why I get my terminal messed up. Thankfully I can get rid of it, when using the --background parameter in the startup script, as also mentioned in the debian bug report. When doing this the output looks like:
ls -lad /proc/1397[89]/fd/*
lr-x------ 1 root root 64 16. Aug 13:31 /proc/13978/fd/0 -> /dev/null
l-wx------ 1 root root 64 16. Aug 13:31 /proc/13978/fd/1 -> /dev/null
l-wx------ 1 root root 64 16. Aug 13:31 /proc/13978/fd/2 -> /dev/null
lrwx------ 1 root root 64 16. Aug 13:31 /proc/13978/fd/3 -> 'socket:[183504]'
lr-x------ 1 root root 64 16. Aug 13:31 /proc/13979/fd/0 -> /dev/null
l-wx------ 1 root root 64 16. Aug 13:31 /proc/13979/fd/1 -> /dev/null
l-wx------ 1 root root 64 16. Aug 13:31 /proc/13979/fd/2 -> /dev/null
And the terminal stays clean.
OK, Now I have researched my old systemd servers. When sslh is started via systemctl (and without the --background parameter) the output looks like:
But when I do a /etc/init.d/sslh restart, the output still tells me, that it is started using systemctl. Even, when I followed all advices, how to untie an application from systemd.
The output tells me: Restarting sslh (via systemctl): sslh.service, however there is not a single connection piece left, which ties this to systemd. And the output still looks like:
And now I create another file in my root users home-directory, sslh.sh, which contains:
#!/bin/bash
. /etc/init.d/sslh
And I do now a ./sslh.sh restart, which is nothing different than the previous one, but I don't do that from the /etc/init.d location!
And now I receive the expected message from my startup-script:
* Restarting ssl/ssh multiplexer sslh
and now also here I get unwanted output to the terminal, and I see, that nobody has grabbed the filehandles:
So I have learned, that systemd is still grabbing sysv-init-scripts, just because they are located in /etc/init.d. This was a real important finding, as I learned, that you can't easily escape from systemd.
So my current impression is, that a code-change would make sslh behave much better as a daemon, even when there are workarounds available (--background parameter, systemd grabbing output). In other systems this behaviour still could lead to problems.
I see this issue as an close relative to #419. As I am also very interested in getting a most up-to-date debian package (as this is the mother of ubuntu/devuan and many others), I think, its worth to look at those bug-reports and get things straight.
There is another debian bug-report, which contains an patch, but I had no deeper look into that.
I see this behaviour as a minor security breach, as this failure may reveal information to others, as the output is tied to the terminal-id.
When a restricted user connects to an system, where an admin has restarted sslh, and this user gets the same terminal-id, he gets the messages.
I may propose a PR for the detaching in the next days, if there are no other idea.
The text was updated successfully, but these errors were encountered:
As I am currently working on improvements of my servers configuration, I realized another problem.
I am starting sslh now on systemd-free systems, via the sysv-init /etc/initd.d/sslh start script.
And when I restart sslh from a terminal after a configuration change, I get status messages messages from sslh written into my terminal window.
When researching this close, I figured out, that there is a debian-bug pending since 2019, describing the same issue. Systemd users are not aware of this, as systemd catches all output from stdout and stderr.
The discussion in the debian bug-report seems not to find the cause, as one of the discussionists couldn't reproduce. So i started myself some research, I wished to share.
First of all, I think, that finally a code change may appropriate, as a daemon should detach from stdout/stdin/stderr, when backgrounding.
The connections should stay connected, when started with the -f parameter.
But now my findings:
On a system without systemd (devuan), the filehandles of sslh are looking like:
So, this fits to my observation, why I get my terminal messed up. Thankfully I can get rid of it, when using the --background parameter in the startup script, as also mentioned in the debian bug report. When doing this the output looks like:
And the terminal stays clean.
OK, Now I have researched my old systemd servers. When sslh is started via systemctl (and without the --background parameter) the output looks like:
which shows, that systemd grabs stdin/stdout to one socket and stderr to another (log?) socket.
But on most systems, I was under the impression, that I have removed the systemd dependancy, by the following steps:
But when I do a /etc/init.d/sslh restart, the output still tells me, that it is started using systemctl. Even, when I followed all advices, how to untie an application from systemd.
The output tells me:
Restarting sslh (via systemctl): sslh.service
, however there is not a single connection piece left, which ties this to systemd. And the output still looks like:And now I create another file in my root users home-directory, sslh.sh, which contains:
And I do now a
./sslh.sh restart
, which is nothing different than the previous one, but I don't do that from the /etc/init.d location!And now I receive the expected message from my startup-script:
* Restarting ssl/ssh multiplexer sslh
and now also here I get unwanted output to the terminal, and I see, that nobody has grabbed the filehandles:
So I have learned, that systemd is still grabbing sysv-init-scripts, just because they are located in /etc/init.d. This was a real important finding, as I learned, that you can't easily escape from systemd.
So my current impression is, that a code-change would make sslh behave much better as a daemon, even when there are workarounds available (--background parameter, systemd grabbing output). In other systems this behaviour still could lead to problems.
I see this issue as an close relative to #419. As I am also very interested in getting a most up-to-date debian package (as this is the mother of ubuntu/devuan and many others), I think, its worth to look at those bug-reports and get things straight.
There is another debian bug-report, which contains an patch, but I had no deeper look into that.
I see this behaviour as a minor security breach, as this failure may reveal information to others, as the output is tied to the terminal-id.
When a restricted user connects to an system, where an admin has restarted sslh, and this user gets the same terminal-id, he gets the messages.
I may propose a PR for the detaching in the next days, if there are no other idea.
The text was updated successfully, but these errors were encountered: