added SNAT to use the correct outgoing IP address from Oracle depending on the WireGuard host
This commit is contained in:
		
							parent
							
								
									c00468eaea
								
							
						
					
					
						commit
						f0542a25c1
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -76,6 +76,18 @@ for rule in "${RULES[@]}"; do
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					case "$action" in
 | 
				
			||||||
 | 
					    "up")
 | 
				
			||||||
 | 
					        firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -o "$INTERFACE_SOURCE" -s "$FORWARD_TO_IP" -j SNAT --to-source "$ORIGINAL_DESTINATION_IP"
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					    "down")
 | 
				
			||||||
 | 
					        firewall-cmd --permanent --direct --remove-rule ipv4 nat POSTROUTING 0 -o "$INTERFACE_SOURCE" -s "$FORWARD_TO_IP" -j SNAT --to-source "$ORIGINAL_DESTINATION_IP"
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					    *)
 | 
				
			||||||
 | 
					        echo "Invalid action. Use 'up' or 'down'."
 | 
				
			||||||
 | 
					        exit 1
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
firewall-cmd --reload > /dev/null
 | 
					firewall-cmd --reload > /dev/null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo -e "\nDone! Don't forget to add/remove the rules in the security list."
 | 
					echo -e "\nDone! Don't forget to add/remove the rules in the security list."
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue