Beispiel #1
0
 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\n\t\t\t\t\t\t,tunnel_network,tunnel_networkv6,remote_network,remote_networkv6\n\t\t\t\t\t\t,gwredir,local_network,local_networkv6,maxclients,compression\n\t\t\t\t\t\t,passtos,client2client,dynamic_ip,pool_enable,topology_subnet\n\t\t\t\t\t\t,serverbridge_dhcp,serverbridge_interface,serverbridge_dhcp_start\n\t\t\t\t\t\t,serverbridge_dhcp_end,dns_domain,dns_server1,dns_server2,dns_server3\n\t\t\t\t\t\t,dns_server4,push_register_dns,ntp_server1,ntp_server2,netbios_enable\n\t\t\t\t\t\t,netbios_ntype,netbios_scope,no_tun_ipv6,verbosity_level,wins_server1\n\t\t\t\t\t\t,wins_server2,client_mgmt_port";
 foreach (explode(",", $copy_fields) as $fieldname) {
     $fieldname = trim($fieldname);
     if (isset($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']);
 }
 $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();
Beispiel #2
0
 if (count($input_errors) == 0) {
     // save data
     $client = array();
     // 1 on 1 copy of config attributes
     $copy_fields = "auth_user,auth_pass,protocol,dev_mode,local_port\n\t\t\t\t\t,server_addr,server_port,resolve_retry,proxy_addr,proxy_port\n\t\t\t\t\t,proxy_authtype,proxy_user,proxy_passwd,description,mode,crypto,digest\n\t\t\t\t\t,engine,tunnel_network,tunnel_networkv6,remote_network,remote_networkv6\n\t\t\t\t\t,use_shaper,compression,passtos,no_tun_ipv6,route_no_pull,route_no_exec\n\t\t\t\t\t,verbosity_level,interface";
     foreach (explode(",", $copy_fields) as $fieldname) {
         $fieldname = trim($fieldname);
         if (!empty($pconfig[$fieldname])) {
             $client[$fieldname] = $pconfig[$fieldname];
         }
     }
     // attributes containing some kind of logic
     if ($vpnid) {
         $client['vpnid'] = $vpnid;
     } else {
         $client['vpnid'] = openvpn_vpnid_next();
     }
     if (isset($pconfig['disable']) && $pconfig['disable'] == "yes") {
         $client['disable'] = true;
     }
     if (strpos($pconfig['interface'], "|") !== false) {
         list($client['interface'], $client['ipaddr']) = explode("|", $pconfig['interface']);
     }
     $client['custom_options'] = str_replace("\r\n", "\n", $pconfig['custom_options']);
     if ($tls_mode) {
         $client['caref'] = $pconfig['caref'];
         $client['certref'] = $pconfig['certref'];
         if (!empty($pconfig['tlsauth_enable'])) {
             if (!empty($pconfig['autotls_enable'])) {
                 $pconfig['tls'] = openvpn_create_key();
             }