| 1 |
# sq, the Sequoia-PGP command line tool |
| 2 |
|
| 3 |
[Sequoia-PGP][] is an implementation of OpenPGP in Rust. It includes a |
| 4 |
suite of library crates, which are meant to be used from applications. |
| 5 |
This crate provides the `sq` command line application. `sq` is aimed |
| 6 |
at command line users as a way to use OpenPGP conveniently from the |
| 7 |
command line. |
| 8 |
|
| 9 |
See the [sq user documentation][] for instructions. The program also has built-in |
| 10 |
help, using the `--help` option and `help` subcommand: |
| 11 |
|
| 12 |
~~~sh |
| 13 |
$ sq help |
| 14 |
... |
| 15 |
~~~ |
| 16 |
|
| 17 |
You can also browse the [manual pages][], look at our [acceptance |
| 18 |
criteria][], and browse the [rustdoc output][] if you want to learn about |
| 19 |
the implementation. |
| 20 |
|
| 21 |
[Sequoia-PGP]: https://sequoia-pgp.org/ |
| 22 |
[sq user documentation]: https://sequoia-pgp.gitlab.io/user-documentation |
| 23 |
[manual pages]: https://sequoia-pgp.gitlab.io/sequoia-sq/man/ |
| 24 |
[acceptance criteria]: https://sequoia-pgp.gitlab.io/sequoia-sq/subplot/ |
| 25 |
[rustdoc output]: https://sequoia-pgp.gitlab.io/sequoia-sq/impl/ |
| 26 |
|
| 27 |
## Installing |
| 28 |
|
| 29 |
The `sq` tool can be installed using cargo: |
| 30 |
|
| 31 |
```sh |
| 32 |
cargo install sequoia-sq |
| 33 |
``` |
| 34 |
|
| 35 |
Please see [sequoia-openpgp's README] for how to install build |
| 36 |
dependencies on your system. |
| 37 |
|
| 38 |
[sequoia-openpgp's README]: https://gitlab.com/sequoia-pgp/sequoia#requirements-and-msrv |
| 39 |
|
| 40 |
## Building from source |
| 41 |
|
| 42 |
This crate can be built from a source checkout using the standard |
| 43 |
`cargo` toolchain: |
| 44 |
|
| 45 |
```sh |
| 46 |
cargo build |
| 47 |
``` |
| 48 |
|
| 49 |
The above creates the `sq` executable, the manual pages, and its shell |
| 50 |
completions. By default, the manual pages and shell completions are |
| 51 |
put into the `cargo` target directory, but the exact location is |
| 52 |
unpredictable. To write the assets to a predictable location, set the |
| 53 |
environment variable `ASSET_OUT_DIR` to a suitable location. |
| 54 |
|
| 55 |
## Using a Container (Docker, Podman, etc.) |
| 56 |
|
| 57 |
The command line tool `sq` can also be built using an OCI compatible image |
| 58 |
builder, eg. podman or docker: |
| 59 |
|
| 60 |
```shell |
| 61 |
$ podman build -f Containerfile -t sq . |
| 62 |
$ podman run --rm -i sq --help |
| 63 |
``` |
| 64 |
|
| 65 |
You can then use sq in the container. |
| 66 |
|
| 67 |
For example searching for a certificate: |
| 68 |
|
| 69 |
```shell |
| 70 |
$ podman run --rm -i sq network search 653909A2F0E37C106F5FAF546C8857E0D8E8F074 |
| 71 |
``` |
| 72 |
|
| 73 |
All sq state is stored under `/sequoia` inside of the container, thus if you |
| 74 |
would like to persist the state between container runs you may bind mount the |
| 75 |
directory on the host. |
| 76 |
|
| 77 |
```shell |
| 78 |
$ mkdir sq-container # create a directory on the host where you will mount the working dir from the container |
| 79 |
$ podman run --rm -i -v $PWD/sq-container:/sequoia sq network search 653909A2F0E37C106F5FAF546C8857E0D8E8F074 |
| 80 |
$ podman run --rm -i -v $PWD/sq-container:/sequoia sq inspect --cert 653909A2F0E37C106F5FAF546C8857E0D8E8F074 |
| 81 |
|
| 82 |
``` |
| 83 |
|
| 84 |
The container environment has sq manpages and bash completion configured. By |
| 85 |
default the container will run sq as its "entrypoint", so if you would like |
| 86 |
to be dropped into a shell then override the entrypoint as follows. |
| 87 |
|
| 88 |
```shell |
| 89 |
# Note the "-t"; Necessary for the allocation of a pseudo-TTY. |
| 90 |
$ podman run --rm -t -i --entrypoint bash sq |
| 91 |
``` |
| 92 |
|
| 93 |
A current build of the container image is available from the gitlab registry. |
| 94 |
Rename it to `sq` locally so that it matches the above commands and for convenience. |
| 95 |
|
| 96 |
```shell |
| 97 |
$ podman pull registry.gitlab.com/sequoia-pgp/sequoia-sq:latest |
| 98 |
$ podman tag registry.gitlab.com/sequoia-pgp/sequoia-sq:latest sq |
| 99 |
$ podman run --rm -i sq --help |
| 100 |
``` |