summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2020-08-19 12:08:52 +0200
committerDavid Lönnhager <david.l@mullvad.net>2020-08-20 14:41:42 +0200
commitd0fcbfaaebb69db037dc63cb41c6eb3dc58aa49b (patch)
tree2a7e0931f69ba93f00824d9a96d97fb9eb885f5b
parent5e25ef9e6d784c86ff9f346428d81fe7f05c4e7a (diff)
downloadmullvadvpn-d0fcbfaaebb69db037dc63cb41c6eb3dc58aa49b.tar.xz
mullvadvpn-d0fcbfaaebb69db037dc63cb41c6eb3dc58aa49b.zip
Remove key rotation interval calculation from management interface
-rw-r--r--mullvad-cli/src/cmds/tunnel.rs10
-rw-r--r--mullvad-daemon/src/management_interface.rs8
-rw-r--r--mullvad-daemon/src/wireguard.rs2
-rw-r--r--mullvad-management-interface/proto/management_interface.proto9
4 files changed, 16 insertions, 13 deletions
diff --git a/mullvad-cli/src/cmds/tunnel.rs b/mullvad-cli/src/cmds/tunnel.rs
index 601115003b..528ebd005e 100644
--- a/mullvad-cli/src/cmds/tunnel.rs
+++ b/mullvad-cli/src/cmds/tunnel.rs
@@ -216,10 +216,12 @@ impl Tunnel {
async fn process_wireguard_rotation_interval_get() -> Result<()> {
let tunnel_options = Self::get_tunnel_options().await?;
- println!(
- "Rotation interval: {} hour(s)",
- tunnel_options.wireguard.unwrap().automatic_rotation
- );
+ match tunnel_options.wireguard.unwrap().automatic_rotation {
+ Some(interval) => {
+ println!("Rotation interval: {} hour(s)", interval.interval);
+ }
+ None => println!("Rotation interval: default"),
+ }
Ok(())
}
diff --git a/mullvad-daemon/src/management_interface.rs b/mullvad-daemon/src/management_interface.rs
index cf5a6cb2dd..61df804d3e 100644
--- a/mullvad-daemon/src/management_interface.rs
+++ b/mullvad-daemon/src/management_interface.rs
@@ -1,6 +1,4 @@
-use crate::{
- wireguard::DEFAULT_AUTOMATIC_KEY_ROTATION, DaemonCommand, DaemonCommandSender, EventListener,
-};
+use crate::{DaemonCommand, DaemonCommandSender, EventListener};
use futures::compat::Future01CompatExt;
use futures01::{future, sync, Future};
use mullvad_management_interface::{
@@ -1199,6 +1197,8 @@ fn convert_bridge_state(state: &BridgeState) -> types::BridgeState {
}
fn convert_tunnel_options(options: &TunnelOptions) -> types::TunnelOptions {
+ use types::tunnel_options::wireguard_options::RotationInterval;
+
types::TunnelOptions {
openvpn: Some(types::tunnel_options::OpenvpnOptions {
mssfix: u32::from(options.openvpn.mssfix.unwrap_or_default()),
@@ -1208,7 +1208,7 @@ fn convert_tunnel_options(options: &TunnelOptions) -> types::TunnelOptions {
automatic_rotation: options
.wireguard
.automatic_rotation
- .unwrap_or((DEFAULT_AUTOMATIC_KEY_ROTATION.as_secs() / 60u64 / 60u64) as u32),
+ .map(|interval| RotationInterval { interval }),
}),
generic: Some(types::tunnel_options::GenericOptions {
enable_ipv6: options.generic.enable_ipv6,
diff --git a/mullvad-daemon/src/wireguard.rs b/mullvad-daemon/src/wireguard.rs
index 58daf58ca5..2ebd5fae50 100644
--- a/mullvad-daemon/src/wireguard.rs
+++ b/mullvad-daemon/src/wireguard.rs
@@ -22,7 +22,7 @@ use talpid_types::ErrorExt;
use tokio_timer;
/// Default automatic key rotation
-pub const DEFAULT_AUTOMATIC_KEY_ROTATION: Duration = Duration::from_secs(7 * 24 * 60 * 60);
+const DEFAULT_AUTOMATIC_KEY_ROTATION: Duration = Duration::from_secs(7 * 24 * 60 * 60);
/// How long to wait before reattempting to rotate keys on failure
const AUTOMATIC_ROTATION_RETRY_DELAY: Duration = Duration::from_secs(60 * 15);
/// How often to check whether the key has expired.
diff --git a/mullvad-management-interface/proto/management_interface.proto b/mullvad-management-interface/proto/management_interface.proto
index 6eabb0965a..fa0190cbb2 100644
--- a/mullvad-management-interface/proto/management_interface.proto
+++ b/mullvad-management-interface/proto/management_interface.proto
@@ -246,7 +246,6 @@ message BridgeState {
}
message Settings {
- // NOTE: token is optional
string account_token = 1;
RelaySettings relay_settings = 2;
BridgeSettings bridge_settings = 3;
@@ -256,7 +255,6 @@ message Settings {
bool auto_connect = 7;
TunnelOptions tunnel_options = 8;
bool show_beta_releases = 9;
- // NOTE: skipping version field
}
message RelaySettings {
@@ -344,10 +342,13 @@ message TunnelOptions {
uint32 mssfix = 1;
}
message WireguardOptions {
+ message RotationInterval {
+ uint32 interval = 1;
+ }
+
// NOTE: optional
uint32 mtu = 1;
- // NOTE: optional
- uint32 automatic_rotation = 2;
+ RotationInterval automatic_rotation = 2;
}
message GenericOptions {
bool enable_ipv6 = 1;