|
|
@ -1,11 +1,6 @@ |
|
|
|
#!/bin/bash |
|
|
|
#!/bin/bash |
|
|
|
set -Eeo pipefail |
|
|
|
set -Eeo pipefail |
|
|
|
|
|
|
|
|
|
|
|
if [ ! -e /etc/openvpn/sshd_config ]; then |
|
|
|
|
|
|
|
echo "Configuration file sshd_config not found. Initializing..." |
|
|
|
|
|
|
|
cp /config/sshd_config /etc/ssh/sshd_config |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# shellcheck disable=2154 |
|
|
|
# shellcheck disable=2154 |
|
|
|
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR |
|
|
|
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR |
|
|
|
|
|
|
|
|
|
|
@ -20,6 +15,14 @@ function log() { |
|
|
|
echo "[$0] $*" >&2 |
|
|
|
echo "[$0] $*" >&2 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Check that `sshd_config` exists |
|
|
|
|
|
|
|
# In case `/etc/ssh/` is mounted as a volume the file `sshd_config` is not |
|
|
|
|
|
|
|
# guaranteed to be there |
|
|
|
|
|
|
|
if [ ! -e /etc/ssh/sshd_config ]; then |
|
|
|
|
|
|
|
echo "Configuration file sshd_config not found. Initializing..." |
|
|
|
|
|
|
|
cp /config/sshd_config /etc/ssh/sshd_config |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Allow running other programs, e.g. bash |
|
|
|
# Allow running other programs, e.g. bash |
|
|
|
if [[ -z "$1" || "$1" =~ $reArgsMaybe ]]; then |
|
|
|
if [[ -z "$1" || "$1" =~ $reArgsMaybe ]]; then |
|
|
|
startSshd=true |
|
|
|
startSshd=true |
|
|
|