diff options
author | David Kunz <david.kunz@dknet.ch> | 2021-08-24 13:08:16 +0000 |
---|---|---|
committer | David Kunz <david.kunz@dknet.ch> | 2021-08-24 13:08:31 +0000 |
commit | 3cb2b445f478ff4f69d1f12de9d8c0b9ebe780d1 (patch) | |
tree | 0e8bccd59ad0a41645a19e4196a0089e126890a9 /debian | |
parent | Adding fencing scripts. (diff) | |
download | compute-tools-3cb2b445f478ff4f69d1f12de9d8c0b9ebe780d1.tar.xz compute-tools-3cb2b445f478ff4f69d1f12de9d8c0b9ebe780d1.zip |
davids debian directorytmp-fence
Diffstat (limited to 'debian')
-rwxr-xr-x | debian/open-infrastructure-container-tools.postinst | 26 | ||||
-rwxr-xr-x | debian/open-infrastructure-container-tools.postrm | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/debian/open-infrastructure-container-tools.postinst b/debian/open-infrastructure-container-tools.postinst index cad8ce0..66fd27f 100755 --- a/debian/open-infrastructure-container-tools.postinst +++ b/debian/open-infrastructure-container-tools.postinst @@ -75,6 +75,13 @@ case "${1}" in db_get open-infrastructure-container-tools/irc IRK_TARGETS="${RET}" # string (w/ empty) + # fencing user + db_get open-infrastructure-container-tools/user + FENCING_USER="${RET:-fence}" + + db_get open-infrastructure-container-tools/key + FENCING_KEY_PATH="${RET:-/home/${MONITOR_USER}/.ssh}" + db_stop Install "/var/lib/machines" "${MACHINES}" @@ -102,6 +109,25 @@ EOF # If the admin deleted or commented some variables but then set # them via debconf, (re-)add them to the config file. + # creating user + if ! getent passwd ${FENCING_USER} > /dev/null 2>&1 + then + useradd -c "fence,,," -M -s /bin/bash ${FENCING_USER} + + if getent passwd ${FENCING_USER} > /dev/null 2>&1 + then + gpasswd -a ${FENCING_USER} ${FENCING_USER} + fi + + fi + +cat > "/etc/sudoers.d/${FENCING_USER}" << EOF +${FENCING_USER} ALL=NOPASSWD: ALL +EOF + + chmod 0440 "/etc/sudoers.d/${FENCING_USER}" + mkdir -p "/home/${FENCING_USER}/.ssh" + test -z "${IRK_TARGETS}" || \ grep -Eq '^ *IRK_TARGETS=' "${CONFFILE}" || \ echo "IRK_TARGETS=" >> "${CONFFILE}" diff --git a/debian/open-infrastructure-container-tools.postrm b/debian/open-infrastructure-container-tools.postrm index c68ac1c..f0e24b8 100755 --- a/debian/open-infrastructure-container-tools.postrm +++ b/debian/open-infrastructure-container-tools.postrm @@ -35,6 +35,8 @@ case "${1}" in Remove /etc/compute-tools/hooks Remove /etc/compute-tools/keys Remove /var/lib/machines + userdel ${FENCING_USER} + Remove /home/${FENCING_USER} ;; purge) |