cmd/tailscale: add up --authkey flag

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
David Crawshaw 2020-04-09 17:16:57 +10:00
parent 1747d099e9
commit f8b72d2b5b

View File

@ -51,6 +51,7 @@ func main() {
upf.BoolVar(&upArgs.noSingleRoutes, "no-single-routes", false, "don't install routes to single nodes") upf.BoolVar(&upArgs.noSingleRoutes, "no-single-routes", false, "don't install routes to single nodes")
upf.BoolVar(&upArgs.noPacketFilter, "no-packet-filter", false, "disable packet filter") upf.BoolVar(&upArgs.noPacketFilter, "no-packet-filter", false, "disable packet filter")
upf.StringVar(&upArgs.advertiseRoutes, "advertise-routes", "", "routes to advertise to other nodes (comma-separated, e.g. 10.0.0.0/8,192.168.0.0/24)") upf.StringVar(&upArgs.advertiseRoutes, "advertise-routes", "", "routes to advertise to other nodes (comma-separated, e.g. 10.0.0.0/8,192.168.0.0/24)")
upf.StringVar(&upArgs.authKey, "authkey", "", "node authorization key")
upCmd := &ffcli.Command{ upCmd := &ffcli.Command{
Name: "up", Name: "up",
ShortUsage: "up [flags]", ShortUsage: "up [flags]",
@ -100,6 +101,7 @@ func main() {
noSingleRoutes bool noSingleRoutes bool
noPacketFilter bool noPacketFilter bool
advertiseRoutes string advertiseRoutes string
authKey string
} }
func runUp(ctx context.Context, args []string) error { func runUp(ctx context.Context, args []string) error {
@ -135,6 +137,7 @@ func runUp(ctx context.Context, args []string) error {
bc.SetPrefs(prefs) bc.SetPrefs(prefs)
opts := ipn.Options{ opts := ipn.Options{
StateKey: globalStateKey, StateKey: globalStateKey,
AuthKey: upArgs.authKey,
Notify: func(n ipn.Notify) { Notify: func(n ipn.Notify) {
if n.ErrMessage != nil { if n.ErrMessage != nil {
log.Fatalf("backend error: %v\n", *n.ErrMessage) log.Fatalf("backend error: %v\n", *n.ErrMessage)