]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
wireguard.cgi: Show a QR code that contains the client configuration
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Apr 2024 15:32:32 +0000 (17:32 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Apr 2025 14:48:31 +0000 (16:48 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
12 files changed:
doc/language_issues.de
doc/language_issues.en
doc/language_issues.es
doc/language_issues.fr
doc/language_issues.it
doc/language_issues.nl
doc/language_issues.pl
doc/language_issues.ru
doc/language_issues.tr
doc/language_missings
html/cgi-bin/wireguard.cgi
langs/en/cgi-bin/en.pl

index b2e03ec38ea143cb7dc7eced66311acf62d81445..c57603fc6475173ab6627ad662ebd862152f6ce2 100644 (file)
@@ -1017,6 +1017,7 @@ WARNING: untranslated string: optional = Optional
 WARNING: untranslated string: ovpn roadwarrior server = OpenVPN Roadwarrior Server
 WARNING: untranslated string: pakfire invalid tree = Invalid repository selected
 WARNING: untranslated string: public key = Public Key
+WARNING: untranslated string: qr code = QR Code
 WARNING: untranslated string: reg_file_data_sampling = Register File Data Sampling (RFDS)
 WARNING: untranslated string: regenerate host certificate = Renew Host Certificate
 WARNING: untranslated string: reiserfs warning1 = Reiserfs is deprecated and scheduled to be removed from the kernel in 2025.
@@ -1053,6 +1054,7 @@ WARNING: untranslated string: wg no local subnets = No local subnets given
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: winbind daemon = Winbind Daemon
 WARNING: untranslated string: wio = unknown string
index 0714a8cd37c4090ab1924005d76f13a6be3b789a..5ddce9b817eecc795efc2dba8fe3be47bbc287c4 100644 (file)
@@ -1543,6 +1543,7 @@ WARNING: untranslated string: pulse dial = Pulse dial:
 WARNING: untranslated string: qos enter bandwidths = You will need to enter your downstream and upstream bandwidth!
 WARNING: untranslated string: qos graphs = Qos Graphs
 WARNING: untranslated string: qos warning = The rule <strong>must</strong> be saved, otherwise it will be discarded!
+WARNING: untranslated string: qr code = QR Code
 WARNING: untranslated string: ram = RAM
 WARNING: untranslated string: rdns = rDNS
 WARNING: untranslated string: read bytes = Bytes Read
@@ -2160,6 +2161,7 @@ WARNING: untranslated string: wg no local subnets = No local subnets given
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
 WARNING: untranslated string: whois results from = WHOIS results from
index f9cbc9a6e9de0e97934c553a44f351a683771a9f..9d2d5d0dd41f4c28322610c92d1076caa5f94ffa 100644 (file)
@@ -1082,6 +1082,7 @@ WARNING: untranslated string: pakfire ago = ago.
 WARNING: untranslated string: password has quotation mark = Password contains an illegal double quotation mark.
 WARNING: untranslated string: processors = Processors
 WARNING: untranslated string: public key = Public Key
+WARNING: untranslated string: qr code = QR Code
 WARNING: untranslated string: reg_file_data_sampling = Register File Data Sampling (RFDS)
 WARNING: untranslated string: regenerate host certificate = Renew Host Certificate
 WARNING: untranslated string: reiserfs warning1 = Reiserfs is deprecated and scheduled to be removed from the kernel in 2025.
@@ -1120,6 +1121,7 @@ WARNING: untranslated string: wg no local subnets = No local subnets given
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
 WARNING: untranslated string: wio = unknown string
index d0545fc3443fae0624c0603eb3f7ffebc0e4cb83..a7af2c1d04975791c3b68216637edd780acd1e13 100644 (file)
@@ -1030,6 +1030,7 @@ WARNING: untranslated string: pakfire ago = ago.
 WARNING: untranslated string: password has quotation mark = Password contains an illegal double quotation mark.
 WARNING: untranslated string: processors = Processors
 WARNING: untranslated string: public key = Public Key
+WARNING: untranslated string: qr code = QR Code
 WARNING: untranslated string: reg_file_data_sampling = Register File Data Sampling (RFDS)
 WARNING: untranslated string: remarks = unknown string
 WARNING: untranslated string: remote subnets = Remote Subnets
@@ -1060,6 +1061,7 @@ WARNING: untranslated string: wg no local subnets = No local subnets given
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
 WARNING: untranslated string: wio = unknown string
index 482546b51334460ca208c5038b4c76b0696bd0fe..069cf7f276891a1f5364384d3419e625b5da239c 100644 (file)
@@ -1292,6 +1292,7 @@ WARNING: untranslated string: processor vulnerability mitigations = Processor Vu
 WARNING: untranslated string: processors = Processors
 WARNING: untranslated string: ptr = PTR
 WARNING: untranslated string: public key = Public Key
+WARNING: untranslated string: qr code = QR Code
 WARNING: untranslated string: rdns = rDNS
 WARNING: untranslated string: reboot fsck = Reboot & run &lsquo;fsck&rsquo;
 WARNING: untranslated string: rebooting ipfire fsck = Rebooting IPFire, forcing filesystem check
@@ -1406,6 +1407,7 @@ WARNING: untranslated string: wg no local subnets = No local subnets given
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
 WARNING: untranslated string: whois results from = WHOIS results from
index 12521129019d13fa213c4a2cbb6a09df8ae6984f..c49c7ad9a8202a7807934c6b2db7543606b83d5c 100644 (file)
@@ -1315,6 +1315,7 @@ WARNING: untranslated string: processor vulnerability mitigations = Processor Vu
 WARNING: untranslated string: processors = Processors
 WARNING: untranslated string: ptr = PTR
 WARNING: untranslated string: public key = Public Key
+WARNING: untranslated string: qr code = QR Code
 WARNING: untranslated string: rdns = rDNS
 WARNING: untranslated string: rebooting ipfire fsck = Rebooting IPFire, forcing filesystem check
 WARNING: untranslated string: received = Received
@@ -1427,6 +1428,7 @@ WARNING: untranslated string: wg no local subnets = No local subnets given
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
 WARNING: untranslated string: whois results from = WHOIS results from
index 2b3a9f3b83da86d5366c21c0785e8096eececb16..5a599ff50e60e9846176529f6d68d9a460412e01 100644 (file)
@@ -1492,6 +1492,7 @@ WARNING: untranslated string: proxy reports weekly = Weekly reports
 WARNING: untranslated string: ptr = PTR
 WARNING: untranslated string: public key = Public Key
 WARNING: untranslated string: qos enter bandwidths = You will need to enter your downstream and upstream bandwidth!
+WARNING: untranslated string: qr code = QR Code
 WARNING: untranslated string: rdns = rDNS
 WARNING: untranslated string: reboot fsck = Reboot & run &lsquo;fsck&rsquo;
 WARNING: untranslated string: rebooting ipfire fsck = Rebooting IPFire, forcing filesystem check
@@ -1669,6 +1670,7 @@ WARNING: untranslated string: wg no local subnets = No local subnets given
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
 WARNING: untranslated string: whois results from = WHOIS results from
index 15af0652583f6de053bd6e6f16d4c61ae1673faa..f70efde448a1bce293b31c86fe089948541b51ca 100644 (file)
@@ -1485,6 +1485,7 @@ WARNING: untranslated string: proxy reports weekly = Weekly reports
 WARNING: untranslated string: ptr = PTR
 WARNING: untranslated string: public key = Public Key
 WARNING: untranslated string: qos enter bandwidths = You will need to enter your downstream and upstream bandwidth!
+WARNING: untranslated string: qr code = QR Code
 WARNING: untranslated string: rdns = rDNS
 WARNING: untranslated string: reboot fsck = Reboot & run &lsquo;fsck&rsquo;
 WARNING: untranslated string: rebooting ipfire fsck = Rebooting IPFire, forcing filesystem check
@@ -1662,6 +1663,7 @@ WARNING: untranslated string: wg no local subnets = No local subnets given
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
 WARNING: untranslated string: whois results from = WHOIS results from
index 1cb9134dd32d1ff89c2860ef8737d660abf0057b..ba2f4871cb1452d588942d86a7a1379722af46d5 100644 (file)
@@ -1202,6 +1202,7 @@ WARNING: untranslated string: processor vulnerability mitigations = Processor Vu
 WARNING: untranslated string: processors = Processors
 WARNING: untranslated string: ptr = PTR
 WARNING: untranslated string: public key = Public Key
+WARNING: untranslated string: qr code = QR Code
 WARNING: untranslated string: reboot fsck = Reboot & run &lsquo;fsck&rsquo;
 WARNING: untranslated string: rebooting ipfire fsck = Rebooting IPFire, forcing filesystem check
 WARNING: untranslated string: received = Received
@@ -1289,6 +1290,7 @@ WARNING: untranslated string: wg no local subnets = No local subnets given
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
 WARNING: untranslated string: whois results from = WHOIS results from
index 9e2df8913d8a2d99bcd93f4fa1cdba0e40165f53..10013f2f2f44e80fb49ba2034e5fbef40683c6a2 100644 (file)
@@ -90,6 +90,7 @@
 < pakfire no dependencies found
 < pakfire resolvedeps wait
 < public key
+< qr code
 < quick control
 < random number generator daemon
 < regenerate host certificate
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg scan the qr code
 < wg warning configuration only shown once
 < winbind daemon
 < wireguard
 < password has quotation mark
 < processors
 < public key
+< qr code
 < regenerate host certificate
 < reg_file_data_sampling
 < reiserfs warning1
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < wireguard
 < password has quotation mark
 < processors
 < public key
+< qr code
 < reg_file_data_sampling
 < remote subnets
 < routing
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < wireguard
 < processor vulnerability mitigations
 < ptr
 < public key
+< qr code
 < random number generator daemon
 < rdns
 < reboot fsck
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < whois results from
 < processor vulnerability mitigations
 < ptr
 < public key
+< qr code
 < random number generator daemon
 < rdns
 < rebooting ipfire fsck
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < whois results from
 < ptr
 < public key
 < qos enter bandwidths
+< qr code
 < random number generator daemon
 < rdns
 < reboot fsck
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < whois results from
 < ptr
 < public key
 < qos enter bandwidths
+< qr code
 < random number generator daemon
 < rdns
 < reboot fsck
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < whois results from
 < processor vulnerability mitigations
 < ptr
 < public key
+< qr code
 < random number generator daemon
 < reboot fsck
 < rebooting ipfire fsck
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < whois results from
index e8d33b486a33639d0641863697cf56d27127fe4f..45363c0d456590db219ec51caa51d10a59b30df6 100644 (file)
@@ -24,6 +24,7 @@ use strict;
 # enable only the following on debugging purpose
 use warnings;
 use CGI::Carp 'fatalsToBrowser';
+use Imager::QRCode;
 use MIME::Base64;
 
 require "/var/ipfire/general-functions.pl";
@@ -878,6 +879,9 @@ sub show_peer_configuration($$) {
        my $key = shift;
        my $private_key = shift;
 
+       # The generated QR code
+       my $qrcode;
+
        # Send HTTP Headers
        &Header::showhttpheaders();
 
@@ -899,10 +903,41 @@ sub show_peer_configuration($$) {
        # Generate the client configuration
        my $config = &generate_client_configuration(\%peer);
 
+       # Create a QR code generator
+       my $qrgen = Imager::QRCode->new(
+               size          => 6,
+               margin        => 0,
+               version       => 0,
+               level         => 'M',
+               mode          => '8-bit',
+               casesensitive => 1,
+               lightcolor    => Imager::Color->new(255, 255, 255),
+               darkcolor     => Imager::Color->new(0, 0, 0),
+       );
+
+       # Encode the configuration
+       my $img = $qrgen->plot("$config");
+
+       # Encode the image as PNG
+       $img->write(data => \$qrcode, type => "png") or die $img->errstr;
+
+       # Encode the image as bas64
+       $qrcode = &MIME::Base64::encode_base64($qrcode);
+
        # Open a new box
        &Header::openbox('100%', '', "$Lang::tr{'wg peer configuration'}: $peer{'NAME'}");
 
        print <<END;
+               <div class="text-center">
+                       <p>
+                               <img src="data:image/png;base64,${qrcode}" alt="$Lang::tr{'qr code'}">
+                       </p>
+
+                       <p>
+                               $Lang::tr{'wg scan the qr code'}
+                       </p>
+               </div>
+
                <h6>$Lang::tr{'wg client configuration file'}</h6>
 
                <code><pre>$config</textarea></code>
index cf82ff8d2bef7fc3916e0871bbea06b29ab654b9..feee700f4aaec0ec75a65fbe35dc7bcc8566731e 100644 (file)
 'qos enter bandwidths' => 'You will need to enter your downstream and upstream bandwidth!',
 'qos graphs' => 'Qos Graphs',
 'qos warning' => 'The rule <strong>must</strong> be saved, otherwise it will be discarded!',
+'qr code' => 'QR Code',
 'quick control' => 'Quick Control',
 'quick playlist' => 'Quick Playlist',
 'ram' => 'RAM',
 'wg peer configuration' => 'Peer Configuration',
 'wg peer does not exist' => 'Peer does not exist',
 'wg pre-shared key (optional)' => 'Pre-Shared Key (optional)',
+'wg scan the qr code' => 'Scan the QR code to import the WireGuard configuration into a mobile client.',
 'wg warning configuration only shown once' => 'Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.',
 'whitelisted' => 'Whitelisted',
 'whois results from' => 'WHOIS results from',