show.html 2.2 KB

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