mirror of
https://github.com/YunoHost-Apps/wireguard_ynh.git
synced 2024-09-03 20:35:58 +02:00
Automatically enable port forwarding
This commit is contained in:
parent
126babe73c
commit
7efb096628
8 changed files with 31 additions and 31 deletions
2
conf/sysctl.conf
Normal file
2
conf/sysctl.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
net.ipv4.ip_forward = 1
|
||||
net.ipv6.conf.all.forwarding = 1
|
|
@ -1,22 +1,8 @@
|
|||
* WireGuard for YunoHost will add a DMKS module to your Linux kernel.
|
||||
* You may need to reboot your server for WireGuard to be able to start.
|
||||
* The package includes WireGuard and non-official web UI to configure it.
|
||||
* Avoid altering the configuration files via the command line interface, though.
|
||||
* Do not manually alter the configuration files.
|
||||
* Use YunoHost permissions panel to allow users to access the web UI.
|
||||
* Only one network interface, *wg0*, can be managed with this app at the moment.
|
||||
|
||||
After installation, you need to `Apply Config` once in the UI before the VPN service can be started.
|
||||
|
||||
### Make your server share its Internet connection
|
||||
|
||||
#### Enable port forwarding
|
||||
|
||||
```bash
|
||||
sudo nano /etc/sysctl.conf
|
||||
# Uncomment the following lines:
|
||||
net.ipv4.ip_forward = 1
|
||||
net.ipv6.conf.all.forwarding = 1
|
||||
# Save and quit (CTRL+O, CTRL+X)
|
||||
sudo sysctl -p
|
||||
```
|
||||
|
||||
|
|
|
@ -1,22 +1,8 @@
|
|||
* Cette application ajoutera un module DMKS à votre noyau Linux.
|
||||
* Vous devriez redémarrer votre serveur pour que WireGuard puisse se lancer.
|
||||
* Cette application inclut WireGuard et une interface web non-officielle pour le configurer.
|
||||
* Évitez de modifier les fichiers de configuration via la ligne de commande.
|
||||
* Ne modifiez pas les fichiers de configuration à la main.
|
||||
* Utiliser le panneau de permissions de YunoHost pour autoriser des utilisateurs à accéder à WireGuard UI.
|
||||
* Une seule interface réseau, *wg0*, peut actuellement être gérée par cette app.
|
||||
|
||||
Après installation, vous devrez cliquer sur `Apply Config` une fois dans l'UI avant que le service VPN puisse être démarré.
|
||||
|
||||
### Partagez votre connexion Internet via WireGuard
|
||||
|
||||
#### Activez le *port forwarding*
|
||||
|
||||
```bash
|
||||
sudo nano /etc/sysctl.conf
|
||||
# Décommentez les lignes suivantes :
|
||||
net.ipv4.ip_forward = 1
|
||||
net.ipv6.conf.all.forwarding = 1
|
||||
# Sauvegardez et quittez (CTRL+O, CTRL+X)
|
||||
sudo sysctl -p
|
||||
```
|
||||
|
||||
|
|
|
@ -68,6 +68,9 @@ ynh_backup --src_path="/etc/wireguard"
|
|||
# Backing up specific config file, in case of it is not in /etc/wireguard
|
||||
ynh_backup --src_path="$(jq -r ".config_file_path" $final_path/db/server/global_settings.json)" --not_mandatory
|
||||
|
||||
# Backup the sysctl config file to enable port forwarding
|
||||
ynh_backup --src_path="/etc/sysctl.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -149,6 +149,14 @@ systemctl daemon-reload
|
|||
systemctl enable --quiet wireguard@wg0.service
|
||||
systemctl enable --quiet --now wireguard@wg0.path
|
||||
|
||||
#=================================================
|
||||
# ENABLE PORT FORWARDING
|
||||
#=================================================
|
||||
ynh_script_progression --message="Enabling port forwarding..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/sysctl.conf" --destination="/etc/sysctl.d/$app.conf"
|
||||
sysctl -p /etc/sysctl.d/$app.conf
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -111,6 +111,9 @@ fi
|
|||
# Remove sudoers file
|
||||
ynh_secure_remove --file="/etc/sudoers.d/${app}_ynh"
|
||||
|
||||
# Remove sysctl file for port forwarding
|
||||
ynh_secure_remove --file="/etc/sysctl.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -119,6 +119,14 @@ systemctl enable --quiet wireguard_ui.service
|
|||
systemctl enable --quiet wireguard@wg0.service
|
||||
systemctl enable --quiet --now wireguard@wg0.path
|
||||
|
||||
#=================================================
|
||||
# ENABLE PORT FORWARDING
|
||||
#=================================================
|
||||
ynh_script_progression --message="Enabling port forwarding..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/sysctl.d/$app.conf"
|
||||
sysctl -p /etc/sysctl.d/$app.conf
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
|
|
@ -186,8 +186,12 @@ systemctl enable --quiet wireguard@wg0.service
|
|||
systemctl enable --quiet --now wireguard@wg0.path
|
||||
|
||||
#=================================================
|
||||
# CONFIGURING WIREGUARD
|
||||
# ENABLE PORT FORWARDING
|
||||
#=================================================
|
||||
ynh_script_progression --message="Enabling port forwarding..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/sysctl.conf" --destination="/etc/sysctl.d/$app.conf"
|
||||
sysctl -p /etc/sysctl.d/$app.conf
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
Loading…
Add table
Reference in a new issue