diff --git a/scripts/sshd-login.sh b/scripts/sshd-login.sh index dcd914a..a4b9d3f 100644 --- a/scripts/sshd-login.sh +++ b/scripts/sshd-login.sh @@ -1,24 +1,33 @@ -#!bin/bash +#!/bin/bash -source /usr/local/bin/notifications.sh +source /usr/local/bin/libs/common.sh +source /etc/serverconfig/.env -# initialize_config() { -# local isInstalling="$1" -# local target_file="$2" -# local crontab_configuration="$3" -# local link_path="$4" +INSTALLED=$1 +if [[ "--install" == $INSTALLED ]]; then + info_print "\n\ +==================================================\n\ + sshd-login Installation\n\ +--------------------------------------------------" -# if [[ $isInstalling != "--install" ]]; then -# return; -# fi + login='session optional pam_exec.so /usr/local/bin/scripts/sshd-login.sh' + file='/etc/pam.d/common-session' -# echo "$crontab_configuration $0" | crontab - -# } + if [[ ! -f "$file" ]]; then + info_print "$file doesn't found." 3 + exit 1 + fi -# install_para="$1" -# if [[ $install_para == "--install" ]]; then + if ! grep -Fxq "$login" "$file"; then + echo "$login" >> "$file" + info_print "login command added to $file." 6 + else + info_print "login command already added to $file." 2 + fi + exit 0; +fi -# fi +source /usr/local/bin/libs/notifications.sh case "$PAM_TYPE" in open_session) diff --git a/scripts/wireguard.sh b/scripts/wireguard.sh new file mode 100644 index 0000000..53b31ad --- /dev/null +++ b/scripts/wireguard.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +INSTALLED=$1 +if [[ "--install" == $INSTALLED ]]; then exit 0; fi \ No newline at end of file