editrule.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. {% extends "base.html" %}
  2. {% block header_title %}Firewall Dashboard{% endblock %}
  3. {% block section_title %}Firewall Dashboard{% endblock %}
  4. {% block debug %}
  5. {{ firewall }}
  6. {{ firewall_name }}
  7. {{ firewall_rulenumber }}
  8. {{ firewall_rule }}
  9. {% endblock %}
  10. {% block content %}
  11. {% if firewall %}
  12. <table border="1" width="100%">
  13. <tr><th>rule #</th><th>description</th><th>protocol</th><th>destination port</th><th>source port</th><th>action</th></tr>
  14. {% for key, value in firewall.items %}
  15. {% for ifkey, ifvalue in value.items %}
  16. <tr>
  17. <td><a href="{% url 'firewall:editrule' firewall_name ifkey %}">{{ ifkey }}</a></td>
  18. <td>{{ ifvalue.description }}</td>
  19. <td>{{ ifvalue.protocol }}</td>
  20. <td>{{ ifvalue.destination.port }}</td>
  21. <td>{{ ifvalue.source.port }}</td>
  22. <td>{{ ifvalue.action }}</td>
  23. </tr>
  24. {% endfor %}
  25. {% endfor %}
  26. </table>
  27. {% else %}
  28. <p>No firewalls.</p>
  29. {% endif %}
  30. <h2>Edit rule</h2>
  31. <form action="{% url 'firewall:editrule' firewall_name firewall_rulenumber %}" method="post">
  32. {% csrf_token %}
  33. <p>
  34. <label for="alias">rule number</label><br>
  35. <input type="text" name="rulenumber" id="rulenumber" value="{{ firewall_rulenumber }}" size="5" disabled>
  36. </p>
  37. <p>
  38. <label for="hostname">action</label><br>
  39. <input type="radio" name="action" id="action" value="accept" {% if firewall_rule.action == "accept" %}checked="checked"{% endif %}> accept
  40. <input type="radio" name="action" id="action" value="drop" {% if firewall_rule.action == "drop" %}checked="checked"{% endif %}> drop
  41. <input type="radio" name="action" id="action" value="reject" {% if firewall_rule.action == "reject" %}checked="checked"{% endif %}> reject
  42. </p>
  43. <p>
  44. <label for="hostname">protocol</label><br>
  45. <input type="radio" name="protocol" id="protocol" value="tcp" {% if firewall_rule.protocol == "tcp" %}checked="checked"{% endif %}> tcp
  46. <input type="radio" name="protocol" id="protocol" value="udp" {% if firewall_rule.protocol == "udp" %}checked="checked"{% endif %}> udp
  47. </p>
  48. <p>
  49. <label for="alias">destination port</label><br>
  50. <input type="text" name="destinationport" id="destinationport" value="{{ firewall_rule.destination.port }}" size="5">
  51. </p>
  52. <p>
  53. <label for="alias">source port</label><br>
  54. <input type="text" name="sourceport" id="sourceport" value="{{ firewall_rule.source.port }}" size="5">
  55. </p>
  56. <input type="submit" value="Edit Rule">
  57. </form>
  58. {% endblock %}