MEDIUM: acme: rename "uri" into "directory"

Rename the "uri" option of the acme section into "directory".
This commit is contained in:
William Lallemand 2025-04-24 10:51:41 +02:00
parent 4e14889587
commit af73f98a3e
3 changed files with 16 additions and 15 deletions

View File

@ -5919,17 +5919,18 @@ contact <string>
curves <string>
When using the ECDSA keytype, configure the curves. The default is P-384.
directory <string>
This keyword configures the directory URL for the CA used by this acme
section. This keyword is mandatory as there is no default URL.
Example:
directory https://acme-staging-v02.api.letsencrypt.org/directory
keytype <string>
Configure the type of key that will be generated. Value can be either "RSA"
or "ECDSA". You can also configure the "curves" for ECDSA and the number of
"bits" for RSA. By default EC384 keys are generated.
uri <string>
This keyword configures the directory URL for the CA used by this acme
section. This keyword is mandatory as there is no default uri.
Example:
uri https://acme-staging-v02.api.letsencrypt.org/directory
Example:
@ -5945,7 +5946,7 @@ Example:
ssl-f-use crt "foo.example.com.pem.ecdsa" acme LE2 domains "foo.example.com.pem,bar.example.com"
acme LE1
uri https://acme-staging-v02.api.letsencrypt.org/directory
directory https://acme-staging-v02.api.letsencrypt.org/directory
account /etc/haproxy/account.key
contact john.doe@example.com
challenge HTTP-01
@ -5953,7 +5954,7 @@ Example:
bits 2048
acme LE2
uri https://acme-staging-v02.api.letsencrypt.org/directory
directory https://acme-staging-v02.api.letsencrypt.org/directory
account /etc/haproxy/account.key
contact john.doe@example.com
challenge HTTP-01

View File

@ -12,7 +12,7 @@ struct acme_cfg {
char *filename; /* config filename */
int linenum; /* config linenum */
char *name; /* section name */
char *uri; /* directory URL */
char *directory; /* directory URL */
struct {
char *contact; /* email associated to account */
char *file; /* account key filename */

View File

@ -243,7 +243,7 @@ static int cfg_parse_acme_kws(char **args, int section_type, struct proxy *curpx
int err_code = 0;
char *errmsg = NULL;
if (strcmp(args[0], "uri") == 0) {
if (strcmp(args[0], "directory") == 0) {
if (!*args[1]) {
ha_alert("parsing [%s:%d]: keyword '%s' in '%s' section requires an argument\n", file, linenum, args[0], cursection);
err_code |= ERR_ALERT | ERR_FATAL;
@ -251,8 +251,8 @@ static int cfg_parse_acme_kws(char **args, int section_type, struct proxy *curpx
}
if (alertif_too_many_args(1, file, linenum, args, &err_code))
goto out;
cur_acme->uri = strdup(args[1]);
if (!cur_acme->uri) {
cur_acme->directory = strdup(args[1]);
if (!cur_acme->directory) {
err_code |= ERR_ALERT | ERR_FATAL;
ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
goto out;
@ -486,7 +486,7 @@ void deinit_acme()
next = acme_cfgs->next;
ha_free(&acme_cfgs->name);
ha_free(&acme_cfgs->uri);
ha_free(&acme_cfgs->directory);
ha_free(&acme_cfgs->account.contact);
ha_free(&acme_cfgs->account.file);
ha_free(&acme_cfgs->account.thumbprint);
@ -497,7 +497,7 @@ void deinit_acme()
}
static struct cfg_kw_list cfg_kws_acme = {ILH, {
{ CFG_ACME, "uri", cfg_parse_acme_kws },
{ CFG_ACME, "directory", cfg_parse_acme_kws },
{ CFG_ACME, "contact", cfg_parse_acme_kws },
{ CFG_ACME, "account", cfg_parse_acme_kws },
{ CFG_ACME, "challenge", cfg_parse_acme_kws },
@ -1540,7 +1540,7 @@ struct task *acme_process(struct task *task, void *context, unsigned int state)
switch (st) {
case ACME_RESSOURCES:
if (http_st == ACME_HTTP_REQ) {
if (acme_http_req(task, ctx, ist(ctx->cfg->uri), HTTP_METH_GET, NULL, IST_NULL) != 0)
if (acme_http_req(task, ctx, ist(ctx->cfg->directory), HTTP_METH_GET, NULL, IST_NULL) != 0)
goto retry;
}