removing banneduser and ip checks
This commit is contained in:
parent
c74fa27247
commit
f2884a510a
23
bin/user
23
bin/user
|
@ -1,33 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
banned_names="/opt/admins/raw/banned_names.txt"
|
|
||||||
banned_keys="/opt/admins/raw/banned_sshkeys.txt"
|
|
||||||
|
|
||||||
run_user=$(id -u)
|
run_user=$(id -u)
|
||||||
if [ "$run_user" -eq 0 ]; then
|
if [ "$run_user" -eq 0 ]; then
|
||||||
n="$1"
|
n="$1"
|
||||||
k="$2"
|
k="$2"
|
||||||
if [ -n "$n" ]; then
|
if [ -n "$n" ]; then
|
||||||
# check for username in ban list
|
|
||||||
while IFS= read -r line
|
|
||||||
do
|
|
||||||
if [ "$n" = "$line" ]; then
|
|
||||||
printf "Username is banned.\\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done <"$banned_names"
|
|
||||||
|
|
||||||
# check for ssh key in ban list
|
|
||||||
if [ -n "${k}" ]; then
|
|
||||||
while IFS= read -r line
|
|
||||||
do
|
|
||||||
if [ "$k" = "$line" ]; then
|
|
||||||
printf "SSH key is banned.\\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done <"$banned_keys"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create user
|
# create user
|
||||||
user_exists=$(id -u "${n}" 2> /dev/null)
|
user_exists=$(id -u "${n}" 2> /dev/null)
|
||||||
if [ -z "${user_exists}" ]; then
|
if [ -z "${user_exists}" ]; then
|
||||||
|
|
Loading…
Reference in New Issue