env/bin/sekrit.1
Lucas 6b2c9dac0c sekrit: increase default length to 44
This makes all the default passwords valid Base64 yielding 264 bits of
entropy.
2023-11-25 10:49:40 +00:00

166 lines
3.4 KiB
Groff

.\"
.\" sekrit.1
.\" Written in 2018-2020 by Lucas
.\" CC0 1.0 Universal/Public domain - No rights reserved
.\"
.\" To the extent possible under law, the author(s) have dedicated all
.\" copyright and related and neighboring rights to this software to the
.\" public domain worldwide. This software is distributed without any
.\" warranty. You should have received a copy of the CC0 Public Domain
.\" Dedication along with this software. If not, see
.\" <http://creativecommons.org/publicdomain/zero/1.0/>.
.\"
.Dd December 2, 2020
.Dt SEKRIT 1
.Os
.Sh NAME
.Nm sekrit
.Nd Secret files manager
.Sh SYNOPSIS
.Nm
.Cm add
.Ar key
.Op Ar value ...
.Nm
.Cm cp
.Op Fl k
.Op key
.Nm
.Cm gen
.Op Fl l Ar length
.Op Ar chars
.Nm
.Cm get
.Ar key
.Nm
.Cm has
.Ar key
.Nm
.Cm ls
.Op Ar keys ...
.Nm
.Cm rm
.Op Fl f
.Ar key
.Op Ar key ...
.Sh DESCRIPTION
.Nm
is a small shell script for managing encrypted files.
It leverages
.Xr gpg2 1
to create and read encrypted files,
and can generate random data to populate them.
.Pp
Because of this,
.Nm
can be used as an account credentials manager,
or as a general-purpose key-value store of encrypted information.
.Bl -tag -width Ds
.It Nm Cm add Ar key Op Ar value ...
Adds a value to
.Ar key .
.Ar value
is inserted as is, without any extra modifications.
If no
.Ar value
is specified on command line,
.Cm add
will read the value from standard input.
.Cm add
will fail if
.Ar key
already has a value.
.It Nm Cm cp Oo Fl k Oc Ar key
Decrypts the value associated with
.Ar key
and copies it to the clipboard with
.Xr xclip 1 .
It removes the last newline unless
.Fl k
is given.
.It Nm Cm gen Oo Fl l Ar length Oc Op Ar chars
Outputs a randomly generated sequence.
The generated sequence consist of characters
.Ar chars .
Defaults to
.Ar +/0-9A-Za-z .
If
.Fl l Ar length
is provided, the randomly generated sequence will be
.Ar length
characters long.
Defaults to 44.
.It Nm Cm get Ar key
Decrypts the value associated with
.Ar key
and prints it to standard output.
Fails if
.Ar key
doesn't have a value associated with it.
.It Nm Cm has Ar key
Returns success if
.Ar key
has a value associated with it.
Fails otherwise.
.It Nm Cm ls Op Ar keys ...
For each
.Ar key
given as argument,
list all the registered keys under that hierarchy.
If no
.Ar key
is given, list all the registered keys.
.It Nm Cm rm Oo Fl f Oc Ar key Op Ar key ...
Removes the file associated with each
.Ar key .
Asks for confirmation before removing each file, unless
.Fl f
is given.
.El
.Sh ENVIRONMENT
.Bl -tag -width SEKRIT_GPG_ID
.It Ev SEKRIT_DIR
Secret files base directory.
Defaults to
.Pa ~/keep/sekrit .
.It Ev SEKRIT_GPG_ID
The recipient to whom encrypt the files.
Must be set for
.Nm
to work.
.El
.Sh EXIT STATUS
.Ex -std
.Sh EXAMPLES
To use
.Nm
as an account credentials manager, you can run
.Bd -literal -offset indent
sekrit add accounts/example.com/user myuser
sekrit gen accounts/example.com/pass
.Ed
.Pp
Then, to retrieve credentials to login as
.Ar myuser
in
.Ar example.com
you can run
.Bd -literal -offset indent
sekrit cp accounts/example.com/user
sekrit cp accounts/example.com/pass
.Ed
.Sh SEE ALSO
.Xr gpg2 1 ,
.Xr xclip 1
.Sh AUTHORS
.An Lucas
.Sh LICENSE
.Nm
is in the public domain.
.Pp
To the extent possible under law, the author(s) have dedicated all
copyright and related and neighboring rights to this software to the
public domain worldwide.
.Pp
.Lk http://creativecommons.org/publicdomain/zero/1.0/