Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rizalkun authored Jan 14, 2018
1 parent b47e75c commit 01f9d51
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions deb7-stunnel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
# Stunnel installer for Debian, Ubuntu and CentOS
# original creator / modifikasi by rzengineer

if [[ "$USER" != 'root' ]]; then
echo "Maaf, Anda harus menjalankan ini sebagai root"
exit
fi

#memeriksa port yang sedang berjalan

echo "-------------------- Stunnel Installer untuk debian dan ubuntu -------------------"
echo ""
echo "Mohon tunggu sebentar.. sedang memeriksa port yang berjalan"
sleep 2
port=2133
if lsof -Pi :$port -sTCP:LISTEN -t >/dev/null ; then
echo "Telah terdeteksi port $port sedang berjalan/aktif"
sleep 2
break
clear
echo "mohon untuk menonaktifkan/mematikan/merubah port $port"
echo "jika sudah silakan mulai install dari awal"
else
echo ""
fi

#update repository
apt-get update
apt-get install stunnel4 -y
cat > /etc/stunnel/stunnel.conf <<-END
socket = a:SO_REUSEADDR=1
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
client = no
[dropbear]
accept = 2133
connect = 127.0.0.1:443
cert = /etc/stunnel/stunnel.pem
END

#membuat sertifikat
openssl genrsa -out key.pem 2048
openssl req -new -x509 -key key.pem -out cert.pem -days 1095
cat key.pem cert.pem >> /etc/stunnel/stunnel.pem

#konfigurasi stunnel
sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4
/etc/init.d/stunnel4 restart

#informasi
clear
echo "------------------------- Informasi ------------------------"
echo ""
echo "Installer ini secara default stunnel berjalan pada port 2133"
echo ""
echo "Source by Rzengineer"
echo "Github https://github.com/rzengineer"

0 comments on commit 01f9d51

Please sign in to comment.