Commit Graph

95 Commits

Author SHA1 Message Date
Nils Sandmann
8465dba587 Add TOTP authentification for ACME DNS INWX
Signed-off-by: Nils Sandmann <git@softcat.org>
2022-01-11 16:34:57 +01:00
Jens Meißner
b788070030 Add DNS challenge schema for knot.
Signed-off-by: Jens Meißner <meissner@b1-systems.de>
2021-11-18 11:21:45 +01:00
Thomas Lamprecht
4ed79f7b4c Revert "dns-challenge: add 'use-proxy' property"
a bit to weird of a place to configure this especially as enabling it
does not guarantee any proxying if there's none..

This reverts commit e1088f616f.
2021-11-11 10:17:14 +01:00
Stoiko Ivanov
e1088f616f dns-challenge: add 'use-proxy' property
this patch adds an optional 'use-proxy' property to the dns
challenges.

If set to 1 the caller is expected to add the proxy url in the plugin
config, which is then set as 'http_proxy' and 'https_proxy'
environment variable by the plugin caller (and then used by curl)

Tested with the pdns plugin, direct traffic to the pdns server being
dropped, and a configured squid proxy

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-11-09 18:03:56 +01:00
Stoiko Ivanov
621046b21d add support for proxies
by setting the proxy for the LWP::UserAgent

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-11-09 18:03:56 +01:00
Thomas Lamprecht
bec914932c d/control: acme-perl: downgrade dependency to plugins to recommends
we have some places where we just do not need the plugins and the
perl library has no hard dependency on the plugin stuff, http
challenge and acme protocol implementation are independent of those

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-09 18:03:40 +01:00
Thomas Lamprecht
e2483043c6 dns: cope with plugin json index not being available
not nice to die plainly on a using this module (which can come in
indirectly/transitively), so lets better cope with that.

Nice side-effect, if nothing uses it, it won't get loaded, so less
IO and memory in that case.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-09 18:03:40 +01:00
Thomas Lamprecht
7b8275a30d buildsys: do not pass arch to upload
variable wasn't set and this is an `arch: all` package anyway..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-08 11:18:26 +02:00
Thomas Lamprecht
300242d78b bump version to 1.4.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-08 11:17:02 +02:00
Thomas Lamprecht
cd4a1aeb00 update acme.sh plugins to 3.0.1 and include new plugins in schema
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-10-08 11:15:34 +02:00
Fabian Grünbichler
2307c38b59 support downloading alternate chains
the current default chains end with an expired root certificate for
maximum compatibility with old Android versions. this breaks some other
older clients (openssl, gnutls) which don't expect chains to contain any
expired certificates, even if they are 'above' the trust anchor.

by setting $root, it is possible to specify which root the ACME provided
certificate chain should end with, downloading alternate chains as
necessary.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-10-08 10:55:49 +02:00
Jens Meißner
b5d46dc4a6 Add DNS challenge schema for nsupdate.
Signed-off-by: Jens Meißner <meissner@b1-systems.de>
2021-09-15 17:04:07 +02:00
Fabian Grünbichler
66f04388e4 bump version to 1.3.0
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-08-11 12:26:39 +02:00
Stoiko Ivanov
51b0ba75c1 plugin-caller: pull in changes from upstream 3.0.0
Commits ae3dda0f8fc3071495cd1e8dff0fe4a339febb1c and
d70b759cb9c5b413cce92e65e841a54a65813962

implementing retrying get and post requests seem worth pulling in.

From a quick look through the diff the remaining changes (between
2.9.0 and 3.0.0) should not be relevant for us

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-08-11 11:52:53 +02:00
Stoiko Ivanov
4685280401 update to acme.sh dns plugins to 3.0.0
fixes #3546

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-08-11 11:52:53 +02:00
Stoiko Ivanov
a5320155c1 acme client: fix #3536 untaint data returned from acme server
The data returned from the acme server (e.g. boulder) should be
considered tainted.

To see which places might need untainted I checked where $self->{ua}
was used (in $self->do) and a quick scan identified __get_result as
the consumer of the tainted data.
In all but one uses the data is decoded from json (which would die if the
result is not valid json).

The remaining use-case yields a certificate in PEM format (and is
handled at the caller of __get_result).

The issue is currently only visible if a proxy is set, because AFAICT
somewhere in SSLeay (or IO::Socket::SSL, which uses SSLeay) a taint
flag is not set on the return value.

