-
Notifications
You must be signed in to change notification settings - Fork 29
/
webmin.sh
55 lines (51 loc) · 1.88 KB
/
webmin.sh
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
53
54
55
#!/bin/bash
# Installs Wordpress for a new domain
# Author Istiyak Amin Santo
# Installs Webmin for fun and profit
# Set up a repo and install
function install_webmin() {
if [[ $distro == "Redhat/CentOS" ]]; then
cat > /etc/yum.repos.d/webmin.repo <<-EOF
[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1
EOF
curl -s http://www.webmin.com/jcameron-key.asc -o "/tmp/jcameron-key.asc"
rpm --import /tmp/jcameron-key.asc > /dev/null 2>&1
rm -f /tmp/jcameron-key.asc
yum -y -q install webmin perl-Net-SSLeay
iptables -I INPUT -m tcp -p tcp --dport 10000 -j ACCEPT
service iptables save > /dev/null 2>&1
elif [[ $distro == "Ubuntu" ]]; then
echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list
echo "deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib" >> /etc/apt/sources.list
wget -q http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc > /dev/null 2>&1
rm -f jcameron-key.asc
apt-get -q update > /dev/null 2>&1
apt-get -q -y install webmin > /dev/null 2>&1
ufw allow 10000 > /dev/null 2>&1
else
echo "Unsupported OS"
exit 1
fi
}
function configure_firewall() {
if [[ ${distro} = "Redhat/CentOS" ]]; then
iptables -I INPUT -p tcp --dport 10000 -m comment --comment "Webmin" -j ACCEPT
/etc/init.d/iptables save
echo "Firewall open on ports 10000"
elif [ ${distro} == "Ubuntu" ]; then
ufw allow 10000
echo "Firewall open on ports 10000"
else
echo "Unsupported OS. Exiting."
exit 1
fi
}
echo "Beginning Installation"
install_webmin
configure_firewall
echo "Webmin installation complete. Port 10000 is open."