Created
November 18, 2024 22:45
-
-
Save eminkel/41064a5d7062465a5d59cd4efff45afe to your computer and use it in GitHub Desktop.
Server provision security script
This file contains hidden or 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
#!/bin/bash | |
# Update and upgrade | |
apt-get update && apt-get upgrade -y | |
# Install common utilities | |
apt-get install -y curl wget git docker fail2ban net-tools | |
# Setup fail2ban | |
cp | |
# Setup firewall | |
ufw default deny incoming | |
ufw allow 22 | |
ufw allow 80 | |
ufw allow 443 | |
# Allow from internal ip range? | |
# ufw allow from 192.168.0.1/24 | |
ufw enable | |
# Create a default user | |
USER_NAME=deploy | |
adduser --disabled-password --gecos "" $USER_NAME | |
usermod -aG sudo docker deploy | |
# Setup SSH for new user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment