add_firewall_ipset.html 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <!-- Begin toolbar -->
  2. <div class="l-center edit">
  3. <div class="l-sort clearfix">
  4. <div class="l-unit-toolbar__buttonstrip">
  5. <a class="ui-button cancel" dir="ltr" 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 float-right">
  8. <a href="#" class="ui-button" data-action="submit" data-id="vstobjects"><i class="fas fa-save status-icon purple"></i><?=_('Save');?></a>
  9. </div>
  10. </div>
  11. </div>
  12. <!-- End toolbar -->
  13. <div class="l-separator"></div>
  14. <div class="l-center animated fadeIn">
  15. <form id="vstobjects" name="v_add_ipset" method="post">
  16. <input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
  17. <input type="hidden" name="ok" value="Add" />
  18. <table class="data mode-add">
  19. <tr class="data-add">
  20. <td class="data-dotted">
  21. <table class="data-col1">
  22. <tr>
  23. <td></td>
  24. </tr>
  25. </table>
  26. </td>
  27. <td class="data-dotted">
  28. <table class="data-col2" width="600px">
  29. <tr>
  30. <td class="step-top">
  31. <span class="page-title"><?=_('Adding Firewall Ipset List');?></span>
  32. </td>
  33. </tr>
  34. <tr>
  35. <td>
  36. <?php
  37. if (!empty($_SESSION['error_msg'])) {
  38. $msg_icon = 'fa-exclamation-circle status-icon red';
  39. $msg_text = htmlentities($_SESSION['error_msg']);
  40. $msg_id = 'vst-error';
  41. } else {
  42. if (!empty($_SESSION['ok_msg'])) {
  43. $msg_icon = 'fa-check-circle status-icon green';
  44. $msg_text = $_SESSION['ok_msg'];
  45. $msg_id = 'vst-ok';
  46. }
  47. }
  48. ?>
  49. <span class="<?=$msg_id;?>"> <i class="fas <?=$msg_icon;?>"></i> <?=$msg_text;?></span>
  50. </td>
  51. </tr>
  52. <tr>
  53. <td class="vst-text step-top">
  54. <?=_('Ip List Name') ?>
  55. </td>
  56. </tr>
  57. <tr>
  58. <td>
  59. <input type="text" size="20" class="vst-input" name="v_ipname" maxlength="255" value="<?=htmlentities(trim($v_ipname, "'"))?>">
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="vst-text step-top">
  64. <?=_('Data Source') ?> <span class="optional">(<?=_('url, script or file');?>)</span>
  65. </td>
  66. </tr>
  67. <tr>
  68. <td>
  69. <select class="vst-list" tabindex="-1" id="datasource_list" onchange="this.nextElementSibling.value=this.value">
  70. <option value="">clear</option>
  71. </select>
  72. <input type="text" size="20" class="vst-input vst-list-editor" name="v_datasource" maxlength="255" value="<?=htmlentities(trim($v_datasource, "'"))?>">
  73. </td>
  74. </tr>
  75. <tr>
  76. <td class="vst-text step-top">
  77. <?=_('Ip Version') ?>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td>
  82. <select class="vst-list" name="v_ipver">
  83. <option value="v4" <?php if ((!empty($v_ipver)) && ( $v_ipver == "'v4'" )) echo 'selected'?>><?=_('ip v4');?></option>
  84. <option value="v6" <?php if ((!empty($v_ipver)) && ( $v_ipver == "'v6'" )) echo 'selected'?>><?=_('ip v6');?></option>
  85. </select>
  86. </td>
  87. </tr>
  88. <tr>
  89. <td class="vst-text step-top">
  90. <?=_('Autoupdate') ?>
  91. </td>
  92. </tr>
  93. <tr>
  94. <td>
  95. <select class="vst-list" name="v_autoupdate">
  96. <option value="yes" <?php if ((!empty($v_autoupdate)) && ( $v_autoupdate == "'yes'" )) echo 'selected'?>><?=_('yes');?></option>
  97. <option value="no" <?php if ((!empty($v_autoupdate)) && ( $v_autoupdate == "'no'" )) echo 'selected'?>><?=_('no');?></option>
  98. </select>
  99. </td>
  100. </tr>
  101. </table>
  102. <table class="data-col2"></table>
  103. </td>
  104. </tr>
  105. </table>
  106. </form>
  107. </div>
  108. <script>
  109. var country_iplists = [
  110. // Define IPv4 country lists
  111. { name: "[IPv4] Country - Canada", source: "http://ipverse.net/ipblocks/data/countries/ca.zone" },
  112. { name: "[IPv4] Country - China", source: "http://ipverse.net/ipblocks/data/countries/cn.zone" },
  113. { name: "[IPv4] Country - France", source: "http://ipverse.net/ipblocks/data/countries/fr.zone" },
  114. { name: "[IPv4] Country - Germany", source: "http://ipverse.net/ipblocks/data/countries/de.zone" },
  115. { name: "[IPv4] Country - India", source: "http://ipverse.net/ipblocks/data/countries/in.zone" },
  116. { name: "[IPv4] Country - Netherlands", source: "http://ipverse.net/ipblocks/data/countries/nl.zone" },
  117. { name: "[IPv4] Country - Romania", source: "http://ipverse.net/ipblocks/data/countries/ro.zone" },
  118. { name: "[IPv4] Country - Russia", source: "http://ipverse.net/ipblocks/data/countries/ru.zone" },
  119. { name: "[IPv4] Country - Spain", source: "http://ipverse.net/ipblocks/data/countries/es.zone" },
  120. { name: "[IPv4] Country - Switzerland", source: "http://ipverse.net/ipblocks/data/countries/ch.zone" },
  121. { name: "[IPv4] Country - Ukraine", source: "http://ipverse.net/ipblocks/data/countries/ua.zone" },
  122. { name: "[IPv4] Country - United Kingdom", source: "http://ipverse.net/ipblocks/data/countries/gb.zone" },
  123. { name: "[IPv4] Country - United States", source: "http://ipverse.net/ipblocks/data/countries/us.zone" },
  124. // Define IPv6 country lists
  125. /*
  126. {name: "[IPv6] Country - China", source:"http://ipverse.net/ipblocks/data/countries/cn-ipv6.zone"},
  127. {name: "[IPv6] Country - Canada", source:"http://ipverse.net/ipblocks/data/countries/ca-ipv6.zone"},
  128. {name: "[IPv6] Country - France", source:"http://ipverse.net/ipblocks/data/countries/fr-ipv6.zone"},
  129. {name: "[IPv6] Country - Germany", source:"http://ipverse.net/ipblocks/data/countries/de-ipv6.zone"},
  130. {name: "[IPv6] Country - India", source:"http://ipverse.net/ipblocks/data/countries/in-ipv6.zone"},
  131. {name: "[IPv6] Country - Netherlands", source:"http://ipverse.net/ipblocks/data/countries/nl-ipv6.zone"},
  132. {name: "[IPv6] Country - Romania", source:"http://ipverse.net/ipblocks/data/countries/ro-ipv6.zone"},
  133. {name: "[IPv6] Country - Russia", source:"http://ipverse.net/ipblocks/data/countries/ru-ipv6.zone"},
  134. {name: "[IPv6] Country - Spain", source:"http://ipverse.net/ipblocks/data/countries/es-ipv6.zone"},
  135. {name: "[IPv6] Country - Switzerland", source:"http://ipverse.net/ipblocks/data/countries/ch-ipv6.zone"},
  136. {name: "[IPv6] Country - Ukraine", source:"http://ipverse.net/ipblocks/data/countries/ua-ipv6.zone"},
  137. {name: "[IPv6] Country - United Kingdom", source:"http://ipverse.net/ipblocks/data/countries/gb-ipv6.zone"},
  138. {name: "[IPv6] Country - United States", source:"http://ipverse.net/ipblocks/data/countries/us-ipv6.zone"},
  139. */
  140. ];
  141. var blacklist_iplists = [
  142. { name: "[IPv4] Block Malicious IPs", source: "script:/usr/local/hestia/install/deb/firewall/ipset/blacklist.sh" },
  143. /*
  144. {name: "[IPv6] Block Malicious IPs", source:"script:/usr/local/hestia/install/deb/firewall/ipset/blacklist.ipv6.sh"},
  145. */
  146. ];
  147. country_iplists.sort(function (a, b) {
  148. return a.name > b.name;
  149. });
  150. blacklist_iplists.sort(function (a, b) {
  151. return a.name > b.name;
  152. });
  153. $(function () {
  154. var targetelement = document.getElementById('datasource_list');
  155. // Blacklist
  156. var newEl = document.createElement("option");
  157. newEl.text = "<?=_('BLACKLIST') ?>";
  158. newEl.disabled = true;
  159. targetelement.appendChild(newEl);
  160. blacklist_iplists.forEach(iplist => {
  161. var newEl = document.createElement("option");
  162. newEl.text = iplist.name;
  163. newEl.value = iplist.source;
  164. targetelement.appendChild(newEl);
  165. });
  166. // IPVERSE
  167. var newEl = document.createElement("option");
  168. newEl.text = "<?=_('IPVERSE') ?>";
  169. newEl.disabled = true;
  170. targetelement.appendChild(newEl);
  171. country_iplists.forEach(iplist => {
  172. var newEl = document.createElement("option");
  173. newEl.text = iplist.name;
  174. newEl.value = iplist.source;
  175. targetelement.appendChild(newEl);
  176. });
  177. });
  178. </script>