From 7d39c4e29b95f44a890d6aa63d76036f6b7a7e43 Mon Sep 17 00:00:00 2001 From: admins Date: Tue, 12 Jul 2022 19:22:47 -0400 Subject: updated some files that had drifted locally --- bin/instistats | Bin 3524120 -> 0 bytes bin/makeuser | 11 +++++++++-- bin/rmuser | 29 +++++++++++++++-------------- bin/toot.py | 4 ++-- 4 files changed, 26 insertions(+), 18 deletions(-) delete mode 100755 bin/instistats (limited to 'bin') diff --git a/bin/instistats b/bin/instistats deleted file mode 100755 index 62d21db..0000000 Binary files a/bin/instistats and /dev/null differ diff --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 +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: -- cgit 1.4.1-2-gfad0 >7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82