-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDRMM-LINSCR-SSHService.sh
More file actions
39 lines (33 loc) · 925 Bytes
/
DRMM-LINSCR-SSHService.sh
File metadata and controls
39 lines (33 loc) · 925 Bytes
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
#!/bin/bash
echo "Job selections:"
echo "- SSH Service Status: $sshEnable"
echo "- SSH Service Action: $sshStart"
echo "- SSH Firewall Rule: $sshFirewall"
echo ""
if [ $sshEnable = "enable" ]; then
echo "# Enabling SSH service"
systemctl enable ssh
elif [ $sshEnable = "disable" ]; then
echo "# Disabling SSH Service"
systemctl disable ssh
fi
if [ $sshStart = "start" ]; then
echo "# Starting SSH Service"
systemctl start ssh
elif [ $sshStart = "stop" ]; then
echo "# Stopping SSH Service"
systemctl stop ssh
fi
if [ $sshFirewall = "add" ]; then
echo "# Adding SSH allow rule to UFW"
ufw allow "OpenSSH"
elif [ $sshFirewall = "remove" ]; then
echo "# Removing SSH allow rule from UFW"
ufw delete allow "OpenSSH"
fi
echo "----------------------"
echo "Current status of SSH service"
systemctl status ssh
echo "----------------------"
echo "Current UFW status"
ufw status