acls_modals.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <!-- Add Modal -->
  2. <div id="addModal" class="hidden fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center p-4">
  3. <div class="bg-white rounded-lg shadow-xl max-w-4xl w-full p-6 max-h-[90vh] overflow-y-auto">
  4. <h3 class="text-2xl font-bold text-gray-800 mb-4">
  5. <i class="fas fa-plus-circle text-blue-600 mr-2"></i>{{ _("Agregar Nueva ACL") }}
  6. </h3>
  7. <form id="addForm" method="POST" action="/admin/acls/add">
  8. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
  9. <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
  10. <div>
  11. <label class="block text-gray-700 font-semibold mb-2">{{ _("Nombre de la ACL:") }}</label>
  12. <input type="text" name="name" id="addName" required
  13. pattern="[a-zA-Z0-9_-]+"
  14. placeholder="mi_acl_personalizada"
  15. class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
  16. <p class="text-xs text-gray-500 mt-1">{{ _("Solo letras, números, guiones y guiones bajos") }}</p>
  17. </div>
  18. <div>
  19. <label class="block text-gray-700 font-semibold mb-2">{{ _("Tipo de ACL:") }}</label>
  20. <select name="type" id="addType" onchange="updateAddTypeInfo()" required
  21. class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
  22. <option value="">{{ _("Selecciona un tipo...") }}</option>
  23. <optgroup label="🌐 Red / IP">
  24. <option value="src">{{ _("src - IP origen del cliente") }}</option>
  25. <option value="dst">{{ _("dst - IP destino [slow]") }}</option>
  26. <option value="localip">{{ _("localip - IP local de conexión") }}</option>
  27. <option value="src_as">{{ _("src_as - AS number origen") }}</option>
  28. <option value="dst_as">{{ _("dst_as - AS number destino") }}</option>
  29. </optgroup>
  30. <optgroup label="🌍 Dominios">
  31. <option value="dstdomain">{{ _("dstdomain - Dominio destino") }}</option>
  32. <option value="srcdomain">{{ _("srcdomain - Dominio origen [slow]") }}</option>
  33. <option value="dstdom_regex">{{ _("dstdom_regex - Regex dominio destino") }}</option>
  34. <option value="srcdom_regex">{{ _("srcdom_regex - Regex dominio origen [slow]") }}</option>
  35. </optgroup>
  36. <optgroup label="🔌 Puertos">
  37. <option value="port">{{ _("port - Puerto TCP destino") }}</option>
  38. <option value="localport">{{ _("localport - Puerto local") }}</option>
  39. <option value="myportname">{{ _("myportname - Nombre de puerto") }}</option>
  40. </optgroup>
  41. <optgroup label="🕐 Tiempo">
  42. <option value="time">{{ _("time - Día y hora") }}</option>
  43. </optgroup>
  44. <optgroup label="🔗 URL">
  45. <option value="url_regex">{{ _("url_regex - Regex en URL completa") }}</option>
  46. <option value="urlpath_regex">{{ _("urlpath_regex - Regex en path") }}</option>
  47. <option value="urllogin">{{ _("urllogin - Regex en login URL") }}</option>
  48. </optgroup>
  49. <optgroup label="⚡ Protocolo">
  50. <option value="proto">{{ _("proto - Protocolo (HTTP/FTP)") }}</option>
  51. <option value="method">{{ _("method - Método HTTP") }}</option>
  52. <option value="http_status">{{ _("http_status - Código HTTP") }}</option>
  53. </optgroup>
  54. <optgroup label="🔐 Autenticación">
  55. <option value="proxy_auth">{{ _("proxy_auth - Usuario proxy [slow]") }}</option>
  56. <option value="proxy_auth_regex">{{ _("proxy_auth_regex - Regex usuario [slow]") }}</option>
  57. <option value="ext_user">{{ _("ext_user - Usuario externo [slow]") }}</option>
  58. <option value="ext_user_regex">{{ _("ext_user_regex - Regex usuario ext [slow]") }}</option>
  59. </optgroup>
  60. <optgroup label="📄 Contenido">
  61. <option value="browser">{{ _("browser - User-Agent") }}</option>
  62. <option value="referer_regex">{{ _("referer_regex - Referer") }}</option>
  63. <option value="req_mime_type">{{ _("req_mime_type - MIME request") }}</option>
  64. <option value="rep_mime_type">{{ _("rep_mime_type - MIME reply") }}</option>
  65. <option value="req_header">{{ _("req_header - Header request") }}</option>
  66. <option value="rep_header">{{ _("rep_header - Header reply") }}</option>
  67. </optgroup>
  68. <optgroup label="🔒 SSL/TLS">
  69. <option value="ssl_error">{{ _("ssl_error - Error SSL") }}</option>
  70. <option value="server_cert_fingerprint">{{ _("server_cert_fingerprint - Fingerprint") }}</option>
  71. <option value="ssl::server_name">{{ _("ssl::server_name - SNI") }}</option>
  72. <option value="ssl::server_name_regex">{{ _("ssl::server_name_regex - SNI regex") }}</option>
  73. </optgroup>
  74. <optgroup label="🔧 Conexiones">
  75. <option value="maxconn">{{ _("maxconn - Max conexiones IP") }}</option>
  76. <option value="max_user_ip">{{ _("max_user_ip - Max IPs usuario") }}</option>
  77. </optgroup>
  78. <optgroup label="⚙️ Avanzado">
  79. <option value="external">{{ _("external - Helper externo [slow]") }}</option>
  80. <option value="random">{{ _("random - Probabilidad random") }}</option>
  81. <option value="note">{{ _("note - Anotación transacción") }}</option>
  82. <option value="any-of">{{ _("any-of - Grupo OR") }}</option>
  83. <option value="all-of">{{ _("all-of - Grupo AND") }}</option>
  84. </optgroup>
  85. </select>
  86. </div>
  87. </div>
  88. <!-- Type Info Display -->
  89. <div id="addTypeInfo" class="hidden mb-4 bg-blue-50 border border-blue-200 rounded-lg p-3">
  90. <div class="flex items-start">
  91. <i id="addTypeIcon" class="fas fa-info-circle text-blue-600 mt-1 mr-2"></i>
  92. <div class="flex-1">
  93. <p id="addTypeDesc" class="text-sm text-gray-700 font-medium"></p>
  94. <p id="addTypeExample" class="text-xs text-gray-600 mt-1 font-mono"></p>
  95. </div>
  96. </div>
  97. </div>
  98. <!-- Options -->
  99. <div class="mb-4">
  100. <label class="block text-gray-700 font-semibold mb-2">{{ _("Opciones (opcional):") }}</label>
  101. <div class="flex flex-wrap gap-2">
  102. <label class="flex items-center px-3 py-2 border-2 border-gray-300 rounded-lg cursor-pointer hover:border-blue-500 hover:bg-blue-50">
  103. <input type="checkbox" name="options[]" value="-i" class="mr-2">
  104. <span class="text-sm"><code>{{ _("-i") }}</code> {{ _("Case-insensitive") }}</span>
  105. </label>
  106. <label class="flex items-center px-3 py-2 border-2 border-gray-300 rounded-lg cursor-pointer hover:border-blue-500 hover:bg-blue-50">
  107. <input type="checkbox" name="options[]" value="-n" class="mr-2">
  108. <span class="text-sm"><code>{{ _("-n") }}</code> {{ _("No lookups") }}</span>
  109. </label>
  110. <label class="flex items-center px-3 py-2 border-2 border-gray-300 rounded-lg cursor-pointer hover:border-blue-500 hover:bg-blue-50">
  111. <input type="checkbox" name="options[]" value="-m" class="mr-2">
  112. <span class="text-sm"><code>{{ _("-m") }}</code> {{ _("List membership") }}</span>
  113. </label>
  114. </div>
  115. </div>
  116. <!-- Values -->
  117. <div class="mb-4">
  118. <label class="block text-gray-700 font-semibold mb-2">{{ _("Valores:") }}</label>
  119. <div id="addValuesList" class="space-y-2 mb-2">
  120. <!-- Values will be added dynamically -->
  121. </div>
  122. <button type="button" onclick="addValueInput('add')" class="text-blue-600 hover:text-blue-800 text-sm font-medium">
  123. <i class="fas fa-plus-circle mr-1"></i>{{ _("Agregar valor") }}
  124. </button>
  125. </div>
  126. <!-- Comment -->
  127. <div class="mb-4">
  128. <label class="block text-gray-700 font-semibold mb-2">{{ _("Comentario (opcional):") }}</label>
  129. <input type="text" name="comment" placeholder="{{ _("Descripción de esta ACL") }}"
  130. class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm">
  131. <p class="text-xs text-gray-500 mt-1">{{ _("Se agregará como comentario antes de la ACL") }}</p>
  132. </div>
  133. <div class="flex space-x-2 justify-end mt-6 pt-4 border-t">
  134. <button type="button" onclick="closeAddModal()" class="px-5 py-2 bg-gray-300 hover:bg-gray-400 text-gray-800 rounded-lg transition-colors font-medium">
  135. {{ _("Cancelar") }}
  136. </button>
  137. <button type="submit" class="px-5 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium">
  138. <i class="fas fa-save mr-2"></i>{{ _("Crear ACL") }}
  139. </button>
  140. </div>
  141. </form>
  142. </div>
  143. </div>
  144. <!-- Edit Modal -->
  145. <div id="editModal" class="hidden fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center p-4">
  146. <div class="bg-white rounded-lg shadow-xl max-w-4xl w-full p-6 max-h-[90vh] overflow-y-auto">
  147. <h3 class="text-2xl font-bold text-gray-800 mb-4">
  148. <i class="fas fa-edit text-blue-600 mr-2"></i>{{ _("Editar ACL") }}
  149. </h3>
  150. <form id="editForm" method="POST" action="/admin/acls/edit">
  151. <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
  152. <input type="hidden" name="id" id="editId">
  153. <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
  154. <div>
  155. <label class="block text-gray-700 font-semibold mb-2">{{ _("Nombre de la ACL:") }}</label>
  156. <input type="text" name="name" id="editName" required
  157. pattern="[a-zA-Z0-9_-]+"
  158. class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent">
  159. </div>
  160. <div>
  161. <label class="block text-gray-700 font-semibold mb-2">{{ _("Tipo de ACL:") }}</label>
  162. <input type="text" id="editTypeDisplay" disabled
  163. class="w-full px-4 py-2 border border-gray-300 rounded-lg bg-gray-100 text-gray-600">
  164. <input type="hidden" name="type" id="editType">
  165. <p class="text-xs text-gray-500 mt-1">{{ _("El tipo no se puede cambiar, crea una nueva ACL si necesitas otro tipo") }}</p>
  166. </div>
  167. </div>
  168. <!-- Options -->
  169. <div class="mb-4">
  170. <label class="block text-gray-700 font-semibold mb-2">{{ _("Opciones:") }}</label>
  171. <div class="flex flex-wrap gap-2">
  172. <label class="flex items-center px-3 py-2 border-2 border-gray-300 rounded-lg cursor-pointer hover:border-blue-500 hover:bg-blue-50">
  173. <input type="checkbox" name="options[]" value="-i" id="editOptI" class="mr-2">
  174. <span class="text-sm"><code>{{ _("-i") }}</code> {{ _("Case-insensitive") }}</span>
  175. </label>
  176. <label class="flex items-center px-3 py-2 border-2 border-gray-300 rounded-lg cursor-pointer hover:border-blue-500 hover:bg-blue-50">
  177. <input type="checkbox" name="options[]" value="-n" id="editOptN" class="mr-2">
  178. <span class="text-sm"><code>{{ _("-n") }}</code> {{ _("No lookups") }}</span>
  179. </label>
  180. <label class="flex items-center px-3 py-2 border-2 border-gray-300 rounded-lg cursor-pointer hover:border-blue-500 hover:bg-blue-50">
  181. <input type="checkbox" name="options[]" value="-m" id="editOptM" class="mr-2">
  182. <span class="text-sm"><code>{{ _("-m") }}</code> {{ _("List membership") }}</span>
  183. </label>
  184. </div>
  185. </div>
  186. <!-- Values -->
  187. <div class="mb-4">
  188. <label class="block text-gray-700 font-semibold mb-2">{{ _("Valores:") }}</label>
  189. <div id="editValuesList" class="space-y-2 mb-2">
  190. <!-- Values will be filled dynamically -->
  191. </div>
  192. <button type="button" onclick="addValueInput('edit')" class="text-blue-600 hover:text-blue-800 text-sm font-medium">
  193. <i class="fas fa-plus-circle mr-1"></i>{{ _("Agregar valor") }}
  194. </button>
  195. </div>
  196. <!-- Comment -->
  197. <div class="mb-4">
  198. <label class="block text-gray-700 font-semibold mb-2">{{ _("Comentario:") }}</label>
  199. <input type="text" name="comment" id="editComment"
  200. class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm">
  201. </div>
  202. <div class="flex space-x-2 justify-end mt-6 pt-4 border-t">
  203. <button type="button" onclick="closeEditModal()" class="px-5 py-2 bg-gray-300 hover:bg-gray-400 text-gray-800 rounded-lg transition-colors font-medium">
  204. {{ _("Cancelar") }}
  205. </button>
  206. <button type="submit" class="px-5 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium">
  207. <i class="fas fa-save mr-2"></i>{{ _("Guardar Cambios") }}
  208. </button>
  209. </div>
  210. </form>
  211. </div>
  212. </div>