xtables-wgobfs: add an iptables extension module to obfuscate WireGuard#19974
xtables-wgobfs: add an iptables extension module to obfuscate WireGuard#19974infinet wants to merge 1 commit intoopenwrt:masterfrom
Conversation
|
I changed the tile. Could you please re-run the Formalities test? Thanks! |
|
You need to change commit title also |
5403eea to
0c9c91e
Compare
|
No usage of AUTORELEASE found in changes |
|
Not sure why but only 1 of the usual 10+ checks ran, I suggest rebasing on current master and doing a force push. |
ab661f8 to
a9ba103
Compare
a9ba103 to
09d4e16
Compare
|
@infinet It seems that your ChaCha8 hash function implementation has some crypto related flaws compared to reference ChaCha20 one:
|
|
Thank you for the insight! It will take some time to review and correct that part of code. In general, this module is trying to remove wireguard packets signature with minimal overhead, while wireguard is taking care of the communication security. |
|
I've taken another look at chacha8 implementation.
|
|
@infinet I also reviewed everything again and found this useful piece of information - https://crypto.stackexchange.com/a/11215 In short, original state addition (feed-forward) is required when you take parts of result that is being added with key (64 bits in the middle). In other words, you can omit feed-forward if you take first and last 32 bits, because they are being added with known input, so it will improve performance a bit. So the only concern is number of rounds. |
I have made few modifications.
The performance is almost the same. |
|
I have rebased it on the latest master branch. |
|
@infinet still relevant? If so commits need to be formatted according to the submission guidelines. And since this is adding a new package, this can be just one commit. |
8026623 to
4529ee7
Compare
|
Yes, it’s still relevant. I have updated the PR and squashed them into a single commit. Thanks! |
|
I think the commit subject should be something like: And the rest go into the commit message. |
4529ee7 to
9d97a6c
Compare
|
You need to address the formality check failures. |
9d97a6c to
c6775d1
Compare
|
Thanks! I have made two changes. Do they look reasonable? |
36c628c to
1c88ad6
Compare
|
Hopefully I have fixed all the formalities error in CI checks. |
Port from https://github.com/infinet/xt_wgobfs, this kernel module obfuscates WireGuard. It can work as server, client, or relay. Performance =========== Test in two Alpine linux VMs on same host. Each VM has 1 CPU and 256M RAM. Iperf3 over wg reports 1.1Gbits/sec without obfuscation, 950Mbits/sec with obfuscation. How it works ============ The sender and receiver share a secret key, which is used by `chacha6` to hash the same input into identical pseudo-random numbers. These pseudo-random numbers are used in obfuscation. The input to hash function is from 16th to 31st bytes of a WG message. The first byte of input is incremented when need to generate a different PRN. - The first 16 bytes of WG message is obfuscated. - The mac2 field is also obfuscated, if it is all zeros. - Padding WG message with random bytes of random length. - Drop keepalive message with 80% probability. - Change the Diffserv field to zero. `Chacha6` is chosen for its speed, as the goal is not encryption. See https://github.com/infinet/xt_wgobfs/blob/main/README.md for usage. Signed-off-by: Wei Chen <weichen302@gmail.com>
1c88ad6 to
3520d5f
Compare
Maintainer: @infinet
Compile tested: (ramips-mt7620 19.07.9 and 22.03.2, x86_64 19.07.9)
Run tested: (x86_64 19.07.9)
Port from https://github.com/infinet/xt_wgobfs, this extension obfuscates WireGuard by:
The first 16 bytes of WG message is obfuscated.
The mac2 field is also obfuscated, if it is all zeros.
Padding WG message with random long random bytes.
Drop keepalive message with 80% probability.
Change the Diffserv field to zero.
See https://github.com/infinet/xt_wgobfs/blob/main/README.md for usage.
Example as client:
Add two iptables rules to firewall.user:
iptables -t mangle -I INPUT -p udp -m udp --sport 6789 -j WGOBFS --key mysecretkey --unobfs
iptables -t mangle -I OUTPUT -p udp -m udp --dport 6789 -j WGOBFS --key mysecretkey --obfs
Here assuming remote server is listening on port 6789.
Signed-off-by: Wei Chen weichen302@gmail.com