Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow connections to internal networks #25

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,29 @@ func main() {
fmt.Printf("Failed to add iptables nat rule: %v\n", err)
os.Exit(ExitSetupFailed)
}

fmt.Println("Adding iptables filter rules for WireGuard interface")

// Add iptables filter rules to always accept traffic between
// a container and the Wireguard interface.
// Required to connect to `internal` Docker networks.
err = ipt.AppendUnique(
"filter", "DOCKER-USER",
"-o", interfaceName,
"-j", "ACCEPT",
)
if err != nil {
fmt.Printf("Failed to add iptables filter rule: %v\n", err)
os.Exit(ExitSetupFailed)
}

err = ipt.AppendUnique(
"filter", "DOCKER-USER",
"-i", interfaceName,
"-j", "ACCEPT",
)
if err != nil {
fmt.Printf("Failed to add iptables filter rule: %v\n", err)
os.Exit(ExitSetupFailed)
}
}