Drop orphaned ovpn-ccd-convert script

Message ID 4df694f9-ec14-7dcf-381d-ebcc1a751fd1@ipfire.org
State Accepted
Commit 0b6d12adae7f41bb31f6b361b2d6a90057de7867
Headers
Series Drop orphaned ovpn-ccd-convert script |

Commit Message

Peter Müller March 19, 2022, 4:35 p.m. UTC
  This script appeared in the rootfiles for Core Updates 65 and 66, being
released in late 2012 and early 2013. It is not used elsewhere, and
there is no sense in keeping it around on IPFire installations.

Should this patch be accepted, a corresponding 'rm' statement is
necessary in the update.sh script of the Core Update it will go into.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
---
 config/rootfiles/common/aarch64/stage2 |  1 -
 config/rootfiles/common/armv6l/stage2  |  1 -
 config/rootfiles/common/x86_64/stage2  |  1 -
 lfs/stage2                             |  1 -
 src/scripts/ovpn-ccd-convert           | 71 --------------------------
 5 files changed, 75 deletions(-)
 delete mode 100644 src/scripts/ovpn-ccd-convert
  

Comments

Adolf Belka March 19, 2022, 9:55 p.m. UTC | #1
Reviewed-by: Adolf Belka <adolf.belka@ipfire.org>

