bastion 0.62.0
ci / fuzz (push) Successful in 3m27s
ci / personal-data (push) Successful in 4s
ci / test (push) Successful in 3m39s

This commit is contained in:
Privatae
2026-11-02 21:31:58 +00:00
parent 79646bda13
commit 2043fa5e9e
29 changed files with 1853 additions and 211 deletions
+15 -7
View File
@@ -28,7 +28,6 @@ import (
"errors"
"fmt"
"io"
"net"
"os"
"strings"
"time"
@@ -47,8 +46,13 @@ type agentActReply struct {
var actNow = time.Now
func serveAct(uid uint32, user string, req agentAskRequest) (r agentActReply) {
return serveActFor(askPeer{UID: uid, Name: user}, req)
}
func serveActFor(peer askPeer, req agentAskRequest) (r agentActReply) {
user := peer.Name
r.User = user
if why := readLaneRefusal(uid, user); why != "" {
if why := readLaneRefusalFor(peer); why != "" {
r.Why = actWording(why)
return r
}
@@ -65,7 +69,7 @@ func serveAct(uid uint32, user string, req agentAskRequest) (r agentActReply) {
r.Failed, r.Why = true, err.Error()
return r
}
ownerActAudit(what, user)
ownerActAudit(what, user, peer.windows())
r.OK, r.Done = true, done
return r
}
@@ -194,21 +198,25 @@ func switchDoneText(host, family string, off bool) string {
// factor directory is made if it is not there yet (a deny or a switch off
// needs no code set up): dcnAuditWith joins its directory onto audit.jsonl,
// and "" would be the daemon's working directory.
func ownerActAudit(what, user string) {
func ownerActAudit(what, user string, pipe bool) {
dir, err := machineFactorDir()
if err != nil {
uilogf("owner act not audited (%v): %s, from %s\n", err, what, user)
return
}
lane := "its ask socket"
if pipe {
lane = "its ask pipe"
}
dcnAuditWith(dir, "owner_lane_act", 0, "",
what+", from the owner's account "+user+" through its ask socket", nil)
what+", from the owner's account "+user+" through "+lane, nil)
}
// ── the asking side ─────────────────────────────────────────────────────────
func actViaSock(req agentAskRequest) (string, error) {
p := readSockPath()
c, err := net.DialTimeout("unix", p, 3*time.Second)
p := askLaneAddr(readSockPath())
c, err := dialAskLane(readSockPath())
if err != nil {
return "", &laneError{down: true, why: "nothing answers on " + p + " (" + err.Error() + ")"}
}