-
Notifications
You must be signed in to change notification settings - Fork 62
feat(amneziawg): Initial AmneziaWG protocol support #336
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
Conversation
| "PersistentKeepalive", | ||
|
|
||
| // AmneziaWG extended parameters | ||
| "Jc", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, check could be simply invert — removing only those keys that you manually process
further down the function. Then there will be no need to keep this list up to date.
Also, wireguard_config.rs always prints:
WARN vopono_core::network::wireguard_config > Unknown key in [Interface] section: Jc
WARN vopono_core::network::wireguard_config > Unknown key in [Interface] section: Jmin
WARN vopono_core::network::wireguard_config > Unknown key in [Interface] section: Jmax
WARN vopono_core::network::wireguard_config > Unknown key in [Interface] section: S1
WARN vopono_core::network::wireguard_config > Unknown key in [Interface] section: S2
WARN vopono_core::network::wireguard_config > Unknown key in [Interface] section: H1
WARN vopono_core::network::wireguard_config > Unknown key in [Interface] section: H2
WARN vopono_core::network::wireguard_config > Unknown key in [Interface] section: H3
WARN vopono_core::network::wireguard_config > Unknown key in [Interface] section: H4
WARN vopono_core::network::wireguard_config > Unknown key in [Peer] section: PresharedKey
Does it matter? Parsing should be implemented even if parameters are not used vopono directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just use an if else here to only add the extra keys in the Amnezia case no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're talking about wireguard_config.rs, I'm not entirely clear where to add if-else.
In wireguard.rs, I tested changes from #336 (comment)
working as expected but not commited.
|
I recently noticed a connection stability issue that needs to be resolved The connection drops every minute, which can be seen by running dmesg
On shutdown: All AmneziaWG options passed in to Inverted check and config dumpdiff --git a/vopono_core/src/network/wireguard.rs b/vopono_core/src/network/wireguard.rs
index 86e7c27..e79b1d3 100644
--- a/vopono_core/src/network/wireguard.rs
+++ b/vopono_core/src/network/wireguard.rs
@@ -76,43 +76,25 @@ impl Wireguard {
// TODO: Maybe properly parse ini format
// Valid keys for wireguard config (see wg(8):CONFIGURATION FILE FORMAT)
- let allow_keys = [
- "PrivateKey",
- "ListenPort",
- "FwMark",
- "PublicKey",
- "PresharedKey",
- "AllowedIPs",
- "Endpoint",
- "PersistentKeepalive",
-
- // AmneziaWG extended parameters
- "Jc",
- "Jmin",
- "Jmax",
- "S1",
- "S2",
- "H1",
- "H2",
- "H3",
- "H4",
+ let parsed_keys = [
+ "Address",
+ "DNS",
+ "MTU",
];
let mut f = std::fs::File::create("/tmp/vopono_wg.conf")
.context("Creating file: /tmp/vopono_wg.conf")?;
- write!(
- f,
- "{}",
- config_string
- .split('\n')
- .filter(|x| x
- .split_once('=')
- .map(|(key, _)| allow_keys.contains(&key.trim()))
- // If line doesn't include an =, don't filter it out
- .unwrap_or(true))
- .collect::<Vec<&str>>()
- .join("\n")
- )?;
+ let content = config_string
+ .split('\n')
+ .filter(|x| x
+ .split_once('=')
+ .map(|(key, _)| !parsed_keys.contains(&key.trim()))
+ // If line doesn't include an =, don't filter it out
+ .unwrap_or(true))
+ .collect::<Vec<&str>>()
+ .join("\n");
+ println!("{}", content);
+ write!(f, "{}", content)?;
}
let config = Self::config_from_file(&config_file)?;
|
|
Similar issue: amnezia-vpn/amneziawg-linux-kernel-module#30 |
|
Looks like problem in namespace / routing, I'm not sure what to do next to find cause of P.S. |
|
I don't know how I came up with this idea 😄
Result: some ping responses come, but periodical disconnects / reconnects happens. |
5106e34 to
06fafd5
Compare
|
The network issues I've been experiencing for the last month appear to |
|
Thanks, I'll see if I can set it up to test on my VPS this weekend. |
|
LGTM, it'd be good to create a later PR with more details for the user guide (e.g. setting it up headlessly etc.) - it's a pain it requires so much set up with the kernel changes and so on. |
Description
Basic implementation of AmneziaWG protocol support.
Run
vopono exec --protocol AmneziaWG --custom ./awg.conf 'curl ifconfig.me'to test it.Closes: #335