On 19/03/2022 17:35, Peter Müller wrote:
> This script appeared in the rootfiles for Core Updates 65 and 66, being
> released in late 2012 and early 2013. It is not used elsewhere, and
> there is no sense in keeping it around on IPFire installations.
>
> Should this patch be accepted, a corresponding 'rm' statement is
> necessary in the update.sh script of the Core Update it will go into.
>
> Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
> ---
>   config/rootfiles/common/aarch64/stage2 |  1 -
>   config/rootfiles/common/armv6l/stage2  |  1 -
>   config/rootfiles/common/x86_64/stage2  |  1 -
>   lfs/stage2                             |  1 -
>   src/scripts/ovpn-ccd-convert           | 71 --------------------------
>   5 files changed, 75 deletions(-)
>   delete mode 100644 src/scripts/ovpn-ccd-convert
>
> diff --git a/config/rootfiles/common/aarch64/stage2 b/config/rootfiles/common/aarch64/stage2
> index d8dc12a7f..e7eae625c 100644
> --- a/config/rootfiles/common/aarch64/stage2
> +++ b/config/rootfiles/common/aarch64/stage2
> @@ -131,7 +131,6 @@ usr/local/bin/update-location-database
>   #usr/local/src
>   #usr/sbin
>   usr/sbin/openvpn-metrics
> -usr/sbin/ovpn-ccd-convert
>   #usr/share
>   #usr/share/doc
>   #usr/share/doc/licenses
> diff --git a/config/rootfiles/common/armv6l/stage2 b/config/rootfiles/common/armv6l/stage2
> index 42ce447d1..670a99927 100644
> --- a/config/rootfiles/common/armv6l/stage2
> +++ b/config/rootfiles/common/armv6l/stage2
> @@ -129,7 +129,6 @@ usr/local/bin/update-location-database
>   #usr/local/src
>   #usr/sbin
>   usr/sbin/openvpn-metrics
> -usr/sbin/ovpn-ccd-convert
>   #usr/share
>   #usr/share/doc
>   #usr/share/doc/licenses
> diff --git a/config/rootfiles/common/x86_64/stage2 b/config/rootfiles/common/x86_64/stage2
> index 70e6c6e75..d07c264b4 100644
> --- a/config/rootfiles/common/x86_64/stage2
> +++ b/config/rootfiles/common/x86_64/stage2
> @@ -131,7 +131,6 @@ usr/local/bin/update-location-database
>   #usr/local/src
>   #usr/sbin
>   usr/sbin/openvpn-metrics
> -usr/sbin/ovpn-ccd-convert
>   #usr/share
>   #usr/share/doc
>   #usr/share/doc/licenses
> diff --git a/lfs/stage2 b/lfs/stage2
> index 356060a1f..6582a0c1a 100644
> --- a/lfs/stage2
> +++ b/lfs/stage2
> @@ -113,7 +113,6 @@ endif
>   
>   	# Move script to correct place.
>   	mv -vf /usr/local/bin/openvpn-metrics /usr/sbin/
> -	mv -vf /usr/local/bin/ovpn-ccd-convert /usr/sbin/
>   	mv -vf /usr/local/bin/captive-cleanup /usr/bin/
>   
>   	# Install firewall scripts.
> diff --git a/src/scripts/ovpn-ccd-convert b/src/scripts/ovpn-ccd-convert
> deleted file mode 100644
> index 05339af78..000000000
> --- a/src/scripts/ovpn-ccd-convert
> +++ /dev/null
> @@ -1,71 +0,0 @@
> -#!/usr/bin/perl
> -###############################################################################
> -#                                                                             #
> -# IPFire.org - A linux based firewall                                         #
> -# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
> -#                                                                             #
> -# This program is free software: you can redistribute it and/or modify        #
> -# it under the terms of the GNU General Public License as published by        #
> -# the Free Software Foundation, either version 3 of the License, or           #
> -# (at your option) any later version.                                         #
> -#                                                                             #
> -# This program is distributed in the hope that it will be useful,             #
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
> -# GNU General Public License for more details.                                #
> -#                                                                             #
> -# You should have received a copy of the GNU General Public License           #
> -# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
> -#                                                                             #
> -###############################################################################
> -
> -my %net=();
> -my %ovpnconfig=();
> -my @serverconf=();
> -my $greennet;
> -my $greensubnet;
> -my $running='off';
> -
> -require '/var/ipfire/general-functions.pl';
> -unless (-d "${General::swroot}/ovpn/ccd") { system("mkdir ${General::swroot}/ovpn/ccd"); }
> -system ("chown nobody.nobody ${General::swroot}/ovpn/ccd");
> -if ( -e "/var/run/openvpn.pid"){
> -	$running='on';
> -	system('/usr/local/bin/openvpnctrl', '-k');
> -}
> -
> -&General::readhash("/var/ipfire/ethernet/settings", \%net);
> -	$greennet=$net{'GREEN_NETADDRESS'};
> -	$greensubnet=$net{'GREEN_NETMASK'};
> -open(FILE,"/var/ipfire/ovpn/server.conf");
> -				while (<FILE>) {
> -					$_=~s/\s*$//g;
> -					if ($_ ne "route $greennet $greensubnet"){
> -						push (@serverconf,$_."\n");
> -					}else{
> -						print"\nFound ROUTE >>route $greennet $greensubnet<< in server.conf.. Deleted!";
> -					}
> -				}
> -
> -&General::readhasharray("/var/ipfire/ovpn/ovpnconfig", \%ovpnconfig);
> -foreach my $key (keys %ovpnconfig){
> -	if($ovpnconfig{$key}[32] eq '' && $ovpnconfig{$key}[3] eq 'host'){
> -		$ovpnconfig{$key}[2] =~ s/ /_/gi;
> -		open ( CCDRWCONF,'>',"/var/ipfire/ovpn/ccd/$ovpnconfig{$key}[2]") or die "Unable to create clientconfigfile $!";
> -		print CCDRWCONF "# OpenVPN Clientconfig from CCD extension by Copymaster#\n\n";
> -		print CCDRWCONF "#This client uses the dynamic pool\n\n";
> -		print CCDRWCONF "\n#Client gets routes to these Networks (behind IPFIRE)\n";
> -		print CCDRWCONF "push \"route $greennet $greensubnet\"\n";
> -		close CCDRWCONF;
> -		print"Client $ovpnconfig{$key}[2] converted! \n";
> -	}else{
> -		print "Client $ovpnconfig{$key}[2] NOT converted!\n";
> -	}
> -	$ovpnconfig{$key}[32] = 'dynamic' if ($ovpnconfig{$key}[32] eq '');
> -}
> -&General::writehasharray("/var/ipfire/ovpn/ovpnconfig", \%ovpnconfig);
> -if ($running eq 'on')
> -{
> -	system('/usr/local/bin/openvpnctrl', '-s');
> -}
> -system ("chown nobody:nobody /var/ipfire/ovpn/ccd/*");
  
Michael Tremer March 21, 2022, 8:55 a.m. UTC | #2
Thank you for keeping IPFire a tidy place :)

