form.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. 'use strict';
  2. 'require view';
  3. 'require form';
  4. 'require tools.widgets as widgets';
  5. return view.extend({
  6. render: function() {
  7. let m, s, o;
  8. m = new form.Map('crowdsec', _('CrowdSec'),
  9. _('Gain <a href="http://www.crowdsec.net">crowd-sourced</a> protection against malicious IPs. ' +
  10. 'Benefit from the most accurate CTI in the world.'));
  11. s = m.section(form.TypedSection, 'bouncer', _('Bouncer'));
  12. s.anonymous = true;
  13. o = s.option(form.Flag, 'enabled', _('Enable'));
  14. o.default = '0';
  15. o.rmempty = false;
  16. o = s.option(form.Value, 'api_url', _('URL of local API'),
  17. _('The URL of your local CrowdSec API instance.'));
  18. o.default = '';
  19. o.rmempty = false;
  20. o = s.option(form.Value, 'api_key', _('API key'),
  21. _('The key of your bouncer as registered on the local CrowdSec API.'));
  22. o.default = '';
  23. o.password = true;
  24. o.rmempty = false;
  25. o = s.option(widgets.DeviceSelect, 'interface', _('Filtered interfaces'),
  26. _('List of interfaces with traffic to be filtered.'));
  27. o.noaliases = true;
  28. o.multiple = true;
  29. o.rmempty = false;
  30. o = s.option(form.Flag, 'ipv6', _('Enable support for IPv6'),
  31. _('If unchecked IPv6 will not be filtered.'));
  32. o.default = '1';
  33. o.rmempty = false;
  34. o = s.option(form.Flag, 'filter_input', _('Filter input chain'),
  35. _('Block packets from filtered interfaces addressed to the router itself.'));
  36. o.default = '1';
  37. o.rmempty = false;
  38. o = s.option(form.Flag, 'filter_forward', _('Filter forward chain'),
  39. _('Block packets from filtered interfaces addressed to devices in your network.'));
  40. o.default = '1';
  41. o.rmempty = false;
  42. o = s.option(form.Flag, 'deny_log', _('Log filtered ip addresses'),
  43. _('If checked, a log statement will be added to the firewall rule and blocked ' +
  44. 'ip addresses will be logged to System Log.'));
  45. o.default = '0';
  46. o.rmempty = false;
  47. return m.render();
  48. },
  49. });