From 144258668271b7088f9242793f569b639a55d882 Mon Sep 17 00:00:00 2001 From: Jack Ivanov <17044561+jackivanov@users.noreply.github.com> Date: Sun, 30 Sep 2018 05:25:02 +0300 Subject: [PATCH] WireGuard: Generate QR codes (#1129) * WireGuard: Generate QR codes * Update client-android.md --- docs/client-android.md | 3 +-- requirements.txt | 1 + roles/wireguard/tasks/main.yml | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/client-android.md b/docs/client-android.md index 1e98f6d..553b507 100644 --- a/docs/client-android.md +++ b/docs/client-android.md @@ -3,5 +3,4 @@ ## Installation via profiles 1. [Install the WireGuard VPN Client](https://play.google.com/store/apps/details?id=com.wireguard.android). -2. Copy `wireguard/{username}.conf` to your phone's internal storage. -3. Open the WireGuard app and add a connection using your AlgoVPN configuration file. +2. Open QR code `configs//wireguard/.png` and scan it in the WireGuard app diff --git a/requirements.txt b/requirements.txt index f258065..4d40c39 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ pyopenssl jinja2==2.8 shade pycrypto +segno diff --git a/roles/wireguard/tasks/main.yml b/roles/wireguard/tasks/main.yml index 3621754..dacedb5 100644 --- a/roles/wireguard/tasks/main.yml +++ b/roles/wireguard/tasks/main.yml @@ -42,6 +42,20 @@ delegate_to: localhost become: false +- name: Generate QR codes + shell: > + umask 077; + which segno && + segno --scale=5 --output={{ item.1 }}.png \ + "{{ lookup('template', 'client.conf.j2') }}" || true + changed_when: false + with_indexed_items: "{{ users }}" + delegate_to: localhost + become: false + args: + chdir: "{{ wireguard_config_path }}" + executable: bash + - name: WireGuard enabled and started service: name: "{{ service_name }}"