diff --git a/nym-node/nym-node-requests/src/api/v1/node/models.rs b/nym-node/nym-node-requests/src/api/v1/node/models.rs index 7b7c820de9..af22876f1c 100644 --- a/nym-node/nym-node-requests/src/api/v1/node/models.rs +++ b/nym-node/nym-node-requests/src/api/v1/node/models.rs @@ -174,4 +174,10 @@ pub struct AuxiliaryDetails { #[schemars(with = "Option")] #[schemars(length(equal = 2))] pub location: Option, + + /// Specifies whether this node operator has agreed to the terms and conditions + /// as defined at + // make sure to include the default deserialisation as this field hasn't existed when the struct was first created + #[serde(default)] + pub accepted_toc: bool, } diff --git a/nym-node/src/cli/commands/run/args.rs b/nym-node/src/cli/commands/run/args.rs index 50bc9e56f4..51d02d461d 100644 --- a/nym-node/src/cli/commands/run/args.rs +++ b/nym-node/src/cli/commands/run/args.rs @@ -18,6 +18,17 @@ pub(crate) struct Args { #[clap(flatten)] pub(crate) config: ConfigArgs, + /// Explicitly specify whether you agree with the terms and conditions of a nym node operator + /// as defined at + #[clap( + long, + env = NYMNODE_ACCEPT_TOC, + alias = "accept-toc", + alias = "accept-t&c", + alias = "accept-operator-terms-and-conditions" + )] + pub(crate) accept_operator_terms: bool, + /// Forbid a new node from being initialised if configuration file for the provided specification doesn't already exist #[clap( long, diff --git a/nym-node/src/cli/commands/run/mod.rs b/nym-node/src/cli/commands/run/mod.rs index 5e06ea442c..9a0f2e585b 100644 --- a/nym-node/src/cli/commands/run/mod.rs +++ b/nym-node/src/cli/commands/run/mod.rs @@ -46,6 +46,12 @@ pub(crate) async fn execute(mut args: Args) -> Result<(), NymNodeError> { let bonding_info_path = args.bonding_information_output.clone(); let init_only = args.init_only; let local = args.local; + let accepted_toc = args.accept_operator_terms; + + if !accepted_toc { + warn!("you don't seem to have accepted the terms and conditions of a Nym node operator"); + warn!("please familiarise yourself with and run the binary with '--accept-toc' flag if you agree with them"); + } let config = if !config_path.exists() { debug!("no configuration file found at '{}'", config_path.display()); @@ -79,7 +85,7 @@ pub(crate) async fn execute(mut args: Args) -> Result<(), NymNodeError> { } check_public_ips(&config.host.public_ips, local); - let nym_node = NymNode::new(config).await?; + let nym_node = NymNode::new(config).await?.with_accepted_toc(accepted_toc); // if requested, write bonding info if let Some(bonding_info_path) = bonding_info_path { diff --git a/nym-node/src/env.rs b/nym-node/src/env.rs index 01bc85bfe7..e549837008 100644 --- a/nym-node/src/env.rs +++ b/nym-node/src/env.rs @@ -18,6 +18,8 @@ pub mod vars { pub const NYMNODE_MODE_ARG: &str = "NYMNODE_MODE"; + pub const NYMNODE_ACCEPT_TOC: &str = "NYMNODE_ACCEPT_TOC"; + // host: pub const NYMNODE_PUBLIC_IPS_ARG: &str = "NYMNODE_PUBLIC_IPS"; pub const NYMNODE_HOSTNAME_ARG: &str = "NYMNODE_HOSTNAME"; diff --git a/nym-node/src/node/mod.rs b/nym-node/src/node/mod.rs index 20b62c3e44..001e7f5f2f 100644 --- a/nym-node/src/node/mod.rs +++ b/nym-node/src/node/mod.rs @@ -293,6 +293,8 @@ impl From for nym_wireguard::WireguardData { pub(crate) struct NymNode { config: Config, + accepted_toc: bool, + description: NodeDescription, // TODO: currently we're only making measurements in 'mixnode' mode; this should be changed @@ -392,9 +394,15 @@ impl NymNode { exit_gateway: ExitGatewayData::new(&config.exit_gateway)?, wireguard: wireguard_data, config, + accepted_toc: false, }) } + pub(crate) fn with_accepted_toc(mut self, accepted_toc: bool) -> Self { + self.accepted_toc = accepted_toc; + self + } + fn exit_network_requester_address(&self) -> Recipient { Recipient::new( self.exit_gateway.nr_ed25519, @@ -530,6 +538,7 @@ impl NymNode { let auxiliary_details = api_requests::v1::node::models::AuxiliaryDetails { location: self.config.host.location, + accepted_toc: self.accepted_toc, }; // mixnode info