SIP-router TLS support :: Virtual domain configuration supportModule: SIP-router TLS support. More...
#include <stdlib.h>#include <openssl/ssl.h>#include <openssl/opensslv.h>#include "../../ut.h"#include "../../mem/shm_mem.h"#include "../../pt.h"#include "../../cfg/cfg.h"#include "tls_server.h"#include "tls_util.h"#include "tls_mod.h"#include "tls_init.h"#include "tls_domain.h"#include "tls_cfg.h"
Go to the source code of this file.
Definition in file tls_domain.c.
| typedef int(* per_ctx_cbk_f)(SSL_CTX *ctx, long larg, void *parg) |
| ctx | SSL context | |
| larg | ? | |
| parg | ? |
Definition at line 251 of file tls_domain.c.
| static int domain_exists | ( | tls_domains_cfg_t * | cfg, | |
| tls_domain_t * | d | |||
| ) | [static] |
| cfg | configuration set | |
| d | checked domain |
Definition at line 1121 of file tls_domain.c.
References tls_domains_cfg::cli_default, tls_domains_cfg::cli_list, tls_domains_cfg::srv_default, tls_domains_cfg::srv_list, TLS_DOMAIN_DEF, and TLS_DOMAIN_SRV.
Referenced by tls_add_domain().

| static int fill_missing | ( | tls_domain_t * | d, | |
| tls_domain_t * | parent | |||
| ) | [static] |
Initialize TLS domain parameters that have not been configured from parent domain (usually one of default domains)
| d | initialized domain | |
| parent | parent domain |
Definition at line 184 of file tls_domain.c.
References _str::len, _str::s, and tls_domain_str().
Referenced by fix_domain().


| static int fix_domain | ( | tls_domain_t * | d, | |
| tls_domain_t * | def | |||
| ) | [static] |
| d | initialized TLS domain | |
| def | default TLS domains |
Definition at line 792 of file tls_domain.c.
References fill_missing(), load_ca_list(), load_cert(), load_crl(), set_cipher_list(), set_session_cache(), set_ssl_options(), set_verification(), and tls_domain_str().
Referenced by tls_fix_domains_cfg().


| int fix_shm_pathname | ( | str * | path | ) |
Fix pathnames, to be used when loading the domain key, cert, ca list a.s.o. It will replace path with a fixed shm allocated version. Assumes path->s was shm allocated.
| path | path to be fixed. If it starts with '.' or '/' is left alone (forced "relative" or "absolute" path). Otherwise the path is considered to be relative to the main config file directory (e.g. for /etc/ser/ser.cfg => /etc/ser/<path>). |
Definition at line 377 of file tls_domain.c.
References get_abs_pathname(), _str::len, and _str::s.
Referenced by load_ca_list(), load_cert(), load_crl(), and load_private_key().


| static int load_ca_list | ( | tls_domain_t * | d | ) | [static] |
| d | domain |
Definition at line 432 of file tls_domain.c.
References fix_shm_pathname(), _str::len, _str::s, and tls_domain_str().
Referenced by fix_domain().


| static int load_cert | ( | tls_domain_t * | d | ) | [static] |
| d | domain |
Definition at line 402 of file tls_domain.c.
References fix_shm_pathname(), _str::len, _str::s, and tls_domain_str().
Referenced by fix_domain().


| static int load_crl | ( | tls_domain_t * | d | ) | [static] |
| d | domain |
Definition at line 468 of file tls_domain.c.
References fix_shm_pathname(), _str::len, _str::s, and tls_domain_str().
Referenced by fix_domain().


| static int load_private_key | ( | tls_domain_t * | d | ) | [static] |
| d | TLS domain |
Definition at line 871 of file tls_domain.c.
References fix_shm_pathname(), _str::len, passwd_cb(), _str::s, and tls_domain_str().
Referenced by tls_fix_domains_cfg().


| static int passwd_cb | ( | char * | buf, | |
| int | size, | |||
| int | rwflag, | |||
| void * | filename | |||
| ) | [static] |
| buf | buffer | |
| size | buffer size | |
| rwflag | not used | |
| filename | filename |
Definition at line 833 of file tls_domain.c.
Referenced by load_private_key().

| static int set_cipher_list | ( | tls_domain_t * | d | ) | [static] |
| d | domain |
Definition at line 508 of file tls_domain.c.
References _str::len, _str::s, and tls_domain_str().
Referenced by fix_domain().


