Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetBird SSH #361

Merged
merged 53 commits into from
Jun 23, 2022
Merged

NetBird SSH #361

merged 53 commits into from
Jun 23, 2022

Conversation

braginini
Copy link
Contributor

No description provided.

@braginini
Copy link
Contributor Author

If an agent has been upgraded from any version without SSH support, all others won't receive an update indicating that SSH is now possible to this peer.
Should be fixed

@@ -145,7 +158,7 @@ func GetConfig(managementURL, adminURL, configPath, preSharedKey string) (*Confi
} else {
// don't overwrite pre-shared key if we receive asterisks from UI
pk := &preSharedKey
if preSharedKey == "**********" {
if preSharedKey == "**********" || preSharedKey == "" {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we shouldn't dismiss empty string as sometimes user wants to remove a preshared key from its config

//nil sshServer means it has not yet been started
var err error
e.sshServer, err = e.sshServerFunc(e.config.SSHKey,
fmt.Sprintf("%s:%d", e.wgInterface.Address.IP.String(), 2222))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

port should come from config for cases when port 2222 is already in use

client/internal/engine.go Show resolved Hide resolved
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

engine := NewEngine(ctx, cancel, &signal.MockClient{}, &mgmt.MockClient{}, &EngineConfig{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets avoid using same interface configuration between tests

@@ -54,6 +55,8 @@ type EngineConfig struct {

// UDPMuxSrflxPort default value 0 - the system will pick an available port
UDPMuxSrflxPort int

SSHKey []byte
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should distinguish private and public ssh keys, here we store private key but other methods use sshKey for public SSH Key (e.g. Login)

const RSAKeySize = 2048

// GeneratePrivateKey creates RSA Private Key of specified byte size
func GeneratePrivateKey(t KeyType) ([]byte, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's avoid using single-letter input variables

"unsafe"
)

func setWinSize(f *os.File, w, h int) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's avoid using single-letter input variables

"os"
)

func setWinSize(f *os.File, w, h int) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's avoid using single-letter input variables

management/server/grpcserver.go Show resolved Hide resolved
@@ -365,7 +384,8 @@ func toWiretrusteeConfig(config *Config, turnCredentials *TURNCredentials) *prot

func toPeerConfig(peer *Peer) *proto.PeerConfig {
return &proto.PeerConfig{
Address: fmt.Sprintf("%s/%d", peer.IP.String(), SubnetSize), // take it from the network
Address: fmt.Sprintf("%s/%d", peer.IP.String(), SubnetSize), // take it from the network
SshConfig: &proto.SSHConfig{SshEnabled: true}, //TODO REMOVE THIS HARDCODED VALUE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove hardcoded flag

@braginini braginini merged commit 06860c4 into main Jun 23, 2022
@braginini braginini deleted the feature/ssh branch June 23, 2022 15:04
pulsastrix pushed a commit to pulsastrix/netbird that referenced this pull request Dec 24, 2023
This PR adds support for SSH access through the NetBird network
without managing SSH skeys.
NetBird client app has an embedded SSH server (Linux/Mac only) 
and a netbird ssh command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants