Load user profile when SSH (#380)

This PR fixes issues with the terminal when
running netbird ssh to a remote agent.
Every session looks up a user and loads its
profile. If no user is found, the connection is rejected.
The default user is root.
This commit is contained in:
Misha Bragin
2022-07-07 11:24:38 +02:00
committed by GitHub
parent 49e9113e0f
commit d4a3ee9d87
5 changed files with 137 additions and 13 deletions

View File

@ -1,5 +1,7 @@
package util
import "os"
// SliceDiff returns the elements in slice `x` that are not in slice `y`
func SliceDiff(x, y []string) []string {
mapY := make(map[string]struct{}, len(y))
@ -14,3 +16,9 @@ func SliceDiff(x, y []string) []string {
}
return diff
}
// FileExists returns true if specified file exists
func FileExists(path string) bool {
_, err := os.Stat(path)
return err == nil
}