diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/instistats | bin | 3524120 -> 0 bytes | |||
-rwxr-xr-x | bin/makeuser | 11 | ||||
-rwxr-xr-x | bin/rmuser | 29 | ||||
-rwxr-xr-x | bin/toot.py | 4 |
4 files changed, 26 insertions, 18 deletions
diff --git a/bin/instistats b/bin/instistats deleted file mode 100755 index 62d21db..0000000 --- a/bin/instistats +++ /dev/null Binary files differdiff --git a/bin/makeuser b/bin/makeuser index 91e3b56..e9a4c1f 100755 --- a/bin/makeuser +++ b/bin/makeuser @@ -84,13 +84,20 @@ case $1 in # 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 + #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 + #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 diff --git a/bin/rmuser b/bin/rmuser index db3ea38..98c697a 100755 --- a/bin/rmuser +++ b/bin/rmuser @@ -1,16 +1,17 @@ -#!/usr/local/bin/bash +#!/bin/sh +set -eu -# Hopefully, this never has to be used. -# Cleans up and removes a user from the system. -# gbmor <ben@gbmor.dev> +if [ -z "$1" ]; then + printf 'Please pass a user as the first argument.\n' + exit 1 +fi -echo "Removing user $1 from the system" -userdel $1 -echo "Cleaning /home and /var/www/users" -rm -rf /home/$1 -rm -rf /var/www/users/$1 -echo "Removing httpd config" -rm -f /etc/httpd/$1.conf -httpdpid=`pgrep httpd | awk 'NR==1{print $1}'` -kill -HUP $httpdpid -echo "Done! Don't forget to remove the appropriate include line from httpd-vusers.conf" +printf 'Removing user %s from the system\n' "$1" +userdel -r -v "$1" +printf 'Cleaning /var/www/users/%s\n' "$1" +rm -rf "/var/www/users/$1" +printf 'Deleting cgit repos\n' +rm -rf "/var/www/cgit_repos/$1" +printf 'Removing httpd config\n' +rm -f "/etc/httpd/$1.conf" +printf 'You need to remove the include line from httpd-vusers.conf and restart httpd\n' diff --git a/bin/toot.py b/bin/toot.py index ae94f30..c13eaf6 100755 --- a/bin/toot.py +++ b/bin/toot.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2 +#!/usr/local/bin/python3 import json import os @@ -50,7 +50,7 @@ def toot(status, media): status = "".join(sys.stdin).strip() # replace shortcodes with emoji :thumbsup: - status = emoji.emojize(status, use_aliases=True) + status = emoji.emojize(status, language='alias') # check status length and post status if len(status) > 500: |