A reproducer for the issue:
```

use strict;
use warnings;

use HTTP::Request;
use LWP::UserAgent;

$ENV{PATH} = "/usr/bin:/bin";

my $ua = LWP::UserAgent->new(env_proxy => 0);
my $request = HTTP::Request->new('GET', 'https://google.com/');
my $resp = $ua->request($request);
my $text = substr($resp->decoded_content, 0, 5);;
system("echo \"$text\""); # does work
$request = HTTP::Request->new('GET', 'http://neverssl.com/');
$resp = $ua->request($request);
$text = substr($resp->decoded_content, 0, 5);;
system("echo \"$text\""); # does not work
```

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-08-11 11:52:53 +02:00
Thomas Lamprecht
cd3891a712 bump version to 1.2.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-16 18:06:24 +02:00
Thomas Lamprecht
8e7256570e update to acme.sh dns plugins to 2.9.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-16 18:03:37 +02:00
Stoiko Ivanov
b0d717c72f plugin-caller: make no-ops always successful
proxmox-acme is used to call the dns-plugins from acme.sh and has the
config editing (saving/clearing) turned int no-ops.

bash's `return` statement w/o argument returns the value of the last
executed command (the one before our no-op method was called) (see
`help return` in bash).
This leads to unexpected behavior in some plugins, which call one of
the methods as last statement join the next step with `&&`.

tested bash behavior with:
```
foo() { return; }; if [ -z 'x' ]; then :; else foo ; fi; echo $?
```

reported in our community-forum:
https://forum.proxmox.com/threads/pmg-acme-dns-with-cyon-failing-to-issue-certificate.92762

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-07-16 17:58:48 +02:00
Stoiko Ivanov
79364a8c54 plugin-caller: add missing methods from acme.sh
As reported in our community forum [0] certain dns plugins use code
from `acme.sh`, which is currently not in our proxmox-acme.

I initially only added _sign and it's callees, but then though about
trying to get all missing methods somehow (only resethttp() was
missing in addition).

