From 114f43a58a6831b6774eb57133d1012b3e588241 Mon Sep 17 00:00:00 2001 From: Caleb Boylan Date: Tue, 16 May 2017 10:40:10 -0700 Subject: [PATCH] build/ops: Lock ceph user during a purge Signed-off-by: Caleb Boylan --- debian/ceph-common.postinst | 6 ++++++ debian/ceph-common.postrm | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/debian/ceph-common.postinst b/debian/ceph-common.postinst index 719dc7908b95..b9d382aaaa91 100644 --- a/debian/ceph-common.postinst +++ b/debian/ceph-common.postinst @@ -62,6 +62,12 @@ case "$1" in -d $SERVER_HOME \ -g $SERVER_GROUP \ $SERVER_USER + # Unlock $SERVER_USER in case it is locked from an uninstall + if [ -f /etc/shadow ]; then + usermod -U -e '' $SERVER_USER + else + usermod -U $SERVER_USER + fi echo "..done" # 5. adjust file and directory permissions diff --git a/debian/ceph-common.postrm b/debian/ceph-common.postrm index b62185483cb6..e6a97543ac16 100644 --- a/debian/ceph-common.postrm +++ b/debian/ceph-common.postrm @@ -24,8 +24,17 @@ case "$1" in ;; purge) - rm -rf /var/log/ceph - rm -rf /etc/ceph + [ -f "/etc/default/ceph" ] && . /etc/default/ceph + [ -z "$SERVER_USER" ] && SERVER_USER=ceph + + rm -rf /var/log/ceph + rm -rf /etc/ceph + + if [ -f /etc/shadow ]; then + usermod -L -e 1 $SERVER_USER + else + usermod -L $SERVER_USER + fi ;; upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) -- 2.47.3