Changeset a35989d
- Timestamp:
- 09/26/17 17:02:09 (8 years ago)
- Branches:
- master, perl-5.22
- Children:
- 0b780b4
- Parents:
- 07ead96
- Location:
- npl/syn3/webint/src/vpn
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
npl/syn3/webint/src/vpn/autoconf_syn3.php
r07ead96 ra35989d 1 1 <? 2 /* 2 /* 3 3 (C) 2004-2013 DatuX - info@datux.nl 4 4 … … 23 23 ?> 24 24 25 <? 25 <? 26 26 /* 27 27 Redirection verhaal met betrekking tot auto configure: … … 33 33 testtunnel instellingen testen 34 34 listtunnels.php klaar :D 35 35 36 36 */ 37 37 $name=$_REQUEST[name]; … … 39 39 $passwd=$_REQUEST[passwd]; 40 40 41 Title(_AutoVPNConfig($name)); 42 41 Title(_AutoVPNConfig($name)); 42 43 43 //read tunnel 44 44 $tunnel=vpn_ReadTunnel($name); … … 52 52 $remote_par.="&new_right=$tunnel[leftid]"; 53 53 $remote_par.="&new_rightsubnet=$tunnel[leftsubnet]"; 54 54 55 if ($tunnel[compress]=='yes') 55 56 $remote_par.="&new_compress=on"; 56 57 else 57 58 $remote_par.="&new_compress=off"; 59 60 if ($tunnel[ikev2]=='insist') 61 $remote_par.="&new_ikev2=on"; 62 else 63 $remote_par.="&new_ikev2=off"; 64 65 66 if ($tunnel[pfs]=='yes') 67 $remote_par.="&new_pfs=on"; 68 else 69 $remote_par.="&new_pfs=off"; 70 58 71 $remote_par.="&new_authby=$tunnel[authby]"; 59 72 $remote_par.="&new_rightrsasigkey=".rawurlencode(vpn_ReadPubKey()); 60 73 $remote_par.="&new_secret=".rawurlencode($secret); 61 74 62 75 // url aan ONZE kant, waar pubkey andere kant uiteindelijk heen moet 63 76 $remote_par.="&puburi=".rawurlencode("https://$_SERVER[HTTP_HOST]/vpn/edittunnel.php?name=$name&save=1"); 64 77 65 78 // jump naar de tunnel config aan de andere kant 66 79 Redirect("https://$ip:10000/vpn/edittunnel.php?$remote_par"); 67 68 69 -
npl/syn3/webint/src/vpn/edittunnel.php
r07ead96 ra35989d 28 28 Title(_VPNtunnelSettings($name)); 29 29 30 //default settings 30 31 $new_pfs="on"; 32 $new_ikev2="off"; 33 $new_leftsourceip=GetFirstLanIp(); 31 34 32 35 //read current configuration … … 38 41 $new_leftid=$tunnel[leftid]; 39 42 $new_rightsubnet=$tunnel[rightsubnet]; 43 $new_leftsourceip=$tunnel[leftsourceip]; 40 44 $new_authby=$tunnel[authby]; 41 45 $new_right=$tunnel[right]; … … 52 56 $new_pfs="off"; 53 57 58 if ($tunnel[ikev2]=='insist') 59 $new_ikev2="on"; 60 else 61 $new_ikev2="off"; 54 62 } 55 63 … … 60 68 if (!vpn_ValidName($new_name)) 61 69 $errors[new_name]=_EnterValidName(); 62 elseif (!ValidIp($new_leftid) )70 elseif (!ValidIp($new_leftid) && !ValidHostname($new_leftid)) 63 71 $errors[new_leftid]=_EnterValidIp(); 64 72 elseif (!ValidSubnet($new_leftsubnet)) 65 73 $errors[new_leftsubnet]=_EnterValidSubnet(); 66 elseif (!ValidIp($new_right) )74 elseif (!ValidIp($new_right) && !ValidHostname($new_right)) 67 75 $errors[new_right]=_EnterValidIp(); 68 76 elseif (!ValidSubnet($new_rightsubnet)) … … 89 97 ) 90 98 $errors[new_secret]=_EnterValidPassword(); 99 elseif ($new_leftsourceip && !ValidIp($new_leftsourceip)) 100 $errors[new_leftsourceip]=_EnterValidIp(); 91 101 92 102 … … 104 114 $tunnel[rightsubnet]=$new_rightsubnet; 105 115 $tunnel[right]=$new_right; 106 $tunnel[rightrsasigkey]=vpn_ReadableToPub($new_rightrsasigkey); 116 117 $rightrsasigkey=vpn_ReadableToPub($new_rightrsasigkey); 118 if ($rightrsasigkey) 119 { 120 $tunnel[rightrsasigkey]=$rightrsasigkey; 121 } 122 else 123 { 124 unset($tunnel[rightrsasigkey]); 125 } 126 107 127 if ($new_compress=="on") 108 128 $tunnel[compress]='yes'; … … 118 138 else 119 139 $tunnel[pfs]="no"; 140 141 if ($new_ikev2=='on') 142 $tunnel[ikev2]="insist"; 143 else 144 $tunnel[ikev2]="never"; 145 146 if ($new_leftsourceip) 147 $tunnel[leftsourceip]=$new_leftsourceip; 148 else 149 unset($tunnel[leftsourceip]); 120 150 121 151 vpn_WriteTunnel($new_name,$tunnel); … … 208 238 209 239 <p> 240 IKE v2: 241 <?InputCheckBox("new_ikev2",$errors);?> 242 243 244 <p> 245 Source IP: 246 <?InputText("new_leftsourceip",$errors);?> 247 248 <p> 210 249 <table> 211 250 <tr> -
npl/syn3/webint/src/vpn/listtunnels.php
r07ead96 ra35989d 30 30 <? Title(_VPNTunnels()); ?> 31 31 32 <? Head($errors,'', 10); ?>32 <? Head($errors,'',60); ?> 33 33 34 34 <h1><?=$TITLE?></h1> … … 50 50 $status=vpn_GetStatus(); 51 51 52 // echo "<pre>";print_r($status);52 // echo "<pre>TEST ";print_r($status); 53 53 54 54 $untested=0; … … 65 65 { 66 66 //status NOT ok? 67 if ($status[$name][state] != "STATE_QUICK_I2" && $status[$name][state] != "STATE_QUICK_R2" )67 if ($status[$name][state] != "STATE_QUICK_I2" && $status[$name][state] != "STATE_QUICK_R2" && $status[$name][state] != "STATE_V2_IPSEC_R" && $status[$name][state] != "STATE_V2_IPSEC_I") 68 68 LinkDefault("testtunnel.php?name=$name&mode=down", _Started(), "<img src='../img/CAUTION.gif'>",_ConfirmDisable($name)); 69 69 else -
npl/syn3/webint/src/vpn/openswan.php
r07ead96 ra35989d 43 43 return false; //return ok-code 44 44 45 // global $VPN_STARTERRORS;46 45 vpn_Stop(); 47 // LogInfo(_LogVPNStarting());48 46 SvcUp("ipsec"); 49 // FileWriteRaw("/etc/sysconfig/pluto_updown", "DEFAULTSOURCE=".GetFirstLanIp()."\n");50 // Cmd("pgrphack closefd /usr/sbin/ipsec setup start |grep 'FATAL:' 1>&2",'',$out,$err);51 52 // if ($err)53 // {54 // FileWrite($VPN_STARTERRORS,$err);55 // LogError(_LogVPNstartErrors(implode(" ",$err)));56 // return ($err);57 // }58 // else59 // {60 // FileWrite($VPN_STARTERRORS,'');61 // sleep(2); //wacht zodat VPN subsysteem up is62 // //kijk of er tunnels up moeten63 // $tunnels=vpn_ReadTunnels();64 // foreach ($tunnels as $name=>$conf)65 // {66 // //hij moet up zijn, EN hij is reeds getest67 // if ((!vpn_TunnelIsDownOnBoot($name)) && vpn_TunnelIsTested($name))68 // vpn_TunnelUp($name);69 // }70 // return false;71 // }72 47 } 73 48 … … 307 282 foreach ($raw as $line) 308 283 { 309 if (preg_match("/^[^a-z ]*([a-z]*)=(.*)$/",$line,$matches))284 if (preg_match("/^[^a-z-0-9]*([a-z0-9]*)=(.*)$/",$line,$matches)) 310 285 $ret[$matches[1]]=$matches[2]; 311 286 } … … 435 410 global $VPN_PRIO; 436 411 437 if (Cmd("ipsec whack --status",'',$output) !=0)412 if (Cmd("ipsec whack --status",'',$output)<0) 438 413 { 439 414 LogError("Error reading ipsec status. Please check if ipsec-service is running"); … … 444 419 foreach ($output as $line) 445 420 { 446 if (preg_match('/^.*#([0-9])*:.*"(.*?)"[:0-9]* ([A-Z0-9_]+) /',$line,$matches))421 if (preg_match('/^.*#([0-9])*:.*"(.*?)"[:0-9]* ([A-Z0-9_]+) /',$line,$matches)) 447 422 { 448 423 $nr=$matches[1];
Note: See TracChangeset
for help on using the changeset viewer.