diff options
author | Ermal Luçi <eri@pfsense.org> | 2008-04-08 16:38:18 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2008-04-08 16:38:18 +0000 |
commit | e5d09d31ee7d5293084654d4ebf83a644271bdec (patch) | |
tree | 4bbfb1dc01e8465bc455d4da58a98db9c96e0f27 /etc/inc/config.inc | |
parent | fdd725f0ee892cb55db8712084d7219430dc8359 (diff) | |
download | pfsense-e5d09d31ee7d5293084654d4ebf83a644271bdec.zip pfsense-e5d09d31ee7d5293084654d4ebf83a644271bdec.tar.gz |
Convert old openvpn server configs to new the new config way.
Diffstat (limited to 'etc/inc/config.inc')
-rw-r--r-- | etc/inc/config.inc | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index 000d4c3..59a6136 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -1139,7 +1139,7 @@ function convert_config() { } /* Convert 4.1 -> 4.2 */ - if ($config['version'] <= 4.0) { + if ($config['version'] <= 4.1) { if (isset($config['shaper'])) unset($config['shaper']); if (isset($config['ezshaper'])) @@ -1149,7 +1149,7 @@ function convert_config() { } /* Convert 4.2 -> 4.3 */ - if ($config['version'] <= 4.1) { + if ($config['version'] <= 4.2) { /* migrate old interface gateway to the new gateways config */ $old_gateways = array(); $gateways = array(); @@ -1168,8 +1168,56 @@ function convert_config() { $i++; } } + $config['version'] = "4.3"; } + /* Convert 4.3 -> 4.4 */ + if ($config['version'] <= 4.3) { + if (isset($config['installedpackages']["openvpn$mode"]['config'])) { + $ocfg =& $config['installedpackages']['openvpnserver']['config']; + if (!isset($config['openvpn'])) + $config['openvpn'] = array(); + if (!isset($config['openvpn']['keys'])) + $config['openvpn']['keys'] = array(); + $ncfg =& $config['openvpn']['keys']; + foreach ($ocfg as $id => $cfg) { + if ($cfg['auth_method'] == 'shared_key') { + $ncfg["converted{$id}"]['shared.key'] = $cfg['shared_key']; + $ncfg["converted{$id}"]['existing'] = "yes"; + $ncfg["converted{$id}"]['auth_method'] = "shared_key"; + $ocfg['cipher'] = "converted{$id}"; + unset($ocfg['shared_key']); + } else { + if (isset($ocfg['ca_cert'])) { + $ncfg["converted{$id}"]['ca.crt'] = $ocfg['ca_cert']; + unset($ocfg['ca_cert']); + } + if (isset($ocfg['server_cert'])) { + $ncfg["converted{$id}"]['server.crt'] = $ocfg['server_cert']; + unset($ocfg['server_cert']); + } + if (isset($ocfg['server_key'])) { + $ncfg["converted{$id}"]['server.key'] = $ocfg['server_key']; + unset($ocfg['ca_cert']); + } + if (isset($ocfg['dh_params'])) { + $ncfg["converted{$id}"]['dh_params.dh'] = $ocfg['dh_params']; + unset($ocfg['dh_params']); + } + if (isset($ocfg['crl'])) { + $ncfg["converted{$id}"]['crl'] = $ocfg['crl']; + unset($ocfg['crl']); + } + $ncfg["converted{$id}"]['existing'] = "yes"; + $ocfg['cipher'] = "converted{$id}"; + } + + } + } + $config['version'] = "4.4"; + } + + if ($prev_version != $config['version']) write_config("Upgraded config version level from {$prev_version} to {$config['version']}"); } |