| static int set_session_cache | ( | tls_domain_t * | d | ) | [static] |
| d | domain |
Definition at line 684 of file tls_domain.c.
References _str::len, and _str::s.
Referenced by fix_domain().

| static int set_ssl_options | ( | tls_domain_t * | d | ) | [static] |
| d | domain |
Definition at line 633 of file tls_domain.c.
Referenced by fix_domain().

| static int set_verification | ( | tls_domain_t * | d | ) | [static] |
| d | domain |
Definition at line 553 of file tls_domain.c.
References TLS_DOMAIN_SRV, and tls_domain_str().
Referenced by fix_domain().


| int tls_add_domain | ( | tls_domains_cfg_t * | cfg, | |
| tls_domain_t * | d | |||
| ) |
| cfg | configuration set | |
| d | TLS domain |
Definition at line 1149 of file tls_domain.c.
References tls_domains_cfg::cli_default, tls_domains_cfg::cli_list, domain_exists(), tls_domains_cfg::srv_default, tls_domains_cfg::srv_list, TLS_DOMAIN_CLI, TLS_DOMAIN_DEF, and TLS_DOMAIN_SRV.

| static int tls_domain_foreach_CTX | ( | tls_domain_t * | d, | |
| per_ctx_cbk_f | ctx_cbk, | |||
| long | l1, | |||
| void * | p2 | |||
| ) | [static] |
| d | domain | |
| ctx_cbk | callback function | |
| l1 | parameter passed to the callback | |
| p2 | parameter passed to the callback |
Definition at line 262 of file tls_domain.c.
Referenced by tls_foreach_CTX_in_cli_domains(), tls_foreach_CTX_in_domain_lst(), and tls_foreach_CTX_in_srv_domains().

| char* tls_domain_str | ( | tls_domain_t * | d | ) |
| d | printed domain |
Definition at line 155 of file tls_domain.c.
References int2str(), TLS_DOMAIN_DEF, and TLS_DOMAIN_SRV.
Referenced by fill_missing(), fix_domain(), load_ca_list(), load_cert(), load_crl(), load_private_key(), set_cipher_list(), set_verification(), tls_complete_init(), and tls_pre_init().


| int tls_fix_domains_cfg | ( | tls_domains_cfg_t * | cfg, | |
| tls_domain_t * | srv_defaults, | |||
| tls_domain_t * | cli_defaults | |||
| ) |
Initialize attributes of all domains from default domains if necessary, fill in missing parameters.
| cfg | initialized domain | |
| srv_defaults | server defaults | |
| cli_defaults | command line interface defaults |
Definition at line 932 of file tls_domain.c.
References tls_domains_cfg::cli_default, tls_domains_cfg::cli_list, fix_domain(), load_private_key(), tls_domains_cfg::srv_default, tls_domains_cfg::srv_list, TLS_DOMAIN_CLI, TLS_DOMAIN_DEF, TLS_DOMAIN_SRV, tls_foreach_CTX_in_cfg(), tls_new_domain(), tls_ssl_ctx_mode(), tls_ssl_ctx_set_freelist(), tls_ssl_ctx_set_max_send_fragment(), and tls_ssl_ctx_set_read_ahead().

| static int tls_foreach_CTX_in_cfg | ( | tls_domains_cfg_t * | cfg, | |
| per_ctx_cbk_f | ctx_cbk, | |||
| long | l1, | |||
| void * | p2 | |||
| ) | [static] |
| cfg | tls cfg | |
| ctx_cbk | callback function | |
| l1 | parameter passed to the callback | |
| p2 | parameter passed to the callback |
Definition at line 349 of file tls_domain.c.
References tls_foreach_CTX_in_cli_domains(), and tls_foreach_CTX_in_srv_domains().
Referenced by tls_fix_domains_cfg().


| static int tls_foreach_CTX_in_cli_domains | ( | tls_domains_cfg_t * | cfg, | |
| per_ctx_cbk_f | ctx_cbk, | |||
| long | l1, | |||
| void * | p2 | |||
| ) | [static] |
| cfg | tls cfg. | |
| ctx_cbk | callback function | |
| l1 | parameter passed to the callback | |
| p2 | parameter passed to the callback |
Definition at line 327 of file tls_domain.c.
References tls_domains_cfg::cli_default, tls_domains_cfg::cli_list, tls_domain_foreach_CTX(), and tls_foreach_CTX_in_domain_lst().
Referenced by tls_foreach_CTX_in_cfg().


