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édenteProchaine révision | Révision précédente | ||
auto-hebergement [2023/12/13 11:51] – [Introduction] admin_elemac | auto-hebergement [2023/12/13 12:25] (Version actuelle) – admin_elemac | ||
---|---|---|---|
Ligne 89: | Ligne 89: | ||
https:// | https:// | ||
- | the etc/ | + | ==== Config WG sur VPS ==== |
+ | installer debian 11 | ||
+ | installer WG | ||
+ | |||
+ | fichier / | ||
+ | < | ||
[Interface] | [Interface] | ||
- | Address = 10.10.10.0/24,fd42::/112 | + | Address = 10.66.66.1/24,fd42:42:42::1/64 |
- | ListenPort = 8099 | + | ListenPort = 51820 |
PrivateKey = ****** | PrivateKey = ****** | ||
- | MTU = 1450 | + | PostUp |
- | PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eno1 -j MASQUERADE; ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -A FORWARD -o %i -j ACCEPT; | + | PostDown = bash / |
- | PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eno1 -j MASQUERADE; ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -D FORWARD -o %i -j ACCEPT; | + | #PostUp = iptables -I INPUT -p udp --dport 51820 -j ACCEPT |
- | Table = auto | + | #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 | ||
- | # ID: | + | ### Client yunohost |
- | # Name: | + | |
- | # Email: | + | |
- | # Created at: | + | |
- | # Update at: 2023-12-11 17: | + | |
[Peer] | [Peer] | ||
- | PublicKey = ******* | + | PublicKey = ****** |
- | PresharedKey = ******** | + | PresharedKey = ****** |
- | AllowedIPs = 10.10.10.1/32,fd42::1/128 | + | AllowedIPs = 10.66.66.2/32,fd42:42:42::2/128 |
- | ``` | + | </ |
- | My yunohost is also connected through a vpn to a vps | + | 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 |
- | [Interface] | + | 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 WG sur Yunohost ==== | ||
+ | |||
+ | / | ||
+ | |||
+ | < | ||
PrivateKey = ****** | PrivateKey = ****** | ||
Address = 10.66.66.2/ | Address = 10.66.66.2/ | ||
Ligne 132: | Ligne 177: | ||
AllowedIPs = 0.0.0.0/ | AllowedIPs = 0.0.0.0/ | ||
PersistentKeepalive = 25 | PersistentKeepalive = 25 | ||
- | ``` | + | </ |
- | the PostUp.sh file is | + | |
- | ``` | + | Le fichier PostUp.sh |
- | # PostUp.sh | + | |
+ | < | ||
#Begin IPV4 | #Begin IPV4 | ||
Ligne 188: | Ligne 233: | ||
# Save and quit (CTRL+O, CTRL+X) | # Save and quit (CTRL+O, CTRL+X) | ||
- | ``` | + | </ |
+ | |||
+ | Le fichier PostDown.sh : | ||
- | and PostDown.sh is | ||
- | ``` | + | < |
- | # PostDown.sh | + | |
#Begin IPV4 | #Begin IPV4 | ||
Ligne 224: | Ligne 269: | ||
# Save and quit (CTRL+O, CTRL+X) | # Save and quit (CTRL+O, CTRL+X) | ||
- | ``` | + | </ |
===== Trouver une machine ===== | ===== Trouver une machine ===== | ||
auto-hebergement.1702464718.txt.gz · Dernière modification : 2023/12/13 11:51 de admin_elemac