diff --git a/updian-rsh b/updian-rsh index eac3b0b..c467ee5 100755 --- a/updian-rsh +++ b/updian-rsh @@ -1,22 +1,36 @@ #/bin/bash +# +# updian-rsh: Updian Restriced Shell +# -# Updian Restriced Shell +# Send message to stdout and syslog +function msg { + echo $1 | logger + echo $1 +} + +echo "$0: Invoked by process $PPID" | logger if [[ -z $SSH_ORIGINAL_COMMAND ]] then - echo "Updian Restriced Shell: Interactive shell not allowed" + msg "$0: Interactive shell not allowed" exit 1 fi case $SSH_ORIGINAL_COMMAND in - "apt-get update -qq" | "apt-get upgrade -s" \ - | "export DEBIAN_FRONTEND=noninteractive && apt-get upgrade -y --force-yes" \ - | "apt-get autoclean" | "checkrestart" \ - | "yum check-update -q" | "yum update -y --skip-broken") - bash -c "$SSH_ORIGINAL_COMMAND" + '/bin/bash -c "test -x /usr/bin/yum"' \ + | '/bin/bash -c "test -x /usr/bin/apt-get"' \ + | '/bin/bash -c "yum check-update -q"' \ + | '/bin/bash -c "yum -y update"' \ + | '/bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get update -qq"' \ + | '/bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get upgrade -s | grep Inst"' \ + | '/bin/bash -c "PAGER=cat DEBIAN_FRONTEND=noninteractive apt-get --yes -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" upgrade"' \ + ) + echo "$0: Executing: $SSH_ORIGINAL_COMMAND" | logger + eval $SSH_ORIGINAL_COMMAND ;; *) - echo "Updian Restriced Shell: Command not allowed: $SSH_ORIGINAL_COMMAND" + msg "$0: Command not allowed: $SSH_ORIGINAL_COMMAND" exit 2 ;; esac diff --git a/updian/config.py b/updian/config.py index b9bfb05..c0b99ad 100644 --- a/updian/config.py +++ b/updian/config.py @@ -48,7 +48,7 @@ secret_key = {secret_key} # url to your installation (used for hyperlinking in mails) -updian_url = http://192.168.0.254/updian/ +updian_uri = http://192.168.0.254/updian/ # send infomails: true|false mail_active = true diff --git a/updian/fabric_utils.py b/updian/fabric_utils.py index e23ab04..3e8f132 100644 --- a/updian/fabric_utils.py +++ b/updian/fabric_utils.py @@ -48,6 +48,9 @@ def _detect_backend(): raise RuntimeError('Auto-detection of package manager returned ' 'ambiguous results. More than one package ' 'manager found on %s.' % fabric.api.env.host) + # No backends found + elif len(available_backends) == 0: + return None backend = available_backends[0]