auto-hebergement
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| auto-hebergement [2023/12/13 11:00] – admin_elemac | auto-hebergement [2023/12/13 11:25] (Version actuelle) – admin_elemac | ||
|---|---|---|---|
| Ligne 89: | Ligne 89: | ||
| https:// | https:// | ||
| + | ==== Config WG sur VPS ==== | ||
| + | installer debian 11 | ||
| - | Config client sur Yunohost | + | installer WG |
| + | |||
| + | fichier / | ||
| + | < | ||
| + | [Interface] | ||
| + | Address = 10.66.66.1/ | ||
| + | ListenPort = 51820 | ||
| + | PrivateKey = ****** | ||
| + | PostUp = bash / | ||
| + | PostDown = bash / | ||
| + | #PostUp = iptables -I INPUT -p udp --dport 51820 -j ACCEPT | ||
| + | #PostUp = iptables -I FORWARD -i ens6 -o wg0 -j ACCEPT | ||
| + | #PostUp = iptables -I FORWARD -i wg0 -j ACCEPT | ||
| + | #PostUp = iptables -t nat -A POSTROUTING -o ens6 -j MASQUERADE | ||
| + | #PostUp = ip6tables -I FORWARD -i wg0 -j ACCEPT | ||
| + | #PostUp = ip6tables -t nat -A POSTROUTING -o ens6 -j MASQUERADE | ||
| + | #PostDown = iptables -D INPUT -p udp --dport 51820 -j ACCEPT | ||
| + | #PostDown = iptables -D FORWARD -i ens6 -o wg0 -j ACCEPT | ||
| + | #PostDown = iptables -D FORWARD -i wg0 -j ACCEPT | ||
| + | #PostDown = iptables -t nat -D POSTROUTING -o ens6 -j MASQUERADE | ||
| + | #PostDown = ip6tables -D FORWARD -i wg0 -j ACCEPT | ||
| + | #PostDown = ip6tables -t nat -D POSTROUTING -o ens6 -j MASQUERADE | ||
| + | |||
| + | |||
| + | ### Client yunohost | ||
| + | [Peer] | ||
| + | PublicKey = ****** | ||
| + | PresharedKey = ****** | ||
| + | AllowedIPs = 10.66.66.2/ | ||
| + | </ | ||
| + | |||
| + | Fichier PostUp.sh | ||
| + | < | ||
| + | iptables -A FORWARD -i wg0 -j ACCEPT; | ||
| + | iptables -t nat -A POSTROUTING -o ens6 -j MASQUERADE; | ||
| + | #ip6tables -A FORWARD -i wg0 -j ACCEPT; | ||
| + | #ip6tables -t nat -A POSTROUTING -o ens6 -j MASQUERADE; | ||
| + | |||
| + | # icmp | ||
| + | iptables -A INPUT -p icmp -j ACCEPT; | ||
| + | #ip6tables -A INPUT -p ipv6-icmp -j ACCEPT; | ||
| + | |||
| + | # Routing TCP port 25 and 587 from Yunohost Server to internet | ||
| + | for j in 25 587 | ||
| + | do | ||
| + | iptables -t nat -A POSTROUTING -s 10.66.66.2 -p tcp --dport $j -j SNAT --to 217.160.99.43; | ||
| + | iptables -A FORWARD -s 10.66.66.2 -p tcp --dport $j -j ACCEPT; | ||
| + | #ip6tables -t nat -A POSTROUTING -s fd42: | ||
| + | #ip6tables -A FORWARD -s fd42: | ||
| + | done | ||
| + | |||
| + | # Routing TCP port required from VPN server to Yunohost server | ||
| + | for i in 25 53 80 140 443 587 993 1194 1195 1935 5222 5269 5432 5665 8099 8443 8447 50059 51820 | ||
| + | do | ||
| + | iptables -t nat -A PREROUTING -i ens6 -p tcp --dport $i -j DNAT --to-destination 10.66.66.2; | ||
| + | iptables -A FORWARD -d 10.66.66.2 -p tcp --dport $i -j ACCEPT; | ||
| + | #ip6tables -t nat -A PREROUTING -i ens6 -p tcp --dport $i -j DNAT --to-destination fd42: | ||
| + | #ip6tables -A FORWARD -d fd42: | ||
| + | done | ||
| + | |||
| + | # Routing UDP port required from VPN server to Yunohost server | ||
| + | iptables -A PREROUTING -t nat -i ens6 -p udp --dport 8099 -j DNAT --to-destination 10.66.66.2 | ||
| + | |||
| + | # Save and quit (CTRL+O, CTRL+X) | ||
| + | </ | ||
| + | |||
| + | ==== Config client | ||
| / | / | ||
auto-hebergement.1702465227.txt.gz · Dernière modification : de admin_elemac
