|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <sys/stat.h>#include <signal.h>#include <fcntl.h>#include <ctype.h>#include <sys/socket.h>#include <unistd.h>#include <netdb.h>#include <netinet/in.h>#include <netinet/tcp.h>#include <arpa/inet.h>#include "common/hashfn.h"#include "common/string.h"#include "libpq/libpq.h"#include "miscadmin.h"#include "pgstat.h"#include "storage/fd.h"#include "storage/latch.h"#include "utils/guc.h"#include "utils/memutils.h"#include "utils/wait_event.h"#include "common/openssl.h"#include <openssl/bn.h>#include <openssl/conf.h>#include <openssl/dh.h>#include <openssl/ec.h>#include <openssl/x509v3.h>#include "lib/simplehash.h"
Go to the source code of this file.
Data Structures | |
| struct | HostCacheEntry |
| struct | hosts |
| struct | CallbackErr |
Macros | |
| #define | SH_PREFIX host_cache |
| #define | SH_ELEMENT_TYPE HostCacheEntry |
| #define | SH_KEY_TYPE const char * |
| #define | SH_KEY hostname |
| #define | SH_HASH_KEY(tb, key) host_cache_pointer(key) |
| #define | SH_EQUAL(tb, a, b) (pg_strcasecmp(a, b) == 0) |
| #define | SH_SCOPE static inline |
| #define | SH_DECLARE |
| #define | SH_DEFINE |
| #define | MAXLEN 71 |
| #define MAXLEN 71 |
| #define SH_DECLARE |
Definition at line 74 of file be-secure-openssl.c.
| #define SH_DEFINE |
Definition at line 75 of file be-secure-openssl.c.
| #define SH_ELEMENT_TYPE HostCacheEntry |
Definition at line 68 of file be-secure-openssl.c.
Definition at line 72 of file be-secure-openssl.c.
| #define SH_HASH_KEY | ( | tb, | |
| key | |||
| ) | host_cache_pointer(key) |
Definition at line 71 of file be-secure-openssl.c.
Definition at line 70 of file be-secure-openssl.c.
Definition at line 69 of file be-secure-openssl.c.
| #define SH_PREFIX host_cache |
Definition at line 67 of file be-secure-openssl.c.
Definition at line 73 of file be-secure-openssl.c.
|
static |
Definition at line 1778 of file be-secure-openssl.c.
References alpn_protos, Assert, and fb().
Referenced by be_tls_open_server().
Definition at line 1168 of file be-secure-openssl.c.
References fb(), pfree(), and port.
Referenced by secure_close().
Definition at line 825 of file be-secure-openssl.c.
References fb(), and SSL_context.
Referenced by secure_destroy().
Definition at line 2273 of file be-secure-openssl.c.
References elog, ERROR, fb(), hash(), len, palloc(), and port.
Referenced by read_client_final_message().
Definition at line 2225 of file be-secure-openssl.c.
Referenced by PerformAuthentication(), pgstat_bestart_security(), and ssl_cipher().
Definition at line 2202 of file be-secure-openssl.c.
Referenced by PerformAuthentication(), and pgstat_bestart_security().
Definition at line 2243 of file be-secure-openssl.c.
References fb(), len, port, strlcpy(), and X509_NAME_to_cstring().
Referenced by pgstat_bestart_security(), and ssl_issuer_dn().
Definition at line 2252 of file be-secure-openssl.c.
References b, fb(), len, port, and strlcpy().
Referenced by pgstat_bestart_security(), and ssl_client_serial().
Definition at line 2234 of file be-secure-openssl.c.
References fb(), len, port, strlcpy(), and X509_NAME_to_cstring().
Referenced by pgstat_bestart_security(), and ssl_client_dn().
Definition at line 2216 of file be-secure-openssl.c.
Referenced by PerformAuthentication(), pgstat_bestart_security(), and ssl_version().
Definition at line 151 of file be-secure-openssl.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, Assert, CurrentMemoryContext, ereport, errcode(), errcontext, errdetail(), errhint(), errmsg, error(), FATAL, fb(), foreach_ptr, GetConfigOption(), host_context_cleanup_cb(), HostCacheEntry::hostname, hostname, HostsLine::hostnames, HOSTSFILE_DISABLED, HOSTSFILE_EMPTY, HOSTSFILE_LOAD_FAILED, HOSTSFILE_LOAD_OK, HOSTSFILE_MISSING, init_host_context(), initialize_dh(), initialize_ecdh(), lappend(), lfirst, HostsLine::linenumber, linitial, load_hosts(), LOG, MemoryContextDelete(), MemoryContextRegisterResetCallback(), MemoryContextSwitchTo(), NIL, palloc0(), palloc0_object, pstrdup(), HostsLine::sourcefile, ssl_ca_file, ssl_cert_file, SSL_context, SSL_hosts, SSL_hosts_memcxt, ssl_key_file, ssl_max_protocol_version, ssl_min_protocol_version, ssl_passphrase_command, ssl_passphrase_command_supports_reload, ssl_protocol_version_to_openssl(), ssl_sni, SSLCipherList, SSLCipherSuites, SSLerrmessage(), and SSLPreferServerCiphers.
Referenced by secure_initialize().
Definition at line 834 of file be-secure-openssl.c.
References alpn_cb(), Assert, COMMERROR, hosts::default_host, ereport, err(), errcode(), errcode_for_socket_access(), ERRCODE_PROTOCOL_VIOLATION, errdetail_internal(), errhint(), errmsg, fb(), info_cb(), len, MemoryContextAlloc(), pfree(), PG_ALPN_PROTOCOL, port, HostsLine::ssl_ca, SSL_context, SSL_hosts, ssl_max_protocol_version, ssl_min_protocol_version, ssl_protocol_version_to_string(), ssl_set_port_bio(), SSLerrmessage(), TopMemoryContext, verify_cb(), WaitLatchOrSocket(), WL_EXIT_ON_PM_DEATH, WL_SOCKET_READABLE, and WL_SOCKET_WRITEABLE.
Referenced by secure_open_server().
Definition at line 1198 of file be-secure-openssl.c.
References COMMERROR, ECONNRESET, ereport, err(), errcode(), ERRCODE_PROTOCOL_VIOLATION, errmsg, EWOULDBLOCK, fb(), len, port, SSLerrmessage(), WL_SOCKET_READABLE, and WL_SOCKET_WRITEABLE.
Referenced by secure_read().
Definition at line 1257 of file be-secure-openssl.c.
References COMMERROR, ECONNRESET, ereport, err(), errcode(), ERRCODE_PROTOCOL_VIOLATION, errmsg, EWOULDBLOCK, fb(), len, port, SSLerrmessage(), WL_SOCKET_READABLE, and WL_SOCKET_WRITEABLE.
Referenced by secure_write().
Definition at line 2479 of file be-secure-openssl.c.
References dummy_ssl_passwd_cb(), fb(), ssl_external_passwd_cb(), ssl_passphrase_command, and ssl_passphrase_command_supports_reload.
Referenced by init_host_context().
Definition at line 1582 of file be-secure-openssl.c.
References Assert, buf, and dummy_ssl_passwd_cb_called.
Referenced by default_openssl_tls_init(), and init_host_context().
Definition at line 2464 of file be-secure-openssl.c.
References fb(), hash(), i, len, pfree(), pg_tolower(), pstrdup(), and string_hash().
Definition at line 596 of file be-secure-openssl.c.
References arg, hosts::default_host, fb(), foreach_ptr, hosts::no_sni, hosts::sni, and HostsLine::ssl_ctx.
Referenced by be_tls_init().
Definition at line 1727 of file be-secure-openssl.c.
References DEBUG4, ereport, errmsg_internal(), fb(), and type.
Referenced by be_tls_open_server().
Definition at line 614 of file be-secure-openssl.c.
References check_ssl_key_file_permissions(), default_openssl_tls_init(), dummy_ssl_passwd_cb(), dummy_ssl_passwd_cb_called, ereport, errcode(), errhint(), errmsg, error(), FATAL, fb(), LOG, openssl_tls_init_hook, HostsLine::ssl_ca, HostsLine::ssl_cert, ssl_crl_dir, ssl_crl_file, HostsLine::ssl_ctx, ssl_external_passwd_cb(), ssl_is_server_start, HostsLine::ssl_key, HostsLine::ssl_passphrase_cmd, HostsLine::ssl_passphrase_reload, ssl_sni, SSLerrmessage(), and WARNING.
Referenced by be_tls_init().
Definition at line 2078 of file be-secure-openssl.c.
References ereport, errcode(), errmsg, FATAL, fb(), load_dh_buffer(), load_dh_file(), LOG, ssl_dh_params_file, and SSLerrmessage().
Referenced by be_tls_init().
Definition at line 2116 of file be-secure-openssl.c.
References _, ereport, errcode(), errhint(), errmsg, FATAL, fb(), LOG, SSLECDHCurve, and SSLerrmessageExt().
Referenced by be_tls_init().
Definition at line 1539 of file be-secure-openssl.c.
References DEBUG2, ereport, errmsg_internal(), fb(), len, and SSLerrmessage().
Referenced by initialize_dh().
Definition at line 1472 of file be-secure-openssl.c.
References AllocateFile(), ereport, errcode(), errcode_for_file_access(), errmsg, FATAL, fb(), filename, FreeFile(), LOG, and SSLerrmessage().
Referenced by initialize_dh().
Definition at line 1388 of file be-secure-openssl.c.
References fb(), Port::last_read_was_eof, and port.
Referenced by port_bio_method().
|
static |
Definition at line 1418 of file be-secure-openssl.c.
References fb(), port_bio_ctrl(), port_bio_method_ptr, port_bio_read(), and port_bio_write().
Referenced by ssl_set_port_bio().
Definition at line 1345 of file be-secure-openssl.c.
References buf, EAGAIN, EINTR, EWOULDBLOCK, fb(), port, and secure_raw_read().
Referenced by port_bio_method().
Definition at line 1369 of file be-secure-openssl.c.
References buf, EAGAIN, EINTR, EWOULDBLOCK, fb(), and secure_raw_write().
Referenced by port_bio_method().
Definition at line 1599 of file be-secure-openssl.c.
References fb(), MAXLEN, name, and pg_clean_ascii().
Referenced by verify_cb().
Definition at line 1561 of file be-secure-openssl.c.
References Assert, buf, fb(), run_ssl_passphrase_command(), and ssl_is_server_start.
Referenced by default_openssl_tls_init(), and init_host_context().
Definition at line 2409 of file be-secure-openssl.c.
References fb(), PG_TLS1_1_VERSION, PG_TLS1_2_VERSION, PG_TLS1_3_VERSION, PG_TLS1_VERSION, and PG_TLS_ANY.
Referenced by be_tls_init().
Definition at line 2444 of file be-secure-openssl.c.
References PG_TLS1_1_VERSION, PG_TLS1_2_VERSION, PG_TLS1_3_VERSION, PG_TLS1_VERSION, and PG_TLS_ANY.
Referenced by be_tls_open_server().
Definition at line 1444 of file be-secure-openssl.c.
References fb(), port, and port_bio_method().
Referenced by be_tls_open_server().
Definition at line 2173 of file be-secure-openssl.c.
References _, fb(), snprintf, and strerror.
Referenced by be_tls_init(), be_tls_open_server(), be_tls_read(), be_tls_write(), init_host_context(), initialize_dh(), load_dh_buffer(), load_dh_file(), and SSLerrmessageExt().
Definition at line 2155 of file be-secure-openssl.c.
References fb(), and SSLerrmessage().
Referenced by initialize_ecdh().
|
static |
Definition at line 1639 of file be-secure-openssl.c.
References _, appendStringInfo(), appendStringInfoChar(), b, errcode(), fb(), initStringInfo(), pfree(), prepare_cert_name(), str, and X509_NAME_to_cstring().
Referenced by be_tls_open_server().
Definition at line 2336 of file be-secure-openssl.c.
References elog, ereport, errcode(), errmsg, ERROR, fb(), i, name, pfree(), pg_any_to_server(), PG_UTF8, and pstrdup().
Referenced by be_tls_get_peer_issuer_name(), be_tls_get_peer_subject_name(), and verify_cb().
|
static |
Definition at line 1771 of file be-secure-openssl.c.
Referenced by alpn_cb().
Definition at line 131 of file be-secure-openssl.c.
Referenced by dummy_ssl_passwd_cb(), and init_host_context().
| openssl_tls_init_hook_typ openssl_tls_init_hook = default_openssl_tls_init |
Definition at line 80 of file be-secure-openssl.c.
Referenced by _PG_init(), and init_host_context().
|
static |
Definition at line 1342 of file be-secure-openssl.c.
Referenced by port_bio_method().
Definition at line 111 of file be-secure-openssl.c.
Referenced by be_tls_destroy(), be_tls_init(), be_tls_open_server(), and initialize_SSL().
|
static |
Referenced by be_tls_init(), and be_tls_open_server().
|
static |
Definition at line 112 of file be-secure-openssl.c.
Referenced by be_tls_init().
|
static |
Definition at line 132 of file be-secure-openssl.c.
Referenced by init_host_context(), and ssl_external_passwd_cb().