ircpass

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ircpass sets a member's chat/IRC password from the (non-root) BBS process. The Ergo password store (/var/lib/ergo/irc-passwd, ergo:ergo 0600) and each member's The Lounge user file are root-owned, so the BBS — which runs as an unprivileged service user — cannot write them directly. Instead it shells out to scripts/set-irc-password.sh through a narrow sudo rule (installed by setup.sh) that lets only that one command run as root for a single member.

This is the chat leg of the unified "reset my password everywhere" flow (passwd@): git (Forgejo) and mail (Mailu) are set in-process via their admin APIs; chat is set here. The script writes the Ergo pbkdf2 hash AND syncs the member's The Lounge saslPassword, so native IRC clients and the web client both keep working with the same secret.

Config (env):

AGENTBBS_SET_IRC_PASSWD   path to set-irc-password.sh (enables the chat leg)
AGENTBBS_SET_IRC_SUDO     "1" (default) to invoke it via sudo; "0" to call it
                          directly (e.g. when the BBS already runs as root, or
                          in tests). When sudo is used the binary is taken from
                          AGENTBBS_SUDO_BIN (default "sudo").

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Script  string // path to set-irc-password.sh; empty disables the chat leg
	UseSudo bool   // run the script through sudo
	SudoBin string // sudo binary (default "sudo")
}

Config locates the privileged helper and how to invoke it.

func ConfigFromEnv

func ConfigFromEnv() Config

ConfigFromEnv reads the chat-password settings from the environment.

func (Config) Configured

func (c Config) Configured() bool

Configured reports whether the chat password can actually be set (the helper script path is set). When false, callers skip the chat leg and say so.

func (Config) SetPassword

func (c Config) SetPassword(member, password string) error

SetPassword sets member's chat/IRC password by running the privileged helper as `set-irc-password.sh <member> -` (optionally via sudo), feeding the password on STDIN. Passing it on stdin — not argv — keeps it out of the process table (ps) and out of sudo's command log. member is the authenticated SSH account name; we still reject anything that isn't a plain account token as defence in depth, so it can never be read as a flag or path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL