Rebrand client cli (#320)

This commit is contained in:
Maycon Santos 2022-05-22 18:53:47 +02:00 committed by GitHub
parent 32611e1131
commit 5cbfa4bb9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 442 additions and 208 deletions

View File

@ -145,6 +145,9 @@ nfpms:
formats: formats:
- deb - deb
replaces:
- wiretrustee
scripts: scripts:
postinstall: "release_files/post_install.sh" postinstall: "release_files/post_install.sh"
preremove: "release_files/pre_remove.sh" preremove: "release_files/pre_remove.sh"
@ -159,6 +162,9 @@ nfpms:
formats: formats:
- rpm - rpm
replaces:
- wiretrustee
scripts: scripts:
postinstall: "release_files/post_install.sh" postinstall: "release_files/post_install.sh"
preremove: "release_files/pre_remove.sh" preremove: "release_files/pre_remove.sh"

View File

@ -105,11 +105,17 @@ Hosted version:
curl -L https://pkgs.wiretrustee.com/debian/public.key | sudo apt-key add - curl -L https://pkgs.wiretrustee.com/debian/public.key | sudo apt-key add -
echo 'deb https://pkgs.wiretrustee.com/debian stable main' | sudo tee /etc/apt/sources.list.d/wiretrustee.list echo 'deb https://pkgs.wiretrustee.com/debian stable main' | sudo tee /etc/apt/sources.list.d/wiretrustee.list
``` ```
2. Install the package 2. Update APT's cache
```shell ```shell
sudo apt-get update sudo apt-get update
sudo apt-get install wiretrustee
``` ```
3. Install the package
```shell
# for CLI only
sudo apt-get install netbird
# for GUI package
sudo apt-get install netbird-ui
```
**RPM/Red hat** **RPM/Red hat**
1. Add the repository: 1. Add the repository:
```shell ```shell
@ -125,26 +131,37 @@ Hosted version:
``` ```
2. Install the package 2. Install the package
```shell ```shell
sudo yum install wiretrustee # for CLI only
sudo yum install netbird
# for GUI package
sudo yum install netbird-ui
``` ```
#### MACOS #### MACOS
**Brew install** **Brew install**
1. Download and install Brew at https://brew.sh/ 1. Download and install Brew at https://brew.sh/
2. Install the client 2. Install the client
```shell ```shell
brew install wiretrustee/client/wiretrustee # for CLI only
brew install netbirdio/tap/netbird
# for GUI package
brew install --cask netbirdio/tap/netbird-ui
``` ```
**Installation from binary** 3. As homebrew doesn't allow sudo exec, we need to install and start the client daemon:
```shell
sudo netbird service install
sudo netbird service start
```
**Installation from binary (CLI only)**
1. Checkout Netbird [releases](https://github.com/netbirdio/netbird/releases/latest) 1. Checkout Netbird [releases](https://github.com/netbirdio/netbird/releases/latest)
2. Download the latest release (**Switch VERSION to the latest**): 2. Download the latest release (**Switch VERSION to the latest**):
```shell ```shell
curl -o ./wiretrustee_<VERSION>_darwin_amd64.tar.gz https://github.com/netbirdio/netbird/releases/download/v<VERSION>/wiretrustee_<VERSION>_darwin_amd64.tar.gz curl -o ./netbird_<VERSION>_darwin_amd64.tar.gz https://github.com/netbirdio/netbird/releases/download/v<VERSION>/wiretrustee_<VERSION>_darwin_amd64.tar.gz
``` ```
3. Decompress 3. Decompress
```shell ```shell
tar xcf ./wiretrustee_<VERSION>_darwin_amd64.tar.gz tar xcf ./netbird_<VERSION>_darwin_amd64.tar.gz
sudo mv wiretrusee /usr/bin/wiretrustee sudo mv netbird /usr/bin/netbird
chmod +x /usr/bin/wiretrustee chmod +x /usr/bin/netbird
``` ```
After that you may need to add /usr/bin in your PATH environment variable: After that you may need to add /usr/bin in your PATH environment variable:
````shell ````shell
@ -152,47 +169,64 @@ Hosted version:
```` ````
4. Install and run the service 4. Install and run the service
```shell ```shell
sudo wiretrustee service install sudo netbird service install
sudo wiretrustee service start sudo netbird service start
``` ```
#### Windows #### Windows
1. Checkout Netbird [releases](https://github.com/netbirdio/netbird/releases/latest) 1. Checkout Netbird [releases](https://github.com/netbirdio/netbird/releases/latest)
2. Download the latest Windows release installer ```wiretrustee_installer_<VERSION>_windows_amd64.exe``` (**Switch VERSION to the latest**): 2. Download the latest Windows release installer ```netbird_installer_<VERSION>_windows_amd64.exe``` (**Switch VERSION to the latest**):
3. Proceed with installation steps 3. Proceed with installation steps
4. This will install the client in the C:\\Program Files\\Wiretrustee and add the client service 4. This will install the client in the C:\\Program Files\\Netbird and add the client service
5. After installing, you can follow the [Client Configuration](#Client-Configuration) steps. 5. After installing, you can follow the [Client Configuration](#Client-Configuration) steps.
> To uninstall the client and service, you can use Add/Remove programs > To uninstall the client and service, you can use Add/Remove programs
### Client Configuration ### Client Configuration
If you installed the UI client, you can launch it and click on Connect
> It will open your browser, and you will be prompt for email and password
Simply run:
```shell
netbird up
```
> It will open your browser, and you will be prompt for email and password
Check connection status:
```shell
netbird status
```
In case you are activating a server peer, you can use a setup-key as described in the steps below:
1. Login to the Management Service. You need to have a `setup key` in hand (see ). 1. Login to the Management Service. You need to have a `setup key` in hand (see ).
For **Unix** systems: For all systems:
```shell ```shell
sudo wiretrustee up --setup-key <SETUP KEY> netbird up --setup-key <SETUP KEY>
``` ```
For **Windows** systems, start powershell as administrator and:
```shell
wiretrustee up --setup-key <SETUP KEY>
```
For **Docker**, you can run with the following command: For **Docker**, you can run with the following command:
```shell ```shell
docker run --network host --privileged --rm -d -e WT_SETUP_KEY=<SETUP KEY> -v wiretrustee-client:/etc/wiretrustee wiretrustee/wiretrustee:<TAG> docker run --network host --privileged --rm -d -e NB_SETUP_KEY=<SETUP KEY> -v netbird-client:/etc/netbird netbirdio/netbird:<TAG>
``` ```
> TAG > 0.3.0 version > TAG > 0.6.0 version
Alternatively, if you are hosting your own Management Service provide `--management-url` property pointing to your Management Service: Alternatively, if you are hosting your own Management Service provide `--management-url` property pointing to your Management Service:
```shell ```shell
sudo wiretrustee up --setup-key <SETUP KEY> --management-url https://localhost:33073 sudo netbird up --setup-key <SETUP KEY> --management-url http://localhost:33073
``` ```
> You could also omit the `--setup-key` property. In this case, the tool will prompt for the key. > You could also omit the `--setup-key` property. In this case, the tool will prompt for the key.
2. Check connection status:
```shell
netbird status
```
2. Check your IP: 3. Check your IP:
For **MACOS** you will just start the service: For **MACOS** you will just start the service:
````shell ````shell
sudo ipconfig getifaddr utun100 sudo ifconfig utun100
```` ````
For **Linux** systems: For **Linux** systems:
```shell ```shell
@ -203,20 +237,19 @@ For **Windows** systems:
netsh interface ip show config name="wt0" netsh interface ip show config name="wt0"
``` ```
3. Repeat on other machines. 4. Repeat on other machines.
### Troubleshooting ### Troubleshooting
1. If you are using self-hosted version and haven't specified `--management-url`, the client app will use the default URL
which is ```https://api.wiretrustee.com:33073```.
1. If you have specified a wrong `--management-url` (e.g., just by mistake when self-hosting) 2. If you have specified a wrong `--management-url` (e.g., just by mistake when self-hosting)
to override it you can do the following: to override it you can do the following:
```shell ```shell
sudo wiretrustee down netbird down
sudo wiretrustee up --management-url https://<CORRECT HOST:PORT>/ netbird up --management-url https://<CORRECT HOST:PORT>/
``` ```
2. If you are using self-hosted version and haven't specified `--management-url`, the client app will use the default URL
which is ```https://api.wiretrustee.com:33073```.
To override it see solution #1 above. To override it see solution #1 above.

View File

@ -13,11 +13,16 @@ import (
var downCmd = &cobra.Command{ var downCmd = &cobra.Command{
Use: "down", Use: "down",
Short: "down wiretrustee connections", Short: "down netbird connections",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := util.InitLog(logLevel, "console") err := handleRebrand(cmd)
if err != nil {
return err
}
err = util.InitLog(logLevel, "console")
if err != nil { if err != nil {
log.Errorf("failed initializing log %v", err) log.Errorf("failed initializing log %v", err)
return err return err

View File

@ -18,11 +18,16 @@ import (
var loginCmd = &cobra.Command{ var loginCmd = &cobra.Command{
Use: "login", Use: "login",
Short: "login to the Wiretrustee Management Service (first run)", Short: "login to the Netbird Management Service (first run)",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := util.InitLog(logLevel, "console") err := handleRebrand(cmd)
if err != nil {
return err
}
err = util.InitLog(logLevel, "console")
if err != nil { if err != nil {
return fmt.Errorf("failed initializing log %v", err) return fmt.Errorf("failed initializing log %v", err)
} }

View File

@ -2,9 +2,14 @@ package cmd
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"io"
"io/fs"
"io/ioutil"
"os" "os"
"os/signal" "os/signal"
"path"
"runtime" "runtime"
"strings" "strings"
"syscall" "syscall"
@ -21,18 +26,24 @@ import (
) )
var ( var (
configPath string configPath string
defaultConfigPath string defaultConfigPathDir string
logLevel string defaultConfigPath string
defaultLogFile string oldDefaultConfigPathDir string
logFile string oldDefaultConfigPath string
daemonAddr string logLevel string
managementURL string defaultLogFileDir string
adminURL string defaultLogFile string
setupKey string oldDefaultLogFileDir string
preSharedKey string oldDefaultLogFile string
rootCmd = &cobra.Command{ logFile string
Use: "wiretrustee", daemonAddr string
managementURL string
adminURL string
setupKey string
preSharedKey string
rootCmd = &cobra.Command{
Use: "netbird",
Short: "", Short: "",
Long: "", Long: "",
SilenceUsage: true, SilenceUsage: true,
@ -45,23 +56,36 @@ func Execute() error {
} }
func init() { func init() {
defaultConfigPath = "/etc/wiretrustee/config.json" defaultConfigPathDir = "/etc/netbird/"
defaultLogFile = "/var/log/wiretrustee/client.log" defaultLogFileDir = "/var/log/netbird/"
oldDefaultConfigPathDir = "/etc/wiretrustee/"
oldDefaultLogFileDir = "/var/log/wiretrustee/"
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
defaultConfigPath = os.Getenv("PROGRAMDATA") + "\\Wiretrustee\\" + "config.json" defaultConfigPathDir = os.Getenv("PROGRAMDATA") + "\\Netbird\\"
defaultLogFile = os.Getenv("PROGRAMDATA") + "\\Wiretrustee\\" + "client.log" defaultLogFileDir = os.Getenv("PROGRAMDATA") + "\\Netbird\\"
oldDefaultConfigPathDir = os.Getenv("PROGRAMDATA") + "\\Wiretrustee\\"
oldDefaultLogFileDir = os.Getenv("PROGRAMDATA") + "\\Wiretrustee\\"
} }
defaultDaemonAddr := "unix:///var/run/wiretrustee.sock" defaultConfigPath = defaultConfigPathDir + "config.json"
defaultLogFile = defaultLogFileDir + "client.log"
oldDefaultConfigPath = oldDefaultConfigPathDir + "config.json"
oldDefaultLogFile = oldDefaultLogFileDir + "client.log"
defaultDaemonAddr := "unix:///var/run/netbird.sock"
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
defaultDaemonAddr = "tcp://127.0.0.1:41731" defaultDaemonAddr = "tcp://127.0.0.1:41731"
} }
rootCmd.PersistentFlags().StringVar(&daemonAddr, "daemon-addr", defaultDaemonAddr, "Daemon service address to serve CLI requests [unix|tcp]://[path|host:port]") rootCmd.PersistentFlags().StringVar(&daemonAddr, "daemon-addr", defaultDaemonAddr, "Daemon service address to serve CLI requests [unix|tcp]://[path|host:port]")
rootCmd.PersistentFlags().StringVar(&managementURL, "management-url", "", fmt.Sprintf("Management Service URL [http|https]://[host]:[port] (default \"%s\")", internal.ManagementURLDefault().String())) rootCmd.PersistentFlags().StringVar(&managementURL, "management-url", "", fmt.Sprintf("Management Service URL [http|https]://[host]:[port] (default \"%s\")", internal.ManagementURLDefault().String()))
rootCmd.PersistentFlags().StringVar(&adminURL, "admin-url", "https://app.netbird.io", "Admin Panel URL [http|https]://[host]:[port]") rootCmd.PersistentFlags().StringVar(&adminURL, "admin-url", "https://app.netbird.io", "Admin Panel URL [http|https]://[host]:[port]")
rootCmd.PersistentFlags().StringVar(&configPath, "config", defaultConfigPath, "Wiretrustee config file location") rootCmd.PersistentFlags().StringVar(&configPath, "config", defaultConfigPath, "Netbird config file location")
rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "info", "sets Wiretrustee log level") rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "info", "sets Netbird log level")
rootCmd.PersistentFlags().StringVar(&logFile, "log-file", defaultLogFile, "sets Wiretrustee log path. If console is specified the the log will be output to stdout") rootCmd.PersistentFlags().StringVar(&logFile, "log-file", defaultLogFile, "sets Netbird log path. If console is specified the the log will be output to stdout")
rootCmd.PersistentFlags().StringVar(&setupKey, "setup-key", "", "Setup key obtained from the Management Service Dashboard (used to register peer)") rootCmd.PersistentFlags().StringVar(&setupKey, "setup-key", "", "Setup key obtained from the Management Service Dashboard (used to register peer)")
rootCmd.PersistentFlags().StringVar(&preSharedKey, "preshared-key", "", "Sets Wireguard PreSharedKey property. If set, then only peers that have the same key can communicate.") rootCmd.PersistentFlags().StringVar(&preSharedKey, "preshared-key", "", "Sets Wireguard PreSharedKey property. If set, then only peers that have the same key can communicate.")
rootCmd.AddCommand(serviceCmd) rootCmd.AddCommand(serviceCmd)
@ -94,22 +118,30 @@ func SetupCloseHandler(ctx context.Context, cancel context.CancelFunc) {
func SetFlagsFromEnvVars() { func SetFlagsFromEnvVars() {
flags := rootCmd.PersistentFlags() flags := rootCmd.PersistentFlags()
flags.VisitAll(func(f *pflag.Flag) { flags.VisitAll(func(f *pflag.Flag) {
envVar := FlagNameToEnvVar(f.Name) oldEnvVar := FlagNameToEnvVar(f.Name, "WT_")
if value, present := os.LookupEnv(envVar); present { if value, present := os.LookupEnv(oldEnvVar); present {
err := flags.Set(f.Name, value) err := flags.Set(f.Name, value)
if err != nil { if err != nil {
log.Infof("unable to configure flag %s using variable %s, err: %v", f.Name, envVar, err) log.Infof("unable to configure flag %s using variable %s, err: %v", f.Name, oldEnvVar, err)
}
}
newEnvVar := FlagNameToEnvVar(f.Name, "NB_")
if value, present := os.LookupEnv(newEnvVar); present {
err := flags.Set(f.Name, value)
if err != nil {
log.Infof("unable to configure flag %s using variable %s, err: %v", f.Name, newEnvVar, err)
} }
} }
}) })
} }
// FlagNameToEnvVar converts flag name to environment var name adding a prefix, // FlagNameToEnvVar converts flag name to environment var name adding a prefix,
// replacing dashes and making all uppercase (e.g. setup-keys is converted to WT_SETUP_KEYS) // replacing dashes and making all uppercase (e.g. setup-keys is converted to NB_SETUP_KEYS according to the input prefix)
func FlagNameToEnvVar(f string) string { func FlagNameToEnvVar(cmdFlag string, prefix string) string {
prefix := "WT_" parsed := strings.ReplaceAll(cmdFlag, "-", "_")
parsed := strings.ReplaceAll(f, "-", "_")
upper := strings.ToUpper(parsed) upper := strings.ToUpper(parsed)
return prefix + upper return prefix + upper
} }
@ -144,3 +176,113 @@ var CLIBackOffSettings = &backoff.ExponentialBackOff{
Stop: backoff.Stop, Stop: backoff.Stop,
Clock: backoff.SystemClock, Clock: backoff.SystemClock,
} }
func handleRebrand(cmd *cobra.Command) error {
var err error
if logFile == defaultLogFile {
if migrateToNetbird(oldDefaultLogFile, defaultLogFile) {
cmd.Printf("will copy Log dir %s and its content to %s\n", oldDefaultLogFileDir, defaultLogFileDir)
err = cpDir(oldDefaultLogFileDir, defaultLogFileDir)
if err != nil {
return err
}
}
}
if configPath == defaultConfigPath {
if migrateToNetbird(oldDefaultConfigPath, defaultConfigPath) {
cmd.Printf("will copy Config dir %s and its content to %s\n", oldDefaultConfigPathDir, defaultConfigPathDir)
err = cpDir(oldDefaultConfigPathDir, defaultConfigPathDir)
if err != nil {
return err
}
}
}
return nil
}
func cpFile(src, dst string) error {
var err error
var srcfd *os.File
var dstfd *os.File
var srcinfo os.FileInfo
if srcfd, err = os.Open(src); err != nil {
return err
}
defer srcfd.Close()
if dstfd, err = os.Create(dst); err != nil {
return err
}
defer dstfd.Close()
if _, err = io.Copy(dstfd, srcfd); err != nil {
return err
}
if srcinfo, err = os.Stat(src); err != nil {
return err
}
return os.Chmod(dst, srcinfo.Mode())
}
func copySymLink(source, dest string) error {
link, err := os.Readlink(source)
if err != nil {
return err
}
return os.Symlink(link, dest)
}
func cpDir(src string, dst string) error {
var err error
var fds []os.FileInfo
var srcinfo os.FileInfo
if srcinfo, err = os.Stat(src); err != nil {
return err
}
if err = os.MkdirAll(dst, srcinfo.Mode()); err != nil {
return err
}
if fds, err = ioutil.ReadDir(src); err != nil {
return err
}
for _, fd := range fds {
srcfp := path.Join(src, fd.Name())
dstfp := path.Join(dst, fd.Name())
fileInfo, err := os.Stat(srcfp)
if err != nil {
return fmt.Errorf("fouldn't get fileInfo; %v", err)
}
switch fileInfo.Mode() & os.ModeType {
case os.ModeSymlink:
if err = copySymLink(srcfp, dstfp); err != nil {
return fmt.Errorf("failed to copy from %s to %s; %v", srcfp, dstfp, err)
}
case os.ModeDir:
if err = cpDir(srcfp, dstfp); err != nil {
return fmt.Errorf("failed to copy from %s to %s; %v", srcfp, dstfp, err)
}
default:
if err = cpFile(srcfp, dstfp); err != nil {
return fmt.Errorf("failed to copy from %s to %s; %v", srcfp, dstfp, err)
}
}
}
return nil
}
func migrateToNetbird(oldPath, newPath string) bool {
_, errOld := os.Stat(oldPath)
_, errNew := os.Stat(newPath)
if errors.Is(errOld, fs.ErrNotExist) || errNew == nil {
return false
}
return true
}

View File

@ -24,8 +24,8 @@ func newProgram(ctx context.Context, cancel context.CancelFunc) *program {
func newSVCConfig() *service.Config { func newSVCConfig() *service.Config {
return &service.Config{ return &service.Config{
Name: "wiretrustee", Name: "netbird",
DisplayName: "Wiretrustee", DisplayName: "Netbird",
Description: "A WireGuard-based mesh network that connects your devices into a single private network.", Description: "A WireGuard-based mesh network that connects your devices into a single private network.",
} }
} }
@ -41,5 +41,5 @@ func newSVC(prg *program, conf *service.Config) (service.Service, error) {
var serviceCmd = &cobra.Command{ var serviceCmd = &cobra.Command{
Use: "service", Use: "service",
Short: "manages wiretrustee service", Short: "manages Netbird service",
} }

View File

@ -76,20 +76,24 @@ func (p *program) Stop(srv service.Service) error {
} }
time.Sleep(time.Second * 2) time.Sleep(time.Second * 2)
log.Info("stopped Wiretrustee service") //nolint log.Info("stopped Netbird service") //nolint
return nil return nil
} }
var runCmd = &cobra.Command{ var runCmd = &cobra.Command{
Use: "run", Use: "run",
Short: "runs wiretrustee as service", Short: "runs Netbird as service",
Run: func(cmd *cobra.Command, args []string) { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := util.InitLog(logLevel, logFile) err := handleRebrand(cmd)
if err != nil { if err != nil {
log.Errorf("failed initializing log %v", err) return err
return }
err = util.InitLog(logLevel, logFile)
if err != nil {
return fmt.Errorf("failed initializing log %v", err)
} }
ctx, cancel := context.WithCancel(cmd.Context()) ctx, cancel := context.WithCancel(cmd.Context())
@ -97,27 +101,30 @@ var runCmd = &cobra.Command{
s, err := newSVC(newProgram(ctx, cancel), newSVCConfig()) s, err := newSVC(newProgram(ctx, cancel), newSVCConfig())
if err != nil { if err != nil {
cmd.PrintErrln(err) return err
return
} }
err = s.Run() err = s.Run()
if err != nil { if err != nil {
cmd.PrintErrln(err) return err
return
} }
cmd.Printf("Wiretrustee service is running") cmd.Printf("Netbird service is running")
return nil
}, },
} }
var startCmd = &cobra.Command{ var startCmd = &cobra.Command{
Use: "start", Use: "start",
Short: "starts wiretrustee service", Short: "starts Netbird service",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := util.InitLog(logLevel, logFile) err := handleRebrand(cmd)
if err != nil {
return err
}
err = util.InitLog(logLevel, logFile)
if err != nil { if err != nil {
log.Errorf("failed initializing log %v", err)
return err return err
} }
@ -133,61 +140,69 @@ var startCmd = &cobra.Command{
cmd.PrintErrln(err) cmd.PrintErrln(err)
return err return err
} }
cmd.Println("Wiretrustee service has been started") cmd.Println("Netbird service has been started")
return nil return nil
}, },
} }
var stopCmd = &cobra.Command{ var stopCmd = &cobra.Command{
Use: "stop", Use: "stop",
Short: "stops wiretrustee service", Short: "stops Netbird service",
Run: func(cmd *cobra.Command, args []string) { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := util.InitLog(logLevel, logFile) err := handleRebrand(cmd)
if err != nil { if err != nil {
log.Errorf("failed initializing log %v", err) return err
}
err = util.InitLog(logLevel, logFile)
if err != nil {
return fmt.Errorf("failed initializing log %v", err)
} }
ctx, cancel := context.WithCancel(cmd.Context()) ctx, cancel := context.WithCancel(cmd.Context())
s, err := newSVC(newProgram(ctx, cancel), newSVCConfig()) s, err := newSVC(newProgram(ctx, cancel), newSVCConfig())
if err != nil { if err != nil {
cmd.PrintErrln(err) return err
return
} }
err = s.Stop() err = s.Stop()
if err != nil { if err != nil {
cmd.PrintErrln(err) return err
return
} }
cmd.Println("Wiretrustee service has been stopped") cmd.Println("Netbird service has been stopped")
return nil
}, },
} }
var restartCmd = &cobra.Command{ var restartCmd = &cobra.Command{
Use: "restart", Use: "restart",
Short: "restarts wiretrustee service", Short: "restarts Netbird service",
Run: func(cmd *cobra.Command, args []string) { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := util.InitLog(logLevel, logFile) err := handleRebrand(cmd)
if err != nil { if err != nil {
log.Errorf("failed initializing log %v", err) return err
}
err = util.InitLog(logLevel, logFile)
if err != nil {
return fmt.Errorf("failed initializing log %v", err)
} }
ctx, cancel := context.WithCancel(cmd.Context()) ctx, cancel := context.WithCancel(cmd.Context())
s, err := newSVC(newProgram(ctx, cancel), newSVCConfig()) s, err := newSVC(newProgram(ctx, cancel), newSVCConfig())
if err != nil { if err != nil {
cmd.PrintErrln(err) return err
return
} }
err = s.Restart() err = s.Restart()
if err != nil { if err != nil {
cmd.PrintErrln(err) return err
return
} }
cmd.Println("Wiretrustee service has been restarted") cmd.Println("Netbird service has been restarted")
return nil
}, },
} }

View File

@ -9,10 +9,15 @@ import (
var installCmd = &cobra.Command{ var installCmd = &cobra.Command{
Use: "install", Use: "install",
Short: "installs wiretrustee service", Short: "installs Netbird service",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := handleRebrand(cmd)
if err != nil {
return err
}
svcConfig := newSVCConfig() svcConfig := newSVCConfig()
svcConfig.Arguments = []string{ svcConfig.Arguments = []string{
@ -47,30 +52,34 @@ var installCmd = &cobra.Command{
cmd.PrintErrln(err) cmd.PrintErrln(err)
return err return err
} }
cmd.Println("Wiretrustee service has been installed") cmd.Println("Netbird service has been installed")
return nil return nil
}, },
} }
var uninstallCmd = &cobra.Command{ var uninstallCmd = &cobra.Command{
Use: "uninstall", Use: "uninstall",
Short: "uninstalls wiretrustee service from system", Short: "uninstalls Netbird service from system",
Run: func(cmd *cobra.Command, args []string) { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := handleRebrand(cmd)
if err != nil {
return err
}
ctx, cancel := context.WithCancel(cmd.Context()) ctx, cancel := context.WithCancel(cmd.Context())
s, err := newSVC(newProgram(ctx, cancel), newSVCConfig()) s, err := newSVC(newProgram(ctx, cancel), newSVCConfig())
if err != nil { if err != nil {
cmd.PrintErrln(err) return err
return
} }
err = s.Uninstall() err = s.Uninstall()
if err != nil { if err != nil {
cmd.PrintErrln(err) return err
return
} }
cmd.Println("Wiretrustee has been uninstalled") cmd.Println("Netbird has been uninstalled")
return nil
}, },
} }

View File

@ -14,11 +14,16 @@ import (
var statusCmd = &cobra.Command{ var statusCmd = &cobra.Command{
Use: "status", Use: "status",
Short: "status of the Wiretrustee Service", Short: "status of the Netbird Service",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := util.InitLog(logLevel, "console") err := handleRebrand(cmd)
if err != nil {
return err
}
err = util.InitLog(logLevel, "console")
if err != nil { if err != nil {
return fmt.Errorf("failed initializing log %v", err) return fmt.Errorf("failed initializing log %v", err)
} }

View File

@ -13,11 +13,16 @@ import (
var upCmd = &cobra.Command{ var upCmd = &cobra.Command{
Use: "up", Use: "up",
Short: "install, login and start wiretrustee client", Short: "install, login and start Netbird client",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
SetFlagsFromEnvVars() SetFlagsFromEnvVars()
err := util.InitLog(logLevel, "console") err := handleRebrand(cmd)
if err != nil {
return err
}
err = util.InitLog(logLevel, "console")
if err != nil { if err != nil {
return fmt.Errorf("failed initializing log %v", err) return fmt.Errorf("failed initializing log %v", err)
} }

View File

@ -8,7 +8,7 @@ import (
var ( var (
versionCmd = &cobra.Command{ versionCmd = &cobra.Command{
Use: "version", Use: "version",
Short: "prints wiretrustee version", Short: "prints Netbird version",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
cmd.Println(system.WiretrusteeVersion()) cmd.Println(system.WiretrusteeVersion())
}, },

View File

@ -40,7 +40,7 @@ const (
func main() { func main() {
var daemonAddr string var daemonAddr string
defaultDaemonAddr := "unix:///var/run/wiretrustee.sock" defaultDaemonAddr := "unix:///var/run/netbird.sock"
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
defaultDaemonAddr = "tcp://127.0.0.1:41731" defaultDaemonAddr = "tcp://127.0.0.1:41731"
} }

View File

@ -15,6 +15,8 @@ cask "{{ $projectName }}" do
app "netbird_ui_darwin_arm64", target: "Netbird UI.app" app "netbird_ui_darwin_arm64", target: "Netbird UI.app"
end end
depends_on formula: "netbird"
name "Netbird UI" name "Netbird UI"
desc "Netbird UI Client" desc "Netbird UI Client"
homepage "https://www.netbird.io/" homepage "https://www.netbird.io/"

View File

@ -47,32 +47,34 @@ For this tutorial we will be using domain ```test.netbird.io``` which points to
The [setup.env](../infrastructure_files/setup.env) file contains the following properties that have to be filled: The [setup.env](../infrastructure_files/setup.env) file contains the following properties that have to be filled:
```bash ```bash
# e.g. app.mydomain.com # Dashboard domain. e.g. app.mydomain.com
WIRETRUSTEE_DOMAIN="" NETBIRD_DOMAIN=""
# e.g. dev-24vkclam.us.auth0.com # e.g. dev-24vkclam.us.auth0.com
WIRETRUSTEE_AUTH0_DOMAIN="" NETBIRD_AUTH0_DOMAIN=""
# e.g. 61u3JMXRO0oOevc7gCkZLCwePQvT4lL0 # e.g. 61u3JMXRO0oOevc7gCkZLCwePQvT4lL0
WIRETRUSTEE_AUTH0_CLIENT_ID="" NETBIRD_AUTH0_CLIENT_ID=""
# e.g. https://app.mydomain.com/ # e.g. https://app.mydomain.com/ or https://app.mydomain.com,
WIRETRUSTEE_AUTH0_AUDIENCE="" # Make sure you used the exact same value for Identifier
# you used when creating your Auth0 API
NETBIRD_AUTH0_AUDIENCE=""
# e.g. hello@mydomain.com # e.g. hello@mydomain.com
WIRETRUSTEE_LETSENCRYPT_EMAIL="" NETBIRD_LETSENCRYPT_EMAIL=""
``` ```
> Other options are available, but they are automatically updated. > Other options are available, but they are automatically updated.
Please follow the steps to get the values. Please follow the steps to get the values.
4. Configure ```WIRETRUSTEE_AUTH0_DOMAIN``` ```WIRETRUSTEE_AUTH0_CLIENT_ID``` ```WIRETRUSTEE_AUTH0_AUDIENCE``` properties. 4. Configure ```NETBIRD_AUTH0_DOMAIN``` ```NETBIRD_AUTH0_CLIENT_ID``` ```NETBIRD_AUTH0_AUDIENCE``` properties.
* To obtain these, please use [Auth0 React SDK Guide](https://auth0.com/docs/quickstart/spa/react/01-login#configure-auth0) up until "Install the Auth0 React SDK". * To obtain these, please use [Auth0 React SDK Guide](https://auth0.com/docs/quickstart/spa/react/01-login#configure-auth0) up until "Install the Auth0 React SDK".
:grey_exclamation: Use ```https://YOUR DOMAIN``` as ````Allowed Callback URLs````, ```Allowed Logout URLs```, ```Allowed Web Origins``` and ```Allowed Origins (CORS)``` :grey_exclamation: Use ```https://YOUR DOMAIN``` as ````Allowed Callback URLs````, ```Allowed Logout URLs```, ```Allowed Web Origins``` and ```Allowed Origins (CORS)```
* set the variables in the ```setup.env``` * set the variables in the ```setup.env```
5. Configure ```WIRETRUSTEE_AUTH0_AUDIENCE``` property. 5. Configure ```NETBIRD_AUTH0_AUDIENCE``` property.
* Check [Auth0 Golang API Guide](https://auth0.com/docs/quickstart/backend/golang) to obtain AuthAudience. * Check [Auth0 Golang API Guide](https://auth0.com/docs/quickstart/backend/golang) to obtain AuthAudience.
* set the property in the ```setup.env``` file. * set the property in the ```setup.env``` file.
6. Configure ```WIRETRUSTEE_LETSENCRYPT_EMAIL``` property. 6. Configure ```NETBIRD_LETSENCRYPT_EMAIL``` property.
This can be any email address. [Let's Encrypt](https://letsencrypt.org/) will create an account while generating a new certificate. This can be any email address. [Let's Encrypt](https://letsencrypt.org/) will create an account while generating a new certificate.
@ -97,8 +99,8 @@ For this tutorial we will be using domain ```test.netbird.io``` which points to
docker-compose logs coturn docker-compose logs coturn
docker-compose logs dashboard docker-compose logs dashboard
10. Once the server is running, you can access the dashboard by https://$WIRETRUSTEE_DOMAIN 10. Once the server is running, you can access the dashboard by https://$NETBIRD_DOMAIN
11. Adding a peer will require you to enter the management URL by following the steps in the page https://$WIRETRUSTEE_DOMAIN/add-peer and in the 3rd step: 11. Adding a peer will require you to enter the management URL by following the steps in the page https://$NETBIRD_DOMAIN/add-peer and in the 3rd step:
```shell ```shell
sudo wiretrustee up --setup-key <PASTE-SETUP-KEY> --management-url https://$WIRETRUSTEE_DOMAIN:33073 sudo netbird up --setup-key <PASTE-SETUP-KEY> --management-url https://$NETBIRD_DOMAIN:33073
``` ```

View File

@ -2,18 +2,18 @@
source setup.env source setup.env
if [[ "x-$WIRETRUSTEE_DOMAIN" == "x-" ]] if [[ "x-$NETBIRD_DOMAIN" == "x-" ]]
then then
echo WIRETRUSTEE_DOMAIN is not set, please update your setup.env file echo NETBIRD_DOMAIN is not set, please update your setup.env file
exit 1 exit 1
fi fi
# local development or tests # local development or tests
if [[ $WIRETRUSTEE_DOMAIN == "localhost" || $WIRETRUSTEE_DOMAIN == "127.0.0.1" ]] if [[ $NETBIRD_DOMAIN == "localhost" || $NETBIRD_DOMAIN == "127.0.0.1" ]]
then then
export WIRETRUSTEE_MGMT_API_ENDPOINT=http://$WIRETRUSTEE_DOMAIN:$WIRETRUSTEE_MGMT_API_PORT export NETBIRD_MGMT_API_ENDPOINT=http://$NETBIRD_DOMAIN:$NETBIRD_MGMT_API_PORT
unset WIRETRUSTEE_MGMT_API_CERT_FILE unset NETBIRD_MGMT_API_CERT_FILE
unset WIRETRUSTEE_MGMT_API_CERT_KEY_FILE unset NETBIRD_MGMT_API_CERT_KEY_FILE
fi fi
# if not provided, we generate a turn password # if not provided, we generate a turn password
@ -28,13 +28,13 @@ LETSENCRYPT_VOLUMENAME="${VOLUME_PREFIX}${LETSENCRYPT_VOLUMESUFFIX}"
# if volume with wiretrustee- prefix already exists, use it, else create new with netbird- # if volume with wiretrustee- prefix already exists, use it, else create new with netbird-
OLD_PREFIX='wiretrustee-' OLD_PREFIX='wiretrustee-'
if docker volume ls | grep -q "${OLD_PREFIX}${MGMT_VOLUMESUFFIX}"; then if docker volume ls | grep -q "${OLD_PREFIX}${MGMT_VOLUMESUFFIX}"; then
MGMT_VOLUMENAME="${$OLD_PREFIX}${MGMT_VOLUMESUFFIX}" MGMT_VOLUMENAME="${OLD_PREFIX}${MGMT_VOLUMESUFFIX}"
fi fi
if docker volume ls | grep -q "${OLD_PREFIX}${SIGNAL_VOLUMESUFFIX}"; then if docker volume ls | grep -q "${OLD_PREFIX}${SIGNAL_VOLUMESUFFIX}"; then
SIGNAL_VOLUMENAME="${$OLD_PREFIX}${SIGNAL_VOLUMESUFFIX}" SIGNAL_VOLUMENAME="${OLD_PREFIX}${SIGNAL_VOLUMESUFFIX}"
fi fi
if docker volume ls | grep -q "${OLD_PREFIX}${LETSENCRYPT_VOLUMESUFFIX}"; then if docker volume ls | grep -q "${OLD_PREFIX}${LETSENCRYPT_VOLUMESUFFIX}"; then
LETSENCRYPT_VOLUMENAME="${$OLD_PREFIX}${LETSENCRYPT_VOLUMESUFFIX}" LETSENCRYPT_VOLUMENAME="${OLD_PREFIX}${LETSENCRYPT_VOLUMESUFFIX}"
fi fi
export MGMT_VOLUMENAME export MGMT_VOLUMENAME

View File

@ -8,13 +8,13 @@ services:
- 80:80 - 80:80
- 443:443 - 443:443
environment: environment:
- AUTH0_DOMAIN=$WIRETRUSTEE_AUTH0_DOMAIN - AUTH0_DOMAIN=$NETBIRD_AUTH0_DOMAIN
- AUTH0_CLIENT_ID=$WIRETRUSTEE_AUTH0_CLIENT_ID - AUTH0_CLIENT_ID=$NETBIRD_AUTH0_CLIENT_ID
- AUTH0_AUDIENCE=$WIRETRUSTEE_AUTH0_AUDIENCE - AUTH0_AUDIENCE=$NETBIRD_AUTH0_AUDIENCE
- WIRETRUSTEE_MGMT_API_ENDPOINT=$WIRETRUSTEE_MGMT_API_ENDPOINT - NETBIRD_MGMT_API_ENDPOINT=$NETBIRD_MGMT_API_ENDPOINT
- NGINX_SSL_PORT=443 - NGINX_SSL_PORT=443
- LETSENCRYPT_DOMAIN=$WIRETRUSTEE_DOMAIN - LETSENCRYPT_DOMAIN=$NETBIRD_DOMAIN
- LETSENCRYPT_EMAIL=$WIRETRUSTEE_LETSENCRYPT_EMAIL - LETSENCRYPT_EMAIL=$NETBIRD_LETSENCRYPT_EMAIL
volumes: volumes:
- $LETSENCRYPT_VOLUMENAME:/etc/letsencrypt/ - $LETSENCRYPT_VOLUMENAME:/etc/letsencrypt/
# Signal # Signal
@ -27,7 +27,7 @@ services:
- 10000:10000 - 10000:10000
# # port and command for Let's Encrypt validation # # port and command for Let's Encrypt validation
# - 443:443 # - 443:443
# command: ["--letsencrypt-domain", "$WIRETRUSTEE_DOMAIN", "--log-file", "console"] # command: ["--letsencrypt-domain", "$NETBIRD_DOMAIN", "--log-file", "console"]
# Management # Management
management: management:
image: netbirdio/management:latest image: netbirdio/management:latest
@ -40,15 +40,15 @@ services:
- ./management.json:/etc/netbird/management.json - ./management.json:/etc/netbird/management.json
ports: ports:
- 33073:33073 #gRPC port - 33073:33073 #gRPC port
- $WIRETRUSTEE_MGMT_API_PORT:33071 #API port - $NETBIRD_MGMT_API_PORT:33071 #API port
# # port and command for Let's Encrypt validation # # port and command for Let's Encrypt validation
# - 443:443 # - 443:443
# command: ["--letsencrypt-domain", "$WIRETRUSTEE_DOMAIN", "--log-file", "console"] # command: ["--letsencrypt-domain", "$NETBIRD_DOMAIN", "--log-file", "console"]
# Coturn # Coturn
coturn: coturn:
image: coturn/coturn image: coturn/coturn
restart: unless-stopped restart: unless-stopped
domainname: $WIRETRUSTEE_DOMAIN domainname: $NETBIRD_DOMAIN
volumes: volumes:
- ./turnserver.conf:/etc/turnserver.conf:ro - ./turnserver.conf:/etc/turnserver.conf:ro
# - ./privkey.pem:/etc/coturn/private/privkey.pem:ro # - ./privkey.pem:/etc/coturn/private/privkey.pem:ro

View File

@ -2,7 +2,7 @@
"Stuns": [ "Stuns": [
{ {
"Proto": "udp", "Proto": "udp",
"URI": "stun:$WIRETRUSTEE_DOMAIN:3478", "URI": "stun:$NETBIRD_DOMAIN:3478",
"Username": "", "Username": "",
"Password": null "Password": null
} }
@ -11,7 +11,7 @@
"Turns": [ "Turns": [
{ {
"Proto": "udp", "Proto": "udp",
"URI": "turn:$WIRETRUSTEE_DOMAIN:3478", "URI": "turn:$NETBIRD_DOMAIN:3478",
"Username": "$TURN_USER", "Username": "$TURN_USER",
"Password": "$TURN_PASSWORD" "Password": "$TURN_PASSWORD"
} }
@ -22,18 +22,18 @@
}, },
"Signal": { "Signal": {
"Proto": "http", "Proto": "http",
"URI": "$WIRETRUSTEE_DOMAIN:10000", "URI": "$NETBIRD_DOMAIN:10000",
"Username": "", "Username": "",
"Password": null "Password": null
}, },
"Datadir": "", "Datadir": "",
"HttpConfig": { "HttpConfig": {
"Address": "0.0.0.0:$WIRETRUSTEE_MGMT_API_PORT", "Address": "0.0.0.0:$NETBIRD_MGMT_API_PORT",
"AuthIssuer": "https://$WIRETRUSTEE_AUTH0_DOMAIN/", "AuthIssuer": "https://$NETBIRD_AUTH0_DOMAIN/",
"AuthAudience": "$WIRETRUSTEE_AUTH0_AUDIENCE", "AuthAudience": "$NETBIRD_AUTH0_AUDIENCE",
"AuthKeysLocation": "https://$WIRETRUSTEE_AUTH0_DOMAIN/.well-known/jwks.json", "AuthKeysLocation": "https://$NETBIRD_AUTH0_DOMAIN/.well-known/jwks.json",
"CertFile":"$WIRETRUSTEE_MGMT_API_CERT_FILE", "CertFile":"$NETBIRD_MGMT_API_CERT_FILE",
"CertKey":"$WIRETRUSTEE_MGMT_API_CERT_KEY_FILE" "CertKey":"$NETBIRD_MGMT_API_CERT_KEY_FILE"
}, },
"IdpManagerConfig": { "IdpManagerConfig": {
"Manager": "none" "Manager": "none"

View File

@ -1,30 +1,30 @@
# Dashboard domain and auth0 configuration # Dashboard domain and auth0 configuration
# Dashboard domain. e.g. app.mydomain.com # Dashboard domain. e.g. app.mydomain.com
WIRETRUSTEE_DOMAIN="" NETBIRD_DOMAIN=""
# e.g. dev-24vkclam.us.auth0.com # e.g. dev-24vkclam.us.auth0.com
WIRETRUSTEE_AUTH0_DOMAIN="" NETBIRD_AUTH0_DOMAIN=""
# e.g. 61u3JMXRO0oOevc7gCkZLCwePQvT4lL0 # e.g. 61u3JMXRO0oOevc7gCkZLCwePQvT4lL0
WIRETRUSTEE_AUTH0_CLIENT_ID="" NETBIRD_AUTH0_CLIENT_ID=""
# e.g. https://app.mydomain.com/ or https://app.mydomain.com, # e.g. https://app.mydomain.com/ or https://app.mydomain.com,
# Make sure you used the exact same value for Identifier # Make sure you used the exact same value for Identifier
# you used when creating your Auth0 API # you used when creating your Auth0 API
WIRETRUSTEE_AUTH0_AUDIENCE="" NETBIRD_AUTH0_AUDIENCE=""
# e.g. hello@mydomain.com # e.g. hello@mydomain.com
WIRETRUSTEE_LETSENCRYPT_EMAIL="" NETBIRD_LETSENCRYPT_EMAIL=""
## From this point, most settings are being done automatically, but you can edit if you need some customization ## From this point, most settings are being done automatically, but you can edit if you need some customization
# Management API # Management API
# Management API port # Management API port
WIRETRUSTEE_MGMT_API_PORT=33071 NETBIRD_MGMT_API_PORT=33071
# Management API endpoint address, used by the Dashboard # Management API endpoint address, used by the Dashboard
WIRETRUSTEE_MGMT_API_ENDPOINT=https://$WIRETRUSTEE_DOMAIN:$WIRETRUSTEE_MGMT_API_PORT NETBIRD_MGMT_API_ENDPOINT=https://$NETBIRD_DOMAIN:$NETBIRD_MGMT_API_PORT
# Management Certficate file path. These are generated by the Dashboard container # Management Certficate file path. These are generated by the Dashboard container
WIRETRUSTEE_MGMT_API_CERT_FILE="/etc/letsencrypt/live/$WIRETRUSTEE_DOMAIN/fullchain.pem" NETBIRD_MGMT_API_CERT_FILE="/etc/letsencrypt/live/$NETBIRD_DOMAIN/fullchain.pem"
# Management Certficate key file path. # Management Certficate key file path.
WIRETRUSTEE_MGMT_API_CERT_KEY_FILE="/etc/letsencrypt/live/$WIRETRUSTEE_DOMAIN/privkey.pem" NETBIRD_MGMT_API_CERT_KEY_FILE="/etc/letsencrypt/live/$NETBIRD_DOMAIN/privkey.pem"
# Turn credentials # Turn credentials
@ -43,15 +43,15 @@ SIGNAL_VOLUMESUFFIX="signal"
LETSENCRYPT_VOLUMESUFFIX="letsencrypt" LETSENCRYPT_VOLUMESUFFIX="letsencrypt"
# exports # exports
export WIRETRUSTEE_DOMAIN export NETBIRD_DOMAIN
export WIRETRUSTEE_AUTH0_DOMAIN export NETBIRD_AUTH0_DOMAIN
export WIRETRUSTEE_AUTH0_CLIENT_ID export NETBIRD_AUTH0_CLIENT_ID
export WIRETRUSTEE_AUTH0_AUDIENCE export NETBIRD_AUTH0_AUDIENCE
export WIRETRUSTEE_LETSENCRYPT_EMAIL export NETBIRD_LETSENCRYPT_EMAIL
export WIRETRUSTEE_MGMT_API_PORT export NETBIRD_MGMT_API_PORT
export WIRETRUSTEE_MGMT_API_ENDPOINT export NETBIRD_MGMT_API_ENDPOINT
export WIRETRUSTEE_MGMT_API_CERT_FILE export NETBIRD_MGMT_API_CERT_FILE
export WIRETRUSTEE_MGMT_API_CERT_KEY_FILE export NETBIRD_MGMT_API_CERT_KEY_FILE
export TURN_USER export TURN_USER
export TURN_PASSWORD export TURN_PASSWORD
export TURN_MIN_PORT export TURN_MIN_PORT

View File

@ -10,16 +10,17 @@ Usage:
netbird-mgmt management [flags] netbird-mgmt management [flags]
Flags: Flags:
--datadir string server data directory location (default "/var/lib/netbird/") --cert-file string Location of your SSL certificate. Can be used when you have an existing certificate and don't want a new certificate be generated automatically. If letsencrypt-domain is specified this property has no effect
--cert-key string Location of your SSL certificate private key. Can be used when you have an existing certificate and don't want a new certificate be generated automatically. If letsencrypt-domain is specified this property has no effect
--datadir string server data directory location
-h, --help help for management -h, --help help for management
--letsencrypt-domain string a domain to issue Let's Encrypt certificate for. Enables TLS using Let's Encrypt. Will fetch and renew certificate, and run the server with TLS --letsencrypt-domain string a domain to issue Let's Encrypt certificate for. Enables TLS using Let's Encrypt. Will fetch and renew certificate, and run the server with TLS
--port int server port to listen on (default 33073) --port int server port to listen on (default 33073)
--cert-file string Location of your SSL certificate. Can be used when you have an existing certificate and don't want a new certificate be generated automatically. If letsencrypt-domain is specified this property has no effect
--cert-key string Location of your SSL certificate private key. Can be used when you have an existing certificate and don't want a new certificate be generated automatically. If letsencrypt-domain is specified this property has no effect
Global Flags: Global Flags:
--config string Netbird config file location to write new config to (default "/etc/netbird/config.json") --config string Netbird config file location to write new config to (default "/etc/netbird")
--log-level string (default "info")
--log-file string sets Netbird log path. If console is specified the the log will be output to stdout (default "/var/log/netbird/management.log") --log-file string sets Netbird log path. If console is specified the the log will be output to stdout (default "/var/log/netbird/management.log")
--log-level string (default "info")
``` ```
## Run Management service (Docker) ## Run Management service (Docker)
@ -42,7 +43,7 @@ docker run -d --name netbird-management \
-p 443:443 \ -p 443:443 \
-v netbird-mgmt:/var/lib/netbird \ -v netbird-mgmt:/var/lib/netbird \
-v ./config.json:/etc/netbird/config.json \ -v ./config.json:/etc/netbird/config.json \
netbird/management:latest \ netbirdio/management:latest \
--letsencrypt-domain <YOUR-DOMAIN> --letsencrypt-domain <YOUR-DOMAIN>
``` ```
> An example of config.json can be found here [management.json](../infrastructure_files/management.json.tmpl) > An example of config.json can be found here [management.json](../infrastructure_files/management.json.tmpl)
@ -81,7 +82,7 @@ docker run -d --name netbird-management \
-p 33073:33073 \ -p 33073:33073 \
-v netbird-mgmt:/var/lib/netbird \ -v netbird-mgmt:/var/lib/netbird \
-v ./config.json:/etc/netbird/config.json \ -v ./config.json:/etc/netbird/config.json \
netbird/management:latest netbirdio/management:latest
``` ```
### Debug tag ### Debug tag
We also publish a docker image with the debug tag which has the log-level set to default, plus it uses the ```gcr.io/distroless/base:debug``` image that can be used with docker exec in order to run some commands in the Management container. We also publish a docker image with the debug tag which has the log-level set to default, plus it uses the ```gcr.io/distroless/base:debug``` image that can be used with docker exec in order to run some commands in the Management container.
@ -90,7 +91,7 @@ shell $ docker run -d --name netbird-management-debug \
-p 33073:33073 \ -p 33073:33073 \
-v netbird-mgmt:/var/lib/netbird \ -v netbird-mgmt:/var/lib/netbird \
-v ./config.json:/etc/netbird/config.json \ -v ./config.json:/etc/netbird/config.json \
netbird/management:debug-latest netbirdio/management:debug-latest
shell $ docker exec -ti netbird-management-debug /bin/sh shell $ docker exec -ti netbird-management-debug /bin/sh
container-shell $ container-shell $

View File

@ -3,9 +3,11 @@ package cmd
import ( import (
"context" "context"
"crypto/tls" "crypto/tls"
"errors"
"flag" "flag"
"fmt" "fmt"
"io" "io"
"io/fs"
"io/ioutil" "io/ioutil"
"net" "net"
"os" "os"
@ -294,10 +296,10 @@ func cpDir(src string, dst string) error {
} }
func migrateToNetbird(oldPath, newPath string) bool { func migrateToNetbird(oldPath, newPath string) bool {
_, old := os.Stat(oldPath) _, errOld := os.Stat(oldPath)
_, new := os.Stat(newPath) _, errNew := os.Stat(newPath)
if os.IsNotExist(old) || os.IsExist(new) { if errors.Is(errOld, fs.ErrNotExist) || errNew == nil {
return false return false
} }

View File

@ -12,24 +12,24 @@ fi
cleanInstall() { cleanInstall() {
printf "\033[32m Post Install of an clean install\033[0m\n" printf "\033[32m Post Install of an clean install\033[0m\n"
# Step 3 (clean install), enable the service in the proper way for this platform # Step 3 (clean install), enable the service in the proper way for this platform
/usr/bin/wiretrustee service install /usr/bin/netbird service install
/usr/bin/wiretrustee service start /usr/bin/netbird service start
} }
upgrade() { upgrade() {
printf "\033[32m Post Install of an upgrade\033[0m\n" printf "\033[32m Post Install of an upgrade\033[0m\n"
if [ "${use_systemctl}" = "True" ]; then if [ "${use_systemctl}" = "True" ]; then
printf "\033[32m Stopping the service\033[0m\n" printf "\033[32m Stopping the service\033[0m\n"
systemctl stop wiretrustee 2> /dev/null || true systemctl stop netbird 2> /dev/null || true
fi fi
if [ -e /lib/systemd/system/wiretrustee.service ]; then if [ -e /lib/systemd/system/netbird.service ]; then
rm -f /lib/systemd/system/wiretrustee.service rm -f /lib/systemd/system/netbird.service
systemctl daemon-reload systemctl daemon-reload
fi fi
# will trow an error until everyone upgrade # will trow an error until everyone upgrade
/usr/bin/wiretrustee service uninstall 2> /dev/null || true /usr/bin/netbird service uninstall 2> /dev/null || true
/usr/bin/wiretrustee service install /usr/bin/netbird service install
/usr/bin/wiretrustee service start /usr/bin/netbird service start
} }
# Check if this is a clean install or an upgrade # Check if this is a clean install or an upgrade

View File

@ -13,16 +13,16 @@ remove() {
if [ "${use_systemctl}" = "True" ]; then if [ "${use_systemctl}" = "True" ]; then
printf "\033[32m Stopping the service\033[0m\n" printf "\033[32m Stopping the service\033[0m\n"
systemctl stop wiretrustee || true systemctl stop netbird || true
if [ -e /lib/systemd/system/wiretrustee.service ]; then if [ -e /lib/systemd/system/netbird.service ]; then
rm -f /lib/systemd/system/wiretrustee.service rm -f /lib/systemd/system/netbird.service
systemctl daemon-reload || true systemctl daemon-reload || true
fi fi
fi fi
printf "\033[32m Uninstalling the service\033[0m\n" printf "\033[32m Uninstalling the service\033[0m\n"
/usr/bin/wiretrustee service uninstall || true /usr/bin/netbird service uninstall || true
if [ "${use_systemctl}" = "True" ]; then if [ "${use_systemctl}" = "True" ]; then

View File

@ -5,31 +5,31 @@ This is a netbird signal-exchange server and client library to exchange connecti
## Command Options ## Command Options
The CLI accepts the command **management** with the following options: The CLI accepts the command **management** with the following options:
```shell ```shell
start Wiretrustee Signal Server daemon start Netbird Signal Server daemon
Usage: Usage:
wiretrustee-signal run [flags] netbird-signal run [flags]
Flags: Flags:
-h, --help help for run -h, --help help for run
--letsencrypt-domain string a domain to issue Let's Encrypt certificate for. Enables TLS using Let's Encrypt. Will fetch and renew certificate, and run the server with TLS --letsencrypt-domain string a domain to issue Let's Encrypt certificate for. Enables TLS using Let's Encrypt. Will fetch and renew certificate, and run the server with TLS
--port int Server port to listen on (e.g. 10000) (default 10000) --port int Server port to listen on (e.g. 10000) (default 10000)
--ssl-dir string server ssl directory location. *Required only for Let's Encrypt certificates. (default "/var/lib/wiretrustee/") --ssl-dir string server ssl directory location. *Required only for Let's Encrypt certificates. (default "/var/lib/netbird/")
Global Flags: Global Flags:
--log-file string sets Netbird log path. If console is specified the the log will be output to stdout (default "/var/log/netbird/signal.log")
--log-level string (default "info") --log-level string (default "info")
--log-file string sets Wiretrustee log path. If console is specified the the log will be output to stdout (default "/var/log/wiretrustee/management.log")
``` ```
## Running the Signal service (Docker) ## Running the Signal service (Docker)
We have packed the Signal server into docker image. You can pull the image from Docker Hub and execute it with the following commands: We have packed the Signal server into docker image. You can pull the image from Docker Hub and execute it with the following commands:
````shell ````shell
docker pull wiretrustee/signal:latest docker pull netbirdio/signal:latest
docker run -d --name wiretrustee-signal -p 10000:10000 wiretrustee/signal:latest docker run -d --name netbird-signal -p 10000:10000 netbirdio/signal:latest
```` ````
The default log-level is set to INFO, if you need you can change it using by updating the docker cmd as followed: The default log-level is set to INFO, if you need you can change it using by updating the docker cmd as followed:
````shell ````shell
docker run -d --name wiretrustee-signal -p 10000:10000 wiretrustee/signal:latest --log-level DEBUG docker run -d --name netbird-signal -p 10000:10000 netbirdio/signal:latest --log-level DEBUG
```` ````
### Run with TLS (Let's Encrypt). ### Run with TLS (Let's Encrypt).
By specifying the **--letsencrypt-domain** the daemon will handle SSL certificate request and configuration. By specifying the **--letsencrypt-domain** the daemon will handle SSL certificate request and configuration.
@ -43,11 +43,11 @@ Replace <YOUR-DOMAIN> with your server's public domain (e.g. mydomain.com or sub
# create a volume # create a volume
docker volume create wiretrustee-signal docker volume create wiretrustee-signal
# run the docker container # run the docker container
docker run -d --name wiretrustee-management \ docker run -d --name netbird-signal \
-p 10000:10000 \ -p 10000:10000 \
-p 443:443 \ -p 443:443 \
-v wiretrustee-signal:/var/lib/wiretrustee \ -v netbird-signal:/var/lib/netbird \
wiretrustee/signal:latest \ netbirdio/signal:latest \
--letsencrypt-domain <YOUR-DOMAIN> --letsencrypt-domain <YOUR-DOMAIN>
``` ```
## For development purposes: ## For development purposes:

View File

@ -1,9 +1,11 @@
package cmd package cmd
import ( import (
"errors"
"flag" "flag"
"fmt" "fmt"
"io" "io"
"io/fs"
"io/ioutil" "io/ioutil"
"net" "net"
"net/http" "net/http"
@ -178,10 +180,10 @@ func cpDir(src string, dst string) error {
} }
func migrateToNetbird(oldPath, newPath string) bool { func migrateToNetbird(oldPath, newPath string) bool {
_, old := os.Stat(oldPath) _, errOld := os.Stat(oldPath)
_, new := os.Stat(newPath) _, errNew := os.Stat(newPath)
if os.IsNotExist(old) || os.IsExist(new) { if errors.Is(errOld, fs.ErrNotExist) || errNew == nil {
return false return false
} }