env/bin/sekrit.1

166 lines
3.4 KiB
Groff
Raw Normal View History

2019-12-04 11:52:17 +01:00
.\"
.\" sekrit.1
2023-06-20 03:00:31 +02:00
.\" Written in 2018-2020 by Lucas
2019-12-04 11:52:17 +01:00
.\" 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
2019-12-04 11:52:17 +01:00
.Dt SEKRIT 1
.Os
.Sh NAME
.Nm sekrit
.Nd Secret files manager
.Sh SYNOPSIS
.Nm
2019-12-04 11:52:17 +01:00
.Cm add
.Ar key
.Op Ar value ...
.Nm
.Cm cp
.Op Fl k
.Op key
.Nm
2019-12-04 11:52:17 +01:00
.Cm gen
.Op Fl l Ar length
.Op Ar chars
.Nm
2019-12-04 11:52:17 +01:00
.Cm get
.Ar key
.Nm
2019-12-04 11:52:17 +01:00
.Cm has
.Ar key
.Nm
2019-12-04 11:52:17 +01:00
.Cm ls
.Op Ar keys ...
.Nm
.Cm rm
.Op Fl f
.Ar key
.Op Ar key ...
2019-12-04 11:52:17 +01:00
.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 ...
2019-12-04 11:52:17 +01:00
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.
2019-12-04 11:52:17 +01:00
.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 43.
.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.
2019-12-04 11:52:17 +01:00
.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.
2019-12-04 11:52:17 +01:00
.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
2019-12-04 11:52:17 +01:00
.Ed
.Sh SEE ALSO
.Xr gpg2 1 ,
.Xr xclip 1
2019-12-04 11:52:17 +01:00
.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/