X-Git-Url: http://git.onelab.eu/?p=pl_sshd.git;a=blobdiff_plain;f=pl_sshd.sh;h=07580336e88c405a95155c0f963f855037cc9a7a;hp=4fa07c49003a90826d3a5c4775f0f1512030aacf;hb=HEAD;hpb=a7813d33924a3e557c6347d81f005c5002dcb269 diff --git a/pl_sshd.sh b/pl_sshd.sh index 4fa07c4..0758033 100755 --- a/pl_sshd.sh +++ b/pl_sshd.sh @@ -1,3 +1,24 @@ #!/bin/sh +# +# this wrapper runs sshd on an alternate port with a different argv[0] +# and PID file (rather annoyingly, the latter has to be specified +# explicitly even if argv[0] is changed). +# +# the alternate port is necessary so we can have two instances of sshd +# running, the different name and PID file are required so that stopping +# the standard sshd won't affect this one. +# +# we use port 806 unless there is a '-p' argument specifying a different +# port. we also have to specify a different PID file so that one sshd +# doesn't clobber the other's PID file. +# +# XXX - unfortunately the standard init.d/sshd script is fairly brutal +# when stopping sshd processes - it will stop anything that looks +# remotely like sshd. the measures taken here still don't prevent that +# but i have decided that restarting/stopping sshd should be sufficiently +# rare that it's not worth worrying about to any greater extent. +# +name=pl_sshd +echo "$@" | grep -q -- '-p[ 0-9]' || port='-p 806' -exec -a pl_sshd /usr/sbin/sshd "$@" +exec -a /usr/local/sbin/pl_sshd /usr/sbin/sshd -o "PidFile /var/run/$name.pid" $port "$@"