-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssb.sh
executable file
·66 lines (56 loc) · 1.75 KB
/
ssb.sh
1
2
3
4
5
6
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
#!/usr/bin/env sh
# Bin Paths
base_path="/opt/secure-shell-bastion"
jail_build="$base_path/bin/jail_build.sh"
jail_remove="$base_path/bin/jail_remove.sh"
user_add_key="$base_path/bin/key_add.sh"
user_rm_key="$base_path/bin/key_remove.sh"
user_show_pub="$base_path/bin/show_pub.sh"
list_users="$base_path/bin/list_users.sh"
if [ "$(id -u)" -ne 0 ]; then
echo "Please run SSB with sudo or as root!"
exit
fi
# Parse Args
case "$1" in
# Takes No Args
-l|--list)
echo "=========================="
echo "Secure Shell Bastion Users"
echo "=========================="
. "$list_users"
;;
# Takes User as Arg
-n|--new_user)
. "$jail_build" "$2"
;;
# Takes User as Arg
-r|--remove_user)
. "$jail_remove" "$2"
;;
# Takes User as Arg
-ak|--add_key)
. "$user_add_key" "$2"
;;
# Takes User as Arg
-rk|--rm_key)
. "$user_rm_key" "$2"
;;
# Takes User as Arg
-sp|--show_pub)
. "$user_show_pub" "$2"
;;
*)
echo "usage: Secure Shell Bastion (SSB)"
echo ""
echo "SSB is an automated fake root jail for ssh users using Alpine Linux and MUSL"
echo ""
echo "-l, --list List all user accounts"
echo "-n, --new_user Create a new SSB user account"
echo "-r, --remove_user Remove a existing SSB user account"
echo "-ak, --add_key Open a users authorized_keys file to add a new key"
echo "-rk, --remove_key Removes all authorized_keys for a user, locking the account"
echo "-sp, --show_pub Show the internal pubkey for a SSB user"
echo ""
;;
esac