> On 19 Mar 2022, at 16:35, Peter Müller <peter.mueller@ipfire.org> wrote:
> 
> This script appeared in the rootfiles for Core Updates 65 and 66, being
> released in late 2012 and early 2013. It is not used elsewhere, and
> there is no sense in keeping it around on IPFire installations.
> 
> Should this patch be accepted, a corresponding 'rm' statement is
> necessary in the update.sh script of the Core Update it will go into.
> 
> Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
> ---
> config/rootfiles/common/aarch64/stage2 |  1 -
> config/rootfiles/common/armv6l/stage2  |  1 -
> config/rootfiles/common/x86_64/stage2  |  1 -
> lfs/stage2                             |  1 -
> src/scripts/ovpn-ccd-convert           | 71 --------------------------
> 5 files changed, 75 deletions(-)
> delete mode 100644 src/scripts/ovpn-ccd-convert
> 
> diff --git a/config/rootfiles/common/aarch64/stage2 b/config/rootfiles/common/aarch64/stage2
> index d8dc12a7f..e7eae625c 100644
> --- a/config/rootfiles/common/aarch64/stage2
> +++ b/config/rootfiles/common/aarch64/stage2
> @@ -131,7 +131,6 @@ usr/local/bin/update-location-database
> #usr/local/src
> #usr/sbin
> usr/sbin/openvpn-metrics
> -usr/sbin/ovpn-ccd-convert
> #usr/share
> #usr/share/doc
> #usr/share/doc/licenses
> diff --git a/config/rootfiles/common/armv6l/stage2 b/config/rootfiles/common/armv6l/stage2
> index 42ce447d1..670a99927 100644
> --- a/config/rootfiles/common/armv6l/stage2
> +++ b/config/rootfiles/common/armv6l/stage2
> @@ -129,7 +129,6 @@ usr/local/bin/update-location-database
> #usr/local/src
> #usr/sbin
> usr/sbin/openvpn-metrics
> -usr/sbin/ovpn-ccd-convert
> #usr/share
> #usr/share/doc
> #usr/share/doc/licenses
> diff --git a/config/rootfiles/common/x86_64/stage2 b/config/rootfiles/common/x86_64/stage2
> index 70e6c6e75..d07c264b4 100644
> --- a/config/rootfiles/common/x86_64/stage2
> +++ b/config/rootfiles/common/x86_64/stage2
> @@ -131,7 +131,6 @@ usr/local/bin/update-location-database
> #usr/local/src
> #usr/sbin
> usr/sbin/openvpn-metrics
> -usr/sbin/ovpn-ccd-convert
> #usr/share
> #usr/share/doc
> #usr/share/doc/licenses
> diff --git a/lfs/stage2 b/lfs/stage2
> index 356060a1f..6582a0c1a 100644
> --- a/lfs/stage2
> +++ b/lfs/stage2
> @@ -113,7 +113,6 @@ endif
> 
> 	# Move script to correct place.
> 	mv -vf /usr/local/bin/openvpn-metrics /usr/sbin/
> -	mv -vf /usr/local/bin/ovpn-ccd-convert /usr/sbin/
> 	mv -vf /usr/local/bin/captive-cleanup /usr/bin/
> 
> 	# Install firewall scripts.
> diff --git a/src/scripts/ovpn-ccd-convert b/src/scripts/ovpn-ccd-convert
> deleted file mode 100644
> index 05339af78..000000000
> --- a/src/scripts/ovpn-ccd-convert
> +++ /dev/null
> @@ -1,71 +0,0 @@
> -#!/usr/bin/perl
> -###############################################################################
> -#                                                                             #
> -# IPFire.org - A linux based firewall                                         #
> -# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
> -#                                                                             #
> -# This program is free software: you can redistribute it and/or modify        #
> -# it under the terms of the GNU General Public License as published by        #
> -# the Free Software Foundation, either version 3 of the License, or           #
> -# (at your option) any later version.                                         #
> -#                                                                             #
> -# This program is distributed in the hope that it will be useful,             #
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
> -# GNU General Public License for more details.                                #
> -#                                                                             #
> -# You should have received a copy of the GNU General Public License           #
> -# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
> -#                                                                             #
> -###############################################################################
> -
> -my %net=();
> -my %ovpnconfig=();
> -my @serverconf=();
> -my $greennet;
> -my $greensubnet;
> -my $running='off';
> -
> -require '/var/ipfire/general-functions.pl';
> -unless (-d "${General::swroot}/ovpn/ccd") { system("mkdir ${General::swroot}/ovpn/ccd"); }
> -system ("chown nobody.nobody ${General::swroot}/ovpn/ccd");
> -if ( -e "/var/run/openvpn.pid"){
> -	$running='on';
> -	system('/usr/local/bin/openvpnctrl', '-k');
> -}
> -
> -&General::readhash("/var/ipfire/ethernet/settings", \%net);
> -	$greennet=$net{'GREEN_NETADDRESS'};
> -	$greensubnet=$net{'GREEN_NETMASK'};
> -open(FILE,"/var/ipfire/ovpn/server.conf");
> -				while (<FILE>) {
> -					$_=~s/\s*$//g;
> -					if ($_ ne "route $greennet $greensubnet"){
> -						push (@serverconf,$_."\n");
> -					}else{
> -						print"\nFound ROUTE >>route $greennet $greensubnet<< in server.conf.. Deleted!";
> -					}
> -				}
> -
> -&General::readhasharray("/var/ipfire/ovpn/ovpnconfig", \%ovpnconfig);
> -foreach my $key (keys %ovpnconfig){
> -	if($ovpnconfig{$key}[32] eq '' && $ovpnconfig{$key}[3] eq 'host'){
> -		$ovpnconfig{$key}[2] =~ s/ /_/gi;
> -		open ( CCDRWCONF,'>',"/var/ipfire/ovpn/ccd/$ovpnconfig{$key}[2]") or die "Unable to create clientconfigfile $!";
> -		print CCDRWCONF "# OpenVPN Clientconfig from CCD extension by Copymaster#\n\n";
> -		print CCDRWCONF "#This client uses the dynamic pool\n\n";
> -		print CCDRWCONF "\n#Client gets routes to these Networks (behind IPFIRE)\n";
> -		print CCDRWCONF "push \"route $greennet $greensubnet\"\n";
> -		close CCDRWCONF;
> -		print"Client $ovpnconfig{$key}[2] converted! \n";
> -	}else{
> -		print "Client $ovpnconfig{$key}[2] NOT converted!\n";
> -	}
> -	$ovpnconfig{$key}[32] = 'dynamic' if ($ovpnconfig{$key}[32] eq '');
> -}
> -&General::writehasharray("/var/ipfire/ovpn/ovpnconfig", \%ovpnconfig);
> -if ($running eq 'on')
> -{
> -	system('/usr/local/bin/openvpnctrl', '-s');
> -}
> -system ("chown nobody:nobody /var/ipfire/ovpn/ccd/*");
> -- 
> 2.34.1
  

