initial version of rsync module which supports running rsynd server on top of tls

This commit is contained in:
Timo Makinen 2019-05-20 23:07:35 +03:00
parent 60406a69f9
commit d49da2f96e
8 changed files with 128 additions and 0 deletions

View file

@ -0,0 +1,35 @@
#!/bin/bash
echo "$@" > /tmp/foo.out
key="/etc/pki/tls/private/$(hostname -f).key"
cert="/etc/pki/tls/certs/$(hostname -f).crt"
cafile="/etc/pki/tls/certs/ca.crt"
port=${RSYNC_SSL_PORT:-873}
# If the user specified USER@HOSTNAME::module, then rsync passes us
# the -l USER option too, so we must be prepared to ignore it.
if [ x"$1" = x"-l" ]; then
shift 2
fi
hostname=$1
shift
if [ x"$hostname" = x -o x"$1" != x"rsync" -o x"$2" != x"--server" -o x"$3" != x"--daemon" ]; then
echo "Usage: stunnel-rsync HOSTNAME rsync --server --daemon ." 1>&2
exit 1
fi
# devzero@web.de came up with this no-tmpfile calling syntax:
stunnel -fd 10 11<&0 <<EOF 10<&0 0<&11 11<&-
foreground = yes
debug = crit
connect = $hostname:$port
client = yes
TIMEOUTclose = 0
verify = 2
cert = $cert
key = $key
CAfile = $cafile
EOF