Apache HTTPD
Classes | Macros | Typedefs | Enumerations | Functions
md_acme.h File Reference

Go to the source code of this file.

Classes

struct  md_acme_t
 
struct  md_acme_req_t
 

Macros

#define MD_PROTO_ACME   "ACME"
 
#define MD_AUTHZ_CHA_HTTP_01   "http-01"
 
#define MD_AUTHZ_CHA_SNI_01   "tls-sni-01"
 
#define MD_ACME_VERSION_UNKNOWN   0x0
 
#define MD_ACME_VERSION_1   0x010000
 
#define MD_ACME_VERSION_2   0x020000
 
#define MD_ACME_VERSION_MAJOR(i)   (((i)&0xFF0000) >> 16)
 

Typedefs

typedef struct md_acme_t md_acme_t
 
typedef struct md_acme_req_t md_acme_req_t
 
typedef apr_status_t md_acme_req_res_cb(md_acme_t *acme, const struct md_http_response_t *res, void *baton)
 
typedef apr_status_t md_acme_req_init_cb(md_acme_req_t *req, void *baton)
 
typedef apr_status_t md_acme_req_json_cb(md_acme_t *acme, apr_pool_t *p, const apr_table_t *headers, struct md_json_t *jbody, void *baton)
 
typedef apr_status_t md_acme_req_err_cb(md_acme_req_t *req, const struct md_result_t *result, void *baton)
 
typedef apr_status_t md_acme_new_nonce_fn(md_acme_t *acme)
 
typedef apr_status_t md_acme_req_init_fn(md_acme_req_t *req, struct md_json_t *jpayload)
 
typedef apr_status_t md_acme_post_fn(md_acme_t *acme, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)
 

Enumerations

enum  md_acme_state_t {
  MD_ACME_S_UNKNOWN , MD_ACME_S_REGISTERED , MD_ACME_S_TOS_ACCEPTED , MD_ACME_S_CHALLENGED ,
  MD_ACME_S_VALIDATED , MD_ACME_S_CERTIFIED , MD_ACME_S_DENIED
}
 

Functions

apr_status_t md_acme_init (apr_pool_t *pool, const char *base_version, int init_ssl)
 
apr_status_t md_acme_create (md_acme_t **pacme, apr_pool_t *p, const char *url, const char *proxy_url, const char *ca_file)
 
apr_status_t md_acme_setup (md_acme_t *acme, struct md_result_t *result)
 
void md_acme_report_result (md_acme_t *acme, apr_status_t rv, struct md_result_t *result)
 
void md_acme_clear_acct (md_acme_t *acme)
 
apr_status_t md_acme_POST_new_account (md_acme_t *acme, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)
 
const charmd_acme_acct_id_get (md_acme_t *acme)
 
const charmd_acme_acct_url_get (md_acme_t *acme)
 
apr_status_t md_acme_use_acct (md_acme_t *acme, struct md_store_t *store, apr_pool_t *p, const char *acct_id)
 
apr_status_t md_acme_use_acct_for_md (md_acme_t *acme, struct md_store_t *store, apr_pool_t *p, const char *acct_id, const md_t *md)
 
apr_status_t md_acme_agree (md_acme_t *acme, apr_pool_t *p, const char *tos)
 
apr_status_t md_acme_check_agreement (md_acme_t *acme, apr_pool_t *p, const char *agreement, const char **prequired)
 
apr_status_t md_acme_save_acct (md_acme_t *acme, apr_pool_t *p, struct md_store_t *store)
 
apr_status_t md_acme_acct_deactivate (md_acme_t *acme, apr_pool_t *p)
 
apr_status_t md_acme_req_body_init (md_acme_req_t *req, struct md_json_t *payload)
 
apr_status_t md_acme_GET (md_acme_t *acme, const char *url, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)
 
apr_status_t md_acme_POST (md_acme_t *acme, const char *url, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)
 
apr_status_t md_acme_get_json (struct md_json_t **pjson, md_acme_t *acme, const char *url, apr_pool_t *p)
 
apr_status_t md_acme_protos_add (struct apr_hash_t *protos, apr_pool_t *p)
 
int md_acme_problem_is_input_related (const char *problem)
 

Macro Definition Documentation

◆ MD_ACME_VERSION_1

#define MD_ACME_VERSION_1   0x010000

Definition at line 39 of file md_acme.h.

◆ MD_ACME_VERSION_2

#define MD_ACME_VERSION_2   0x020000

Definition at line 40 of file md_acme.h.

◆ MD_ACME_VERSION_MAJOR

#define MD_ACME_VERSION_MAJOR (   i)    (((i)&0xFF0000) >> 16)

Definition at line 42 of file md_acme.h.

