Sie sind auf Seite 1von 6

#!

/bin/bash
clear
lightgreen='\e[1;32m'
again='\e[1;32m'
red='\e[1;31m'
yellow='\e[1;33m'
white='\e[1;37m'
again='y'
while [ $again == 'y' ] || [ $again == 'Y' ];
do
echo -e $red "
_
_
___
_
"
echo -e $red " _ __ | |__ __ _ _ __ | |_ / _ \ _ __ ___
| |_ ___ __ _ _
__ ___ "
echo -e $red "| _ \| _ \ / _ | _ \| __| | | | _ _ \ _____| __/ _ \/ _ |
_ _ \ "
echo -e $white "| |_) | | | | (_| | | | | |_| |_| | | | | | |_____| || __/ (_|
| | | | | |"
echo -e $white "| .__/|_| |_|\__,_|_| |_|\__|\___/|_| |_| |_|
\__\___|\__,_
|_| |_| |_|"
echo -e $white "|_|"
echo ''
echo -e $yellow'Pilihan :'
echo -e $red"
1) Tambah user system"
echo
"
2) Atur user setingkat root"
echo
"
3) Ganti password root"
echo
"
4) Nonaktif akun user tidak dipakai"
echo
"
5) Atur permission file system"
echo
"
6) Hardening SSH"
echo
"
7) Hardening web server apache"
echo
"
8) Hardening PHP.ini"
echo
"
9) Reset password root mysql"
echo
"
10) Mysql secure installation"
echo
"
11) Hardening kernel"
echo
"
12) Otomatis Tendang Serangan DOS"
echo
"
13) Otomatis Tendang Port Scanner"
echo
"
14) Cari PHP Backdoors"
echo
"
15) Install Linux Malware Detect"
echo
"
16) Scanning dengan Linux Malware Detect"
echo
"
17) Install DDOS Protection"
echo
"
18) Aktifkan DDOS Protection"
echo
"
19) Uninstall DDOS Protection"
echo
"
20) Atur Firewall Iptables"
echo
"
21) Cek Firewall Iptables"
echo
"
22) Crontab"
echo
"
X ) Keluar"
echo -n -e $yellow'\033[4mPilih >\033[0m'; tput sgr0
read choose
if test $choose == '1'
then
echo "Tambah user"
read -p 'Nama user ssh : ' user
adduser $user
elif test $choose == '2'
then
echo "Atur user setingkat root"
read -p 'Username :' userroot
echo "$userroot ALL=(ALL:ALL) ALL" >> /etc/sudoers
echo "User $userroot telah setingkat root"

elif test $choose == '3'


then
echo "Ganti password root"
passwd
echo "Password root sukses terganti"
elif test $choose == '4'
then
echo "Disable akun dan grup yang tidak dipakai"
sed -i 's/^lp/#lp/' /etc/passwd
sed -i 's/^games/#games/' /etc/passwd
sed -i 's/^sync/#sync/' /etc/passwd
sed -i 's/^shutdown/#shutdown/' /etc/passwd
sed -i 's/^halt/#halt/' /etc/passwd
sed -i 's/^mail/#mail/' /etc/passwd
sed -i 's/^news/#news/' /etc/passwd
sed -i 's/^uucp/#uucp/' /etc/passwd
sed -i 's/^operator/#operator/' /etc/passwd
sed -i 's/^gopher/#gopher/' /etc/passwd
sed -i 's/^ftp/#ftp/' /etc/passwd
sed -i 's/^lp/#lp/' /etc/group
sed -i 's/^games/#games/' /etc/group
sed -i 's/^uucp/#uucp/' /etc/group
echo "Akun dan grup berhasil diupdate"
sleep 2
echo " "
elif test $choose == '5'
then
echo "Atur permission file system"
echo "chmod 400 /etc/hosts.allow"
chmod 400 /etc/hosts.allow
echo "chmod 400 /etc/hosts.deny"
chmod 400 /etc/hosts.deny
echo "chmod 400 /etc/shadow"
chmod 400 /etc/shadow
echo "chmod 400 /etc/passwd"
chmod 400 /etc/passwd
echo "chmod 400 /etc/crontab"
chmod 400 /etc/crontab
echo "chmod 400 /etc/cron.deny"
chmod 400 /etc/cron.deny
echo "chmod 400 /etc/at.deny"
chmod 400 /etc/at.deny
echo "chmod 400 /etc/cron.allow"
chmod 400 /etc/cron.allow
echo "chmod 400 /etc/at.allow"
chmod 400 /etc/at.allow
echo "chmod 644 /var/log/wtmp"
chmod 644 /var/log/wtmp
echo "chmod 644 /etc/group"
chmod 644 /etc/group
echo "chmod 700 /var/spool/cron"
chmod 700 /var/spool/cron
echo "chmod 700 /etc/cron.d"
chmod 700 /etc/cron.d
echo "chmod 700 /etc/cron.hourly"
chmod 700 /etc/cron.hourly
echo "chmod 700 /etc/cron.monthly"
chmod 700 /etc/cron.monthly
echo "chmod 700 /etc/cron.dialy"

