2017-03-23 20:08:34 +03:00
|
|
|
## openvpn-install
|
2013-05-14 16:04:19 +04:00
|
|
|
|
2024-09-14 06:20:35 +03:00
|
|
|
OpenVPN Server installer for Ubuntu, Debian, AlmaLinux, Rocky Linux, CentOS, and Fedora.
|
|
|
|
|
|
|
|
This repo is originally a fork of https://github.com/Nyr/openvpn-install with some changes and added features.
|
|
|
|
|
|
|
|
### Instructions
|
2013-05-14 16:04:19 +04:00
|
|
|
|
2024-09-14 06:20:35 +03:00
|
|
|
Download and execute the script:
|
2013-05-14 16:04:19 +04:00
|
|
|
|
2024-09-14 06:20:35 +03:00
|
|
|
```
|
|
|
|
wget https://raw.githubusercontent.com/davift/openvpn-install/master/openvpn-install.sh
|
|
|
|
chmod +x openvpn-install.sh
|
|
|
|
./openvpn-install.sh
|
|
|
|
```
|
2013-05-14 16:04:19 +04:00
|
|
|
|
2014-12-11 01:31:04 +03:00
|
|
|
Once it ends, you can run it again to add more users, remove some of them or even completely uninstall OpenVPN.
|
2013-05-14 16:04:19 +04:00
|
|
|
|
2024-09-14 06:20:35 +03:00
|
|
|
### Automation
|
|
|
|
|
|
|
|
Download the CLI script:
|
|
|
|
|
|
|
|
```
|
|
|
|
wget https://raw.githubusercontent.com/davift/openvpn-install/master/openvpn-cli.sh
|
|
|
|
chmod +x openvpn-cli.sh
|
|
|
|
./openvpn-cli.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
The CLI script allows you to add and revoke users with a single command or for using with Ansible or Terraform.
|
|
|
|
|
|
|
|
```
|
|
|
|
See examples:
|
|
|
|
|
|
|
|
./openvpn-cli.sh add username add a new client
|
|
|
|
./openvpn-cli.sh revoke username revoke a client
|
|
|
|
./openvpn-cli.sh add username@domain.com add a new client and send the configuration via email
|
|
|
|
./openvpn-cli.sh revoke username@domain.com revoke client and send the configuration via email
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
### Optional
|
|
|
|
|
|
|
|
If the new client account is a valid email address, the configuration file is automatically sent, as long as MSMTP is installed and configured.
|
2013-05-14 16:04:19 +04:00
|
|
|
|
2024-09-14 06:20:35 +03:00
|
|
|
```
|
|
|
|
sudo apt install msmtp msmtp-mta -y
|
|
|
|
sudo nano /etc/msmtprc
|
|
|
|
```
|
2023-11-08 14:40:11 +03:00
|
|
|
|
2024-09-14 06:20:35 +03:00
|
|
|
MSMTP Configuration Example (for Gmail):
|
2024-09-09 15:23:16 +03:00
|
|
|
|
2024-09-14 06:20:35 +03:00
|
|
|
```
|
|
|
|
defaults
|
|
|
|
auth on
|
|
|
|
tls on
|
|
|
|
tls_trust_file /etc/ssl/certs/ca-certificates.crt
|
|
|
|
logfile ~/.msmtp.log
|
|
|
|
account gmail
|
|
|
|
host smtp.gmail.com
|
|
|
|
port 587
|
|
|
|
from username@gmail.com
|
|
|
|
user username@gmail.com
|
|
|
|
password password
|
|
|
|
account default : gmail
|
|
|
|
```
|