Apache2
md_acme.h File Reference

Go to the source code of this file.

Data Structures

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 char * md_acme_acct_id_get (md_acme_t *acme)
 
const char * md_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

◆ MD_ACME_VERSION_2

#define MD_ACME_VERSION_2   0x020000

◆ MD_ACME_VERSION_MAJOR

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

◆ MD_ACME_VERSION_UNKNOWN

#define MD_ACME_VERSION_UNKNOWN   0x0

◆ MD_AUTHZ_CHA_HTTP_01

#define MD_AUTHZ_CHA_HTTP_01   "http-01"

◆ MD_AUTHZ_CHA_SNI_01

#define MD_AUTHZ_CHA_SNI_01   "tls-sni-01"

◆ MD_PROTO_ACME

#define MD_PROTO_ACME   "ACME"

Typedef Documentation

◆ md_acme_new_nonce_fn

typedef apr_status_t md_acme_new_nonce_fn(md_acme_t *acme)

◆ 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)

◆ md_acme_req_err_cb

typedef apr_status_t md_acme_req_err_cb(md_acme_req_t *req, const struct md_result_t *result, void *baton)

Request callback on detected errors.

◆ 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.

◆ md_acme_req_init_fn

typedef apr_status_t md_acme_req_init_fn(md_acme_req_t *req, struct md_json_t *jpayload)

◆ 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.

◆ 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).

◆ md_acme_req_t

typedef struct md_acme_req_t md_acme_req_t

◆ md_acme_t

typedef struct md_acme_t md_acme_t

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 

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..

◆ 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.

◆ md_acme_acct_url_get()

const char* md_acme_acct_url_get ( md_acme_t acme)

◆ 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.

◆ 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.

◆ md_acme_clear_acct()

void md_acme_clear_acct ( md_acme_t acme)

Clear any existing account data from acme instance.

◆ 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

◆ 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 
)

◆ 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

◆ 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.

◆ 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

◆ 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 
)

◆ 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.

◆ md_acme_protos_add()

apr_status_t md_acme_protos_add ( struct apr_hash_t protos,
apr_pool_t p 
)

◆ md_acme_report_result()

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

◆ md_acme_req_body_init()

apr_status_t md_acme_req_body_init ( md_acme_req_t req,
struct md_json_t payload 
)

◆ md_acme_save_acct()

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

◆ 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

◆ 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

◆ 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