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 [2022/11/27 23:03] – admin_elemac | auto-hebergement [2023/12/13 11:25] (Version actuelle) – admin_elemac | ||
|---|---|---|---|
| Ligne 13: | Ligne 13: | ||
| * tous les [[https:// | * tous les [[https:// | ||
| * la vente de noms de domaine n' | * la vente de noms de domaine n' | ||
| - | ===== Prendre un VPN ===== | + | ===== Option 1 Prendre un VPN " |
| ==== Introduction ==== | ==== Introduction ==== | ||
| Ligne 76: | Ligne 76: | ||
| sudo chmod 644 / | sudo chmod 644 / | ||
| + | ===== option 2 VPN sur un VPS ===== | ||
| + | ==== Introduction ==== | ||
| + | L' | ||
| + | |||
| + | Également permettre un accès pour le la collaboration distante (DaVinci Resolve par exemple) | ||
| + | |||
| + | Un tuto pour configurer le VPN sur le VPS | ||
| + | https:// | ||
| + | |||
| + | En cas de soucis accès internet avec tunnel wireguard | ||
| + | https:// | ||
| + | |||
| + | ==== Config WG sur VPS ==== | ||
| + | |||
| + | installer debian 11 | ||
| + | |||
| + | 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 WG sur Yunohost ==== | ||
| + | |||
| + | / | ||
| + | |||
| + | < | ||
| + | PrivateKey = ****** | ||
| + | Address = 10.66.66.2/ | ||
| + | DNS = 1.1.1.1, | ||
| + | |||
| + | PostUp = bash / | ||
| + | PostDown = bash / | ||
| + | |||
| + | [Peer] | ||
| + | PublicKey = ***** | ||
| + | PresharedKey = ****** | ||
| + | Endpoint = ***.**.**.**: | ||
| + | AllowedIPs = 0.0.0.0/ | ||
| + | PersistentKeepalive = 25 | ||
| + | </ | ||
| + | |||
| + | Le fichier PostUp.sh | ||
| + | |||
| + | < | ||
| + | |||
| + | #Begin IPV4 | ||
| + | iptables -w -N vpnclient_in; | ||
| + | iptables -w -N vpnclient_out; | ||
| + | iptables -w -N vpnclient_fwd; | ||
| + | |||
| + | iptables -w -A vpnclient_in -p icmp -j ACCEPT; | ||
| + | iptables -w -A vpnclient_in -s 10.66.66.2/ | ||
| + | |||
| + | #Allowing required TCP ports | ||
| + | for i in 25 53 80 140 443 587 993 1194 1195 1935 5222 5269 5462 5665 51820 | ||
| + | do | ||
| + | iptables -w -A vpnclient_in -p tcp --dport $i -j ACCEPT; | ||
| + | done | ||
| + | iptables -w -A vpnclient_in -m conntrack --ctstate RELATED, | ||
| + | iptables -w -A vpnclient_in -j DROP; | ||
| + | |||
| + | iptables -w -A vpnclient_out -j ACCEPT; | ||
| + | |||
| + | iptables -w -A vpnclient_fwd -j DROP; | ||
| + | |||
| + | iptables -w -I INPUT 1 -i wg0 -j vpnclient_in; | ||
| + | iptables -w -I OUTPUT 1 -o wg0 -j vpnclient_out; | ||
| + | iptables -w -I FORWARD 1 -o wg0 -j vpnclient_fwd; | ||
| + | #End IPV4 | ||
| + | |||
| + | #Begin IPV6 | ||
| + | #ip6tables -w -N vpnclient_in; | ||
| + | #ip6tables -w -N vpnclient_out; | ||
| + | #ip6tables -w -N vpnclient_fwd; | ||
| + | |||
| + | #ip6tables -w -A vpnclient_in -p ipv6-icmp -j ACCEPT; | ||
| + | #ip6tables -w -A vpnclient_in -s fd42: | ||
| + | |||
| + | #Allowing required TCP ports | ||
| + | #for i in 25 80 140 443 587 993 5222 5269 | ||
| + | #do | ||
| + | # ip6tables -w -A vpnclient_in -p tcp --dport $i -j ACCEPT; | ||
| + | #done | ||
| + | #ip6tables -w -A vpnclient_in -m conntrack --ctstate RELATED, | ||
| + | #ip6tables -w -A vpnclient_in -j DROP; | ||
| + | |||
| + | #ip6tables -w -A vpnclient_out -j ACCEPT; | ||
| + | #ip6tables -w -A vpnclient_fwd -j DROP; | ||
| + | |||
| + | #ip6tables -w -I INPUT 1 -i wg0 -j vpnclient_in; | ||
| + | #ip6tables -w -I OUTPUT 1 -o wg0 -j vpnclient_out; | ||
| + | #ip6tables -w -I FORWARD 1 -o wg0 -j vpnclient_fwd; | ||
| + | #End IPV6 | ||
| + | |||
| + | # Save and quit (CTRL+O, CTRL+X) | ||
| + | </ | ||
| + | |||
| + | Le fichier PostDown.sh : | ||
| + | |||
| + | |||
| + | < | ||
| + | |||
| + | #Begin IPV4 | ||
| + | iptables -w -F vpnclient_in; | ||
| + | iptables -w -F vpnclient_out; | ||
| + | iptables -w -F vpnclient_fwd; | ||
| + | |||
| + | iptables -D INPUT -i wg0 -j vpnclient_in; | ||
| + | iptables -D FORWARD -o wg0 -j vpnclient_fwd; | ||
| + | iptables -D OUTPUT -o wg0 -j vpnclient_out; | ||
| + | |||
| + | iptables -w -X vpnclient_in; | ||
| + | iptables -w -X vpnclient_out; | ||
| + | iptables -w -X vpnclient_fwd; | ||
| + | #End IPV4 | ||
| + | |||
| + | #Begin IPV6 | ||
| + | #ip6tables -w -F vpnclient_in; | ||
| + | #ip6tables -w -F vpnclient_out; | ||
| + | #ip6tables -w -F vpnclient_fwd; | ||
| + | |||
| + | #ip6tables -D INPUT -i wg0 -j vpnclient_in; | ||
| + | #ip6tables -D FORWARD -o wg0 -j vpnclient_fwd; | ||
| + | #ip6tables -D OUTPUT -o wg0 -j vpnclient_out; | ||
| + | |||
| + | #ip6tables -w -X vpnclient_in; | ||
| + | #ip6tables -w -X vpnclient_out; | ||
| + | #ip6tables -w -X vpnclient_fwd; | ||
| + | #End IPV6 | ||
| + | |||
| + | # Save and quit (CTRL+O, CTRL+X) | ||
| + | </ | ||
| ===== Trouver une machine ===== | ===== Trouver une machine ===== | ||
| Ligne 109: | Ligne 302: | ||
| sudo su | sudo su | ||
| + | |||
| app=flarum | app=flarum | ||
| + | |||
| cd / | cd / | ||
| + | |||
| sudo -u $app php7.4 composer.phar require vendor/ | sudo -u $app php7.4 composer.phar require vendor/ | ||
auto-hebergement.1669590210.txt.gz · Dernière modification : de admin_elemac
