Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions updian-rsh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion updian/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions updian/fabric_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down