gatehere

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gatehere holds the rules of ssh-gate's server mode (--here): a phone's key that logs in to a server runs komando there through the gate, and the gate decides what may run on that server itself. The rules are pure: the cli hands in the paths and the command's words.

Index

Constants

View Source
const ThisServer = "localhost"

ThisServer is how a command through the server mode names the server it runs on: the only target there.

Variables

View Source
var SSHFiles = []string{"authorized_keys", "authorized_keys2", "config", "rc", "environment"}

SSHFiles are the files in ~/.ssh sshd reads for a login. The whole folder is protected; these are named so a refusal says which.

View Source
var StartFiles = []string{
	".profile", ".bash_profile", ".bash_login", ".bashrc", ".bash_logout",
	".zshenv", ".zprofile", ".zshrc", ".zlogin", ".zlogout",
	".kshrc", ".mkshrc", ".cshrc", ".tcshrc", ".login", ".logout",
	".xprofile", ".xsession", ".xinitrc", ".pam_environment",
}

StartFiles are the files a shell or a login reads as it starts, in the home: a line written there runs at the user's next login.

Functions

func Keys

func Keys() (run, shell [][3]string)

Keys are the (type, area, verb) keys the server mode names: those it runs and the shells it refuses. TestGateHereKeysNameTheTree in internal/cli holds them to the command tree.

func NextTo

func NextTo(home string) map[string]string

NextTo are the folders next to home (/home/*, /Users/*), as other users' homes: the users a system keeps outside /etc/passwd (macOS, a directory service) have their homes there too. Folders starting with a dot, and macOS's /Users/Shared, are no homes.

func OtherHomes

func OtherHomes(passwd []byte, home string) map[string]string

OtherHomes are the homes of the users in an /etc/passwd text other than the one at home. A home counts when its last word is the user's name (/home/budi, /root): /usr/sbin, / and /nonexistent are none.

func Resolve

func Resolve(path, home string) string

Resolve is path as an absolute path with every symlink resolved, also one that points at nothing yet and one under a folder that does not exist yet: what a write to path would really change.

func Runs

func Runs(typ, area, verb string) (bool, string)

Runs says whether the command with this safety key runs in server mode, and why not.

func SystemLog

func SystemLog(line string) error

SystemLog writes line to this system's log (auth facility), where a user cannot change or remove it.

func Target

func Target(word string) string

Target says why word is no target in server mode, or "".

Types

type Paths

type Paths struct {
	Home    string            // the paired user's home, from the user database
	Komando string            // komando's own folder: settings, rules, guard, audit
	Self    string            // the gate's own binary, symlinks resolved
	Homes   map[string]string // every other user's home, by name (OtherHomes)
}

Paths are what the server mode protects (rule a) and keeps unread (the read limit), for the user the key logs in as.

func (Paths) ReadRefusal

func (p Paths) ReadRefusal(path string) string

ReadRefusal says why a command through the gate may not read path, or "" (the read limit): another user's home, ~/.ssh (private keys) and komando's own folder (its vault and keys), by any name.

func (Paths) WriteRefusal

func (p Paths) WriteRefusal(path string) string

WriteRefusal says why a command through the gate may not write, move, remove or change the mode of path, or "" (rule a). It checks the path as named and as its symlinks resolve, a parent folder of a protected place (a rename moves what is in it), and a file with other names (a hardlink of a protected file is that file).

Jump to

Keyboard shortcuts

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