Created
July 11, 2021 17:03
-
-
Save ayrilmaz/c067331a5e7919314b63127f2e870d63 to your computer and use it in GitHub Desktop.
Add/Remove uff rules ssh login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ -n $SSH_CONNECTION ]] ; then | |
echo "Merhaba Emre. Ip adresin:" | |
echo "${SSH_CLIENT%% *}" | |
echo "eski kurallar siliniyor" | |
for i in $(ufw status numbered | grep 27017 | awk -F"[][]" '{print $2}' | tr --delete [:blank:] | sort -rn); do | |
yes | ufw delete $i | |
echo "27017 silindi" | |
done | |
for i in $(ufw status numbered | grep 5432 | awk -F"[][]" '{print $2}' | tr --delete [:blank:] | sort -rn); do | |
yes | ufw delete $i | |
echo "5432 silindi" | |
done | |
ufw allow from ${SSH_CLIENT%% *} to any port 27017 | |
echo "27017 eklendi" | |
ufw allow from ${SSH_CLIENT%% *} to any port 5432 | |
echo "5432 eklendi" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment