function openvpn_resync_gwgroup($gwgroupname = "") { global $config; if (!empty($gwgroupname)) { if (isset($config['openvpn']['openvpn-server'])) { foreach ($config['openvpn']['openvpn-server'] as &$settings) { if ($gwgroupname == $settings['interface']) { log_error("Resyncing OpenVPN for gateway group " . $gwgroupname . " server " . $settings["description"] . "."); openvpn_resync('server', $settings); } } } if (isset($config['openvpn']['openvpn-client'])) { foreach ($config['openvpn']['openvpn-client'] as &$settings) { if ($gwgroupname == $settings['interface']) { log_error("Resyncing OpenVPN for gateway group " . $gwgroupname . " client " . $settings["description"] . "."); openvpn_resync('client', $settings); } } } // Note: no need to resysnc Client Specific (csc) here, as changes to the OpenVPN real interface do not effect these. } else { log_error("openvpn_resync_gwgroup called with null gwgroup parameter."); } }
if (isset($pconfig['mode']) && $pconfig['mode'] == "server_tls_user" && isset($server['strictusercn'])) { $server['strictusercn'] = $pconfig['strictusercn']; } } else { $server['shared_key'] = base64_encode($pconfig['shared_key']); } if (isset($_POST['duplicate_cn']) && $_POST['duplicate_cn'] == "yes") { $server['duplicate_cn'] = true; } // update or add to config if (isset($id) && $a_server[$id]) { $a_server[$id] = $server; } else { $a_server[] = $server; } openvpn_resync('server', $server); write_config(); header("Location: vpn_openvpn_server.php"); exit; } elseif (!empty($pconfig['authmode'])) { $pconfig['authmode'] = implode(",", $pconfig['authmode']); } } } $pgtitle = array(gettext("OpenVPN"), gettext("Server")); $shortcut_section = "openvpn"; include "head.inc"; $main_buttons = array(array('href' => 'vpn_openvpn_server.php?act=new', 'label' => gettext("add server"))); legacy_html_escape_form_data($pconfig); ?>
$client['certref'] = $pconfig['certref']; if (!empty($pconfig['tlsauth_enable'])) { if (!empty($pconfig['autotls_enable'])) { $pconfig['tls'] = openvpn_create_key(); } $client['tls'] = base64_encode($pconfig['tls']); } } else { $client['shared_key'] = base64_encode($pconfig['shared_key']); } if (isset($id) && isset($a_client[$id])) { $a_client[$id] = $client; } else { $a_client[] = $client; } openvpn_resync('client', $client); write_config(); header("Location: vpn_openvpn_client.php"); exit; } } } // escape form output before processing legacy_html_escape_form_data($pconfig); include "head.inc"; $main_buttons = array(array('href' => 'vpn_openvpn_client.php?act=new', 'label' => gettext("add client"))); ?> <body> <?php include "fbegin.inc";