Patch

diff --git a/config/rootfiles/common/aarch64/stage2 b/config/rootfiles/common/aarch64/stage2
index d8dc12a7f..e7eae625c 100644
--- a/config/rootfiles/common/aarch64/stage2
+++ b/config/rootfiles/common/aarch64/stage2
@@ -131,7 +131,6 @@  usr/local/bin/update-location-database
 #usr/local/src
 #usr/sbin
 usr/sbin/openvpn-metrics
-usr/sbin/ovpn-ccd-convert
 #usr/share
 #usr/share/doc
 #usr/share/doc/licenses
diff --git a/config/rootfiles/common/armv6l/stage2 b/config/rootfiles/common/armv6l/stage2
index 42ce447d1..670a99927 100644
--- a/config/rootfiles/common/armv6l/stage2
+++ b/config/rootfiles/common/armv6l/stage2
@@ -129,7 +129,6 @@  usr/local/bin/update-location-database
 #usr/local/src
 #usr/sbin
 usr/sbin/openvpn-metrics
-usr/sbin/ovpn-ccd-convert
 #usr/share
 #usr/share/doc
 #usr/share/doc/licenses
diff --git a/config/rootfiles/common/x86_64/stage2 b/config/rootfiles/common/x86_64/stage2
index 70e6c6e75..d07c264b4 100644
--- a/config/rootfiles/common/x86_64/stage2
+++ b/config/rootfiles/common/x86_64/stage2
@@ -131,7 +131,6 @@  usr/local/bin/update-location-database
 #usr/local/src
 #usr/sbin
 usr/sbin/openvpn-metrics
