Skip to content

Commit 1c1d9d2

Browse files
committed
BUG/MINOR: acme: permission checks on the CLI
Permission checks on the CLI for ACME are missing. This patch adds a check on the ACME commands so they can only be run in admin mode. ACME is stil a feature in experimental-mode. Initial report by Cameron Brown. Must be backported to 3.2 and later.
1 parent 47987cc commit 1c1d9d2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/acme.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,6 +2731,9 @@ static int cli_acme_renew_parse(char **args, char *payload, struct appctx *appct
27312731
struct ckch_store *store = NULL;
27322732
char *errmsg = NULL;
27332733

2734+
if (!cli_has_level(appctx, ACCESS_LVL_ADMIN))
2735+
return 1;
2736+
27342737
if (!*args[2]) {
27352738
memprintf(&errmsg, ": not enough parameters\n");
27362739
goto err;
@@ -2770,6 +2773,9 @@ static int cli_acme_chall_ready_parse(char **args, char *payload, struct appctx
27702773
int remain = 0;
27712774
struct ebmb_node *node = NULL;
27722775

2776+
if (!cli_has_level(appctx, ACCESS_LVL_ADMIN))
2777+
return 1;
2778+
27732779
if (!*args[2] || !*args[3] || !*args[4]) {
27742780
memprintf(&msg, "Not enough parameters: \"acme challenge_ready <certfile> domain <domain>\"\n");
27752781
goto err;
@@ -2892,16 +2898,20 @@ static int cli_acme_status_io_handler(struct appctx *appctx)
28922898
return 1;
28932899
}
28942900

2895-
static int cli_acme_ps(char **args, char *payload, struct appctx *appctx, void *private)
2901+
static int cli_acme_parse_status(char **args, char *payload, struct appctx *appctx, void *private)
28962902
{
2903+
2904+
if (!cli_has_level(appctx, ACCESS_LVL_ADMIN))
2905+
return 1;
2906+
28972907
return 0;
28982908
}
28992909

29002910

29012911

29022912
static struct cli_kw_list cli_kws = {{ },{
29032913
{ { "acme", "renew", NULL }, "acme renew <certfile> : renew a certificate using the ACME protocol", cli_acme_renew_parse, NULL, NULL, NULL, 0 },
2904-
{ { "acme", "status", NULL }, "acme status : show status of certificates configured with ACME", cli_acme_ps, cli_acme_status_io_handler, NULL, NULL, 0 },
2914+
{ { "acme", "status", NULL }, "acme status : show status of certificates configured with ACME", cli_acme_parse_status, cli_acme_status_io_handler, NULL, NULL, 0 },
29052915
{ { "acme", "challenge_ready", NULL }, "acme challenge_ready <certfile> domain <domain> : notify HAProxy that the ACME challenge is ready", cli_acme_chall_ready_parse, NULL, NULL, NULL, 0 },
29062916
{ { NULL }, NULL, NULL, NULL }
29072917
}};

0 commit comments

Comments
 (0)