PageRenderTime 39ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/spec/fixtures/iptables/conversion_hash.rb

https://github.com/blentz/puppetlabs-firewall
Ruby | 727 lines | 717 code | 3 blank | 7 comment | 0 complexity | 3247c54b93dea590b8a22cf2f1b6f0de MD5 | raw file
Possible License(s): Apache-2.0
  1. # These hashes allow us to iterate across a series of test data
  2. # creating rspec examples for each parameter to ensure the input :line
  3. # extrapolates to the desired value for the parameter in question. And
  4. # vice-versa
  5. # This hash is for testing a line conversion to a hash of parameters
  6. # which will be used to create a resource.
  7. ARGS_TO_HASH = {
  8. 'long_rule_1' => {
  9. :line => '-A INPUT -s 1.1.1.1/32 -d 1.1.1.1/32 -p tcp -m multiport --dports 7061,7062 -m multiport --sports 7061,7062 -m comment --comment "000 allow foo" -j ACCEPT',
  10. :table => 'filter',
  11. :compare_all => true,
  12. :params => {
  13. :action => "accept",
  14. :chain => "INPUT",
  15. :destination => "1.1.1.1/32",
  16. :dport => ["7061","7062"],
  17. :ensure => :present,
  18. :line => '-A INPUT -s 1.1.1.1/32 -d 1.1.1.1/32 -p tcp -m multiport --dports 7061,7062 -m multiport --sports 7061,7062 -m comment --comment "000 allow foo" -j ACCEPT',
  19. :name => "000 allow foo",
  20. :proto => "tcp",
  21. :provider => "iptables",
  22. :source => "1.1.1.1/32",
  23. :sport => ["7061","7062"],
  24. :table => "filter",
  25. },
  26. },
  27. 'action_drop_1' => {
  28. :line => '-A INPUT -m comment --comment "000 allow foo" -j DROP',
  29. :table => 'filter',
  30. :params => {
  31. :jump => nil,
  32. :action => "drop",
  33. },
  34. },
  35. 'action_reject_1' => {
  36. :line => '-A INPUT -m comment --comment "000 allow foo" -j REJECT',
  37. :table => 'filter',
  38. :params => {
  39. :jump => nil,
  40. :action => "reject",
  41. },
  42. },
  43. 'action_nil_1' => {
  44. :line => '-A INPUT -m comment --comment "000 allow foo"',
  45. :table => 'filter',
  46. :params => {
  47. :jump => nil,
  48. :action => nil,
  49. },
  50. },
  51. 'jump_custom_chain_1' => {
  52. :line => '-A INPUT -m comment --comment "000 allow foo" -j custom_chain',
  53. :table => 'filter',
  54. :params => {
  55. :jump => "custom_chain",
  56. :action => nil,
  57. },
  58. },
  59. 'source_destination_ipv4_no_cidr' => {
  60. :line => '-A INPUT -s 1.1.1.1 -d 2.2.2.2 -m comment --comment "000 source destination ipv4 no cidr"',
  61. :table => 'filter',
  62. :params => {
  63. :source => '1.1.1.1/32',
  64. :destination => '2.2.2.2/32',
  65. },
  66. },
  67. 'source_destination_ipv6_no_cidr' => {
  68. :line => '-A INPUT -s 2001:db8:85a3::8a2e:370:7334 -d 2001:db8:85a3::8a2e:370:7334 -m comment --comment "000 source destination ipv6 no cidr"',
  69. :table => 'filter',
  70. :params => {
  71. :source => '2001:db8:85a3::8a2e:370:7334/128',
  72. :destination => '2001:db8:85a3::8a2e:370:7334/128',
  73. },
  74. },
  75. 'source_destination_ipv4_netmask' => {
  76. :line => '-A INPUT -s 1.1.1.0/255.255.255.0 -d 2.2.0.0/255.255.0.0 -m comment --comment "000 source destination ipv4 netmask"',
  77. :table => 'filter',
  78. :params => {
  79. :source => '1.1.1.0/24',
  80. :destination => '2.2.0.0/16',
  81. },
  82. },
  83. 'source_destination_ipv6_netmask' => {
  84. :line => '-A INPUT -s 2001:db8:1234::/ffff:ffff:ffff:0000:0000:0000:0000:0000 -d 2001:db8:4321::/ffff:ffff:ffff:0000:0000:0000:0000:0000 -m comment --comment "000 source destination ipv6 netmask"',
  85. :table => 'filter',
  86. :params => {
  87. :source => '2001:db8:1234::/48',
  88. :destination => '2001:db8:4321::/48',
  89. },
  90. },
  91. 'dport_range_1' => {
  92. :line => '-A INPUT -m multiport --dports 1:1024 -m comment --comment "000 allow foo"',
  93. :table => 'filter',
  94. :params => {
  95. :dport => ["1-1024"],
  96. },
  97. },
  98. 'dport_range_2' => {
  99. :line => '-A INPUT -m multiport --dports 15,512:1024 -m comment --comment "000 allow foo"',
  100. :table => 'filter',
  101. :params => {
  102. :dport => ["15","512-1024"],
  103. },
  104. },
  105. 'sport_range_1' => {
  106. :line => '-A INPUT -m multiport --sports 1:1024 -m comment --comment "000 allow foo"',
  107. :table => 'filter',
  108. :params => {
  109. :sport => ["1-1024"],
  110. },
  111. },
  112. 'sport_range_2' => {
  113. :line => '-A INPUT -m multiport --sports 15,512:1024 -m comment --comment "000 allow foo"',
  114. :table => 'filter',
  115. :params => {
  116. :sport => ["15","512-1024"],
  117. },
  118. },
  119. 'tcp_flags_1' => {
  120. :line => '-A INPUT -p tcp -m tcp --tcp-flags SYN,RST,ACK,FIN SYN -m comment --comment "000 initiation"',
  121. :table => 'filter',
  122. :compare_all => true,
  123. :chain => 'INPUT',
  124. :proto => 'tcp',
  125. :params => {
  126. :chain => "INPUT",
  127. :ensure => :present,
  128. :line => '-A INPUT -p tcp -m tcp --tcp-flags SYN,RST,ACK,FIN SYN -m comment --comment "000 initiation"',
  129. :name => "000 initiation",
  130. :proto => "tcp",
  131. :provider => "iptables",
  132. :table => "filter",
  133. :tcp_flags => "SYN,RST,ACK,FIN SYN",
  134. },
  135. },
  136. 'state_returns_sorted_values' => {
  137. :line => '-A INPUT -m state --state INVALID,RELATED,ESTABLISHED',
  138. :table => 'filter',
  139. :params => {
  140. :state => ['ESTABLISHED', 'INVALID', 'RELATED'],
  141. :action => nil,
  142. },
  143. },
  144. 'comment_string_character_validation' => {
  145. :line => '-A INPUT -s 192.168.0.1/32 -m comment --comment "000 allow from 192.168.0.1, please"',
  146. :table => 'filter',
  147. :params => {
  148. :source => '192.168.0.1/32',
  149. },
  150. },
  151. 'log_level_debug' => {
  152. :line => '-A INPUT -m comment --comment "956 INPUT log-level" -m state --state NEW -j LOG --log-level 7',
  153. :table => 'filter',
  154. :params => {
  155. :state => ['NEW'],
  156. :log_level => '7',
  157. :jump => 'LOG'
  158. },
  159. },
  160. 'log_level_warn' => {
  161. :line => '-A INPUT -m comment --comment "956 INPUT log-level" -m state --state NEW -j LOG',
  162. :table => 'filter',
  163. :params => {
  164. :state => ['NEW'],
  165. :log_level => '4',
  166. :jump => 'LOG'
  167. },
  168. },
  169. 'load_limit_module' => {
  170. :line => '-A INPUT -m multiport --dports 123 -m comment --comment "057 INPUT limit NTP" -m limit --limit 15/hour',
  171. :table => 'filter',
  172. :params => {
  173. :dport => ['123'],
  174. :limit => '15/hour'
  175. },
  176. },
  177. 'proto_ipencap' => {
  178. :line => '-A INPUT -p ipencap -m comment --comment "0100 INPUT accept ipencap"',
  179. :table => 'filter',
  180. :params => {
  181. :proto => 'ipencap',
  182. }
  183. },
  184. 'load_uid_owner_filter_module' => {
  185. :line => '-A OUTPUT -m owner --uid-owner root -m comment --comment "057 OUTPUT uid root only" -j ACCEPT',
  186. :table => 'filter',
  187. :params => {
  188. :action => 'accept',
  189. :uid => 'root',
  190. :chain => 'OUTPUT',
  191. },
  192. },
  193. 'load_uid_owner_postrouting_module' => {
  194. :line => '-t mangle -A POSTROUTING -m owner --uid-owner root -m comment --comment "057 POSTROUTING uid root only" -j ACCEPT',
  195. :table => 'mangle',
  196. :params => {
  197. :action => 'accept',
  198. :chain => 'POSTROUTING',
  199. :uid => 'root',
  200. },
  201. },
  202. 'load_gid_owner_filter_module' => {
  203. :line => '-A OUTPUT -m owner --gid-owner root -m comment --comment "057 OUTPUT gid root only" -j ACCEPT',
  204. :table => 'filter',
  205. :params => {
  206. :action => 'accept',
  207. :chain => 'OUTPUT',
  208. :gid => 'root',
  209. },
  210. },
  211. 'load_gid_owner_postrouting_module' => {
  212. :line => '-t mangle -A POSTROUTING -m owner --gid-owner root -m comment --comment "057 POSTROUTING gid root only" -j ACCEPT',
  213. :table => 'mangle',
  214. :params => {
  215. :action => 'accept',
  216. :chain => 'POSTROUTING',
  217. :gid => 'root',
  218. },
  219. },
  220. 'mark_set-mark' => {
  221. :line => '-t mangle -A PREROUTING -j MARK --set-xmark 0x3e8/0xffffffff',
  222. :table => 'mangle',
  223. :params => {
  224. :jump => 'MARK',
  225. :chain => 'PREROUTING',
  226. :set_mark => '0x3e8/0xffffffff',
  227. }
  228. },
  229. 'iniface_1' => {
  230. :line => '-A INPUT -i eth0 -m comment --comment "060 iniface" -j DROP',
  231. :table => 'filter',
  232. :params => {
  233. :action => 'drop',
  234. :chain => 'INPUT',
  235. :iniface => 'eth0',
  236. },
  237. },
  238. 'iniface_with_vlans_1' => {
  239. :line => '-A INPUT -i eth0.234 -m comment --comment "060 iniface" -j DROP',
  240. :table => 'filter',
  241. :params => {
  242. :action => 'drop',
  243. :chain => 'INPUT',
  244. :iniface => 'eth0.234',
  245. },
  246. },
  247. 'iniface_with_plus_1' => {
  248. :line => '-A INPUT -i eth+ -m comment --comment "060 iniface" -j DROP',
  249. :table => 'filter',
  250. :params => {
  251. :action => 'drop',
  252. :chain => 'INPUT',
  253. :iniface => 'eth+',
  254. },
  255. },
  256. 'outiface_1' => {
  257. :line => '-A OUTPUT -o eth0 -m comment --comment "060 outiface" -j DROP',
  258. :table => 'filter',
  259. :params => {
  260. :action => 'drop',
  261. :chain => 'OUTPUT',
  262. :outiface => 'eth0',
  263. },
  264. },
  265. 'outiface_with_vlans_1' => {
  266. :line => '-A OUTPUT -o eth0.234 -m comment --comment "060 outiface" -j DROP',
  267. :table => 'filter',
  268. :params => {
  269. :action => 'drop',
  270. :chain => 'OUTPUT',
  271. :outiface => 'eth0.234',
  272. },
  273. },
  274. 'outiface_with_plus_1' => {
  275. :line => '-A OUTPUT -o eth+ -m comment --comment "060 outiface" -j DROP',
  276. :table => 'filter',
  277. :params => {
  278. :action => 'drop',
  279. :chain => 'OUTPUT',
  280. :outiface => 'eth+',
  281. },
  282. },
  283. 'pkttype multicast' => {
  284. :line => '-A INPUT -m pkttype --pkt-type multicast -j ACCEPT',
  285. :table => 'filter',
  286. :params => {
  287. :action => 'accept',
  288. :pkttype => 'multicast',
  289. },
  290. },
  291. 'socket_option' => {
  292. :line => '-A PREROUTING -m socket -j ACCEPT',
  293. :table => 'mangle',
  294. :params => {
  295. :action => 'accept',
  296. :chain => 'PREROUTING',
  297. :socket => true,
  298. },
  299. },
  300. 'isfragment_option' => {
  301. :line => '-A INPUT -f -j ACCEPT',
  302. :table => 'filter',
  303. :params => {
  304. :action => 'accept',
  305. :isfragment => true,
  306. },
  307. },
  308. 'single_tcp_sport' => {
  309. :line => '-A OUTPUT -s 10.94.100.46/32 -p tcp -m tcp --sport 20443 -j ACCEPT',
  310. :table => 'mangle',
  311. :params => {
  312. :action => 'accept',
  313. :chain => 'OUTPUT',
  314. :source => "10.94.100.46/32",
  315. :proto => "tcp",
  316. :sport => ["20443"],
  317. },
  318. },
  319. 'single_udp_sport' => {
  320. :line => '-A OUTPUT -s 10.94.100.46/32 -p udp -m udp --sport 20443 -j ACCEPT',
  321. :table => 'mangle',
  322. :params => {
  323. :action => 'accept',
  324. :chain => 'OUTPUT',
  325. :source => "10.94.100.46/32",
  326. :proto => "udp",
  327. :sport => ["20443"],
  328. },
  329. },
  330. 'single_tcp_dport' => {
  331. :line => '-A OUTPUT -s 10.94.100.46/32 -p tcp -m tcp --dport 20443 -j ACCEPT',
  332. :table => 'mangle',
  333. :params => {
  334. :action => 'accept',
  335. :chain => 'OUTPUT',
  336. :source => "10.94.100.46/32",
  337. :proto => "tcp",
  338. :dport => ["20443"],
  339. },
  340. },
  341. 'single_udp_dport' => {
  342. :line => '-A OUTPUT -s 10.94.100.46/32 -p udp -m udp --dport 20443 -j ACCEPT',
  343. :table => 'mangle',
  344. :params => {
  345. :action => 'accept',
  346. :chain => 'OUTPUT',
  347. :source => "10.94.100.46/32",
  348. :proto => "udp",
  349. :dport => ["20443"],
  350. },
  351. },
  352. }
  353. # This hash is for testing converting a hash to an argument line.
  354. HASH_TO_ARGS = {
  355. 'long_rule_1' => {
  356. :params => {
  357. :action => "accept",
  358. :chain => "INPUT",
  359. :destination => "1.1.1.1",
  360. :dport => ["7061","7062"],
  361. :ensure => :present,
  362. :name => "000 allow foo",
  363. :proto => "tcp",
  364. :source => "1.1.1.1",
  365. :sport => ["7061","7062"],
  366. :table => "filter",
  367. },
  368. :args => ["-t", :filter, "-s", "1.1.1.1/32", "-d", "1.1.1.1/32", "-p", :tcp, "-m", "multiport", "--sports", "7061,7062", "-m", "multiport", "--dports", "7061,7062", "-m", "comment", "--comment", "000 allow foo", "-j", "ACCEPT"],
  369. },
  370. 'long_rule_2' => {
  371. :params => {
  372. :chain => "INPUT",
  373. :destination => "2.10.13.3/24",
  374. :dport => ["7061"],
  375. :ensure => :present,
  376. :jump => "my_custom_chain",
  377. :name => "700 allow bar",
  378. :proto => "udp",
  379. :source => "1.1.1.1",
  380. :sport => ["7061","7062"],
  381. :table => "filter",
  382. },
  383. :args => ["-t", :filter, "-s", "1.1.1.1/32", "-d", "2.10.13.0/24", "-p", :udp, "-m", "multiport", "--sports", "7061,7062", "-m", "multiport", "--dports", "7061", "-m", "comment", "--comment", "700 allow bar", "-j", "my_custom_chain"],
  384. },
  385. 'no_action' => {
  386. :params => {
  387. :name => "100 no action",
  388. :table => "filter",
  389. },
  390. :args => ["-t", :filter, "-p", :tcp, "-m", "comment", "--comment",
  391. "100 no action"],
  392. },
  393. 'zero_prefixlen_ipv4' => {
  394. :params => {
  395. :name => '100 zero prefix length ipv4',
  396. :table => 'filter',
  397. :source => '0.0.0.0/0',
  398. :destination => '0.0.0.0/0',
  399. },
  400. :args => ['-t', :filter, '-p', :tcp, '-m', 'comment', '--comment', '100 zero prefix length ipv4'],
  401. },
  402. 'zero_prefixlen_ipv6' => {
  403. :params => {
  404. :name => '100 zero prefix length ipv6',
  405. :table => 'filter',
  406. :source => '::/0',
  407. :destination => '::/0',
  408. },
  409. :args => ['-t', :filter, '-p', :tcp, '-m', 'comment', '--comment', '100 zero prefix length ipv6'],
  410. },
  411. 'source_destination_ipv4_no_cidr' => {
  412. :params => {
  413. :name => '000 source destination ipv4 no cidr',
  414. :table => 'filter',
  415. :source => '1.1.1.1',
  416. :destination => '2.2.2.2',
  417. },
  418. :args => ['-t', :filter, '-s', '1.1.1.1/32', '-d', '2.2.2.2/32', '-p', :tcp, '-m', 'comment', '--comment', '000 source destination ipv4 no cidr'],
  419. },
  420. 'source_destination_ipv6_no_cidr' => {
  421. :params => {
  422. :name => '000 source destination ipv6 no cidr',
  423. :table => 'filter',
  424. :source => '2001:db8:1234::',
  425. :destination => '2001:db8:4321::',
  426. },
  427. :args => ['-t', :filter, '-s', '2001:db8:1234::/128', '-d', '2001:db8:4321::/128', '-p', :tcp, '-m', 'comment', '--comment', '000 source destination ipv6 no cidr'],
  428. },
  429. 'source_destination_ipv4_netmask' => {
  430. :params => {
  431. :name => '000 source destination ipv4 netmask',
  432. :table => 'filter',
  433. :source => '1.1.1.0/255.255.255.0',
  434. :destination => '2.2.0.0/255.255.0.0',
  435. },
  436. :args => ['-t', :filter, '-s', '1.1.1.0/24', '-d', '2.2.0.0/16', '-p', :tcp, '-m', 'comment', '--comment', '000 source destination ipv4 netmask'],
  437. },
  438. 'source_destination_ipv6_netmask' => {
  439. :params => {
  440. :name => '000 source destination ipv6 netmask',
  441. :table => 'filter',
  442. :source => '2001:db8:1234::/ffff:ffff:ffff:0000:0000:0000:0000:0000',
  443. :destination => '2001:db8:4321::/ffff:ffff:ffff:0000:0000:0000:0000:0000',
  444. },
  445. :args => ['-t', :filter, '-s', '2001:db8:1234::/48', '-d', '2001:db8:4321::/48', '-p', :tcp, '-m', 'comment', '--comment', '000 source destination ipv6 netmask'],
  446. },
  447. 'sport_range_1' => {
  448. :params => {
  449. :name => "100 sport range",
  450. :sport => ["1-1024"],
  451. :table => "filter",
  452. },
  453. :args => ["-t", :filter, "-p", :tcp, "-m", "multiport", "--sports", "1:1024", "-m", "comment", "--comment", "100 sport range"],
  454. },
  455. 'sport_range_2' => {
  456. :params => {
  457. :name => "100 sport range",
  458. :sport => ["15","512-1024"],
  459. :table => "filter",
  460. },
  461. :args => ["-t", :filter, "-p", :tcp, "-m", "multiport", "--sports", "15,512:1024", "-m", "comment", "--comment", "100 sport range"],
  462. },
  463. 'dport_range_1' => {
  464. :params => {
  465. :name => "100 sport range",
  466. :dport => ["1-1024"],
  467. :table => "filter",
  468. },
  469. :args => ["-t", :filter, "-p", :tcp, "-m", "multiport", "--dports", "1:1024", "-m", "comment", "--comment", "100 sport range"],
  470. },
  471. 'dport_range_2' => {
  472. :params => {
  473. :name => "100 sport range",
  474. :dport => ["15","512-1024"],
  475. :table => "filter",
  476. },
  477. :args => ["-t", :filter, "-p", :tcp, "-m", "multiport", "--dports", "15,512:1024", "-m", "comment", "--comment", "100 sport range"],
  478. },
  479. 'tcp_flags_1' => {
  480. :params => {
  481. :name => "000 initiation",
  482. :tcp_flags => "SYN,RST,ACK,FIN SYN",
  483. :table => "filter",
  484. },
  485. :args => ["-t", :filter, "-p", :tcp, "-m", "tcp", "--tcp-flags", "SYN,RST,ACK,FIN", "SYN", "-m", "comment", "--comment", "000 initiation",]
  486. },
  487. 'states_set_from_array' => {
  488. :params => {
  489. :name => "100 states_set_from_array",
  490. :table => "filter",
  491. :state => ['ESTABLISHED', 'INVALID']
  492. },
  493. :args => ["-t", :filter, "-p", :tcp, "-m", "comment", "--comment", "100 states_set_from_array",
  494. "-m", "state", "--state", "ESTABLISHED,INVALID"],
  495. },
  496. 'comment_string_character_validation' => {
  497. :params => {
  498. :name => "000 allow from 192.168.0.1, please",
  499. :table => 'filter',
  500. :source => '192.168.0.1'
  501. },
  502. :args => ['-t', :filter, '-s', '192.168.0.1/32', '-p', :tcp, '-m', 'comment', '--comment', '000 allow from 192.168.0.1, please'],
  503. },
  504. 'port_property' => {
  505. :params => {
  506. :name => '001 port property',
  507. :table => 'filter',
  508. :port => '80',
  509. },
  510. :args => ['-t', :filter, '-p', :tcp, '-m', 'multiport', '--ports', '80', '-m', 'comment', '--comment', '001 port property'],
  511. },
  512. 'log_level_debug' => {
  513. :params => {
  514. :name => '956 INPUT log-level',
  515. :table => 'filter',
  516. :state => 'NEW',
  517. :jump => 'LOG',
  518. :log_level => 'debug'
  519. },
  520. :args => ['-t', :filter, '-p', :tcp, '-m', 'comment', '--comment', '956 INPUT log-level', '-m', 'state', '--state', 'NEW', '-j', 'LOG', '--log-level', '7'],
  521. },
  522. 'log_level_warn' => {
  523. :params => {
  524. :name => '956 INPUT log-level',
  525. :table => 'filter',
  526. :state => 'NEW',
  527. :jump => 'LOG',
  528. :log_level => 'warn'
  529. },
  530. :args => ['-t', :filter, '-p', :tcp, '-m', 'comment', '--comment', '956 INPUT log-level', '-m', 'state', '--state', 'NEW', '-j', 'LOG', '--log-level', '4'],
  531. },
  532. 'load_limit_module' => {
  533. :params => {
  534. :name => '057 INPUT limit NTP',
  535. :table => 'filter',
  536. :dport => '123',
  537. :limit => '15/hour'
  538. },
  539. :args => ['-t', :filter, '-p', :tcp, '-m', 'multiport', '--dports', '123', '-m', 'comment', '--comment', '057 INPUT limit NTP', '-m', 'limit', '--limit', '15/hour'],
  540. },
  541. 'proto_ipencap' => {
  542. :params => {
  543. :name => '0100 INPUT accept ipencap',
  544. :table => 'filter',
  545. :proto => 'ipencap',
  546. },
  547. :args => ['-t', :filter, '-p', :ipencap, '-m', 'comment', '--comment', '0100 INPUT accept ipencap'],
  548. },
  549. 'load_uid_owner_filter_module' => {
  550. :params => {
  551. :name => '057 OUTPUT uid root only',
  552. :table => 'filter',
  553. :uid => 'root',
  554. :action => 'accept',
  555. :chain => 'OUTPUT',
  556. :proto => 'all',
  557. },
  558. :args => ['-t', :filter, '-p', :all, '-m', 'owner', '--uid-owner', 'root', '-m', 'comment', '--comment', '057 OUTPUT uid root only', '-j', 'ACCEPT'],
  559. },
  560. 'load_uid_owner_postrouting_module' => {
  561. :params => {
  562. :name => '057 POSTROUTING uid root only',
  563. :table => 'mangle',
  564. :uid => 'root',
  565. :action => 'accept',
  566. :chain => 'POSTROUTING',
  567. :proto => 'all',
  568. },
  569. :args => ['-t', :mangle, '-p', :all, '-m', 'owner', '--uid-owner', 'root', '-m', 'comment', '--comment', '057 POSTROUTING uid root only', '-j', 'ACCEPT'],
  570. },
  571. 'load_gid_owner_filter_module' => {
  572. :params => {
  573. :name => '057 OUTPUT gid root only',
  574. :table => 'filter',
  575. :chain => 'OUTPUT',
  576. :gid => 'root',
  577. :action => 'accept',
  578. :proto => 'all',
  579. },
  580. :args => ['-t', :filter, '-p', :all, '-m', 'owner', '--gid-owner', 'root', '-m', 'comment', '--comment', '057 OUTPUT gid root only', '-j', 'ACCEPT'],
  581. },
  582. 'load_gid_owner_postrouting_module' => {
  583. :params => {
  584. :name => '057 POSTROUTING gid root only',
  585. :table => 'mangle',
  586. :gid => 'root',
  587. :action => 'accept',
  588. :chain => 'POSTROUTING',
  589. :proto => 'all',
  590. },
  591. :args => ['-t', :mangle, '-p', :all, '-m', 'owner', '--gid-owner', 'root', '-m', 'comment', '--comment', '057 POSTROUTING gid root only', '-j', 'ACCEPT'],
  592. },
  593. 'mark_set-mark_int' => {
  594. :params => {
  595. :name => '058 set-mark 1000',
  596. :table => 'mangle',
  597. :jump => 'MARK',
  598. :chain => 'PREROUTING',
  599. :set_mark => '1000',
  600. },
  601. :args => ['-t', :mangle, '-p', :tcp, '-m', 'comment', '--comment', '058 set-mark 1000', '-j', 'MARK', '--set-xmark', '0x3e8/0xffffffff'],
  602. },
  603. 'mark_set-mark_hex' => {
  604. :params => {
  605. :name => '058 set-mark 0x32',
  606. :table => 'mangle',
  607. :jump => 'MARK',
  608. :chain => 'PREROUTING',
  609. :set_mark => '0x32',
  610. },
  611. :args => ['-t', :mangle, '-p', :tcp, '-m', 'comment', '--comment', '058 set-mark 0x32', '-j', 'MARK', '--set-xmark', '0x32/0xffffffff'],
  612. },
  613. 'mark_set-mark_hex_with_hex_mask' => {
  614. :params => {
  615. :name => '058 set-mark 0x32/0xffffffff',
  616. :table => 'mangle',
  617. :jump => 'MARK',
  618. :chain => 'PREROUTING',
  619. :set_mark => '0x32/0xffffffff',
  620. },
  621. :args => ['-t', :mangle, '-p', :tcp, '-m', 'comment', '--comment', '058 set-mark 0x32/0xffffffff', '-j', 'MARK', '--set-xmark', '0x32/0xffffffff'],
  622. },
  623. 'mark_set-mark_hex_with_mask' => {
  624. :params => {
  625. :name => '058 set-mark 0x32/4',
  626. :table => 'mangle',
  627. :jump => 'MARK',
  628. :chain => 'PREROUTING',
  629. :set_mark => '0x32/4',
  630. },
  631. :args => ['-t', :mangle, '-p', :tcp, '-m', 'comment', '--comment', '058 set-mark 0x32/4', '-j', 'MARK', '--set-xmark', '0x32/0x4'],
  632. },
  633. 'iniface_1' => {
  634. :params => {
  635. :name => '060 iniface',
  636. :table => 'filter',
  637. :action => 'drop',
  638. :chain => 'INPUT',
  639. :iniface => 'eth0',
  640. },
  641. :args => ["-t", :filter, "-i", "eth0", "-p", :tcp, "-m", "comment", "--comment", "060 iniface", "-j", "DROP"],
  642. },
  643. 'iniface_with_vlans_1' => {
  644. :params => {
  645. :name => '060 iniface',
  646. :table => 'filter',
  647. :action => 'drop',
  648. :chain => 'INPUT',
  649. :iniface => 'eth0.234',
  650. },
  651. :args => ["-t", :filter, "-i", "eth0.234", "-p", :tcp, "-m", "comment", "--comment", "060 iniface", "-j", "DROP"],
  652. },
  653. 'iniface_with_plus_1' => {
  654. :params => {
  655. :name => '060 iniface',
  656. :table => 'filter',
  657. :action => 'drop',
  658. :chain => 'INPUT',
  659. :iniface => 'eth+',
  660. },
  661. :args => ["-t", :filter, "-i", "eth+", "-p", :tcp, "-m", "comment", "--comment", "060 iniface", "-j", "DROP"],
  662. },
  663. 'outiface_1' => {
  664. :params => {
  665. :name => '060 outiface',
  666. :table => 'filter',
  667. :action => 'drop',
  668. :chain => 'OUTPUT',
  669. :outiface => 'eth0',
  670. },
  671. :args => ["-t", :filter, "-o", "eth0", "-p", :tcp, "-m", "comment", "--comment", "060 outiface", "-j", "DROP"],
  672. },
  673. 'outiface_with_vlans_1' => {
  674. :params => {
  675. :name => '060 outiface',
  676. :table => 'filter',
  677. :action => 'drop',
  678. :chain => 'OUTPUT',
  679. :outiface => 'eth0.234',
  680. },
  681. :args => ["-t", :filter, "-o", "eth0.234", "-p", :tcp, "-m", "comment", "--comment", "060 outiface", "-j", "DROP"],
  682. },
  683. 'outiface_with_plus_1' => {
  684. :params => {
  685. :name => '060 outiface',
  686. :table => 'filter',
  687. :action => 'drop',
  688. :chain => 'OUTPUT',
  689. :outiface => 'eth+',
  690. },
  691. :args => ["-t", :filter, "-o", "eth+", "-p", :tcp, "-m", "comment", "--comment", "060 outiface", "-j", "DROP"],
  692. },
  693. 'pkttype multicast' => {
  694. :params => {
  695. :name => '062 pkttype multicast',
  696. :table => "filter",
  697. :action => 'accept',
  698. :chain => 'INPUT',
  699. :iniface => 'eth0',
  700. :pkttype => 'multicast',
  701. },
  702. :args => ["-t", :filter, "-i", "eth0", "-p", :tcp, "-m", "pkttype", "--pkt-type", :multicast, "-m", "comment", "--comment", "062 pkttype multicast", "-j", "ACCEPT"],
  703. },
  704. 'socket_option' => {
  705. :params => {
  706. :name => '050 socket option',
  707. :table => 'mangle',
  708. :action => 'accept',
  709. :chain => 'PREROUTING',
  710. :socket => true,
  711. },
  712. :args => ['-t', :mangle, '-p', :tcp, '-m', 'socket', '-m', 'comment', '--comment', '050 socket option', '-j', 'ACCEPT'],
  713. },
  714. 'isfragment_option' => {
  715. :params => {
  716. :name => '050 isfragment option',
  717. :table => 'filter',
  718. :proto => :all,
  719. :action => 'accept',
  720. :isfragment => true,
  721. },
  722. :args => ['-t', :filter, '-p', :all, '-f', '-m', 'comment', '--comment', '050 isfragment option', '-j', 'ACCEPT'],
  723. },
  724. }