From 127e786b70911bed54c1189e394e6744907395c1 Mon Sep 17 00:00:00 2001 From: Benjamin Morrison Date: Mon, 12 Jun 2023 22:40:57 -0400 Subject: wrapper script for adding users in bulk. cleanup and reconcile local changes. --- bin/makeuser | 107 ----------------------------------------------------------- 1 file changed, 107 deletions(-) delete mode 100755 bin/makeuser (limited to 'bin/makeuser') diff --git a/bin/makeuser b/bin/makeuser deleted file mode 100755 index e9a4c1f..0000000 --- a/bin/makeuser +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/local/bin/bash -# --------------------------------------------------------------------------- -# makeuser - tilde.institute new user creation -# Usage: makeuser [-h|--help] "" -# ben@gbmor.dev -# --------------------------------------------------------------------------- - -PROGNAME=${0##*/} -VERSION="0.1" - -error_exit() { - echo -e "${PROGNAME}: ${1:-"Unknown Error"}" >&2 - exit 1 -} - -usage() { - echo -e "usage: $PROGNAME [-h|--help] \"\"" -} - -[[ $(id -u) != 0 ]] && error_exit "you must be the superuser to run this script." - -USERLIST=$( /etc/httpd/$1.conf - -# add the user's vhost config to the bridged vhost config, which -# is loaded by /etc/httpd.conf. This is necessary because httpd(8) -# does not support globbing on includes - echo "include \"/etc/httpd/$1.conf\"" >> /etc/httpd-vusers.conf - -# Sort and deduplicate entries in the bridged vhost config file -# Duplicate entries cause weird behavior. Subdomains after the -# duplicated entry won't resolve properly and instead resolve -# to the main site - sort -u /etc/httpd-vusers.conf > /etc/httpd-vusers.conf.sorted - cp /etc/httpd-vusers.conf.sorted /etc/httpd-vusers.conf - #pkill -HUP httpd - rcctl restart httpd - -# send welcome email - sed -e "s/newusername/$1/g" /admin/misc/email.tmpl | mail -r admins@tilde.institute -s "welcome to tilde.institute!" $2 - -# subscribe to mailing list - #echo " " | doas -u $1 mail -s "subscribe" institute-join@lists.tildeverse.org - -# lock down the users' history files so they can't be deleted or truncated (bash and ksh only) - doas -u "$1" touch /home/$1/.history - doas -u "$1" touch /home/$1/.bash_history - chflags uappnd /home/$1/.history - chflags uappnd /home/$1/.bash_history - -# announce the new user's creation on mastodon -# then copy their ssh key to their home directory - /admin/bin/toot.py "Welcome new user ~$1!" - /var/www/htdocs/userlist - echo "$3" | tee /home/$1/.ssh/authorized_keys -esac -- cgit 1.4.1-2-gfad0