-*- mode: org -*-

* acme-client-portable

Portable version of OpenBSD's ~acme-client~.

This repository takes ~acme-client~ from OpenBSD's source tree and patches it to
be usable on other Unixes as well.  It is important to mention that portability
is the only goal of this project.  Any features must go via OpenBSD's source
tree.

** Dependencies

Sufficiently POSIX-like system (Linux in particular is enough), C compiler
supporting C99 and a SSL library (LibreSSL, OpenSSL are supported).

Optional dependencies are =libtls= and bsd's =queue.h= header.

** Building

Tarballs can be downloaded from https://files.wolfsden.cz/releases/acme-client/.
Unless stated otherwise, documentation assumes that you are building from the
tarball and not from git.

Assuming you are on a typical GNU/Linux system with OpenSSL installed, you
should be fine with typical incantation:

#+begin_src sh
  ./configure
  make
  make install
#+end_src

SSL library is located using ~pkg-config~, but you can override it using
=--with-openssl=DIR= argument to configure.  If auto-detection fails and you do
not provide explicit path, some standard locations are tried as a fallback.

You can request usage of =libtls= (and therefore get closer to the original
OpenBSD's version) by using =--enable-libtls= configure argument.  Again,
~pkg-config~ is used to locate the library, with possibility of a manual
override (=--with-libtls=).

If there is a header =bsd/sys/queue.h= available, it is preferred, however copy
is bundled and used if no other is found.

*** Configuration examples

Use LibreSSL, without =libtls=:

#+begin_src sh
  SSLDIR=/tmp/libressl/install-full
  ./configure                      \
          --with-openssl="$SSLDIR" \
          LDFLAGS="-Wl,-rpath $SSLDIR/lib"
#+end_src

Use LibreSSL, with =libtls=:

#+begin_src sh
  SSLDIR=/tmp/libressl/install-full
  ./configure                      \
          --with-libtls="$SSLDIR"  \
          --with-openssl="$SSLDIR" \
  	LDFLAGS="-Wl,-rpath $SSLDIR/lib"
#+end_src

And finally, use OpenSSL, with =libtls=:

#+begin_src sh
  SSLDIR=/tmp/openssl-1.1.1/install
  TLSDIR=/tmp/libressl/install-libtls-only
  ./configure                      \
          --with-libtls="$TLSDIR"  \
          --with-openssl="$SSLDIR" \
  	LDFLAGS="-Wl,-rpath $SSLDIR/lib -Wl,-rpath $TLSDIR/lib"
#+end_src

** Tests

For running the tests, you need to have pebble[0] in the PATH. Additionally, you
need to arrange for =tests/hosts= file to be at =/etc/hosts=.  After that just
run =check= target.

[0]: https://github.com/letsencrypt/pebble

** License

Original OpenBSD's source code is under the same license as it was.  My changes
(the portable bits) are under GPL-3.0-only.  That makes the final program
licensed under GPL-3.0-only.
