mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
Merge branch 'netbirdio:main' into main
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<strong>Big News! Wiretrustee becomes Netbird</strong>.
|
<strong>Big News! Wiretrustee becomes Netbird</strong>.
|
||||||
<a href="https://blog.netbird.io/wiretrustee-becomes-netbird">
|
<a href="https://netbird.io/blog/wiretrustee-becomes-netbird">
|
||||||
Learn more
|
Learn more
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<strong>
|
<strong>
|
||||||
Start using Netbird at <a href="https://app.netbird.io/">app.netbird.io</a>
|
Start using Netbird at <a href="https://app.netbird.io/">app.netbird.io</a>
|
||||||
<br/>
|
<br/>
|
||||||
See <a href="https://docs.netbird.io">Documentation</a>
|
See <a href="https://netbird.io/docs/">Documentation</a>
|
||||||
<br/>
|
<br/>
|
||||||
Join our <a href="https://join.slack.com/t/wiretrustee/shared_invite/zt-vrahf41g-ik1v7fV8du6t0RwxSrJ96A">Slack channel</a>
|
Join our <a href="https://join.slack.com/t/wiretrustee/shared_invite/zt-vrahf41g-ik1v7fV8du6t0RwxSrJ96A">Slack channel</a>
|
||||||
<br/>
|
<br/>
|
||||||
|
|||||||
@@ -90,6 +90,23 @@ func (s *Server) Start() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// loginAttempt attempts to login using the provided information. it returns a status in case something fails
|
||||||
|
func (s *Server) loginAttempt(ctx context.Context, setupKey, jwtToken string) (internal.StatusType, error) {
|
||||||
|
var status internal.StatusType
|
||||||
|
err := internal.Login(ctx, s.config, setupKey, jwtToken)
|
||||||
|
if err != nil {
|
||||||
|
if s, ok := gstatus.FromError(err); ok && (s.Code() == codes.InvalidArgument || s.Code() == codes.PermissionDenied) {
|
||||||
|
log.Warnf("failed login: %v", err)
|
||||||
|
status = internal.StatusNeedsLogin
|
||||||
|
} else {
|
||||||
|
log.Errorf("failed login: %v", err)
|
||||||
|
status = internal.StatusLoginFailed
|
||||||
|
}
|
||||||
|
return status, err
|
||||||
|
}
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
// Login uses setup key to prepare configuration for the daemon.
|
// Login uses setup key to prepare configuration for the daemon.
|
||||||
func (s *Server) Login(_ context.Context, msg *proto.LoginRequest) (*proto.LoginResponse, error) {
|
func (s *Server) Login(_ context.Context, msg *proto.LoginRequest) (*proto.LoginResponse, error) {
|
||||||
s.mutex.Lock()
|
s.mutex.Lock()
|
||||||
@@ -102,23 +119,23 @@ func (s *Server) Login(_ context.Context, msg *proto.LoginRequest) (*proto.Login
|
|||||||
|
|
||||||
state := internal.CtxGetState(ctx)
|
state := internal.CtxGetState(ctx)
|
||||||
defer func() {
|
defer func() {
|
||||||
s, err := state.Status()
|
status, err := state.Status()
|
||||||
if err != nil || (s != internal.StatusNeedsLogin && s != internal.StatusLoginFailed) {
|
if err != nil || (status != internal.StatusNeedsLogin && status != internal.StatusLoginFailed) {
|
||||||
state.Set(internal.StatusIdle)
|
state.Set(internal.StatusIdle)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
state.Set(internal.StatusConnecting)
|
|
||||||
|
|
||||||
s.mutex.Lock()
|
s.mutex.Lock()
|
||||||
managementURL := s.managementURL
|
managementURL := s.managementURL
|
||||||
if msg.ManagementUrl != "" {
|
if msg.ManagementUrl != "" {
|
||||||
managementURL = msg.ManagementUrl
|
managementURL = msg.ManagementUrl
|
||||||
|
s.managementURL = msg.ManagementUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
adminURL := s.adminURL
|
adminURL := s.adminURL
|
||||||
if msg.AdminURL != "" {
|
if msg.AdminURL != "" {
|
||||||
adminURL = msg.AdminURL
|
adminURL = msg.AdminURL
|
||||||
|
s.adminURL = msg.AdminURL
|
||||||
}
|
}
|
||||||
s.mutex.Unlock()
|
s.mutex.Unlock()
|
||||||
|
|
||||||
@@ -131,6 +148,13 @@ func (s *Server) Login(_ context.Context, msg *proto.LoginRequest) (*proto.Login
|
|||||||
s.config = config
|
s.config = config
|
||||||
s.mutex.Unlock()
|
s.mutex.Unlock()
|
||||||
|
|
||||||
|
if _, err := s.loginAttempt(ctx, "", ""); err == nil {
|
||||||
|
state.Set(internal.StatusIdle)
|
||||||
|
return &proto.LoginResponse{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
state.Set(internal.StatusConnecting)
|
||||||
|
|
||||||
if msg.SetupKey == "" {
|
if msg.SetupKey == "" {
|
||||||
providerConfig, err := internal.GetDeviceAuthorizationFlowInfo(ctx, config)
|
providerConfig, err := internal.GetDeviceAuthorizationFlowInfo(ctx, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -176,14 +200,8 @@ func (s *Server) Login(_ context.Context, msg *proto.LoginRequest) (*proto.Login
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := internal.Login(ctx, s.config, msg.SetupKey, ""); err != nil {
|
if loginStatus, err := s.loginAttempt(ctx, msg.SetupKey, ""); err != nil {
|
||||||
if s, ok := gstatus.FromError(err); ok && (s.Code() == codes.InvalidArgument || s.Code() == codes.PermissionDenied) {
|
state.Set(loginStatus)
|
||||||
log.Warnf("failed login with known status: %v", err)
|
|
||||||
state.Set(internal.StatusNeedsLogin)
|
|
||||||
} else {
|
|
||||||
log.Errorf("failed login: %v", err)
|
|
||||||
state.Set(internal.StatusLoginFailed)
|
|
||||||
}
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,14 +253,8 @@ func (s *Server) WaitSSOLogin(_ context.Context, msg *proto.WaitSSOLoginRequest)
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := internal.Login(ctx, s.config, "", tokenInfo.AccessToken); err != nil {
|
if loginStatus, err := s.loginAttempt(ctx, "", tokenInfo.AccessToken); err != nil {
|
||||||
if s, ok := gstatus.FromError(err); ok && (s.Code() == codes.InvalidArgument || s.Code() == codes.PermissionDenied) {
|
state.Set(loginStatus)
|
||||||
log.Warnf("failed login: %v", err)
|
|
||||||
state.Set(internal.StatusNeedsLogin)
|
|
||||||
} else {
|
|
||||||
log.Errorf("failed login: %v", err)
|
|
||||||
state.Set(internal.StatusLoginFailed)
|
|
||||||
}
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -247,11 +247,6 @@ func (s *serviceClient) login() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := s.conn.Up(s.ctx, &proto.UpRequest{}); err != nil {
|
|
||||||
log.Errorf("up service: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,6 +271,12 @@ func (s *serviceClient) menuUpClick() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status, err = conn.Status(s.ctx, &proto.StatusRequest{})
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("get service status: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if status.Status != string(internal.StatusIdle) {
|
if status.Status != string(internal.StatusIdle) {
|
||||||
log.Warnf("already connected")
|
log.Warnf("already connected")
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ then
|
|||||||
export TURN_PASSWORD=$(openssl rand -base64 32|sed 's/=//g')
|
export TURN_PASSWORD=$(openssl rand -base64 32|sed 's/=//g')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MGMT_VOLUMENAME="${$VOLUME_PREFIX}${MGMT_VOLUMESUFFIX}"
|
MGMT_VOLUMENAME="${VOLUME_PREFIX}${MGMT_VOLUMESUFFIX}"
|
||||||
SIGNAL_VOLUMENAME="${$VOLUME_PREFIX}${SIGNAL_VOLUMESUFFIX}"
|
SIGNAL_VOLUMENAME="${VOLUME_PREFIX}${SIGNAL_VOLUMESUFFIX}"
|
||||||
LETSENCRYPT_VOLUMENAME="${$VOLUME_PREFIX}${LETSENCRYPT_VOLUMESUFFIX}"
|
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
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ services:
|
|||||||
- $LETSENCRYPT_VOLUMENAME:/etc/letsencrypt/
|
- $LETSENCRYPT_VOLUMENAME:/etc/letsencrypt/
|
||||||
# Signal
|
# Signal
|
||||||
signal:
|
signal:
|
||||||
image: netbird/signal:latest
|
image: netbirdio/signal:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- $SIGNAL_VOLUMENAME:/var/lib/netbird
|
- $SIGNAL_VOLUMENAME:/var/lib/netbird
|
||||||
@@ -30,7 +30,7 @@ services:
|
|||||||
# command: ["--letsencrypt-domain", "$WIRETRUSTEE_DOMAIN", "--log-file", "console"]
|
# command: ["--letsencrypt-domain", "$WIRETRUSTEE_DOMAIN", "--log-file", "console"]
|
||||||
# Management
|
# Management
|
||||||
management:
|
management:
|
||||||
image: netbird/management:latest
|
image: netbirdio/management:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- dashboard
|
- dashboard
|
||||||
|
|||||||
Reference in New Issue
Block a user