fix(P07): remove all password/token paths (REQ-146, R-021, C-34) -- BREAKING
---ci--- project: orca phase: 7 milestone: v0.12 status: execute ---/ci--- R-021 invariant: no passwords, no Orca-issued tokens, no CA-key passphrases anywhere in the system. Removed: - proxmox/bootstrap.go: ssh.Password auth -> ssh.PublicKeys (key-based). --password/ removed from node join; replaced with --ssh-key (default: orca SSH key). Pre-staged key required. - stepca/stepca.go: --password-file /dev/stdin removed from Init and issueCert. Provisioner changed to 'orca-oidc' (OIDC provisioner). - identity/spiffe.go: --password-file removed from MintSVID. Provisioner changed to 'orca-oidc'. Tests: all proxmox, stepca, identity, cli tests updated + pass. 3 new password-rejection regression tests. Fake SSH server gains PublicKeyCallback. go vet clean. Full build green.
This commit is contained in:
@@ -61,9 +61,11 @@ type Options struct {
|
||||
Host string
|
||||
// SSHUser is the initial SSH username (default "root").
|
||||
SSHUser string
|
||||
// Password is the SSH password for the initial connection.
|
||||
// NEVER persisted (D-031). The caller must zero this after use.
|
||||
Password string
|
||||
// SSHKeyPath is the path to the private SSH key for key-based auth
|
||||
// (R-021: no passwords). The operator pre-stages the orca SSH public
|
||||
// key on the remote host out-of-band (or uses step ssh for an
|
||||
// OIDC-issued cert). Required.
|
||||
SSHKeyPath string
|
||||
// ProxmoxUser is the Linux system user to create on the host
|
||||
// (default "orca"). Config-overridable.
|
||||
ProxmoxUser string
|
||||
@@ -101,8 +103,8 @@ func BootstrapProxmox(ctx context.Context, opts Options) (*Result, error) {
|
||||
if opts.Host == "" {
|
||||
return nil, fmt.Errorf("proxmox bootstrap: host is required")
|
||||
}
|
||||
if opts.Password == "" {
|
||||
return nil, fmt.Errorf("proxmox bootstrap: password is required (use --password or $ORCA_PROXMOX_PASSWORD)")
|
||||
if opts.SSHKeyPath == "" {
|
||||
return nil, fmt.Errorf("proxmox bootstrap: SSH key path is required (R-021: no passwords; pre-stage the orca SSH key or use step ssh)")
|
||||
}
|
||||
if opts.SSHUser == "" {
|
||||
opts.SSHUser = "root"
|
||||
@@ -152,9 +154,18 @@ func BootstrapProxmox(ctx context.Context, opts Options) (*Result, error) {
|
||||
hostKeyCallback = cb
|
||||
}
|
||||
|
||||
// Load the SSH private key for key-based auth (R-021: no passwords).
|
||||
keyBytes, err := os.ReadFile(opts.SSHKeyPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read SSH key %s: %w", opts.SSHKeyPath, err)
|
||||
}
|
||||
signer, err := ssh.ParsePrivateKey(keyBytes)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parse SSH key %s: %w", opts.SSHKeyPath, err)
|
||||
}
|
||||
sshConfig := &ssh.ClientConfig{
|
||||
User: opts.SSHUser,
|
||||
Auth: []ssh.AuthMethod{ssh.Password(opts.Password)},
|
||||
Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)},
|
||||
HostKeyCallback: hostKeyCallback,
|
||||
Timeout: 10 * time.Second,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user