bastion 0.55.3
ci / personal-data (push) Successful in 5s
ci / test (push) Successful in 3m51s
ci / fuzz (push) Successful in 2m55s

This commit is contained in:
Privatae
2026-10-25 23:16:45 +00:00
parent 77b7853ae1
commit 8822d5df85
136 changed files with 8638 additions and 1641 deletions
+24 -9
View File
@@ -139,13 +139,28 @@ func restartHintFor(goos string) string {
return "Restart the service so the change takes: systemctl restart privatae-bastion"
}
// stepupEnrollHint is the stepup-enroll line to print after a networked
// machine is anchored: approvals on it need a second factor or a device.
func stepupEnrollHint() string { return stepupEnrollHintFor(runtime.GOOS) }
func stepupEnrollHintFor(goos string) string {
if goos == "windows" {
return "privatae-bastion stepup-enroll (from this Administrator terminal)"
}
return "sudo -H privatae-bastion stepup-enroll"
// stepupEnrollHint is the stepup-enroll line `pair` prints for a pairing with
// no second factor. It is run as whoever ran `pair`, since that is whose state
// the pairing is in: with machine authority (an anchored or networked machine,
// a root install) through sudo -H or this Administrator terminal, and as the
// person's own account on a local install. --host is named when more than one
// host is paired, as stepup-enroll then requires.
func stepupEnrollHint(host string, paired int) string {
return stepupEnrollHintFor(runtime.GOOS, machineAuthorityHeld(), host, paired)
}
func stepupEnrollHintFor(goos string, authority bool, host string, paired int) string {
cmd := "privatae-bastion stepup-enroll"
if paired > 1 {
cmd += " --host " + host
}
switch {
case goos == "windows" && authority:
return cmd + " (from this Administrator terminal)"
case goos == "windows":
return cmd
case authority:
return "sudo -H " + cmd
}
return cmd
}