add_firewall_ipset.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <!-- Begin toolbar -->
  2. <div class="l-sort">
  3. <div class="l-sort__inner">
  4. <div class="l-unit-toolbar__buttonstrip">
  5. <a class="button button-secondary" id="btn-back" href="/list/firewall/ipset/"><i class="fas fa-arrow-left status-icon blue"></i><?=_('Back');?></a>
  6. </div>
  7. <div class="l-unit-toolbar__buttonstrip">
  8. <a href="#" class="button" data-action="submit" data-id="vstobjects"><i class="fas fa-floppy-disk status-icon purple"></i><?=_('Save');?></a>
  9. </div>
  10. </div>
  11. </div>
  12. <!-- End toolbar -->
  13. <div class="l-center animate__animated animate__fadeIn">
  14. <form id="vstobjects" name="v_add_ipset" method="post">
  15. <input type="hidden" name="token" value="<?=$_SESSION['token']?>">
  16. <input type="hidden" name="ok" value="Add">
  17. <div class="form-container">
  18. <h1 class="form-title"><?=_('Adding Firewall Ipset List');?></h1>
  19. <?php show_alert_message($_SESSION);?>
  20. <div class="u-mb10">
  21. <label for="v_ipname" class="form-label"><?=_('Ip List Name') ?></label>
  22. <input type="text" class="form-control" name="v_ipname" id="v_ipname" maxlength="255" value="<?=htmlentities(trim($v_ipname, "'"))?>">
  23. </div>
  24. <div class="u-mb10">
  25. <label for="v_datasource" class="form-label">
  26. <?=_('Data Source') ?> <span class="optional">(<?=_('url, script or file');?>)</span>
  27. </label>
  28. <div class="u-pos-relative">
  29. <select class="form-select" tabindex="-1" id="datasource_list" onchange="this.nextElementSibling.value=this.value">
  30. <option value="">clear</option>
  31. </select>
  32. <input type="text" class="form-control list-editor" name="v_datasource" id="v_datasource" maxlength="255" value="<?=htmlentities(trim($v_datasource, "'"))?>">
  33. </div>
  34. </div>
  35. <div class="u-mb10">
  36. <label for="v_ipver" class="form-label"><?=_('Ip Version') ?></label>
  37. <select class="form-select" name="v_ipver" id="v_ipver">
  38. <option value="v4" <?php if ((!empty($v_ipver)) && ( $v_ipver == "'v4'" )) echo 'selected'?>><?=_('ip v4');?></option>
  39. <option value="v6" <?php if ((!empty($v_ipver)) && ( $v_ipver == "'v6'" )) echo 'selected'?>><?=_('ip v6');?></option>
  40. </select>
  41. </div>
  42. <div class="u-mb10">
  43. <label for="v_autoupdate" class="form-label"><?=_('Autoupdate') ?></label>
  44. <select class="form-select" name="v_autoupdate" id="v_autoupdate">
  45. <option value="yes" <?php if ((!empty($v_autoupdate)) && ( $v_autoupdate == "'yes'" )) echo 'selected'?>><?=_('yes');?></option>
  46. <option value="no" <?php if ((!empty($v_autoupdate)) && ( $v_autoupdate == "'no'" )) echo 'selected'?>><?=_('no');?></option>
  47. </select>
  48. </div>
  49. </div>
  50. </form>
  51. </div>
  52. <script>
  53. var country_iplists = [
  54. <?php
  55. $country = array('ca' => 'Canada', 'cn' => 'China', 'fr' => 'French', 'de' => 'Germany', 'in' => 'India', 'nl' => 'Netherlands', 'ro' => 'Romania', 'ru' => 'Russia', 'es' => 'Spain', 'ch' => 'Switzerland', 'tr' => 'Turkey', 'ua' => 'Ukraine', 'gb' => 'United Kingdom', 'us' => 'United States');
  56. foreach($country as $iso =>$name){
  57. echo '{name: "[IPv4] Country - '.$name.'", source:"https://raw.githubusercontent.com/ipverse/rir-ip/master/country/'.$iso.'/ipv4-aggregated.txt"},'."\n";
  58. }
  59. ?>
  60. // Define IPv6 country lists
  61. /*
  62. <?php
  63. foreach($country as $iso =>$name){
  64. echo '{name: "[IPv6] Country - '.$name.'", source:"https://raw.githubusercontent.com/ipverse/rir-ip/master/country/'.$iso.'/ipv6-aggregated.txt"},'."\n";
  65. }
  66. ?>
  67. */
  68. ];
  69. var blacklist_iplists = [
  70. { name: "[IPv4] Block Malicious IPs", source: "script:/usr/local/hestia/install/deb/firewall/ipset/blacklist.sh" },
  71. /*
  72. {name: "[IPv6] Block Malicious IPs", source:"script:/usr/local/hestia/install/deb/firewall/ipset/blacklist.ipv6.sh"},
  73. */
  74. ];
  75. country_iplists.sort(function (a, b) {
  76. return a.name > b.name;
  77. });
  78. blacklist_iplists.sort(function (a, b) {
  79. return a.name > b.name;
  80. });
  81. $(function () {
  82. var targetElement = document.getElementById('datasource_list');
  83. // Blacklist
  84. var newEl = document.createElement("option");
  85. newEl.text = "<?=_('BLACKLIST') ?>";
  86. newEl.disabled = true;
  87. targetElement.appendChild(newEl);
  88. blacklist_iplists.forEach(iplist => {
  89. var newEl = document.createElement("option");
  90. newEl.text = iplist.name;
  91. newEl.value = iplist.source;
  92. targetElement.appendChild(newEl);
  93. });
  94. // IPVERSE
  95. var newEl = document.createElement("option");
  96. newEl.text = "<?=_('IPVERSE') ?>";
  97. newEl.disabled = true;
  98. targetElement.appendChild(newEl);
  99. country_iplists.forEach(iplist => {
  100. var newEl = document.createElement("option");
  101. newEl.text = iplist.name;
  102. newEl.value = iplist.source;
  103. targetElement.appendChild(newEl);
  104. });
  105. });
  106. </script>