diff --git a/AppDir/etc/daemon.yml b/AppDir/etc/daemon.yml index 5677c59..7308d6a 100644 --- a/AppDir/etc/daemon.yml +++ b/AppDir/etc/daemon.yml @@ -73,7 +73,7 @@ storage: # # Once assigned (either implicitly or explicitly) the rpc_port of an # allocation should not be changed. - allocations: + #allocations: #- data_path: /foo/bar/data # meta_path: /foo/bar/meta diff --git a/docs/admin/creating-a-new-network.md b/docs/admin/creating-a-new-network.md index fa513fd..f81ff9f 100644 --- a/docs/admin/creating-a-new-network.md +++ b/docs/admin/creating-a-new-network.md @@ -104,9 +104,9 @@ you can run: ``` sudo cryptic-net admin create-network \ - --config /path/to/daemon.yml \ + --config-path /path/to/daemon.yml \ --name \ - --ip \ + --ip-net \ --domain \ --hostname \ | gpg -e -r \ @@ -115,9 +115,9 @@ sudo cryptic-net admin create-network \ A couple of notes here: -* The `--ip` parameter is formed from both the subnet and the IP you chose +* The `--ip-net` parameter is formed from both the subnet and the IP you chose within it. So if your subnet is `10.10.0.0/16`, and your chosen IP in that - subnet is `10.10.4.20`, then your `--ip` parameter will be `10.10.4.20/16`. + subnet is `10.10.4.20`, then your `--ip-net` parameter will be `10.10.4.20/16`. * Only one gpg recipient is specified. If you intend on including other users as network administrators you can add them to the recipients list at this step, diff --git a/docs/user/creating-a-daemonyml-file.md b/docs/user/creating-a-daemonyml-file.md index 27d3c76..ad76264 100644 --- a/docs/user/creating-a-daemonyml-file.md +++ b/docs/user/creating-a-daemonyml-file.md @@ -20,10 +20,10 @@ parameters. Feel free to edit this file as needed. ## Using daemon.yml With the `daemon.yml` created and configured, you can configure your daemon -process to use it by passing it as the `-c` argument: +process to use it by passing it as the `--config-path` argument: ``` -sudo cryptic-net daemon -c /path/to/daemon.yml +sudo cryptic-net daemon --config-path /path/to/daemon.yml ``` If you are an operator then your host should be running its `cryptic-net daemon` diff --git a/entrypoint/src/bootstrap/hosts.go b/entrypoint/src/bootstrap/hosts.go index e995e3f..2439eab 100644 --- a/entrypoint/src/bootstrap/hosts.go +++ b/entrypoint/src/bootstrap/hosts.go @@ -9,7 +9,7 @@ import ( // NebulaHost describes the nebula configuration of a Host which is relevant for // other hosts to know. type NebulaHost struct { - CertPEM string `yaml:"crt"` + CertPEM string `yaml:"cert_pem"` PublicAddr string `yaml:"public_addr,omitempty"` } diff --git a/entrypoint/src/cmd/entrypoint/daemon.go b/entrypoint/src/cmd/entrypoint/daemon.go index 3afd0db..ed7ba3b 100644 --- a/entrypoint/src/cmd/entrypoint/daemon.go +++ b/entrypoint/src/cmd/entrypoint/daemon.go @@ -135,8 +135,12 @@ func runDaemonPmuxOnce( } err := doOnce(ctx, func(ctx context.Context) error { - fmt.Fprintln(os.Stderr, "updating host info in garage") - return hostBootstrap.PutGarageBoostrapHost(ctx) + if err := hostBootstrap.PutGarageBoostrapHost(ctx); err != nil { + fmt.Fprintf(os.Stderr, "updating host info in garage: %v\n", err) + return err + } + + return nil }) if err != nil { @@ -155,8 +159,12 @@ func runDaemonPmuxOnce( } err := doOnce(ctx, func(ctx context.Context) error { - fmt.Fprintln(os.Stderr, "applying garage layout") - return garageApplyLayout(ctx, hostBootstrap, daemonConfig) + if err := garageApplyLayout(ctx, hostBootstrap, daemonConfig); err != nil { + fmt.Fprintf(os.Stderr, "applying garage layout: %v\n", err) + return err + } + + return nil }) if err != nil { @@ -234,9 +242,8 @@ var subCmdDaemon = subCmd{ bootstrapDataDirPath = bootstrap.DataDirPath(envDataDirPath) bootstrapAppDirPath = bootstrap.AppDirPath(envAppDirPath) - hostBootstrapPath string - hostBootstrap bootstrap.Bootstrap - foundHostBootstrap bool + hostBootstrapPath string + hostBootstrap bootstrap.Bootstrap ) tryLoadBootstrap := func(path string) bool { @@ -245,6 +252,7 @@ var subCmdDaemon = subCmd{ return false } else if hostBootstrap, err = bootstrap.FromFile(path); errors.Is(err, fs.ErrNotExist) { + fmt.Fprintf(os.Stderr, "bootstrap file not found at %q\n", path) err = nil return false @@ -253,21 +261,22 @@ var subCmdDaemon = subCmd{ return false } + fmt.Fprintf(os.Stderr, "bootstrap file found at %q\n", path) hostBootstrapPath = path return true } - foundHostBootstrap = tryLoadBootstrap(bootstrapDataDirPath) - foundHostBootstrap = !foundHostBootstrap && *bootstrapPath != "" && tryLoadBootstrap(*bootstrapPath) - foundHostBootstrap = !foundHostBootstrap && tryLoadBootstrap(bootstrapAppDirPath) - - if err != nil { + switch { + case tryLoadBootstrap(bootstrapDataDirPath): + case *bootstrapPath != "" && tryLoadBootstrap(*bootstrapPath): + case tryLoadBootstrap(bootstrapAppDirPath): + case err != nil: return fmt.Errorf("attempting to load bootstrap.yml file: %w", err) - - } else if !foundHostBootstrap { + default: return errors.New("No bootstrap.yml file could be found, and one is not provided with --bootstrap-path") + } - } else if hostBootstrapPath != bootstrapDataDirPath { + if hostBootstrapPath != bootstrapDataDirPath { // If the bootstrap file is not being stored in the data dir, copy // it there, so it can be loaded from there next time. diff --git a/entrypoint/src/dnsmasq/tpl.go b/entrypoint/src/dnsmasq/tpl.go index 746ec49..48d980c 100644 --- a/entrypoint/src/dnsmasq/tpl.go +++ b/entrypoint/src/dnsmasq/tpl.go @@ -32,8 +32,10 @@ no-hosts user= group= -{{- range $host := .Hosts }} -address=/{{ $host.Name }}.hosts.{{ .Domain }}/{{ $host.Nebula.IP }} +{{- $domain := . -}} + +{{- range .Hosts }} +address=/{{ .Name }}.hosts.{{ $domain }}/{{ .IP }} {{ end -}} {{- range .Resolvers }}