From f873bcdb07001cfc5571cb6cf98e3df3a8e83515 Mon Sep 17 00:00:00 2001 From: Erik Kapfer Date: Mon, 13 Mar 2023 13:56:41 +0100 Subject: [PATCH] OpenVPN: Added correct index for ovpnconfig, modified legend in WUI - Fix for #11048 which includes now an index parameter for 'pass' or 'no-pass' for all connections. - Modification via update.sh to deliver an 'pass' (all crypted *.p12 files) or 'no-pass' (N2N and not encrypted files) index for all existing connections. - Only one place for two different icons (encrypted or not encrypted) in HTML section in 'Connection Status and -Control'. - Added new icon with already existing openvpn.png combined with an lock icon from https://www.freepik.com/ with the specific address https://www.flaticon.com/free-icon/lock_891399 which is free for personla and commercial use. - Change 'Legend' order in 'Connection status and -Control' for better overview and change table width. - Added new icon 'openvpn_encrypted.png' in 'Legend' section. Signed-off-by: Erik Kapfer --- config/rootfiles/core/174/update.sh | 28 ++++++++++ html/cgi-bin/ovpnmain.cgi | 74 ++++++++++++++----------- html/html/images/openvpn_encrypted.png | Bin 0 -> 6562 bytes langs/de/cgi-bin/de.pl | 2 +- langs/en/cgi-bin/en.pl | 2 +- 5 files changed, 73 insertions(+), 33 deletions(-) create mode 100644 html/html/images/openvpn_encrypted.png diff --git a/config/rootfiles/core/174/update.sh b/config/rootfiles/core/174/update.sh index 7acaad64e9..e15b31df2a 100644 --- a/config/rootfiles/core/174/update.sh +++ b/config/rootfiles/core/174/update.sh @@ -184,6 +184,34 @@ if [ -e "/opt/pakfire/db/installed/meta-perl-TimeDate" ] && [ -e "/opt/pakfire/d /opt/pakfire/db/rootfiles/perl-TimeDate fi +## Modify ovpnconfig according to bug 11048 for pass, no-pass modification in ovpnconfig index +# Check if ovpnconfig is not empty and exists +if [ -s /var/ipfire/ovpn/ovpnconfig ]; then + # Sort all N2N connections out since they do not use encryption + awk '{FS=OFS=","} {if($5=="net") {$43="no-pass"; print $0}}' /var/ipfire/ovpn/ovpnconfig >> /var/ipfire/ovpn/ovpnconfig.new + + # Investigate roadwarrior connection names for *.p12 files + for y in $(awk -F',' '/host/ { print $3 }' /var/ipfire/ovpn/ovpnconfig); do + # Sort all unencrypted roadwarriors out and set 'no-pass' in [43] index + if [[ -n $(openssl pkcs12 -info -in /var/ipfire/ovpn/certs/${y}.p12 -noout -password pass:'' 2>&1 | grep 'Encrypted') ]]; then + awk -v var="$y" '{FS=OFS=","} {if($3==var) {$43="no-pass"; print $0}}' /var/ipfire/ovpn/ovpnconfig >> /var/ipfire/ovpn/ovpnconfig.new + fi + done + + # Investigate connection names for *.p12 files + for x in $(awk -F',' '/host/ { print $3 }' /var/ipfire/ovpn/ovpnconfig); do + # Sort all encrypted roadwarriors out and set 'pass' in [43] index + if [[ -n $(openssl pkcs12 -info -in /var/ipfire/ovpn/certs/${x}.p12 -noout -password pass:'' 2>&1 | grep 'error') ]]; then + awk -v var="$x" '{FS=OFS=","} {if($3==var) {$43="pass"; print $0}}' /var/ipfire/ovpn/ovpnconfig >> /var/ipfire/ovpn/ovpnconfig.new + fi + done +fi + +# Renew existing ovpnconfig with refreshed index +mv /var/ipfire/ovpn/ovpnconfig.new /var/ipfire/ovpn/ovpnconfig +# Set correct ownerschip +chown nobody:nobody /var/ipfire/ovpn/ovpnconfig + # This update needs a reboot... touch /var/run/need_reboot diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index 87bda4f1ef..f2c3e81f34 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -4327,8 +4327,14 @@ if ($cgiparams{'TYPE'} eq 'net') { $confighash{$key}[39] = $cgiparams{'DAUTH'}; $confighash{$key}[40] = $cgiparams{'DCIPHER'}; - if (($cgiparams{'TYPE'} eq 'host') && ($cgiparams{'CERT_PASS1'} eq "")) { - $confighash{$key}[41] = "no-pass"; + if ($confighash{$key}[41] eq "") { + if (($cgiparams{'TYPE'} eq 'host') && ($cgiparams{'CERT_PASS1'} eq "")) { + $confighash{$key}[41] = "no-pass"; + } elsif (($cgiparams{'TYPE'} eq 'host') && ($cgiparams{'CERT_PASS1'} ne "")) { + $confighash{$key}[41] = "pass"; + } elsif ($cgiparams{'TYPE'} eq 'net') { + $confighash{$key}[41] = "no-pass"; + } } $confighash{$key}[42] = 'HOTP/T30/6'; @@ -5459,20 +5465,24 @@ END } - print <$active - -
- - - -
+ if ($confighash{$key}[41] eq "pass") { + print <$active + +
+ + + + +
END - ; - if ($confighash{$key}[41] eq "no-pass") { + ; } elsif ($confighash{$key}[41] eq "no-pass") { print < + $active + +
@@ -5480,7 +5490,7 @@ END
END - } else { + ; } else { print " "; } @@ -5556,30 +5566,32 @@ END # If the config file contains entries, print Key to action icons if ( $id ) { print < - + + - - + + + + + + + + + + + + + + + - - - - - - - - - - - - -
  $Lang::tr{'legend'}:  $Lang::tr{$Lang::tr{'click to disable'}    ?RELOAD$Lang::tr{'dl client arch insecure'}    ?RELOAD$Lang::tr{'dl client arch'}     $Lang::tr{ $Lang::tr{'show certificate'}    $Lang::tr{$Lang::tr{'show otp qrcode'}
      ?FLOPPY$Lang::tr{'download certificate'}  ?OFF$Lang::tr{'click to enable'}  $Lang::tr{$Lang::tr{'click to disable'}     $Lang::tr{ $Lang::tr{'edit'}     $Lang::tr{ $Lang::tr{'remove'}
    ?OFF$Lang::tr{'click to enable'}    ?FLOPPY$Lang::tr{'download certificate'}    ?RELOAD$Lang::tr{'dl client arch'}    $Lang::tr{$Lang::tr{'show otp qrcode'}

+ +
END ; } diff --git a/html/html/images/openvpn_encrypted.png b/html/html/images/openvpn_encrypted.png new file mode 100644 index 0000000000000000000000000000000000000000..fdedc7b33c43556abf397efa2183f4a266f1667e GIT binary patch literal 6562 zc-rk)XIN8Nw+=ltK@bERF(@FA9w3C?q!;NTiYX@{KoTUOcLXaUDkx2g0|HV80Tq=Z zDqRt0C?lYtARsb;!UsYSZ-S2F-1|M>{dJ$`{_rH{UVEQ?a@xtkQc`T2 z7zhNCw6-#L=Kf0aPOvcdsYLW6ay5c`a=kWzanulGSKb3K)g$=j`PuC7&Q^uQQ>mup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B1M1 z%DJQ-&ud;Hc6o1?M330Vv<~&JHj2w%RDiute2uGfzkKpS+fpU*$sKdRa<{WnMq%R- zpg7N{7NsRWxx+?0m%0gbr~$Q0b0x}qM)qpT?mQ8>xS$MWU8nBOT@MP<`Dg;t)2X6G z;8pvnU}HCvPKfevi&m)@dq@4H1^w@h0&#vFlTXsjRu4N3rK;p#-+blbwo81q&I{sQ z=U6pLX&-BMFnZ&?#ieU~uO-CoO1KjDK2CDpT*+b7ys}^C{_@CeubL4%mDdc`RU++_ wGe3Cm-c(sTnK(X7Vzawyxc3NF?DD!mWI^~brIw*s-k%HB77pf>rbiS03!u|@5C8xG literal 0 Hc-jL100001 diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 33730f0c31..b9665e62d4 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -817,7 +817,7 @@ 'display hostname in window title' => 'Hostname im Fenstertitel anzeigen', 'display traffic at home' => 'Berechneten Traffic auf der Startseite anzeigen', 'display webinterface effects' => 'Überblendeffekte einschalten', -'dl client arch' => 'Client Paket herunterladen (zip)', +'dl client arch' => 'Verschlüsseltes Client Paket herunterladen (zip)', 'dl client arch insecure' => 'Ungesichertes Client-Paket herunterladen (zip)', 'dmz' => 'DMZ', 'dmz pinhole configuration' => 'Einstellungen des DMZ-Schlupfloches', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 729516538b..7b16704945 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -859,7 +859,7 @@ 'display hostname in window title' => 'Display hostname in window title', 'display traffic at home' => 'Display calculated traffic on startpage', 'display webinterface effects' => 'Activate effects', -'dl client arch' => 'Download Client Package (zip)', +'dl client arch' => 'Download Encrypted Client Package (zip)', 'dl client arch insecure' => 'Download insecure Client Package (zip)', 'dmz' => 'DMZ', 'dmz pinhole configuration' => 'DMZ pinhole configuration', -- 2.47.2