chmod 700 /etc/cron.dialy


echo "chmod 700 /etc/cron.weekly"
chmod 700 /etc/cron.weekly
echo "Atur permisson selesai"
elif test $choose == '6'
then
echo "Hardening SSH"
echo "Nonaktif remote dengan user root"
sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
echo "Atur user yang boleh akses SSH"
read -p "User : " allowuser
echo "AllowUsers $allowuser" >> /etc/ssh/sshd_config
echo "Atur authentication public key"
echo "Masukan user yang boleh akses dengan key : "
read -p "User : " allowkey
mkdir /home/$allowkey/.ssh
chown -R $allowkey /home/$allowkey/.ssh
chmod 755 /home/$allowkey/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDK9oTW392v1id1rBkRTpivh2GnDG
bjpx4+2I8hZmTjkdMFRfW+ss5VOgXUgfrAqfKZTzJZpJKCB1+x/BCTDjVLpnc95kv86hLFHYGsVyBKN3
Qh3kXJfE4s80nIIXf/yVYT+ObSzF9tttx2Cqn//juLelv4x8oWLFdojTrfFV6XuiylqcH44nw9dsqAT2
WEzBwk1DjRhI0wTnViaT1QFrouGmQ18r5tigyRZu9xQVN28ipw6gGEPoVsguIcGRGJT6ULqgCzVlB1Xf
U9GgxTyFurrhLsnJgwWgOJMQ8Is0FcR3jyPrkFlQGsTHXDfO8gIbwc0i64ylv+uPHwpaHwSQMd paijo
@MasIcal" > /home/$allowkey/.ssh/authorized_keys
chmod 600 /home/$allowkey/.ssh/authorized_keys
sed -i 's/RSAAuthentication yes/RSAAuthentication yes/' /etc/ssh/sshd_co
nfig
sed -i 's/PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/s
shd_config
sed -i 's/AuthorizedKeysFile /home/user/.ssh/authorized_keys/AuthorizedK
eysFile /home/$allowkey/.ssh/authorized_keys/' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ss
h/sshd_config
sed -i 's/#GSSAPIAuthentication no/GSSAPIAuthentication no/' /etc/ssh/ss
hd_config
sed -i 's/GSSAPIAuthentication yes/#GSSAPIAuthentication yes/' /etc/ssh/
sshd_config
service ssh restart
echo "Hardening SSH selesai"
elif test $choose == '7'
then
echo "Hardening web server"
echo "Mematikan Server Signature"
sed -i 's/ServerSignature On/ServerSignature Off/' /etc/apache2/conf.d/s
ecurity
echo "Mematikan Server Token"
sed -i 's/ServerTokens OS/ServerTokens Prod/' /etc/apache2/conf.d/securi
ty
echo "Mematikan Trace enable"
sed -i 's/TraceEnable On/TraceEnable Off/' /etc/apache2/conf.d/security
echo "Aktifkan X-XSS-Protection"
sed -i 's/#Header set X-XSS-Protection: "1; mode=block"/Header set X-XSS
-Protection: "1; mode=block"/' /etc/apache2/conf.d/security
echo "Aktifkan X-Frame-Options"
sed -i 's/#Header set X-Frame-Options: "sameorigin"/Header always append
X-Frame-Options SAMEORIGIN/' /etc/apache2/conf.d/security
echo "Aktifkan X-content-Type-Options"
sed -i 's/#Header set X-Content-Type-Options: "nosniff"/Header set X-Con
tent-Type-Options: "nosniff"/' /etc/apache2/conf.d/security

echo "Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure" >> /etc/apache2/