◆ MD_ACME_VERSION_UNKNOWN

#define MD_ACME_VERSION_UNKNOWN   0x0

Definition at line 38 of file md_acme.h.

◆ MD_AUTHZ_CHA_HTTP_01

#define MD_AUTHZ_CHA_HTTP_01   "http-01"

Definition at line 35 of file md_acme.h.

◆ MD_AUTHZ_CHA_SNI_01

#define MD_AUTHZ_CHA_SNI_01   "tls-sni-01"

Definition at line 36 of file md_acme.h.

◆ MD_PROTO_ACME

#define MD_PROTO_ACME   "ACME"

Definition at line 33 of file md_acme.h.

Typedef Documentation

◆ md_acme_new_nonce_fn

typedef apr_status_t md_acme_new_nonce_fn(md_acme_t *acme)

Definition at line 84 of file md_acme.h.

◆ md_acme_post_fn

typedef apr_status_t md_acme_post_fn(md_acme_t *acme, md_acme_req_init_cb *on_init, md_acme_req_json_cb *on_json, md_acme_req_res_cb *on_res, md_acme_req_err_cb *on_err, void *baton)

Definition at line 87 of file md_acme.h.

◆ md_acme_req_err_cb

Request callback on detected errors.

Definition at line 80 of file md_acme.h.

◆ md_acme_req_init_cb

typedef apr_status_t md_acme_req_init_cb(md_acme_req_t *req, void *baton)

Request callback to initialize before sending. May be invoked more than once in case of retries.

Definition at line 67 of file md_acme.h.

◆ md_acme_req_init_fn

Definition at line 85 of file md_acme.h.

◆ md_acme_req_json_cb

typedef apr_status_t md_acme_req_json_cb(md_acme_t *acme, apr_pool_t *p, const apr_table_t *headers, struct md_json_t *jbody, void *baton)

Request callback on a successful response (HTTP response code 2xx) and content type matching application/.*json.

Definition at line 73 of file md_acme.h.

◆ md_acme_req_res_cb

typedef apr_status_t md_acme_req_res_cb(md_acme_t *acme, const struct md_http_response_t *res, void *baton)

Request callback on a successful HTTP response (status 2xx).

Definition at line 60 of file md_acme.h.

◆ md_acme_req_t

Definition at line 56 of file md_acme.h.

◆ md_acme_t

Definition at line 54 of file md_acme.h.

Enumeration Type Documentation

◆ md_acme_state_t

Enumerator
MD_ACME_S_UNKNOWN 
MD_ACME_S_REGISTERED 
MD_ACME_S_TOS_ACCEPTED 
MD_ACME_S_CHALLENGED 
MD_ACME_S_VALIDATED 
MD_ACME_S_CERTIFIED 
MD_ACME_S_DENIED 

Definition at line 44 of file md_acme.h.

Function Documentation

◆ md_acme_acct_deactivate()

apr_status_t md_acme_acct_deactivate ( md_acme_t acme,
apr_pool_t p 
)

Deactivate the current account at the ACME server..

Definition at line 682 of file md_acme_acct.c.

◆ md_acme_acct_id_get()

const char * md_acme_acct_id_get ( md_acme_t acme)

Get the local name of the account currently used by the acme instance. Will be NULL if no account has been setup successfully.

Definition at line 533 of file md_acme.c.

◆ md_acme_acct_url_get()

const char * md_acme_acct_url_get ( md_acme_t acme)

Definition at line 538 of file md_acme.c.

◆ md_acme_agree()

apr_status_t md_acme_agree ( md_acme_t acme,
apr_pool_t p,
const char tos 
)

Agree to the given Terms-of-Service url for the current account.

Definition at line 714 of file md_acme_acct.c.

◆ md_acme_check_agreement()

apr_status_t md_acme_check_agreement ( md_acme_t acme,
apr_pool_t p,
const char agreement,
const char **  prequired 
)

Confirm with the server that the current account agrees to the Terms-of-Service given in the agreement url. If the known agreement is equal to this, nothing is done. If it differs, the account is re-validated in the hope that the server announces the Tos URL it wants. If this is equal to the agreement specified, the server is notified of this. If the server requires a ToS that the account thinks it has already given, it is resend.

If an agreement is required, different from the current one, APR_INCOMPLETE is returned and the agreement url is returned in the parameter.

Definition at line 729 of file md_acme_acct.c.

◆ md_acme_clear_acct()

void md_acme_clear_acct ( md_acme_t acme)

Clear any existing account data from acme instance.

Definition at line 526 of file md_acme.c.

◆ md_acme_create()

apr_status_t md_acme_create ( md_acme_t **  pacme,
apr_pool_t p,
const char url,
const char proxy_url,
const char ca_file 
)

