90-firewall.sh 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # -- Setup firewall configuration
  2. uci set firewall.@defaults[0].syn_flood=1
  3. uci set firewall.@defaults[0].input=ACCEPT
  4. uci set firewall.@defaults[0].output=ACCEPT
  5. uci set firewall.@defaults[0].forward=ACCEPT
  6. uci add firewall zone
  7. uci set firewall.@zone[-1]=zone
  8. uci set firewall.@zone[-1].name=usb
  9. uci add_list firewall.@zone[-1].network='usb'
  10. uci set firewall.@zone[-1].input=ACCEPT
  11. uci set firewall.@zone[-1].output=ACCEPT
  12. uci set firewall.@zone[-1].forward=ACCEPT
  13. uci set firewall.@zone[-1].masq=1
  14. uci set firewall.@zone[-1].mtu_fix=1
  15. uci add firewall forwarding
  16. uci set firewall.@forwarding[-1].src=lan
  17. uci set firewall.@forwarding[-1].dest=usb
  18. uci add firewall forwarding
  19. uci set firewall.@forwarding[-1].src=usb
  20. uci set firewall.@forwarding[-1].dest=lan
  21. uci add firewall zone
  22. uci set firewall.@zone[-1]=zone
  23. uci set firewall.@zone[-1].name=wwan
  24. uci add_list firewall.@zone[-1].network=wwan
  25. uci add_list firewall.@zone[-1].network=wwan6
  26. uci set firewall.@zone[-1].input=ACCEPT
  27. uci set firewall.@zone[-1].output=ACCEPT
  28. uci set firewall.@zone[-1].forward=ACCEPT
  29. uci set firewall.@zone[-1].masq=1
  30. uci set firewall.@zone[-1].mtu_fix=1
  31. uci add firewall forwarding
  32. uci set firewall.@forwarding[-1].src=lan
  33. uci set firewall.@forwarding[-1].dest=wwan
  34. uci add firewall forwarding
  35. uci set firewall.@forwarding[-1].src=wwan
  36. uci set firewall.@forwarding[-1].dest=lan
  37. uci add firewall zone
  38. uci set firewall.@zone[-1].name=wan
  39. uci add_list firewall.@zone[-1].network='wan'
  40. uci add_list firewall.@zone[-1].network='wan6'
  41. uci set firewall.@zone[-1].input=ACCEPT
  42. uci set firewall.@zone[-1].output=ACCEPT
  43. uci set firewall.@zone[-1].forward=ACCEPT
  44. uci set firewall.@zone[-1].masq=1
  45. uci set firewall.@zone[-1].mtu_fix=1
  46. uci add firewall forwarding
  47. uci set firewall.@forwarding[-1].src=lan
  48. uci set firewall.@forwarding[-1].dest=wan
  49. uci add firewall forwarding
  50. uci set firewall.@forwarding[-1].src=wan
  51. uci set firewall.@forwarding[-1].dest=lan
  52. uci add firewall allowssh
  53. uci set firewall.allowssh=rule
  54. uci set firewall.allowssh.name='Allow-SSH'
  55. uci set firewall.allowssh.src='wan'
  56. uci set firewall.allowssh.proto='tcp'
  57. uci set firewall.allowssh.dest_port='22'
  58. uci set firewall.allowssh.target='ACCEPT'
  59. uci set firewall.allowssh.family='ipv4'
  60. uci set firewall.allowssh.enabled='0'
  61. uci add firewall allowui
  62. uci set firewall.allowui=rule
  63. uci set firewall.allowui.name='Allow-WEB'
  64. uci set firewall.allowui.src='wan'
  65. uci set firewall.allowui.proto='tcp'
  66. uci set firewall.allowui.dest_port='1471'
  67. uci set firewall.allowui.target='ACCEPT'
  68. uci set firewall.allowui.family='ipv4'
  69. uci set firewall.allowui.enabled='0'
  70. uci add firewall allowws
  71. uci set firewall.allowws=rule
  72. uci set firewall.allowws.name='Allow-WEB-WS'
  73. uci set firewall.allowws.src='wan'
  74. uci set firewall.allowws.proto='tcp'
  75. uci set firewall.allowws.dest_port='1337'
  76. uci set firewall.allowws.target='ACCEPT'
  77. uci set firewall.allowws.family='ipv4'
  78. uci set firewall.allowws.enabled='1'
  79. uci commit firewall
  80. exit 0