Apache HTTPD
Classes | Functions
md_acme_acct.c File Reference
#include <assert.h>
#include <stdio.h>
#include <apr_lib.h>
#include <apr_file_info.h>
#include <apr_file_io.h>
#include <apr_fnmatch.h>
#include <apr_hash.h>
#include <apr_strings.h>
#include <apr_tables.h>
#include "md.h"
#include "md_crypt.h"
#include "md_json.h"
#include "md_jws.h"
#include "md_log.h"
#include "md_result.h"
#include "md_store.h"
#include "md_util.h"
#include "md_version.h"
#include "md_acme.h"
#include "md_acme_acct.h"

Go to the source code of this file.

Classes

struct  find_ctx
 
struct  acct_ctx_t
 

Functions

static apr_status_t acct_make (md_acme_acct_t **pacct, apr_pool_t *p, const char *ca_url, apr_array_header_t *contacts)
 
static const charmk_acct_id (apr_pool_t *p, md_acme_t *acme, int i)
 
static const charmk_acct_pattern (apr_pool_t *p, md_acme_t *acme)
 
static md_acme_acct_st acct_st_from_str (const char *s)
 
md_json_tmd_acme_acct_to_json (md_acme_acct_t *acct, apr_pool_t *p)
 
apr_status_t md_acme_acct_from_json (md_acme_acct_t **pacct, md_json_t *json, apr_pool_t *p)
 
apr_status_t md_acme_acct_save (md_store_t *store, apr_pool_t *p, md_acme_t *acme, const char **pid, md_acme_acct_t *acct, md_pkey_t *acct_key)
 
apr_status_t md_acme_acct_load (md_acme_acct_t **pacct, md_pkey_t **ppkey, md_store_t *store, md_store_group_t group, const char *name, apr_pool_t *p)
 
int md_acme_acct_matches_url (md_acme_acct_t *acct, const char *url)
 
int md_acme_acct_matches_md (md_acme_acct_t *acct, const md_t *md)
 
static int find_acct (void *baton, const char *name, const char *aspect, md_store_vtype_t vtype, void *value, apr_pool_t *ptemp)
 
static apr_status_t acct_find (const char **pid, md_acme_acct_t **pacct, md_pkey_t **ppkey, md_store_t *store, md_store_group_t group, const char *name_pattern, const md_t *md, apr_pool_t *p)
 
static apr_status_t acct_find_and_verify (md_store_t *store, md_store_group_t group, const char *name_pattern, md_acme_t *acme, const md_t *md, apr_pool_t *p)
 
apr_status_t md_acme_find_acct_for_md (md_acme_t *acme, md_store_t *store, const md_t *md)
 
apr_status_t md_acme_acct_id_for_md (const char **pid, md_store_t *store, md_store_group_t group, const md_t *md, apr_pool_t *p)
 
static apr_status_t on_init_acct_upd (md_acme_req_t *req, void *baton)
 
static apr_status_t acct_upd (md_acme_t *acme, apr_pool_t *p, const apr_table_t *hdrs, md_json_t *body, void *baton)
 
apr_status_t md_acme_acct_update (md_acme_t *acme)
 
apr_status_t md_acme_acct_validate (md_acme_t *acme, md_store_t *store, apr_pool_t *p)
 
static apr_status_t get_eab (md_json_t **peab, md_acme_req_t *req, const char *kid, const char *hmac64, md_pkey_t *account_key, const char *url)
 
static apr_status_t on_init_acct_new (md_acme_req_t *req, void *baton)
 
apr_status_t md_acme_acct_register (md_acme_t *acme, md_store_t *store, const md_t *md, apr_pool_t *p)
 
static apr_status_t on_init_acct_del (md_acme_req_t *req, void *baton)
 
apr_status_t md_acme_acct_deactivate (md_acme_t *acme, apr_pool_t *p)
 
static apr_status_t on_init_agree_tos (md_acme_req_t *req, void *baton)
 
apr_status_t md_acme_agree (md_acme_t *acme, apr_pool_t *p, const char *agreement)
 
apr_status_t md_acme_check_agreement (md_acme_t *acme, apr_pool_t *p, const char *agreement, const char **prequired)
 

Function Documentation

◆ acct_find()

static apr_status_t acct_find ( const char **  pid,
md_acme_acct_t **  pacct,
md_pkey_t **  ppkey,
md_store_t store,
md_store_group_t  group,
const char name_pattern,
const md_t md,
apr_pool_t p 
)
static

Definition at line 297 of file md_acme_acct.c.

◆ acct_find_and_verify()

static apr_status_t acct_find_and_verify ( md_store_t store,
md_store_group_t  group,
const char name_pattern,
md_acme_t acme,
const md_t md,
apr_pool_t p 
)
static

Definition at line 323 of file md_acme_acct.c.

◆ acct_make()

static apr_status_t acct_make ( md_acme_acct_t **  pacct,
apr_pool_t p,
const char ca_url,
apr_array_header_t contacts 
)
static