Create a new ACME server instance. If path is not NULL, will use that directory for persisting information. Will load any information persisted in earlier session. url needs only be specified for instances where this has never been persisted before.

Parameters
pacmewill hold the ACME server instance on success
ppool to used
urlurl of the server, optional if known at path
proxy_urloptional url of a HTTP(S) proxy to use

Definition at line 620 of file md_acme.c.

◆ md_acme_GET()

apr_status_t md_acme_GET ( md_acme_t acme,
const char url,
md_acme_req_init_cb on_init,
md_acme_req_json_cb on_json,
md_acme_req_res_cb on_res,
md_acme_req_err_cb on_err,
void *  baton 
)

Definition at line 455 of file md_acme.c.

◆ md_acme_get_json()

apr_status_t md_acme_get_json ( struct md_json_t **  pjson,
md_acme_t acme,
const char url,
apr_pool_t p 
)

Retrieve a JSON resource from the ACME server

Definition at line 509 of file md_acme.c.

◆ md_acme_init()

apr_status_t md_acme_init ( apr_pool_t pool,
const char base_version,
int  init_ssl 
)

Global init, call once at start up.

Definition at line 163 of file md_acme.c.

◆ md_acme_POST()

apr_status_t md_acme_POST ( md_acme_t acme,
const char url,
md_acme_req_init_cb on_init,
md_acme_req_json_cb on_json,
md_acme_req_res_cb on_res,
md_acme_req_err_cb on_err,
void *  baton 
)

Perform a POST against the ACME url. If a on_json callback is given and the HTTP response is JSON, only this callback is invoked. Otherwise, on HTTP status 2xx, the on_res callback is invoked. If no on_res is given, it is considered a response error, since only JSON was expected. At least one callback needs to be non-NULL.

Parameters
acmethe ACME server to talk to
urlthe url to send the request to
on_initcallback to initialize the request data
on_jsoncallback on successful JSON response
on_rescallback on successful HTTP response
batonuserdata for callbacks

Definition at line 432 of file md_acme.c.

◆ md_acme_POST_new_account()

apr_status_t md_acme_POST_new_account ( md_acme_t acme,
md_acme_req_init_cb on_init,
md_acme_req_json_cb on_json,
md_acme_req_res_cb on_res,
md_acme_req_err_cb on_err,
void *  baton 
)

Definition at line 607 of file md_acme.c.

◆ md_acme_problem_is_input_related()

int md_acme_problem_is_input_related ( const char problem)

Return != 0 iff the given problem identifier is an ACME error string indicating something is wrong with the input values, e.g. from our configuration.

Definition at line 91 of file md_acme.c.

◆ md_acme_protos_add()

apr_status_t md_acme_protos_add ( struct apr_hash_t protos,
apr_pool_t p 
)

Definition at line 1101 of file md_acme_drive.c.

◆ md_acme_report_result()

void md_acme_report_result ( md_acme_t acme,
apr_status_t  rv,
struct md_result_t result 
)

Definition at line 478 of file md_acme.c.

◆ md_acme_req_body_init()

apr_status_t md_acme_req_body_init ( md_acme_req_t req,
struct md_json_t payload 
)

Definition at line 250 of file md_acme.c.

◆ md_acme_save_acct()

apr_status_t md_acme_save_acct ( md_acme_t acme,
apr_pool_t p,
struct md_store_t store 
)

Definition at line 592 of file md_acme.c.

◆ md_acme_setup()

apr_status_t md_acme_setup ( md_acme_t acme,
struct md_result_t result 
)

Contact the ACME server and retrieve its directory information.

Parameters
acmethe ACME server to contact

Definition at line 756 of file md_acme.c.

◆ md_acme_use_acct()

apr_status_t md_acme_use_acct ( md_acme_t acme,
struct md_store_t store,
apr_pool_t p,
const char acct_id 
)

Specify the account to use by name in local store. On success, the account is the "current" one used by the acme instance.

Parameters
acmethe acme instance to set the account for
storethe store to load accounts from
ppool for allocations
acct_idname of the account to load

Definition at line 543 of file md_acme.c.

◆ md_acme_use_acct_for_md()

apr_status_t md_acme_use_acct_for_md ( md_acme_t acme,
struct md_store_t store,
apr_pool_t p,
const char acct_id,
const md_t md 
)

Specify the account to use for a specific MD by name in local store. On success, the account is the "current" one used by the acme instance.

Parameters
acmethe acme instance to set the account for
storethe store to load accounts from
ppool for allocations
acct_idname of the account to load
mdthe MD the account shall be used for

Definition at line 567 of file md_acme.c.