From 627dbb5135e250e162991af565bcf711bea70338 Mon Sep 17 00:00:00 2001 From: steering7253 Date: Sun, 5 Jul 2026 22:36:07 -0600 Subject: init --- README.md | 6 ++++++ bust_cache | 5 +++++ cgitsuper.sudoers.d | 3 +++ download_keys | 4 ++++ make_new_user | 10 ++++++++++ 5 files changed, 28 insertions(+) create mode 100644 README.md create mode 100755 bust_cache create mode 100644 cgitsuper.sudoers.d create mode 100755 download_keys create mode 100755 make_new_user diff --git a/README.md b/README.md new file mode 100644 index 0000000..0d4e562 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +Utility scripts, mostly for use by automation (). + +- cgitsuper.sudoers.d - /etc/sudoers.d/cgitsuper +- bust\_cache - run (sudo as root) by bust\_cache.php +- download\_keys - run (sudo as new user) by make\_new\_user +- make\_new\_user - run (sudo as root) by register.php diff --git a/bust_cache b/bust_cache new file mode 100755 index 0000000..8097f5d --- /dev/null +++ b/bust_cache @@ -0,0 +1,5 @@ +#!/bin/sh + +rm -rf /var/cache/cgit/* + +echo busted diff --git a/cgitsuper.sudoers.d b/cgitsuper.sudoers.d new file mode 100644 index 0000000..0790c34 --- /dev/null +++ b/cgitsuper.sudoers.d @@ -0,0 +1,3 @@ +cgitsuper ALL=(ALL:ALL) NOPASSWD: /opt/cgit-space/sbin/bust_cache "" +cgitsuper ALL=(ALL:ALL) NOPASSWD: /opt/cgit-space/sbin/make_new_user +root ALL=(ALL:ALL) NOPASSWD: /opt/cgit-space/sbin/download_keys diff --git a/download_keys b/download_keys new file mode 100755 index 0000000..74fd4d3 --- /dev/null +++ b/download_keys @@ -0,0 +1,4 @@ +#!/bin/sh + +mkdir -p -- "$HOME/.ssh" +curl -- "$1" | sed '/restrict,pty /!s/^/restrict,pty /' >$HOME/.ssh/authorized_keys diff --git a/make_new_user b/make_new_user new file mode 100755 index 0000000..aa9f772 --- /dev/null +++ b/make_new_user @@ -0,0 +1,10 @@ +#!/bin/sh + +user="$1" +auth_keys_url="$2" + +useradd -s /usr/bin/git-shell -G git -m -- "$user" +sudo -H -u "$user" /opt/cgit-space/sbin/download_keys "$auth_keys_url" +ln -s /home/"$user" /opt/cgit-space/users/'~'"$user" + +echo "User has been created." -- cgit v1.3.1-10-gc9f91