See also "set ssl crl-file" and "commit ssl crl-file".
+acme ps
+ Show the running ACME tasks. See also "acme renew".
+
+ Example:
+ $ echo "@1 acme ps" | socat /run/haproxy-master.sock - | column -t -s $'\t'
+ # certificate section state
+ foobar.pem.rsa LE1 Running
+ foobar.pem.ecdsa LE2 Running
+
acme renew <certificate>
Starts an ACME certificate generation task with the given certificate name.
The certificate must be linked to an acme section, see section 3.13. of the
- configuration manual.
+ configuration manual. See also "acme ps".
add acl [@<ver>] <acl> <pattern>
Add an entry into the acl <acl>. <acl> is the #<id> or the <name> returned by
#include <import/ebsttree.h>
#include <import/mjson.h>
+#include <import/mt_list.h>
#include <haproxy/acme-t.h>
#if defined(HAVE_ACME)
+
+struct mt_list acme_tasks = MT_LIST_HEAD_INIT(acme_tasks);
+
static struct acme_cfg *acme_cfgs = NULL;
static struct acme_cfg *cur_acme = NULL;
X509_REQ_free(ctx->req);
+ MT_LIST_DELETE(&ctx->el);
+
free(ctx);
}
enum acme_st st = ctx->state;
enum http_st http_st = ctx->http_state;
char *errmsg = NULL;
+ struct mt_list tmp = MT_LIST_LOCK_FULL(&ctx->el);
switch (st) {
case ACME_RESSOURCES:
}
+ MT_LIST_UNLOCK_FULL(&ctx->el, tmp);
ctx->retries = ACME_RETRY;
ctx->http_state = http_st;
ctx->state = st;
ha_free(&errmsg);
+ MT_LIST_UNLOCK_FULL(&ctx->el, tmp);
return task;
abort:
ha_free(&errmsg);
end:
+ MT_LIST_UNLOCK_FULL(&ctx->el, tmp);
acme_del_acme_ctx_map(ctx);
acme_ctx_destroy(ctx);
task_destroy(task);
ctx->cfg = cfg;
task->context = ctx;
+ MT_LIST_INIT(&ctx->el);
+ MT_LIST_APPEND(&acme_tasks, &ctx->el);
+
task_wakeup(task, TASK_WOKEN_INIT);
return 0;
}
+static int cli_acme_ps_io_handler(struct appctx *appctx)
+{
+ struct mt_list back;
+ struct acme_ctx *ctx;
+
+ chunk_reset(&trash);
+
+ chunk_appendf(&trash, "# certificate\tsection\tstate\n");
+ if (applet_putchk(appctx, &trash) == -1)
+ return 1;
+
+ MT_LIST_FOR_EACH_ENTRY_LOCKED(ctx, &acme_tasks, el, back) {
+ chunk_appendf(&trash, "%s\t%s\tRunning\n", ctx->store->path, ctx->cfg->name);
+
+ /* TODO: handle backref list when list of task > buffer size */
+ if (applet_putchk(appctx, &trash) == -1)
+ return 1;
+ }
+
+ return 1;
+}
+
+static int cli_acme_ps(char **args, char *payload, struct appctx *appctx, void *private)
+{
+ return 0;
+}
+
+
static struct cli_kw_list cli_kws = {{ },{
{ { "acme", "renew", NULL }, "acme renew <certfile> : renew a certificate using the ACME protocol", cli_acme_renew_parse, NULL, NULL, NULL, 0 },
+ { { "acme", "ps", NULL }, "acme ps : show running ACME tasks", cli_acme_ps, cli_acme_ps_io_handler, NULL, NULL, 0 },
{ { NULL }, NULL, NULL, NULL }
}};