vpnc.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. 'use strict';
  2. 'require form';
  3. 'require network';
  4. network.registerPatternVirtual(/^vpn-.+$/);
  5. return network.registerProtocol('vpnc', {
  6. getI18n: function() {
  7. return _('VPNC (CISCO 3000 (and others) VPN)');
  8. },
  9. getIfname: function() {
  10. return this._ubus('l3_device') || 'vpn-%s'.format(this.sid);
  11. },
  12. getOpkgPackage: function() {
  13. return 'vpnc';
  14. },
  15. isFloating: function() {
  16. return true;
  17. },
  18. isVirtual: function() {
  19. return true;
  20. },
  21. getDevices: function() {
  22. return null;
  23. },
  24. containsDevice: function(ifname) {
  25. return (network.getIfnameOf(ifname) == this.getIfname());
  26. },
  27. renderFormOptions: function(s) {
  28. var o;
  29. o = s.taboption('general', form.Value, 'server', _('VPN Server'));
  30. o.datatype = 'host(0)';
  31. o = s.taboption('general', form.Value, 'local_addr', _('VPN Local address'));
  32. o.placeholder = '0.0.0.0';
  33. o.datatype = 'ipaddr';
  34. o = s.taboption('general', form.Value, 'local_port', _('VPN Local port'));
  35. o.placeholder = '500';
  36. o.datatype = 'port';
  37. o = s.taboption('general', form.Value, 'interface', _('Output Interface'));
  38. o.template = 'cbi/network_netlist';
  39. o = s.taboption('general', form.Value, 'mtu', _('MTU'));
  40. o.datatype = 'uinteger';
  41. s.taboption('general', form.Value, 'username', _('Username'));
  42. o = s.taboption('general', form.Value, 'password', _('Password'));
  43. o.password = true;
  44. o = s.taboption('general', form.Value, 'hexpassword', _('Obfuscated Password'));
  45. o.password = true;
  46. s.taboption('general', form.Value, 'authgroup', _('Auth Group'));
  47. o = s.taboption('general', form.Value, 'passgroup', _('Group Password'));
  48. o.password = true;
  49. o = s.taboption('general', form.Value, 'hexpassgroup', _('Obfuscated Group Password'));
  50. o.password= true;
  51. s.taboption('general', form.Value, 'domain', _('NT Domain'));
  52. s.taboption('general', form.Value, 'vendor', _('Vendor'));
  53. o = s.taboption('general', form.ListValue, 'dh_group', _('IKE DH Group'));
  54. o.value('dh2');
  55. o.value('dh1');
  56. o.value('dh5');
  57. o = s.taboption('general', form.ListValue, 'pfs', _('Perfect Forward Secrecy'));
  58. o.value('server');
  59. o.value('nopfs');
  60. o.value('dh1');
  61. o.value('dh2');
  62. o.value('dh5');
  63. o = s.taboption('general', form.ListValue, 'natt_mode', _('NAT-T Mode'));
  64. o.value('natt', _('RFC3947 NAT-T mode'));
  65. o.value('none', _('No NAT-T'));
  66. o.value('force-natt', _('Force use of NAT-T'));
  67. o.value('cisco-udp', _('Cisco UDP encapsulation'));
  68. o = s.taboption('general', form.Flag, 'enable_no_enc', _('Disable Encryption'), _('If checked, encryption is disabled'));
  69. o.default = o.disabled;
  70. o = s.taboption('general', form.Flag, 'enable_single_des', _('Enable Single DES'), _('If checked, 1DES is enabled'));
  71. o.default = o.disabled;
  72. o = s.taboption('general', form.Value, 'dpd_idle', _('DPD Idle Timeout'));
  73. o.datatype = 'uinteger';
  74. o.placeholder = '600';
  75. o = s.taboption('general', form.Value, 'target_network', _('Target network'));
  76. o.placeholder = '0.0.0.0/0';
  77. o.datatype = 'network';
  78. }
  79. });