Web lists-archives.com

tinysshd dependency on systemd

>>>>> Vincent Bernat <bernat@xxxxxxxxxx> writes:
>>>>> ❦ 21 octobre 2018 13:15 GMT, Ivan Shmakov <ivan@xxxxxxxxxxx>:
>>>>> ‘TFH’ == Tollef Fog Heen <tfheen@xxxxxx> writes:


 TFH> tinysshd only ships a systemd unit file; neomutt links against
 TFH> libgpgme11 which again Depends on gnupg.  It’s the kind of
 TFH> dependencies that individually make sense,

 >> I beg to differ; I suppose (though haven’t actually tried) I can
 >> start tinysshd straight from rc.local just as well, or even write my
 >> own init.d script, right?  Having the dependency in place just makes
 >> it harder to me to contribute an init.d script for the package.

 > tinysshd requires some kind of socket server to run.  It could run
 > from inetd,

	Reading tinysshd(8), I see that it can also be started from
	tcpserver(8) or BusyBox’ tcpsvd (which doesn’t seem to be
	available in Debian yet.)  Or, I suppose, socat(1)?  Say:

# setsid -- socat  TCP6-LISTEN:22,fork \
      EXEC:"tinysshd -v /etc/tinyssh/sshkeydir" & 

	Contrary to running from Inetd, the use of the likes of socat(1)
	and tcpserver(8) can readily be adapted for an init.d script
	(or, rather, init-d-script(5) DAEMON wrapper), which in turn
	allows the user to control the daemon with the usual service(8).

	Examples (untested) of such a wrapper and a corresponding init.d
	script are MIMEd.

 > so if you were an actual user, I would propose you file a bug report
 > against the package to let the maintainer knows the dependency is too
 > strong for your use (and maybe propose a patch to integrate with inetd).

 > As you are not, please, do not.  Our resources are scarce and we
 > already cater for the need of many non-existent users.

	You know, in almost twenty years of using GNU/Linux, I think
	it’s the first time I’m requested /not/ to report bugs and
	contribute patches.  How times did change, indeed!

FSF associate member #7257  http://am-1.org/~ivan/
### tinysshd-wrapper  -*- Sh -*-
## Run tinysshd via socat(1) or tcpserver(8), whichever is available.

### Ivan Shmakov, 2018

## To the extent possible under law, the author(s) have dedicated
## all copyright and related and neighboring rights to this software
## to the public domain worldwide.  This software is distributed
## without any warranty.

## You should have received a copy of the CC0 Public Domain Dedication
## along with this software.  If not, see
## <http://creativecommons.org/publicdomain/zero/1.0/>.

### Code:

set -e

PREFERENCE="socat tcpserver"

test  -r /etc/default/tinysshd-wrapper \
    && . /etc/default/tinysshd-wrapper

run_socat () {
    ## .
    exec socat  TCP6-LISTEN:"$PORT",fork \

run_tcpserver () {
    ## .
    exec tcpserver -HRDl0 "$PORT" \
        "$TINYSSHD" -v "$SSHKEYDIR"

for p in ${PREFERENCE} ; do
    type "$p" > /dev/null || continue
    ## .

printf %s\\n "FATAL: Neither of ${PREFERENCE:-(none?)} are available" >&2

### tinysshd-wrapper ends here
# Provides:             tinysshd
# Required-Start:    	$remote_fs $syslog
# Required-Stop:     	$remote_fs $syslog
# Default-Start:     	2 3 4 5
# Default-Stop:      	0 1 6
# Short-Description:    minimalistic (subset of) SSHv2 server
DESC="minimalistic (subset of) SSHv2 server"