askpass

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 4 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 askpass delivers a passphrase to ssh-keygen without it ever appearing on a command line.

ssh-keygen's -N flag is unusable for a real passphrase: argv is world-readable through ps and /proc/<pid>/cmdline, so every local user can read it for as long as the process runs. Piping to stdin does not work either, because ssh-keygen asks via readpassphrase(3), which opens /dev/tty in preference to stdin whenever a terminal exists.

What does work is the askpass protocol: ssh-keygen executes the program named by SSH_ASKPASS and reads the passphrase from its standard output. sshmgr names itself, so no separate helper binary has to be installed or trusted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Environ

func Environ(self, secret string) []string

Environ returns the full child environment for an ssh-keygen invocation that should ask self for the passphrase.

SSH_ASKPASS_REQUIRE=force (OpenSSH 8.4 and later) is what makes this work with a terminal attached; without it ssh-keygen reads /dev/tty directly and ignores the helper. Older ssh-keygen ignores the variable and falls back to prompting on the terminal, or to reading stdin when there is no terminal - both of which keep the passphrase off the command line, so no version check is needed.

func Serve

func Serve(w io.Writer) int

Serve writes the passphrase for ssh-keygen to read and reports the process exit code.

func Serving

func Serving() bool

Serving reports whether this process was executed by ssh-keygen as an askpass helper rather than invoked by the user. ssh-keygen passes the prompt text as an argument, which is not a sshmgr command, so this has to be checked before the command line is parsed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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