diff --git a/Makefile b/Makefile index 1d691c19d..e1221d766 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ central-controller-docker: FORCE docker build -t registry.zerotier.com/zerotier-central/ztcentral-controller:${TIMESTAMP} -f controller/central-docker/Dockerfile . clean: FORCE - rm -rf ${BUILDDIR} rust-zerotier-core/target rust-zerotier-service/target + rm -rf ${BUILDDIR} rust-zerotier-core/target rust-zerotier-service/target rust-zerotier-core/src/capi.rs rust-zerotier-service/src/osdep.rs distclean: FORCE rm -rf ${BUILDDIR} diff --git a/rust-zerotier-service/src/cli.rs b/rust-zerotier-service/src/cli.rs index 11b1e5e94..76c2e79ea 100644 --- a/rust-zerotier-service/src/cli.rs +++ b/rust-zerotier-service/src/cli.rs @@ -37,11 +37,11 @@ Common Operations: · status Show node status and configuration · set [setting] [value] List all settings (with no args) -· port Primary P2P port -· secondaryport Secondary P2P port (0 to disable) -· blacklist cidr Toggle physical path blacklisting -· blacklist if Toggle interface prefix blacklisting -· portmap Toggle use of uPnP or NAT-PMP +· port Primary P2P port +· secondaryport Secondary P2P port (0 to disable) +· blacklist cidr Toggle physical path blacklisting +· blacklist if [Un]blacklist interface prefix +· portmap Toggle use of uPnP and NAT-PMP · peer [option] · show
Show detailed peer information @@ -53,16 +53,15 @@ Common Operations: · show Show detailed network information · list List networks · set [option] [value] Get or set network options -· manageips Is IP management allowed? -· manageroutes Is route management allowed? -· managedns Allow network to push DNS config -· globalips Allow assignment of global IPs? -· globalroutes Can global IP space routes be set? -· defaultroute Can default route be overridden? +· manageips Is IP management allowed? +· manageroutes Is route management allowed? +· managedns Allow network to push DNS config +· globalips Allow assignment of global IPs? +· globalroutes Can global IP space routes be set? +· defaultroute Can default route be overridden? · join [-options] Join a virtual network - -t Token to submit to controller - -c Controller identity or fingerprint + -c Controller identity or fingerprint · leave Leave a virtual network Advanced Operations: @@ -94,14 +93,14 @@ Advanced Operations: · list List certificates at local node · show Show certificate details newsid [sid secret out] Create a new subject unique ID - newcsr Create a subject CSR - sign Sign a CSR to create a certificate + newcsr [csr out] Create a subject CSR + sign [cert out] Sign a CSR to create a certificate verify Verify certificate (not chain) dump Verify and print certificate -· import [trust] [...] Import certificate into this node - trust flag: rootca Certificate is a root CA - trust flag: ztrootset ZeroTier root node set -· restore Re-import default certificates +· import [trust,trust,...] Import certificate into this node + trust flag: rootca Certificate is a root CA + trust flag: ztrootset ZeroTier root node set +· factoryreset Re-import compiled-in default certs · export [path] Export a certificate from this node · delete Delete certificate from this node @@ -161,7 +160,7 @@ pub(crate) fn parse_cli_args() -> ArgMatches<'static> { .arg(Arg::with_name("port#").index(1).validator(is_valid_port))) .subcommand(App::new("blacklist") .subcommand(App::new("cidr") - .arg(Arg::with_name("ip/bits").index(1)) + .arg(Arg::with_name("ip_bits").index(1)) .arg(Arg::with_name("boolean").index(2).validator(is_bool))) .subcommand(App::new("if") .arg(Arg::with_name("prefix").index(1)) @@ -175,15 +174,18 @@ pub(crate) fn parse_cli_args() -> ArgMatches<'static> { .subcommand(App::new("listroots")) .subcommand(App::new("try"))) .subcommand(App::new("network") - .subcommand(App::new("show")) + .subcommand(App::new("show") + .arg(Arg::with_name("nwid").index(1).required(true))) .subcommand(App::new("list")) - .subcommand(App::new("set"))) + .subcommand(App::new("set") + .arg(Arg::with_name("nwid").index(1).required(true)) + .arg(Arg::with_name("setting").index(2).required(false)) + .arg(Arg::with_name("value").index(3).required(false)))) .subcommand(App::new("join") - .arg(Arg::with_name("token").short("t").takes_value(true)) .arg(Arg::with_name("controller").short("c").takes_value(true)) - .arg(Arg::with_name("id").index(1).required(true))) + .arg(Arg::with_name("nwid").index(1).required(true))) .subcommand(App::new("leave") - .arg(Arg::with_name("id").index(1).required(true))) + .arg(Arg::with_name("nwid").index(1).required(true))) .subcommand(App::new("service")) .subcommand(App::new("controller") .subcommand(App::new("list")) @@ -231,8 +233,7 @@ pub(crate) fn parse_cli_args() -> ArgMatches<'static> { .subcommand(App::new("newsid") .arg(Arg::with_name("path").index(1).required(false))) .subcommand(App::new("newcsr") - .arg(Arg::with_name("secret").index(1).required(true)) - .arg(Arg::with_name("output").index(2).required(false))) + .arg(Arg::with_name("path").index(2).required(false))) .subcommand(App::new("sign") .arg(Arg::with_name("csr").index(1).required(true)) .arg(Arg::with_name("identity").index(2).required(true)) @@ -243,8 +244,8 @@ pub(crate) fn parse_cli_args() -> ArgMatches<'static> { .arg(Arg::with_name("cert").index(1).required(true))) .subcommand(App::new("import") .arg(Arg::with_name("cert").index(1).required(true)) - .arg(Arg::with_name("trust").possible_value("rootca").possible_value("ztrootset").index(2).multiple(true))) - .subcommand(App::new("restore")) + .arg(Arg::with_name("trust").index(2).required(false))) + .subcommand(App::new("factoryreset")) .subcommand(App::new("export") .arg(Arg::with_name("serial").index(1).required(true)) .arg(Arg::with_name("path").index(2).required(false))) diff --git a/rust-zerotier-service/src/commands/cert.rs b/rust-zerotier-service/src/commands/cert.rs index 00ac182c0..fbaaa2783 100644 --- a/rust-zerotier-service/src/commands/cert.rs +++ b/rust-zerotier-service/src/commands/cert.rs @@ -45,7 +45,7 @@ fn newsid<'a>(store: &Store, cli_args: Option<&ArgMatches<'a>>, auth_token: &Opt } #[inline(always)] -fn newcsr<'a>(store: &Store, cli_args: &ArgMatches<'a>, auth_token: &Option) -> i32 { +fn newcsr<'a>(store: &Store, cli_args: Option<&ArgMatches<'a>>, auth_token: &Option) -> i32 { 0 } @@ -89,12 +89,12 @@ pub(crate) fn run<'a>(store: &Store, cli_args: &ArgMatches<'a>, auth_token: &Opt ("list", None) => list(store, auth_token), ("show", Some(sub_cli_args)) => show(store, sub_cli_args, auth_token), ("newsid", sub_cli_args) => newsid(store, sub_cli_args, auth_token), - ("newcsr", Some(sub_cli_args)) => newcsr(store, sub_cli_args, auth_token), + ("newcsr", sub_cli_args) => newcsr(store, sub_cli_args, auth_token), ("sign", Some(sub_cli_args)) => sign(store, sub_cli_args, auth_token), ("verify", Some(sub_cli_args)) => verify(store, sub_cli_args, auth_token), ("dump", Some(sub_cli_args)) => dump(store, sub_cli_args, auth_token), ("import", Some(sub_cli_args)) => import(store, sub_cli_args, auth_token), - ("restore", None) => restore(store, auth_token), + ("factoryreset", None) => restore(store, auth_token), ("export", Some(sub_cli_args)) => export(store, sub_cli_args, auth_token), ("delete", Some(sub_cli_args)) => delete(store, sub_cli_args, auth_token), _ => {