globals.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. 'use strict';
  2. 'require view';
  3. 'require form';
  4. 'require network';
  5. 'require tools.widgets as widgets';
  6. return view.extend({
  7. load: function() {
  8. return Promise.all([
  9. network.getDevices(),
  10. ]);
  11. },
  12. render: function(data) {
  13. var netDevs = data[0];
  14. var m, s, o;
  15. m = new form.Map('libreswan', _('IPSec Global Settings'));
  16. s = m.section(form.NamedSection, 'globals', 'libreswan');
  17. s.anonymous = false;
  18. s.addremove = false;
  19. o = s.option(form.ListValue, 'debug', _('Debug Logs'));
  20. o.default = false;
  21. o.rmempty = false;
  22. o.value('none', _('none - No Logging'));
  23. o.value('base', _('base - Moderate Logging'));
  24. o.value('cpu-usage', _('cpu-usage - Timing/Load Logging'));
  25. o.value('crypto', _('crypto - All crypto related Logging'));
  26. o.value('tmi', _('tmi - Too Much/Excessive Logging'));
  27. o.value('private', _('private - Sensitive private-key/password Logging'));
  28. o.default = 'none'
  29. o = s.option(form.Flag, 'uniqueids', _('Uniquely Identify Remotes'),
  30. _('Whether IDs should be considered identifying remote parties uniquely'));
  31. o.default = false;
  32. o.rmempty = false;
  33. o = s.option(widgets.NetworkSelect, 'listen_interface', _('Listen Interface'),
  34. _('Interface for IPsec to use'));
  35. o.datatype = 'string';
  36. o.multiple = false;
  37. o.optional = true;
  38. o = s.option(form.Value, 'listen', _('Listen Address'),
  39. _('IP address to listen on, default depends on Listen Interface'));
  40. o.datatype = 'ip4addr';
  41. for (var i = 0; i < netDevs.length; i++) {
  42. var addrs = netDevs[i].getIPAddrs();
  43. for (var j = 0; j < addrs.length; j++) {
  44. o.value(addrs[j].split('/')[0]);
  45. }
  46. }
  47. o.depends({ 'listen_interface' : '' });
  48. o = s.option(form.Value, 'nflog_all', _('Enable nflog on nfgroup'),
  49. _('NFLOG group number to log all pre-crypt and post-decrypt traffic to'));
  50. o.datatype = 'uinteger';
  51. o.default = 0;
  52. o.rmempty = true;
  53. o.optional = true;
  54. o = s.option(form.DynamicList, 'virtual_private', _('Allowed Virtual Private'),
  55. _('The address ranges that may live behind a NAT router through which a client connects'));
  56. o.datatype = 'neg(ip4addr)';
  57. o.multiple = true;
  58. o.optional = true;
  59. return m.render();
  60. }
  61. });