Skip to content

rezkycodes/openfortivpn-easy-instalation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” OpenFortiVPN Auto Installer

Script instalasi otomatis untuk OpenFortiVPN - Universal Linux Installer.

πŸ“‹ Daftar Isi

✨ Fitur

  • βœ… 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

πŸ”§ Prasyarat

Sistem Operasi

  • Linux (Ubuntu, Debian, Fedora, RHEL, CentOS, Rocky, AlmaLinux, Arch, Manjaro, openSUSE, Alpine, Gentoo)
  • Akses internet untuk download packages
  • User dengan sudo privileges

Package Requirements

Package berikut akan diinstall otomatis:

  • openfortivpn
  • ppp
  • resolvconf (untuk Debian/Ubuntu)

πŸ“¦ Instalasi

1. Download Project

cd /home/rezkycodes/Development/ScriptShell/openfortivpn-installer

2. Install OpenFortiVPN (Opsional)

Jika OpenFortiVPN belum terinstall, jalankan script installer multi-distro:

bash install-package.sh

Script 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)

3. Setup Konfigurasi

Copy file example dan edit dengan kredensial Anda:

cp .env.openfortivpn.example .env.openfortivpn
nano .env.openfortivpn

Edit 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.

4. Jalankan Installer

bash install-openfortivpn.sh

Script akan:

  1. βœ… Install OpenFortiVPN
  2. βœ… Setup konfigurasi di /etc/openfortivpn/myvpn.conf (sesuai PROFILE_NAME)
  3. βœ… Membuat helper script di /usr/local/bin/vpn
  4. βœ… Setup systemd service
  5. βœ… Konfigurasi firewall
  6. βœ… Test koneksi (opsional)

βš™οΈ Konfigurasi

File Konfigurasi

| 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 |

Environment Variables

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)

πŸš€ Penggunaan

Setelah instalasi, gunakan command vpn untuk kontrol VPN:

Connect ke VPN

vpn start
# atau
vpn connect

Output:

πŸ” Connecting to VPN...
βœ… VPN Connected!

Interface Info:
  IP: 10.x.x.x/32

Connection Type:
  βœ… DTLS (UDP) - High Performance Mode

Disconnect dari VPN

vpn stop
# atau
vpn disconnect

Cek Status VPN

vpn status

Output detail termasuk:

  • Status koneksi (Connected/Disconnected)
  • Protocol type (DTLS/TLS)
  • IP Address
  • Active routes
  • Gateway latency

Restart VPN

vpn restart

Lihat Logs Real-time

vpn logs
# atau
vpn log

Tekan Ctrl+C untuk keluar.

Test Koneksi

vpn test

Test akan melakukan:

  1. Protocol check (DTLS/TLS)
  2. Latency test ke gateway
  3. DNS resolution test

Bantuan

vpn

πŸ”„ Auto-Start saat Boot (Opsional)

Enable Auto-start

sudo systemctl enable openfortivpn@myvpn
sudo systemctl start openfortivpn@myvpn

Disable Auto-start

sudo systemctl disable openfortivpn@myvpn
sudo systemctl stop openfortivpn@myvpn

Monitor Service

# Check status
sudo systemctl status openfortivpn@myvpn

# Live logs
sudo journalctl -u openfortivpn@myvpn -f

πŸ› Troubleshooting

VPN Tidak Bisa Connect

  1. Cek kredensial di .env.openfortivpn

    cat .env.openfortivpn
  2. Cek logs untuk error

    vpn logs
    # atau
    sudo tail -f /var/log/openfortivpn.log
  3. Test koneksi ke server

    ping vpn.example.com
    telnet vpn.example.com 10443
  4. Cek firewall

    sudo firewall-cmd --list-ports

    Pastikan port 10443/tcp dan 10443/udp terbuka.

Certificate Error

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"

Port Sudah Digunakan

# Cek process yang menggunakan port
sudo ss -tulpn | grep 10443

# Kill process jika diperlukan
sudo pkill openfortivpn

DNS Tidak Bekerja

Jika DNS tidak resolve setelah connect:

# Cek resolv.conf
cat /etc/resolv.conf

# Manual restart DNS
sudo systemctl restart NetworkManager

Force Disconnect

Jika 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

πŸ“Š Connection Info

DTLS vs TLS

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.

Ports

Port Protocol Purpose
10443 TCP TLS connection (fallback)
10443 UDP DTLS connection (primary)

❓ FAQ

Q: Apa itu DTLS?

A: Datagram Transport Layer Security (DTLS) adalah protokol yang mirip TLS tapi menggunakan UDP. Lebih cepat dan efisien untuk VPN.

Q: Apakah bisa digunakan untuk user lain?

A: Ya! Cukup edit file .env.openfortivpn dengan kredensial user masing-masing.

Q: Bagaimana cara mengganti password?

A: Edit file .env.openfortivpn dan update nilai VPN_PASS, lalu jalankan ulang installer:

bash install-openfortivpn.sh

Q: Apakah kredensial aman?

A: File .env.openfortivpn sudah masuk dalam .gitignore dan memiliki permission 600 (hanya owner yang bisa baca). Namun tetap jaga kerahasiaan file ini.

Q: Bagaimana cara uninstall?

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 openfortivpn

Q: VPN sering disconnect?

A: Gunakan systemd service untuk auto-reconnect:

sudo systemctl enable openfortivpn@myvpn
sudo systemctl start openfortivpn@myvpn

Service akan otomatis reconnect jika koneksi terputus.

πŸ“ Catatan Penting

Important

  • Jangan share file .env.openfortivpn ke 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

πŸ“ž Support

Untuk bantuan lebih lanjut:

πŸ“„ License

Script ini dibuat untuk penggunaan umum.


Happy VPN-ing! πŸŽ‰

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages