|
@@ -170,7 +170,7 @@ def send_mail(email, wgconfig_path):
|
|
|
# 5- Envoie la clé à l'utilisateur (email/manuellement)
|
|
|
if __name__ == '__main__':
|
|
|
cp = configparser.ConfigParser()
|
|
|
- cp.read('/etc/wireguard/wg-create.ini')
|
|
|
+ cp.read('/etc/wireguard/wg-create-account.ini')
|
|
|
config = Config(cp)
|
|
|
(member_email, member_id) = check_env()
|
|
|
with tempfile.TemporaryDirectory() as temp_dir:
|
|
@@ -186,9 +186,9 @@ if __name__ == '__main__':
|
|
|
use_email = input("Envoyer la configuration (contenant la clé privée) par email? (O/n)")
|
|
|
if use_email.strip().lower() == "o" :
|
|
|
with open(privkey_path, "r") as pkh:
|
|
|
- peer_privkey = pkh.read()
|
|
|
+ peer_privkey = pkh.read()
|
|
|
with open(psk_path, "r") as pskh:
|
|
|
- peer_psk = pskh.read()
|
|
|
+ peer_psk = pskh.read()
|
|
|
email = Email(config.smtp_user, config.smtp_pass, config.smtp_from,\
|
|
|
member_email, config.smtp_server)
|
|
|
send_email(email, generate_wg_quick_client_config(peer_privkey, member_id, config.pubkey,\
|
|
@@ -198,8 +198,8 @@ if __name__ == '__main__':
|
|
|
print("=======================")
|
|
|
print("À vous de vous débrouiller pour passer les clés/config à l'utilisateur")
|
|
|
print("Clé privée: %s" % (privkey_path))
|
|
|
- print("Clé pré-partagée (psk): %s" % (psk_path))
|
|
|
- print("Clé publique (psk): %s" % (pubkey_path))
|
|
|
+ print("Clé pré-partagée (psk): %s" % (psk_path))
|
|
|
+ print("Clé publique (psk): %s" % (pubkey_path))
|
|
|
input("Appuyez sur entrée pour continuer (les clés privées seront détruites): ")
|
|
|
except Exception as e:
|
|
|
print("ERREUR: erreur lors de la génération/transfert de la clé:")
|
|
@@ -215,10 +215,10 @@ if __name__ == '__main__':
|
|
|
else:
|
|
|
print("Le membre {} semble déja avoir un compte VPN.".format(member_id))
|
|
|
print("Veuillez contacter la liste de diffusion technique\
|
|
|
- si son compte necessite une ré-activation.")
|
|
|
+ i son compte necessite une ré-activation.")
|
|
|
sys.exit(1)
|
|
|
print("[+] Chargement de la nouvelle interface réseau")
|
|
|
- _run_cmd("systemctl restart %s" % (config.wg_service))
|
|
|
+ _run_cmd("systemctl restart %s" % (config.wg_service))
|
|
|
print("[+] Nettoyage des clés")
|
|
|
_run_cmd("shred -u %s %s %s" % (privkey_path, pubkey_path, psk_path))
|
|
|
print("[+] COMPTE CRÉE AVEC SUCCÈS")
|