openconnect-gui icon indicating copy to clipboard operation
openconnect-gui copied to clipboard

Update for vpnc-script.js

Open afl1 opened this issue 9 years ago • 7 comments

Following fixies and new features in update:

  • fixed routing when host ip address is first from subnet;
  • added routes for DNS a WINS server;
  • added VPN domain to DNS suffix search list;
  • added connection-specific DNS suffix for vPN tunnel interface;
  • added complete clean-up after disconnect;

vpnc-script.js.txt

afl1 avatar Mar 10 '16 20:03 afl1

@afl1 could you add this as a pull request?

nmav avatar Mar 10 '16 22:03 nmav

OK

afl1 avatar Mar 10 '16 22:03 afl1

Hi @afl1 pls. create a commit with your file (attached here) and create a pull request agains right branch (devel -> devel OR master -> master), depending where u start comimting your changes, thanks in advance.

horar avatar Mar 10 '16 22:03 horar

Just a suggestion: you might want to capture STDERR in addition to STDOUT in the 'exec' subroutine. ws.Run("cmd.exe /c " +cmd+" 2>&1 > " + tmpdir + "vpnc.out", 0, true);

Also, the last line WScript.Quit(0);
seems to indicate you want to notify "open-connect" that the script always worked. Wouldn't it be better to send back a non-zero RC when any of the "exec"s fail to tell us we coded something wrong?

spetragl avatar Mar 15 '16 18:03 spetragl

yaep, the script itself an communication with may be improved, I agree....

horar avatar Mar 15 '16 23:03 horar

Time for more testing. Oh incidentally, the 2>&1 seems to fix (bug #59) the missing command output in the GUI log (except for Disconnect; not sure why only that is missing).

spetragl avatar Mar 16 '16 16:03 spetragl

I found a problem with these lines. They cause the APPs that go thru the tunnel (by default) not to connect. If I comment them out, default APPs connect as before.

//// echo("VPN host: " + ((address_array[3] & netmask_array[0])+ 0)); // if (internal_gw_array[3] == address_array[3]){ // internal_gw_array[3] = (address_array[3] & netmask_array[3] ) + 2 // }

var internal_gw = internal_gw_array.join(".");

// if (searchList.search(env("CISCO_DEF_DOMAIN")) != 0) { // searchList = env("CISCO_DEF_DOMAIN") + "," + searchList; // WshShell.RegWrite ("HKLM\System\CurrentControlSet\Services\TCPIP\Parameters\SearchList", // searchList, "REG_SZ"); // exec("ipconfig /registerdns"); // }
// if (tunReg != "") { // WshShell.RegWrite ("HKLM\System\CurrentControlSet\Services\TCPIP\Parameters\Interfaces" + tunReg + "\Domain", // env("CISCO_DEF_DOMAIN"), "REG_SZ"); // }

spetragl avatar Mar 17 '16 19:03 spetragl