-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadme
More file actions
52 lines (43 loc) · 1.47 KB
/
Copy pathreadme
File metadata and controls
52 lines (43 loc) · 1.47 KB
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
To run the script:
wget -O manage-server.sh https://raw.githubusercontent.com/djurcola/UbuntuManagementScript/refs/heads/master/manage-server.sh
chmod +x manage-server.sh
sudo ./manage-server.sh
To extend the script:
#Create a new function:
# --- Action: Configure UFW Firewall ---
function configure_firewall() {
echo -e "\n${GREEN}--- Configuring UFW Firewall ---${NC}"
apt-get install -y ufw
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow http
ufw allow https
# Use 'y' to proceed without interactive confirmation
echo "y" | ufw enable
ufw status verbose
echo -e "${GREEN}--- UFW Firewall Configuration Complete ---${NC}"
}
# Add a new option to the main menu:
# Inside the main_menu function's echo block...
echo "4) Install Docker"
echo "5) Configure Firewall (UFW)" # <-- Add this line
echo "----------------------------------------"
# Add a new case in the case statement to call your new function:
# Inside the case statement in main_menu...
4)
install_docker
;;
5) # <-- Add this new block
configure_firewall
;;
q|Q)
#(Optional) Add it to run_all_actions if you want it to be part of the "Run All" sequence:
function run_all_actions() {
echo -e "\n${YELLOW}===== RUNNING ALL ACTIONS =====${NC}"
update_system
setup_unattended_upgrades
install_docker
configure_firewall # <-- Add this line
echo -e "\n${YELLOW}===== ALL ACTIONS COMPLETED =====${NC}"
}