conf.d/security
echo "Restart apache2"
service apache2 restart
elif test $choose == '8'
then
echo "Hardening PHP"
echo "Disable function beberapa function berbahaya"
sed -i 's/disable_functions =/disable_functions = show_source,symlink,sy
stem,shell_exec,eval,exec,proc_get_status,proc_nice,proc_terminate,define_syslog
_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinumcols,ini_alter,
leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl
,dll,ftp,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,popen,fpass
thru,php_uname,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,p
cntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsi
g,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_s
igprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcn
tl_setpriority,str_rot13,phpuuname,php_uname,gzinflate,eval/' /etc/php5/apache2/
php.ini
sed -i 's/safe_mode = Off/safe_mode = On' /etc/php5/apache2/php.ini
sed -i 's/safe_mode_gid = Off/safe_mode_gid = On' /etc/php5/apache2/php.
ini
sed -i 's/expose_php = On/expose_php = Off' /etc/php5/apache2/php.ini
sed -i 's/magic_quotes_gpc = On/magic_quotes_gpc = Off' /etc/php5/apache
2/php.ini
sed -i 's/log_errors = Off/log_errors = On' /etc/php5/apache2/php.ini
sed -i 's/allow_url_fopen = On/allow_url_fopen = Off' /etc/php5/apache2/
php.ini
sed -i 's/allow_url_include = On/allow_url_include = Off' /etc/php5/apac
he2/php.ini
sed -i 's/;upload_tmp_dir =/upload_tmp_dir =/var/php_tmp' /etc/php5/apac
he2/php.ini
sed -i 's/upload_max_filesize = 100M/upload_max_filesize = 2M' /etc/php5
/apache2/php.ini
sed -i 's/;session.save_path = "/var/lib/php5"/session.save_path = "/var
/lib/php5"' /etc/php5/apache2/php.ini
sed -i 's/;session.save_path = "/var/lib/php5"/session.save_path = "/var
/lib/php5"' /etc/php5/apache2/php.ini
elif test $choose == '9'
then
echo "Matikan service mysql"
service mysql stop
sleep 3
echo "selesai..."
echo "==============================================================="
echo "Mulai proses reset..."
echo "==============================================================="
sleep 3
echo "Tekan Enter !"
echo "==============================================================="
echo "Jika reset gunakan perintah dibawah !"
echo "use mysql;"
echo "UPDATE user SET password=PASSWORD("passmu") WHERE user='root';"
echo "==============================================================="
mysqld_safe --skip-grant-tables &
mysql -u root -p
elif test $choose == '10'
then

mysql_secure_installation
elif test $choose == '11'
then
echo "Linux kernel hardening"
echo "net.ipv4.tcp_max_syn_backlog = 4096" >> /etc/sysctl.conf
echo "net.ipv4.tcp_syncookies = 1" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter = 1" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.accept_source_route = 0"
>> /etc/sysctl.conf
echo "net.ipv4.conf.all.secure_redirects = 0" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.accept_redirects = 0" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.rp_filter = 1" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.accept_source_route = 0"
>> /etc/sysctl.conf
echo "net.ipv4.conf.default.secure_redirects = 0" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.accept_redirects = 0" >> /etc/sysctl.conf
echo "net.ipv4.icmp_echo_ignore_broadcast = 1" >> /etc/sysctl.conf
echo "net.ipv4.ip_forward = 0" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.send_redirects = 0" >> /etc/sysctl.conf
echo "net.ipv4.conf.all.send_redirects = 0"
>> /etc/sysctl.conf
echo "net.ipv4.icmp_ignore_bogus_error_responses = 1" >> /etc/sysctl.conf
sleep 2
echo ""
elif test $choose == '12'
then
../lib/./blocking.sh &
ps ax | grep blocking.sh
elif test $choose == '13'
then
../lib/./antiscan.pl &
ps ax | grep antiscan
elif test $choose == '14'
then
echo -n "Masukan web dir: "
read web
PATTERNS="shell_exec|system|base64_decode|exec|gzinflate|eval"
grep -RPl --include=*.{php,txt} "($PATTERNS)" $web
elif test $choose == '15'
then
cd ../lib/maldet/ && ./install.sh && cp -rf sigs /usr/local/maldetect/ &
& cd ../../submenu
elif test $choose == '16'
then
echo -n -e $lightgreen" Masukan dir yang ingin discanning. Contoh /var/w
ww/ : ";
read maldet
maldet -a $maldet
elif test $choose == '17'
then
cd ../lib/ddos/debian/ && ./install.sh && cd ../../../submenu
elif test $choose == '18'
then
/usr/local/ddos/./ddos.sh -c

elif test $choose == '19'


then
cd ../lib/ddos/debian/ && ./uninstall.ddos && cd ../../../submenu
elif test $choose == '20'
then
sh ../lib/fw_debian.sh
elif test $choose == '21'
then
iptables -L -n -v -x
elif test $choose ==
then
crontab -e
elif test $choose ==
then
clear
exit
elif test $choose ==
then
clear
exit
fi
echo
echo -e -n "Kembali?
read again;

'21'
'X'

'x'

(y/n) :";

while [ $again != 'y' ] && [ $again != 'Y' ] && [ $again != 'n' ] && [ $aga
in != 'N' ];
do
echo -n "Kembali (y/n) :";
read again;
done
done

Das könnte Ihnen auch gefallen