diff --git a/frida_cli/src/main.rs b/frida_cli/src/main.rs index b9d2633..bc282a4 100644 --- a/frida_cli/src/main.rs +++ b/frida_cli/src/main.rs @@ -42,10 +42,11 @@ fn generate_peer_config(matches: &ArgMatches, config_path: &str, cfg_raw: &Strin internal_address = Ipv4Addr::new(internal_address.octets()[0], internal_address.octets()[1], internal_address.octets()[2], internal_address.octets()[3]+1); - let cl_cfg = &ClientConfiguration::default(if grab_endpoint { &config.interface.bind_address } else { endpoint }, + let cl_cfg = &ClientConfiguration::default(&config.interface.bind_address.clone(), keepalive, &config.interface.public_key, - &internal_address.to_string()); + &internal_address.to_string(), + &config.interface.internal_address.clone()); config.peers.push(ServerPeer { public_key: cl_cfg.client.public_key.clone(), ip: internal_address.clone() }); diff --git a/frida_client/src/client.rs b/frida_client/src/client.rs index a006f6a..7d9ce64 100644 --- a/frida_client/src/client.rs +++ b/frida_client/src/client.rs @@ -316,7 +316,7 @@ pub mod desktop { let mtu: u16 = 1400; config.address(self.client_config.client.address.parse().unwrap()) .netmask(Ipv4Addr::new(255, 255, 255, 255)) - .destination(Ipv4Addr::new(10, 66, 66, 1)) + .destination(self.client_config.server.internal_gateway.parse().unwrap()) .mtu(mtu) .tun_name("tun0"); diff --git a/frida_core/src/config.rs b/frida_core/src/config.rs index 4c53a58..f7b299e 100644 --- a/frida_core/src/config.rs +++ b/frida_core/src/config.rs @@ -86,6 +86,7 @@ pub struct ClientInterface { pub struct EndpointInterface { pub public_key: String, pub endpoint: String, + pub internal_gateway: String, pub keepalive: u8 } @@ -96,7 +97,7 @@ pub struct ClientConfiguration { } impl ClientConfiguration { - pub fn default(endpoint: &str, keepalive: u8, public_key: &str, internal_address: &str) -> Self { + pub fn default(endpoint: &str, keepalive: u8, public_key: &str, internal_address: &str, internal_gateway: &str) -> Self { let mut csprng = StdRng::from_entropy(); let secret = StaticSecret::random_from_rng(&mut csprng); ClientConfiguration { @@ -108,6 +109,7 @@ impl ClientConfiguration { server: EndpointInterface { public_key: String::from_str(public_key).unwrap(), endpoint: String::from_str(endpoint).unwrap(), + internal_gateway: String::from_str(internal_gateway).unwrap(), keepalive } }