-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
118 lines (114 loc) · 3.07 KB
/
main.go
File metadata and controls
118 lines (114 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package main
import (
"fmt"
"os"
"github.com/therealpaulgg/ssh-sync/pkg/actions"
"github.com/therealpaulgg/ssh-sync/pkg/actions/interactive"
"github.com/urfave/cli/v2"
)
var version string
func main() {
app := &cli.App{
Name: "ssh-sync",
Usage: "sync your ssh keys to a remote server",
Version: version,
Description: "Syncs your ssh keys to a remote server",
Commands: []*cli.Command{
{
Name: "setup",
Description: "Set up your system to use ssh-sync.",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "classic",
Aliases: []string{"c"},
Usage: "Use classical elliptic curve cryptography (ECDSA/ECDH-ES) instead of post-quantum",
},
},
Action: actions.Setup,
},
{
Name: "upload",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "path",
Aliases: []string{"p"},
Usage: "Path to the ssh keys",
},
},
Action: actions.Upload,
},
{
Name: "download",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "path",
Aliases: []string{"p"},
Usage: "Path to write the downloaded SSH keys",
},
&cli.BoolFlag{
Name: "safe-mode",
Aliases: []string{"s"},
Usage: "Safe mode will sync to an alternate directory (.ssh-sync-data)",
},
},
Action: actions.Download,
},
{
Name: "sync",
Usage: "Sync SSH keys bidirectionally with the server",
Description: "Synchronizes local SSH keys with the server. Newer version wins silently; prompts only on genuine conflicts.",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "path",
Aliases: []string{"p"},
Usage: "Path to the local SSH keys directory",
},
&cli.BoolFlag{
Name: "safe-mode",
Aliases: []string{"s"},
Usage: "Safe mode will write downloads to an alternate directory (.ssh-sync-data)",
},
},
Action: actions.Sync,
},
{
Name: "challenge-response",
ArgsUsage: "[challenge-phrase]",
Action: actions.ChallengeResponse,
},
{
Name: "list-machines",
Action: actions.ListMachines,
},
{
Name: "remove-machine",
ArgsUsage: "[machine-name]",
Action: actions.RemoveMachine,
},
{
Name: "reset",
Action: actions.Reset,
},
{
Name: "migrate",
Description: "Migrate keys from classical ECDSA to post-quantum (ML-DSA-65 + ML-KEM-768)",
Action: actions.Migrate,
},
{
Name: "rotate-master-key",
Usage: "Rotate the master key and re-encrypt all stored SSH keys",
Description: "Generates a new master key, re-encrypts all SSH keys on the server, and distributes the new key to each registered machine.",
Action: actions.RotateMasterKey,
},
{
Name: "interactive",
Description: "Uses a TUI mode for interacting with keys and config",
Usage: "Interactively manage your ssh keys with a TUI",
Action: interactive.Interactive,
},
},
}
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err.Error())
}
}