]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/scripts/convert-ovpn
3 ###############################################################################
5 # IPFire.org - A linux based firewall #
6 # Copyright (C) 2013 Alexander Marx <amarx@ipfire.org> #
8 # This program is free software: you can redistribute it and/or modify #
9 # it under the terms of the GNU General Public License as published by #
10 # the Free Software Foundation, either version 3 of the License, or #
11 # (at your option) any later version. #
13 # This program is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU General Public License for more details. #
18 # You should have received a copy of the GNU General Public License #
19 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
21 ###############################################################################
23 # This script converts old openvpn ccd files with underscore #
24 # to files with spaces to make them working with openvpn 2.3 again #
25 # STEP1: read ovpnconfig and verify cert names #
26 # STEP2: if neccessary convert ccd file #
28 ###############################################################################
30 require '/var/ipfire/general-functions.pl';
33 my $ccdpath="/var/ipfire/ovpn/ccd/";
34 my $ovpnconfig="/var/ipfire/ovpn/ovpnconfig";
36 &General
::readhasharray
($ovpnconfig,\
%configovpn);
41 print "Converting CCD files...\n";
44 foreach my $key (sort keys %configovpn){
45 # Skip everything else but roadwarrior connections.
46 next if ($configovpn{$key}[3] ne 'host');
48 # Skip all connections with no space in the CN name.
49 next if ($configovpn{$key}[2] !~ " ");
51 my $ccdname = $configovpn{$key}[2];
54 # Rename the CCD file if one with the old format exists.
56 print " Renaming $ccdname -> $configovpn{$key}[2]...\n";
57 rename($ccdname, $configovpn{$key}[2]);