ip2ulong($pconfig['serverbridge_dhcp_end'])) { $input_errors[] = gettext("The Server Bridge DHCP range is invalid (start higher than end)."); } } do_input_validation($pconfig, $reqdfields, $reqdfieldsn, $input_errors); if (count($input_errors) == 0) { // validation correct, save data $server = array(); // delete(rename) old interface so a new TUN or TAP interface can be created. if (isset($id) && $pconfig['dev_mode'] <> $a_server[$id]['dev_mode']) { openvpn_delete('server', $a_server[$id]); } // 1 on 1 copy of config attributes $copy_fields = "mode,protocol,dev_mode,local_port,description,crypto,digest,engine ,tunnel_network,tunnel_networkv6,remote_network,remote_networkv6 ,gwredir,local_network,local_networkv6,maxclients,compression ,passtos,client2client,dynamic_ip,pool_enable,topology_subnet ,serverbridge_dhcp,serverbridge_interface,serverbridge_dhcp_start ,serverbridge_dhcp_end,dns_domain,dns_server1,dns_server2,dns_server3 ,dns_server4,push_register_dns,ntp_server1,ntp_server2,netbios_enable ,netbios_ntype,netbios_scope,no_tun_ipv6,verbosity_level,wins_server1 ,wins_server2,client_mgmt_port,strictusercn"; foreach (explode(",", $copy_fields) as $fieldname) { $fieldname = trim($fieldname); if (!empty($pconfig[$fieldname])) { $server[$fieldname] = $pconfig[$fieldname]; } } // attributes containing some kind of logic if ($vpnid != 0) { $server['vpnid'] = $vpnid; } else { $server['vpnid'] = openvpn_vpnid_next(); } if ($pconfig['disable'] == "yes") { $server['disable'] = true; } if (!empty($pconfig['authmode'])) { $server['authmode'] = implode(",", $pconfig['authmode']); } if (strpos($pconfig['interface'], "|") !== false) { list($server['interface'], $server['ipaddr']) = explode("|", $pconfig['interface']); } else { $server['interface'] = $pconfig['interface']; } $server['custom_options'] = str_replace("\r\n", "\n", $pconfig['custom_options']); if ($tls_mode) { if ($pconfig['tlsauth_enable']) { if (!empty($pconfig['autotls_enable'])) { $pconfig['tls'] = openvpn_create_key(); } $server['tls'] = base64_encode($pconfig['tls']); } foreach (array("caref","crlref", "certref","dh_length","cert_depth") as $cpKey) { if (isset($pconfig[$cpKey])) { $server[$cpKey] = $pconfig[$cpKey]; } } 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); ?>
0) { print_input_errors($input_errors); } if (isset($savemsg)) { print_info_box_np($savemsg); } ?>
/>

onclick="tlsauth_change()" /> .
onclick="autotls_change()" /> .
.

.

.

.
onclick="autokey_change()" /> .
.
/>
onchange="tuntap_change()" />

onclick="gwredir_change()" />
/>
/>
/>
/>
/>
/>
/>
onclick="dns_domain_change()" />
onclick="dns_server_change()" />
#1:  #2:  #3:  #4: 
/>
onclick="ntp_server_change()" />
#1:  #2: 
onclick="netbios_change()" />
onclick="wins_server_change()" />
#1:  #2: 
onclick="client_mgmt_port_change()" />

  " />
/ " class="btn btn-default btn-xs"> " class="act_delete btn btn-default btn-xs">