« Wireguard » : différence entre les versions

Aucun résumé des modifications
Aucun résumé des modifications
 
(4 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
== Commandes ==
 
=== Générer paire de clés pour un client ===
 
=== 🟢 Générer paire de clés pour un client ===
<syntaxhighlight lang="bash" line copy>
wg genkey | tee client1.key | wg pubkey > client1.pub
wg genkey | tee client1.key | wg pubkey > client1.pub
</syntaxhighlight>
=== 🟢 Ajouter une PresharedKey (PSK) à un peer ===
<syntaxhighlight lang="bash" line>
mkdir -p /etc/wireguard/keys
chmod 700 /etc/wireguard/keys
</syntaxhighlight>
<syntaxhighlight lang="bash" line>
wg genpsk | tee /etc/wireguard/keys/client1.psk
chmod 600 /etc/wireguard/keys/client1.psk
</syntaxhighlight>
👉 récupère la clé :
<syntaxhighlight lang="bash" copy>
cat /etc/wireguard/keys/client1.psk
</syntaxhighlight>
1. Modifier ton `wg0.conf` (serveur)
<syntaxhighlight lang="bash" copy>
nano /etc/wireguard/wg0.conf
</syntaxhighlight>
Ajoute dans le peer concerné :
<syntaxhighlight lang="bash" line>
[Peer]
PublicKey = CLIENT_PUBLIC_KEY
PresharedKey = TA_PSK_ICI
</syntaxhighlight>
2. Ajouter la PSK côté client
<syntaxhighlight lang="bash" copy>
nano /etc/wireguard/client1.conf
</syntaxhighlight>
<syntaxhighlight lang="bash" line>
[Peer]
PublicKey = SERVER_PUBLIC_KEY
PresharedKey = TA_PSK_ICI
</syntaxhighlight>
=== 🟢 Commandes ===
Démarrer l'interface :
Démarrer l'interface :
<syntaxhighlight lang="bash" line copy>
<syntaxhighlight lang="bash" line copy>
Ligne 9 : Ligne 61 :
<syntaxhighlight lang="bash" line copy>
<syntaxhighlight lang="bash" line copy>
sudo wg-quick down wg0
sudo wg-quick down wg0
</syntaxhighlight>
Redémarrer l'interface
<syntaxhighlight lang="bash" line copy>
systemctl restart wg-quick@wg0
</syntaxhighlight>
</syntaxhighlight>
Les logs de WireGuard sont également enregistrés dans le journal système
Les logs de WireGuard sont également enregistrés dans le journal système
Ligne 41 : Ligne 97 :
sudo watch -n 1 wg show wg0
sudo watch -n 1 wg show wg0
</syntaxhighlight>
</syntaxhighlight>
=== 🟢 QR‑code WireGuard ===
*[[ Wireguard_qrcode | Wireguard qrcode ]]


== Sources ==
== Sources ==