The heuristic used to get all missing methods was grepping for '\b_'
in all dns plugins and then removing:
* declarations in proxmox_acme (already present)
* methods declared in the plugins themselves
* $_.* (or ${_.*) - variable use
* comments

in shell:
```
present=$(awk 'BEGIN{ORS="|";} /^_/{ gsub(/\(\) {/, ""); print $0}' \
  src/proxmox-acme | | sed -r 's/\|$//')
local=$(awk 'BEGIN{ORS="|";} /^_/{ gsub(/\(\) {/, ""); print $0}' \
  src/acme.sh/dnsapi/dns*.sh | sed -r 's/\|$//')
grep '\b_' src/acme.sh/dnsapi/* | grep -Ev \
  "$present|$local|_[a-zA-Z0-9_-]+=|\\$\{?_|^src/acme.sh/dnsapi/.*sh:#"
```

[0] https://forum.proxmox.com/threads/proxmox-acme-with-transip-plugin-_sign-command-not-found.92582/

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-07-16 17:57:59 +02:00
Thomas Lamprecht
1a9d0b7bad bump version to 1.1.1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-05 18:58:34 +02:00
Stoiko Ivanov
a4ac1b6ee2 fix #3390: standalone: explicitly bind to '::'
This patch follows 2f8be3bfda203065b22e60862e5f98d831a46921 from
pve-common:
Instead of not specifying a listen address, we first try to bind on
'::', which usually accepts connections for both ipv4 and ipv6,
and fall back to '0.0.0.0' if this fails (if ipv6 is disabled via
kernel commandline).

The arguments are the same for HTTP::Daemon as for IO::Socket::IP,
since the former has IO::Socket::IP as base.

Additionally, by setting 'V6Only' explicitly to '0', the listening
socket will also accept ipv4 connections, even if the sysctl
'net.ipv6.bindv6only' is set to 1 - the sysctl provides a default
value, which can be overridden by a socket-option (see ipv6(7) -
IPV6_ONLY).

setting this option results in the following setsockopt-call being
added:
setsockopt(3, SOL_IPV6, IPV6_V6ONLY, [0], 4) = 0

AFAICT the socket option is available and overridable on Linux > 2.4
see [0] for an explanation of why this might not be wanted

Overriding the default setting set by an admin might be debateable,
but considering that the http-listener for the ACME challenge is
rather short-lived I think this is justified. The only other option
would be to create 2 listening sockets and binding on both - which
would mean reorganizing our perl-deamons to deal with multiple listen
sockets.

quickly tested on a publicly reachable test-machine of mine with:
* ipv6.domain.test (only AAAA record)
* ip46.domain.test (both AAAA and A)
* ipv4.domain.test (only A record)
with:
* sysctl net.ipv6.bindv6only=1 (for all 3 domains)
* disabling ipv6 via kernel-commandline (only ipv4 tested)
* disabling ipv6 via sysctl (only ipv4 tested)
* only configuring an ipv6 address (only ipv6 tested)

[0] https://man.openbsd.org/inet6.4
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-06-21 09:35:39 +02:00
Thomas Lamprecht
085b9535c4 buildsys: change upload dist to bullseye
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-08 10:29:08 +02:00
Thomas Lamprecht
bd6a54e6f4 bump version to 1.1.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-05 14:32:24 +02:00
Thomas Lamprecht
bf506bfeb0 d/control: fix descriptions
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-05 14:32:24 +02:00
Thomas Lamprecht
a19ae07bfb split into two packages: a perl one and an acme.sh plugin one
Main reason for this split is PBS, which only needs the plugins and
would like to avoid the perl one (which pulls in pve-common too)

This includes a few small changes which are technically not direct
part of the split, but related enough:
* change source name of package from libproxmox-acme-perl to
  libproxmox-acme
* make lintian override for script exec permission narrower to avoid
  possible false negatives in the future, really only allow the
  dnsapi ones.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-05 14:32:24 +02:00
Thomas Lamprecht
4195bf0a9a move DNS plugin schema to separate JSON based file
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-05 14:32:15 +02:00
Thomas Lamprecht
5185b076fc buildsys: actually install new plugins
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-05 14:32:15 +02:00
Lorenz Stechauner
da91f53693 dns challenge: add world4you schema
Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2021-05-05 10:48:42 +02:00
Thomas Lamprecht
0663394d2e update acme.sh plugins to 2.8.9 and include new plugins in schema
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-05 10:00:15 +02:00
Thomas Lamprecht
cb5329e656 debian: set source format correctly
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-05 10:00:15 +02:00
Thomas Lamprecht
7c671e3ffe bump version to 1.0.8
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-16 17:11:51 +01:00
Thomas Lamprecht
21e6ed3007 dns: add new plugins to schema and install them
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-16 17:04:35 +01:00
Thomas Lamprecht
3721195233 update acme.sh to current master
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-16 17:01:41 +01:00
Wolfgang Bumiller
c617455e64 add missing 'use PVE::Acme' statement
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-03-12 15:59:46 +01:00
Thomas Lamprecht
5bc035dda3 bump version to 1.0.7
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-11 19:10:19 +01:00
Thomas Lamprecht
dfc8695d03 acme: define kapper.net and acme-dns schema
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-11 19:10:19 +01:00
Thomas Lamprecht
394bfcc5be buildsys: ensure new plugins also get installed
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-11 18:54:53 +01:00
Thomas Lamprecht
895b703e20 add basic test so schema is in sync with available plugins
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-11 18:54:53 +01:00
Thomas Lamprecht
da7c723f60 dns challenge: add missing plugins to schema
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-11 18:43:16 +01:00
Thomas Lamprecht
cd491a0711 bump version to 1.0.6
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-07 11:59:17 +01:00
Thomas Lamprecht
5fa6f0f615 update acme.sh to 2.8.8
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-07 11:53:57 +01:00
Fabian Grünbichler
3704cab609 bump version to 1.0.5
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-09-04 14:01:17 +02:00
Thomas Lamprecht
1192b59586 fix #2732: use actual plugin config data
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-24 00:24:44 +02:00
Thomas Lamprecht
956b5190e4 dns challenge: add 'INWX' acme.sh schema
https://bugzilla.proxmox.com/show_bug.cgi?id=2731

Requested-by: Claas Hilbrecht <Claas.Hilbrecht@linum.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-23 23:55:38 +02:00
Thomas Lamprecht
b21c536ad7 bump version to 1.0.4
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-15 20:07:01 +02:00
Thomas Lamprecht
231ed7c0fd dns challenge: describe digitalocean schema
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-15 20:04:56 +02:00
Thomas Lamprecht
ec59606a39 dns challenge: add df (dyndnsfree.de) provider
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-15 20:04:53 +02:00
Thomas Lamprecht
5cc388d2d6 update acme.sh dns plugins to 2.8.6
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-15 19:57:20 +02:00
Thomas Lamprecht
c69fdfe998 make clean: clean more
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-05-15 19:53:19 +02:00