Script instalasi otomatis untuk OpenFortiVPN - Universal Linux Installer.
- β Auto-install OpenFortiVPN dan dependencies
- β Konfigurasi otomatis dengan template yang sudah disesuaikan
- β DTLS Support untuk performa optimal (fallback ke TLS jika diperlukan)
- β
Helper script (
vpn) untuk manajemen VPN yang mudah - β Systemd service untuk auto-start saat boot
- β Monitoring tools built-in untuk troubleshooting
- β Firewall configuration otomatis
- Linux (Ubuntu, Debian, Fedora, RHEL, CentOS, Rocky, AlmaLinux, Arch, Manjaro, openSUSE, Alpine, Gentoo)
- Akses internet untuk download packages
- User dengan sudo privileges
Package berikut akan diinstall otomatis:
openfortivpnpppresolvconf(untuk Debian/Ubuntu)
cd /home/rezkycodes/Development/ScriptShell/openfortivpn-installerJika OpenFortiVPN belum terinstall, jalankan script installer multi-distro:
bash install-package.shScript ini akan:
- β Detect distro Linux Anda otomatis
- β Install OpenFortiVPN sesuai package manager (apt/dnf/pacman/zypper/apk)
- β Install semua dependencies yang diperlukan
Distro yang Didukung:
- Ubuntu / Debian / Linux Mint / Pop!_OS (apt)
- Fedora / RHEL / CentOS / Rocky / AlmaLinux (dnf/yum)
- Arch Linux / Manjaro / EndeavourOS (pacman)
- openSUSE / SLES (zypper)
- Alpine Linux (apk)
- Gentoo (portage)
Copy file example dan edit dengan kredensial Anda:
cp .env.openfortivpn.example .env.openfortivpn
nano .env.openfortivpnEdit file .env.openfortivpn dengan kredensial VPN Anda:
# Gateway Settings
VPN_HOST="vpn.example.com"
VPN_PORT="10443"
# Authentication (GANTI DENGAN KREDENSIAL ANDA)
VPN_USER="username.anda"
VPN_PASS="password.anda"
# Certificate Validation (GANTI DENGAN CERT HASH ANDA)
VPN_CERT="your_certificate_hash_here"
# Profile Name
PROFILE_NAME="myvpn"Caution
File .env.openfortivpn berisi kredensial sensitif! Jangan share atau commit ke repository.
bash install-openfortivpn.shScript akan:
- β Install OpenFortiVPN
- β
Setup konfigurasi di
/etc/openfortivpn/myvpn.conf(sesuai PROFILE_NAME) - β
Membuat helper script di
/usr/local/bin/vpn - β Setup systemd service
- β Konfigurasi firewall
- β Test koneksi (opsional)
| File | Lokasi | Deskripsi |
|------|--------|-----------||
| Package Installer | install-package.sh | Install OpenFortiVPN multi-distro |
| Main Installer | install-openfortivpn.sh | Configurator dan setup VPN |
| Environment | .env.openfortivpn | Kredensial dan konfigurasi VPN |
| OpenFortiVPN Config | /etc/openfortivpn/myvpn.conf | File konfigurasi utama (sesuai profile) |
| Helper Script | /usr/local/bin/vpn | Command untuk kontrol VPN |
| Systemd Service | /etc/systemd/system/openfortivpn@.service | Service template |
| Log File | /var/log/openfortivpn.log | File log koneksi |
VPN_HOST # Hostname VPN gateway
VPN_PORT # Port VPN (default: 10443)
VPN_USER # Username VPN Anda
VPN_PASS # Password VPN Anda
VPN_CERT # SHA256 hash dari server certificate
PROFILE_NAME # Nama profil (default: myvpn)Setelah instalasi, gunakan command vpn untuk kontrol VPN:
vpn start
# atau
vpn connectOutput:
π Connecting to VPN...
β
VPN Connected!
Interface Info:
IP: 10.x.x.x/32
Connection Type:
β
DTLS (UDP) - High Performance Mode
vpn stop
# atau
vpn disconnectvpn statusOutput detail termasuk:
- Status koneksi (Connected/Disconnected)
- Protocol type (DTLS/TLS)
- IP Address
- Active routes
- Gateway latency
vpn restartvpn logs
# atau
vpn logTekan Ctrl+C untuk keluar.
vpn testTest akan melakukan:
- Protocol check (DTLS/TLS)
- Latency test ke gateway
- DNS resolution test
vpnsudo systemctl enable openfortivpn@myvpn
sudo systemctl start openfortivpn@myvpnsudo systemctl disable openfortivpn@myvpn
sudo systemctl stop openfortivpn@myvpn# Check status
sudo systemctl status openfortivpn@myvpn
# Live logs
sudo journalctl -u openfortivpn@myvpn -f-
Cek kredensial di
.env.openfortivpncat .env.openfortivpn
-
Cek logs untuk error
vpn logs # atau sudo tail -f /var/log/openfortivpn.log -
Test koneksi ke server
ping vpn.example.com telnet vpn.example.com 10443
-
Cek firewall
sudo firewall-cmd --list-ports
Pastikan port
10443/tcpdan10443/udpterbuka.
Jika muncul error certificate:
# Connect sekali untuk mendapatkan certificate hash
sudo openfortivpn vpn.example.com:10443 -u username
# Copy hash yang muncul ke .env.openfortivpn
VPN_CERT="hash_yang_didapat"# Cek process yang menggunakan port
sudo ss -tulpn | grep 10443
# Kill process jika diperlukan
sudo pkill openfortivpnJika DNS tidak resolve setelah connect:
# Cek resolv.conf
cat /etc/resolv.conf
# Manual restart DNS
sudo systemctl restart NetworkManagerJika VPN hang atau tidak bisa disconnect normal:
# Kill semua process openfortivpn
sudo pkill -9 openfortivpn
# Hapus PID file
sudo rm -f /var/run/openfortivpn.pid
# Hapus interface ppp0
sudo ip link delete ppp0 2>/dev/null| Protocol | Transport | Performance | Use Case |
|---|---|---|---|
| DTLS | UDP | β‘ High | Default, best performance |
| TLS | TCP | π’ Lower | Fallback jika DTLS gagal |
Script akan otomatis menggunakan DTLS untuk performa terbaik. Jika DTLS tidak tersedia atau gagal, akan fallback ke TLS.
| Port | Protocol | Purpose |
|---|---|---|
| 10443 | TCP | TLS connection (fallback) |
| 10443 | UDP | DTLS connection (primary) |
A: Datagram Transport Layer Security (DTLS) adalah protokol yang mirip TLS tapi menggunakan UDP. Lebih cepat dan efisien untuk VPN.
A: Ya! Cukup edit file .env.openfortivpn dengan kredensial user masing-masing.
A: Edit file .env.openfortivpn dan update nilai VPN_PASS, lalu jalankan ulang installer:
bash install-openfortivpn.shA: File .env.openfortivpn sudah masuk dalam .gitignore dan memiliki permission 600 (hanya owner yang bisa baca). Namun tetap jaga kerahasiaan file ini.
A:
# Stop service
sudo systemctl stop openfortivpn@myvpn
sudo systemctl disable openfortivpn@myvpn
# Hapus files
sudo rm -f /etc/openfortivpn/myvpn.conf
sudo rm -f /usr/local/bin/vpn
sudo rm -f /etc/systemd/system/openfortivpn@.service
# Uninstall package (opsional)
sudo dnf remove openfortivpnA: Gunakan systemd service untuk auto-reconnect:
sudo systemctl enable openfortivpn@myvpn
sudo systemctl start openfortivpn@myvpnService akan otomatis reconnect jika koneksi terputus.
Important
- Jangan share file
.env.openfortivpnke orang lain - Ganti password secara berkala untuk keamanan
- Backup file konfigurasi Anda
Warning
- Script harus dijalankan sebagai user biasa (bukan root)
- Pastikan user memiliki sudo privileges
- Koneksi internet diperlukan saat instalasi
Untuk bantuan lebih lanjut:
- Email: rezyk.codes@gmail.com
- Developer: RezkyCodes
- Issues: Laporkan bug atau request fitur
Script ini dibuat untuk penggunaan umum.
Happy VPN-ing! π