-
Notifications
You must be signed in to change notification settings - Fork 58
Refactor NFQueue verdict handling and introduce TUN device management #256
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
Open
DanielLavrushin
wants to merge
62
commits into
main
Choose a base branch
from
tun-feature-gen2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 54 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
8204839
Refactor NFQueue verdict handling and introduce TUN device management
DanielLavrushin 2107a56
feat: enhance TUN configuration to support multiple routes
DanielLavrushin 8dd6dd2
feat: enhance route collection logic for TUN device to support select…
DanielLavrushin 03390b5
feat: implement TUN route management and configuration updates
DanielLavrushin aa60ea9
feat: add TUN mode configuration and settings to Feature component
DanielLavrushin 7062887
feat: enhance TUN settings with route management and localization upd…
DanielLavrushin 4e59594
feat: enhance TUN engine with error logging and forwarding metrics
DanielLavrushin 2ec85e9
feat: clear masquerade tables on TUN engine start failure
DanielLavrushin e372bb9
feat: ensure route teardown on TUN engine start failure
DanielLavrushin 06e5a44
feat: enhance IPv6 socket binding error handling and disable on failure
DanielLavrushin 82f8090
feat: remove cleanup of DNS pending routes during pool cleanup
DanielLavrushin 889d8c2
feat: add skip setup option for masquerade table management in TUN en…
DanielLavrushin 8407d8d
feat: improve default route handling in setup by using IPv4 only
DanielLavrushin e9b9f48
feat: add validation for TUN device name length in openTUN function
DanielLavrushin b5d6394
feat: ensure TUN device is deleted on sender initialization failure
DanielLavrushin d1afcc8
feat: ensure safe stop of TUN engine using sync.Once for idempotency
DanielLavrushin 5130a8d
feat: add interface validation in TUN engine to prevent conflicts wit…
DanielLavrushin c1e3f73
fix: handle error when checking existing route table in setupBypassTa…
DanielLavrushin 3aed60a
feat: update DNS packet processing to use client MAC address for SNI …
DanielLavrushin 80c300d
fix: reset TUNRouteFunc to nil on TUN engine start failure
DanielLavrushin bd9ea1a
fix: remove assignment of TUNRouteFunc to nil in Stop method
DanielLavrushin 68d2e56
feat: add TUN engine mode migration and validation tests
DanielLavrushin aa9f5dc
refactor: extract delFwmarkRule method for better code reuse in setup…
DanielLavrushin 39577fa
test: add unit tests for extractField and extractGateway functions
DanielLavrushin 16b81d9
feat: enhance setupBypassTable to check for existing route tables and…
DanielLavrushin 72639d7
fix: change route command from add to replace in addRoute and addBypa…
DanielLavrushin 68ab96c
fix: add early return in ClearMasqueradeOnly if masquerade is disabled
DanielLavrushin 9795e1d
fix: improve AddRoute method to handle quit signal before adding route
DanielLavrushin 68abd00
fix: add conditional checks before syncing tproxy and routing configu…
DanielLavrushin 7743e45
fix: update ApplyMasqueradeOnly to clear masquerade before applying i…
DanielLavrushin 3e6a4de
fix: replace hardcoded constants with system-defined values for tun d…
DanielLavrushin 89841e7
feat: add TUN-interface packet engine for devices without NFQUEUE
DanielLavrushin e863d51
fix: enhance default route handling and improve error logging in setu…
DanielLavrushin d4cae5b
feat: implement password hashing and validation, enhance web server c…
DanielLavrushin d74ac3c
fix: improve error handling in packet forwarding and enhance logging …
DanielLavrushin 349792f
feat: implement NAT setup and teardown for routeManager
DanielLavrushin eaa734a
feat: add conntrack sysctl management functions for masquerade setup
DanielLavrushin 9624b87
feat: enhance NAT setup with dynamic MTU configuration and improved e…
DanielLavrushin 987f360
fix: update logging message for NOTRACK installation in NAT setup
DanielLavrushin 660c58b
feat: implement reconcile loop for routeManager to monitor and update…
DanielLavrushin 77b4b55
feat: add bypassMark to TUNConfig and implement connbytes bypass rule…
DanielLavrushin c7369e1
feat: implement token expiration cleanup and enhance login attempt ma…
DanielLavrushin 570fa59
feat: enhance routeManager to support --skip-tables option for flexib…
DanielLavrushin 44c7b36
refactor: simplify packet handling in readLoop by eliminating unneces…
DanielLavrushin 41bfe80
feat: initialize current map in routeManager and enhance run function…
DanielLavrushin 18d2ab5
refactor: streamline ClearMasquerade function by consolidating comman…
DanielLavrushin b308c09
fix: stop pool on TUN engine start failure to prevent resource leaks
DanielLavrushin 06861e5
refactor: improve ruleFieldValue function for better readability and …
DanielLavrushin 664307b
fix: handle error when setting non-blocking mode in openTUN function
DanielLavrushin 92293d0
chore: update changelog to reflect password hashing for Web UI login
DanielLavrushin 25ce356
refactor: remove bypassMark from TUNConfig and related logic to simpl…
DanielLavrushin 5a1a6d8
feat: add masquerade mark-bypass rule in iptables and nftables managers
DanielLavrushin 9ec2bf2
fix: resolve DNS redirect issues for encrypted DNS (DoH) in certain s…
DanielLavrushin 0eed903
chore: update changelog for new TUN engine, secure password storage, …
DanielLavrushin eb8655f
fix: resolve routing set address update issues in certain setups dns …
DanielLavrushin 64cd650
fix: synchronize tproxy and routing configurations in TUN mode
DanielLavrushin 7b5f4ed
feat(tun): introduce TUN packet-processing engine with port-scoped ca…
DanielLavrushin fc8996d
feat(tun): implement MSS clamp functionality and enhance packet handl…
DanielLavrushin 088cee2
feat(tun): integrate ReinjectMarkBit for enhanced packet marking in T…
DanielLavrushin cc84686
fix(tun): clear MSS clamp and revert conntrack sysctls on TUN engine …
DanielLavrushin 4a7e34c
feat(tun): add iptables check in setup to ensure necessary binaries f…
DanielLavrushin 42c7a4e
fix(tun): add validation for minimum IP header length in senderFor fu…
DanielLavrushin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package config | ||
|
|
||
| import ( | ||
| "strings" | ||
|
|
||
| "golang.org/x/crypto/bcrypt" | ||
| ) | ||
|
|
||
| const webPasswordCost = 12 | ||
|
|
||
| func HashPassword(plain string) (string, error) { | ||
| h, err := bcrypt.GenerateFromPassword([]byte(plain), webPasswordCost) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| return string(h), nil | ||
| } | ||
|
|
||
| func CheckPassword(hash, plain string) bool { | ||
| if hash == "" { | ||
| return false | ||
| } | ||
| return bcrypt.CompareHashAndPassword([]byte(hash), []byte(plain)) == nil | ||
| } | ||
|
|
||
| func IsHashedPassword(s string) bool { | ||
| return strings.HasPrefix(s, "$2a$") || | ||
| strings.HasPrefix(s, "$2b$") || | ||
| strings.HasPrefix(s, "$2y$") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package engine | ||
|
|
||
| type PacketVerdict int | ||
|
|
||
| const ( | ||
| VerdictAccept PacketVerdict = iota | ||
| VerdictDrop | ||
| ) | ||
|
|
||
| type Engine interface { | ||
| Start() error | ||
| Stop() | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.