Definition at line 41 of file md_acme_acct.c.

◆ acct_st_from_str()

static md_acme_acct_st acct_st_from_str ( const char s)
static

Definition at line 73 of file md_acme_acct.c.

◆ acct_upd()

static apr_status_t acct_upd ( md_acme_t acme,
apr_pool_t p,
const apr_table_t hdrs,
md_json_t body,
void *  baton 
)
static

Definition at line 420 of file md_acme_acct.c.

◆ find_acct()

static int find_acct ( void *  baton,
const char name,
const char aspect,
md_store_vtype_t  vtype,
void *  value,
apr_pool_t ptemp 
)
static

Definition at line 270 of file md_acme_acct.c.

◆ get_eab()

static apr_status_t get_eab ( md_json_t **  peab,
md_acme_req_t req,
const char kid,
const char hmac64,
md_pkey_t account_key,
const char url 
)
static

Definition at line 508 of file md_acme_acct.c.

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

apr_status_t md_acme_acct_from_json ( md_acme_acct_t **  pacct,
md_json_t json,
apr_pool_t p 
)

Definition at line 123 of file md_acme_acct.c.

◆ md_acme_acct_id_for_md()

apr_status_t md_acme_acct_id_for_md ( const char **  pid,
md_store_t store,
md_store_group_t  group,
const md_t md,
apr_pool_t p 
)

Find the account id for a given md.

Definition at line 381 of file md_acme_acct.c.

◆ md_acme_acct_load()

apr_status_t md_acme_acct_load ( md_acme_acct_t **  pacct,
md_pkey_t **  ppkey,
md_store_t store,
md_store_group_t  group,
const char name,
apr_pool_t p 
)

Definition at line 202 of file md_acme_acct.c.

◆ md_acme_acct_matches_md()

int md_acme_acct_matches_md ( md_acme_acct_t acct,
const md_t md 
)

Definition at line 244 of file md_acme_acct.c.

◆ md_acme_acct_matches_url()

int md_acme_acct_matches_url ( md_acme_acct_t acct,
const char url 
)

Definition at line 237 of file md_acme_acct.c.

◆ md_acme_acct_register()

apr_status_t md_acme_acct_register ( md_acme_t acme,
md_store_t store,
const md_t md,
apr_pool_t p 
)

Create a new account at the ACME server for an MD. The new account is the one used by the acme instance afterwards, on success.

Definition at line 573 of file md_acme_acct.c.

◆ md_acme_acct_save()

apr_status_t md_acme_acct_save ( md_store_t store,
apr_pool_t p,
md_acme_t acme,
const char **  pid,
md_acme_acct_t acct,
md_pkey_t acct_key 
)

Definition at line 176 of file md_acme_acct.c.

◆ md_acme_acct_to_json()

md_json_t * md_acme_acct_to_json ( md_acme_acct_t acct,
apr_pool_t p 
)

Convert an ACME account form/to JSON.

Definition at line 89 of file md_acme_acct.c.

◆ md_acme_acct_update()

apr_status_t md_acme_acct_update ( md_acme_t acme)

Update the account from the ACME server.

  • Will update acme->acct structure from server on success
  • Will return error status when request failed or account is not known.

Definition at line 462 of file md_acme_acct.c.

◆ md_acme_acct_validate()

apr_status_t md_acme_acct_validate ( md_acme_t acme,
md_store_t store,
apr_pool_t p 
)

Update the account and persist changes in the store, if given (and not NULL).

Definition at line 476 of file md_acme_acct.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_find_acct_for_md()

apr_status_t md_acme_find_acct_for_md ( md_acme_t acme,
md_store_t store,
const md_t md 
)

Find an existing account in the local store. On APR_SUCCESS, the acme instance will have a current, validated account to use.

Definition at line 358 of file md_acme_acct.c.

◆ mk_acct_id()

static const char * mk_acct_id ( apr_pool_t p,
md_acme_t acme,
int  i 
)
static

Definition at line 60 of file md_acme_acct.c.

◆ mk_acct_pattern()

static const char * mk_acct_pattern ( apr_pool_t p,
md_acme_t acme 
)
static

Definition at line 65 of file md_acme_acct.c.

◆ on_init_acct_del()

static apr_status_t on_init_acct_del ( md_acme_req_t req,
void *  baton 
)
static

Definition at line 672 of file md_acme_acct.c.

◆ on_init_acct_new()

static apr_status_t on_init_acct_new ( md_acme_req_t req,
void *  baton 
)
static

Definition at line 550 of file md_acme_acct.c.

◆ on_init_acct_upd()

static apr_status_t on_init_acct_upd ( md_acme_req_t req,
void *  baton 
)
static

Definition at line 414 of file md_acme_acct.c.

◆ on_init_agree_tos()

static apr_status_t on_init_agree_tos ( md_acme_req_t req,
void *  baton 
)
static

Definition at line 702 of file md_acme_acct.c.