-usr/sbin/ovpn-ccd-convert
 #usr/share
 #usr/share/doc
 #usr/share/doc/licenses
diff --git a/lfs/stage2 b/lfs/stage2
index 356060a1f..6582a0c1a 100644
--- a/lfs/stage2
+++ b/lfs/stage2
@@ -113,7 +113,6 @@  endif
 
 	# Move script to correct place.
 	mv -vf /usr/local/bin/openvpn-metrics /usr/sbin/
-	mv -vf /usr/local/bin/ovpn-ccd-convert /usr/sbin/
 	mv -vf /usr/local/bin/captive-cleanup /usr/bin/
 
 	# Install firewall scripts.
diff --git a/src/scripts/ovpn-ccd-convert b/src/scripts/ovpn-ccd-convert
deleted file mode 100644
index 05339af78..000000000
--- a/src/scripts/ovpn-ccd-convert
+++ /dev/null
@@ -1,71 +0,0 @@ 
-#!/usr/bin/perl
-###############################################################################
-#                                                                             #
-# IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
-#                                                                             #
-# This program is free software: you can redistribute it and/or modify        #
-# it under the terms of the GNU General Public License as published by        #
-# the Free Software Foundation, either version 3 of the License, or           #
-# (at your option) any later version.                                         #
-#                                                                             #
-# This program is distributed in the hope that it will be useful,             #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
-# GNU General Public License for more details.                                #
-#                                                                             #
-# You should have received a copy of the GNU General Public License           #
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
-#                                                                             #
-###############################################################################
-
-my %net=();
-my %ovpnconfig=();
-my @serverconf=();
-my $greennet;
-my $greensubnet;
-my $running='off';
-
-require '/var/ipfire/general-functions.pl';
-unless (-d "${General::swroot}/ovpn/ccd") { system("mkdir ${General::swroot}/ovpn/ccd"); }
-system ("chown nobody.nobody ${General::swroot}/ovpn/ccd");
-if ( -e "/var/run/openvpn.pid"){
-	$running='on';
-	system('/usr/local/bin/openvpnctrl', '-k');
-}
-
-&General::readhash("/var/ipfire/ethernet/settings", \%net);
-	$greennet=$net{'GREEN_NETADDRESS'};
-	$greensubnet=$net{'GREEN_NETMASK'};
-open(FILE,"/var/ipfire/ovpn/server.conf");
-				while (<FILE>) {
-					$_=~s/\s*$//g;
-					if ($_ ne "route $greennet $greensubnet"){
-						push (@serverconf,$_."\n");
-					}else{
-						print"\nFound ROUTE >>route $greennet $greensubnet<< in server.conf.. Deleted!";
-					}
-				}
-
-&General::readhasharray("/var/ipfire/ovpn/ovpnconfig", \%ovpnconfig);
-foreach my $key (keys %ovpnconfig){
-	if($ovpnconfig{$key}[32] eq '' && $ovpnconfig{$key}[3] eq 'host'){
-		$ovpnconfig{$key}[2] =~ s/ /_/gi;
-		open ( CCDRWCONF,'>',"/var/ipfire/ovpn/ccd/$ovpnconfig{$key}[2]") or die "Unable to create clientconfigfile $!";
-		print CCDRWCONF "# OpenVPN Clientconfig from CCD extension by Copymaster#\n\n";
-		print CCDRWCONF "#This client uses the dynamic pool\n\n";
-		print CCDRWCONF "\n#Client gets routes to these Networks (behind IPFIRE)\n";
-		print CCDRWCONF "push \"route $greennet $greensubnet\"\n";
-		close CCDRWCONF;
-		print"Client $ovpnconfig{$key}[2] converted! \n";
-	}else{
-		print "Client $ovpnconfig{$key}[2] NOT converted!\n";
-	}
-	$ovpnconfig{$key}[32] = 'dynamic' if ($ovpnconfig{$key}[32] eq '');
-}
-&General::writehasharray("/var/ipfire/ovpn/ovpnconfig", \%ovpnconfig);
-if ($running eq 'on')
-{
-	system('/usr/local/bin/openvpnctrl', '-s');
-}
-system ("chown nobody:nobody /var/ipfire/ovpn/ccd/*");