| static int tls_foreach_CTX_in_domain_lst | ( | tls_domain_t * | d, | |
| per_ctx_cbk_f | ctx_cbk, | |||
| long | l1, | |||
| void * | p2 | |||
| ) | [static] |
| d | domain | |
| ctx_cbk | callback function | |
| l1 | parameter passed to the callback | |
| p2 | parameter passed to the callback |
Definition at line 285 of file tls_domain.c.
References tls_domain_foreach_CTX().
Referenced by tls_foreach_CTX_in_cli_domains(), and tls_foreach_CTX_in_srv_domains().


| static int tls_foreach_CTX_in_srv_domains | ( | tls_domains_cfg_t * | cfg, | |
| per_ctx_cbk_f | ctx_cbk, | |||
| long | l1, | |||
| void * | p2 | |||
| ) | [static] |
| cfg | tls cfg. | |
| ctx_cbk | callback function | |
| l1 | parameter passed to the callback | |
| p2 | parameter passed to the callback |
Definition at line 305 of file tls_domain.c.
References tls_domains_cfg::srv_default, tls_domains_cfg::srv_list, tls_domain_foreach_CTX(), and tls_foreach_CTX_in_domain_lst().
Referenced by tls_foreach_CTX_in_cfg().


| void tls_free_cfg | ( | tls_domains_cfg_t * | cfg | ) |
| cfg | freed configuration |
Definition at line 105 of file tls_domain.c.
References tls_domains_cfg::cli_default, tls_domains_cfg::cli_list, tls_domains_cfg::srv_default, tls_domains_cfg::srv_list, and tls_free_domain().
Referenced by tls_destroy_cfg().


| void tls_free_domain | ( | tls_domain_t * | d | ) |
| d | freed domain |
Definition at line 78 of file tls_domain.c.
References _str::s.
Referenced by tls_free_cfg().

| tls_domain_t* tls_lookup_cfg | ( | tls_domains_cfg_t * | cfg, | |
| int | type, | |||
| struct ip_addr * | ip, | |||
| unsigned short | port | |||
| ) |
| cfg | configuration set | |
| type | type of configuration | |
| ip | IP for configuration | |
| port | port for configuration |
Definition at line 1090 of file tls_domain.c.
References tls_domains_cfg::cli_default, tls_domains_cfg::cli_list, tls_domains_cfg::srv_default, tls_domains_cfg::srv_list, TLS_DOMAIN_DEF, and TLS_DOMAIN_SRV.
Referenced by tls_complete_init().

| tls_domains_cfg_t* tls_new_cfg | ( | void | ) |
Create new TLS configuration structure.
Create new configuration structure in new allocated shared memory
Definition at line 1068 of file tls_domain.c.
| tls_domain_t* tls_new_domain | ( | int | type, | |
| struct ip_addr * | ip, | |||
| unsigned short | port | |||
| ) |
Create a new domain structure in new allocated shared memory.
| type | domain Type | |
| ip | domain IP | |
| port | domain port |
Definition at line 53 of file tls_domain.c.
Referenced by tls_fix_domains_cfg().

| static int tls_ssl_ctx_mode | ( | SSL_CTX * | ctx, | |
| long | mode, | |||
| void * | clear | |||
| ) | [static] |
| ctx | SSL context | |
| mode | SSL_MODE_* | |
| clear | if set to !=0 will do a clear, else (==0) a set |
Definition at line 716 of file tls_domain.c.
Referenced by tls_fix_domains_cfg().

| static int tls_ssl_ctx_set_freelist | ( | SSL_CTX * | ctx, | |
| long | val, | |||
| void * | unused | |||
| ) | [static] |
| ctx | TLS context | |
| val | value (<0 ignored) | |
| unused | unused |
Definition at line 739 of file tls_domain.c.
Referenced by tls_fix_domains_cfg().

| static int tls_ssl_ctx_set_max_send_fragment | ( | SSL_CTX * | ctx, | |
| long | val, | |||
| void * | unused | |||
| ) | [static] |
| ctx | TLS context | |
| val | value (<0 ignored). Should be between 512 and 16k | |
| unused | unused |
Definition at line 760 of file tls_domain.c.
Referenced by tls_fix_domains_cfg().

| static int tls_ssl_ctx_set_read_ahead | ( | SSL_CTX * | ctx, | |
| long | val, | |||
| void * | unused | |||
| ) | [static] |
| ctx | TLS context | |
| val | value (<0 ignored, 0 or >0) | |
| unused | unused |
Definition at line 780 of file tls_domain.c.
Referenced by tls_fix_domains_cfg().

1.7.1