Clean all iptables rules on stop
Prevents the "iptables: Chain already exists." error by making sure that we don't leave any chain on start. The ideal solution is to use iptables-restore instead, which will do the right job. But this needs to be changed in NixOS entirely. Reviewed-by: Aleix Boné <abonerib@bsc.es>
This commit is contained in:
		
							parent
							
								
									129273e8d8
								
							
						
					
					
						commit
						89c65ea578
					
				| @ -56,6 +56,11 @@ | |||||||
|         iptables -A nixos-fw -p tcp -s 10.0.40.30 --dport 23080 -j nixos-fw-log-refuse |         iptables -A nixos-fw -p tcp -s 10.0.40.30 --dport 23080 -j nixos-fw-log-refuse | ||||||
|         iptables -A nixos-fw -p tcp -s 10.0.40.0/24 --dport 23080 -j nixos-fw-accept |         iptables -A nixos-fw -p tcp -s 10.0.40.0/24 --dport 23080 -j nixos-fw-accept | ||||||
|       ''; |       ''; | ||||||
|  |       # Flush all rules and chains on stop so it won't break on start | ||||||
|  |       extraStopCommands = '' | ||||||
|  |         iptables -F | ||||||
|  |         iptables -X | ||||||
|  |       ''; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user