diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-08-17 14:26:09 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-08-17 14:26:09 +0200 |
commit | a625945fe295da227d863f6ec085ec2828ce4d72 (patch) | |
tree | 9fdff16d4046ff6aa62d4221ba2b6a4f6851adc4 | |
parent | 05f2587bdff32e5d2f8c19d290654beb47be2db5 (diff) |
warn about insecure permissions but still run
needed on dead simple systems like rustkrazy
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/main.rs | 4 |
2 files changed, 2 insertions, 4 deletions
@@ -19,7 +19,7 @@ where config is the config path (defaults to /data/dyndns.conf). The configuration file is simply a JSON file. -**Since this file contains account credentials the client will refuse to run +**Since this file contains account credentials the client will print a warning if anyone other than its owner has any permissions. A reasonable default is 0600.** diff --git a/src/main.rs b/src/main.rs index be87630..e2ed534 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,6 @@ use serde::{Deserialize, Serialize}; #[derive(Debug)] enum Error { - InsecureConfig, ChannelRecv(mpsc::RecvError), ChannelSend4(mpsc::SendError<Ipv4Net>), ChannelSend6(mpsc::SendError<Ipv6Net>), @@ -35,7 +34,6 @@ impl std::error::Error for Error {} impl fmt::Display for Error { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Self::InsecureConfig => write!(fmt, "config has insecure permissions (need 0?00)"), Self::ChannelRecv(e) => write!(fmt, "can't recv from mpsc channel: {}", e), Self::ChannelSend4(e) => write!(fmt, "can't send to mpsc channel: {}", e), Self::ChannelSend6(e) => write!(fmt, "can't send to mpsc channel: {}", e), @@ -154,7 +152,7 @@ fn main() -> Result<()> { let mut config_file = File::open(config_path.as_str())?; if config_file.metadata()?.permissions().mode() & 0o077 > 0 { - return Err(Error::InsecureConfig); + println!("WARNING: insecure permissions on config"); } let mut config_contents = String::new(); |