]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
ovpnmain.cgi: Move things that belong together together
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 Mar 2024 15:44:02 +0000 (16:44 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 2 Jun 2025 19:44:59 +0000 (19:44 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/ovpnmain.cgi

index ebbabaa2555a47bf117e6ef026a748a2ab4eaabe..9054cc014c7ab361bceb287653edfeedcea44250 100644 (file)
@@ -65,7 +65,7 @@ my $errormessage = '';
 my $cryptoerror = '';
 my $cryptowarning = '';
 my %settings=();
-my $routes_push_file = '';
+my $routes_push_file = "${General::swroot}/ovpn/routes_push";
 my $confighost="${General::swroot}/fwhosts/customhosts";
 my $configgrp="${General::swroot}/fwhosts/customgroups";
 my $customnet="${General::swroot}/fwhosts/customnetworks";
@@ -75,7 +75,10 @@ my $local_serverconf = "${General::swroot}/ovpn/scripts/server.conf.local";
 my $local_clientconf = "${General::swroot}/ovpn/scripts/client.conf.local";
 my $dhparameter = "/etc/ssl/ffdhe4096.pem";
 
+# Read Ethernet configuration
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
+
+# Set default CGI parameters
 $cgiparams{'ENABLED'} = 'off';
 $cgiparams{'ENABLED_BLUE'} = 'off';
 $cgiparams{'ENABLED_ORANGE'} = 'off';
@@ -95,7 +98,9 @@ $cgiparams{'number'} = '';
 $cgiparams{'DCIPHER'} = '';
 $cgiparams{'DAUTH'} = '';
 $cgiparams{'TLSAUTH'} = '';
-$routes_push_file = "${General::swroot}/ovpn/routes_push";
+
+# Load CGI parameters
+&Header::getcgihash(\%cgiparams, {'wantfile' => 1, 'filevar' => 'FH'});
 
 # Add CCD files if not already present
 unless (-e $routes_push_file) {
@@ -114,9 +119,6 @@ unless (-e "$local_clientconf") {
        close (LCC);
 }
 
-&Header::getcgihash(\%cgiparams, {'wantfile' => 1, 'filevar' => 'FH'});
-
-# prepare openvpn config file
 ###
 ### Useful functions
 ###
@@ -202,7 +204,7 @@ sub writeserverconf {
                        print CONF "push \"route " . $tempovpnsubnet[0]. " " .  $tempovpnsubnet[1] . "\"\n";
                }
        }
-# a.marx ccd
+
        my %ccdconfhash=();
        &General::readhasharray("${General::swroot}/ovpn/ccd.conf", \%ccdconfhash);
        foreach my $key (keys %ccdconfhash) {
@@ -218,7 +220,6 @@ sub writeserverconf {
                        print CONF "route $a $b\n";
                }
        }
-# ccd end
 
        if ($sovpnsettings{CLIENT2CLIENT} eq 'on') {
        print CONF "client-to-client\n";