mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-08-13 22:37:28 +00:00
tor: premium tor-url / tor-irc / tor routes over Tor
Add three premium-gated SSH routes:
ssh tor-url@host <url> one-shot HTTP(S) GET over Tor (host-side,
curl via SOCKS, 30s/2MB caps, http/https only)
ssh -t tor-irc@host <server> interactive IRC over Tor in the member's pod
ssh -t tor@host <command...> run any command over Tor (torsocks) in the pod
tor-url runs host-side and constrained; tor/tor-irc run inside the member's
isolated pod (new pods.Exec) so arbitrary/interactive commands are sandboxed,
never on the host. internal/tor wraps curl/torsocks/irssi. All gated by
ensurePremium; names reserved. setup.sh installs + enables tor (SOCKS
127.0.0.1:9050) and torsocks.
Note: tor-url is host-side and self-contained. tor/tor-irc still need the pod
image to carry torsocks+irssi and reach the Tor SOCKS — follow-up.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ac4b0873d9
commit
4be87440d5
5 changed files with 285 additions and 1 deletions
|
|
@ -46,6 +46,16 @@ var DomainNames = map[string]bool{"domain": true, "domains": true}
|
|||
// (see IsAdmin); the name itself confers nothing.
|
||||
var AdminNames = map[string]bool{"admin": true, "sysop": true}
|
||||
|
||||
// TorURLNames route to the one-shot "fetch a URL over Tor" command (premium).
|
||||
var TorURLNames = map[string]bool{"tor-url": true}
|
||||
|
||||
// TorIRCNames route to an interactive IRC-over-Tor client in the member's pod.
|
||||
var TorIRCNames = map[string]bool{"tor-irc": true}
|
||||
|
||||
// TorNames route to the generic "run a command over Tor" passthrough in the
|
||||
// member's pod (premium). Checked after the more specific tor-* routes.
|
||||
var TorNames = map[string]bool{"tor": true}
|
||||
|
||||
// GameNames are usernames that route to AgentGames: the line-delimited-JSON
|
||||
// agent-vs-agent match protocol (PRD §5.2). `play@` stays a guest hub alias.
|
||||
var GameNames = map[string]bool{"game": true, "games": true}
|
||||
|
|
@ -65,6 +75,15 @@ func IsDomainName(u string) bool { return DomainNames[strings.ToLower(u)] }
|
|||
// IsAdminName reports whether the SSH username requests the admin console.
|
||||
func IsAdminName(u string) bool { return AdminNames[strings.ToLower(u)] }
|
||||
|
||||
// IsTorURLName reports whether the SSH username requests the tor-url fetch.
|
||||
func IsTorURLName(u string) bool { return TorURLNames[strings.ToLower(u)] }
|
||||
|
||||
// IsTorIRCName reports whether the SSH username requests the tor-irc client.
|
||||
func IsTorIRCName(u string) bool { return TorIRCNames[strings.ToLower(u)] }
|
||||
|
||||
// IsTorName reports whether the SSH username requests the generic tor passthrough.
|
||||
func IsTorName(u string) bool { return TorNames[strings.ToLower(u)] }
|
||||
|
||||
// systemReserved are names that don't drive an SSH route but would still
|
||||
// collide with a per-user subdomain (<name>.<host>), the agent route, or common
|
||||
// infra hostnames — so members may not claim them as account names.
|
||||
|
|
@ -80,7 +99,8 @@ var systemReserved = map[string]bool{
|
|||
// therefore cannot be used as a member's account name.
|
||||
func IsReservedName(name string) bool {
|
||||
n := strings.ToLower(name)
|
||||
if GuestNames[n] || PodNames[n] || JoinNames[n] || DomainNames[n] || AdminNames[n] || systemReserved[n] {
|
||||
if GuestNames[n] || PodNames[n] || JoinNames[n] || DomainNames[n] || AdminNames[n] ||
|
||||
TorURLNames[n] || TorIRCNames[n] || TorNames[n] || systemReserved[n] {
|
||||
return true
|
||||
}
|
||||
return strings.HasPrefix(n, "video-") // video-<code> call routes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue