mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-11-29 15:31:53 +00:00
security: pod egress guard + remove banned members' pods (#172)
Member pods egress through pasta as the host. A pod could reach every 0.0.0.0 listener on the BBS host (ufw does not filter local delivery; pasta maps the host at 169.254.1.2) and could open SSH to other fleet servers from the BBS IP. On 2026-11-19 an attacker with a pod did both. - deploy/podguard.sh: nftables table matched by socket cgroup (the service user's slice), so the agentbbs daemon is unaffected. Pods may only use the host's public ports + DNS; servers listed in /etc/agentbbs/podguard.env are dropped. Loaded after user@<uid> and every 5 minutes (nft binds the cgroup id at load time). - pods.Manager.Remove + reapBannedPods: a banned member's pod is removed at start and every 2 minutes (it previously kept running for days). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
388360012c
commit
e68938fa0e
4 changed files with 134 additions and 0 deletions
|
|
@ -153,6 +153,17 @@ func (m *Manager) startAgent(s ssh.Session, user string) (sock string, cleanup f
|
|||
return "/run/agentbbs-agent/" + fname, func() { _ = l.Close(); _ = os.Remove(hostSock) }
|
||||
}
|
||||
|
||||
// Remove force-removes the member's pod container (stopping any shells in it).
|
||||
// The home volume is kept so an unban restores their files. It returns true
|
||||
// when a container was actually removed.
|
||||
func (m *Manager) Remove(user string) bool {
|
||||
name := m.containerName(user)
|
||||
if err := exec.Command(m.engine, "container", "inspect", name).Run(); err != nil {
|
||||
return false
|
||||
}
|
||||
return exec.Command(m.engine, "rm", "-f", name).Run() == nil
|
||||
}
|
||||
|
||||
// Engine reports the active container engine.
|
||||
func (m *Manager) Engine() string { return m.engine }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue