dont use sudo

This commit is contained in:
Alex 2023-03-09 11:54:44 +01:00
parent ae4acb2e91
commit 4f5ecdd55f

View file

@ -84,8 +84,8 @@ fn fasthash(data: &[u8]) -> u64 {
} }
fn wg_dump(config: &Config) -> Result<(Pubkey, u16, Vec<(Pubkey, Option<SocketAddr>, u64)>)> { fn wg_dump(config: &Config) -> Result<(Pubkey, u16, Vec<(Pubkey, Option<SocketAddr>, u64)>)> {
let output = Command::new("sudo") let output = Command::new("wg")
.args(["wg", "show", &config.interface, "dump"]) .args(["show", &config.interface, "dump"])
.output()?; .output()?;
let mut lines = std::str::from_utf8(&output.stdout)?.split('\n'); let mut lines = std::str::from_utf8(&output.stdout)?.split('\n');
@ -256,9 +256,8 @@ impl Daemon {
if !endpoints.is_empty() { if !endpoints.is_empty() {
let endpoint = endpoints[i % endpoints.len()]; let endpoint = endpoints[i % endpoints.len()];
info!("Configure {} with endpoint {}", peer.pubkey, endpoint.0); info!("Configure {} with endpoint {}", peer.pubkey, endpoint.0);
Command::new("sudo") Command::new("wg")
.args([ .args([
"wg",
"set", "set",
&self.config.interface, &self.config.interface,
"peer", "peer",