X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/55eeaea101ce1d88287b0b4a41ccafb20e1cce57..8db00894ab7750513d8750290e508b5802bc1fc5:/src/newconf.c?ds=sidebyside diff --git a/src/newconf.c b/src/newconf.c index e36882f..b436b54 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -13,7 +13,7 @@ #include "ircd_defs.h" #include "sprintf_irc.h" #include "common.h" -#include "s_log.h" +#include "logger.h" #include "s_conf.h" #include "s_user.h" #include "s_newconf.h" @@ -28,6 +28,7 @@ #include "ircd.h" #include "snomask.h" #include "blacklist.h" +#include "sslproc.h" #define CF_TYPE(x) ((x) & CF_MTYPE) @@ -241,7 +242,7 @@ conf_set_serverinfo_vhost(void *data) static void conf_set_serverinfo_vhost6(void *data) { -#ifdef IPV6 +#ifdef RB_IPV6 if(inetpton(AF_INET6, (char *) data, &ServerInfo.ip6.sin6_addr) <= 0) { conf_report_error("Invalid netmask for server IPv6 vhost (%s)", (char *) data); @@ -351,6 +352,7 @@ static struct mode_table connect_table[] = { { "compressed", SERVER_COMPRESSED }, { "encrypted", SERVER_ENCRYPTED }, { "topicburst", SERVER_TB }, + { "ssl", SERVER_SSL }, { NULL, 0 }, }; @@ -670,7 +672,7 @@ conf_set_class_ping_time(void *data) static void conf_set_class_cidr_bitlen(void *data) { -#ifdef IPV6 +#ifdef RB_IPV6 unsigned int maxsize = 128; #else unsigned int maxsize = 32; @@ -744,8 +746,10 @@ conf_end_listen(struct TopConf *tc) return 0; } + + static void -conf_set_listen_port(void *data) +conf_set_listen_port_both(void *data, int ssl) { conf_parm_t *args = data; for (; args; args = args->next) @@ -758,28 +762,40 @@ conf_set_listen_port(void *data) } if(listener_address == NULL) { - add_listener(args->v.number, listener_address, AF_INET); -#ifdef IPV6 - add_listener(args->v.number, listener_address, AF_INET6); + add_listener(args->v.number, listener_address, AF_INET, ssl); +#ifdef RB_IPV6 + add_listener(args->v.number, listener_address, AF_INET6, ssl); #endif } else { int family; -#ifdef IPV6 +#ifdef RB_IPV6 if(strchr(listener_address, ':') != NULL) family = AF_INET6; else #endif family = AF_INET; - add_listener(args->v.number, listener_address, family); + add_listener(args->v.number, listener_address, family, ssl); } } } +static void +conf_set_listen_port(void *data) +{ + conf_set_listen_port_both(data, 0); +} + +static void +conf_set_listen_sslport(void *data) +{ + conf_set_listen_port_both(data, 1); +} + static void conf_set_listen_address(void *data) { @@ -1150,6 +1166,13 @@ conf_end_connect(struct TopConf *tc) yy_server->flags &= ~SERVER_COMPRESSED; } #endif + if(ServerConfCompressed(yy_server) && ServerConfSSL(yy_server)) + { + conf_report_error("Ignoring compressed for connect block %s -- " + "ssl and compressed are mutually exclusive (OpenSSL does its own compression)", + yy_server->name); + yy_server->flags &= ~SERVER_COMPRESSED; + } add_server_conf(yy_server); rb_dlinkAdd(yy_server, &yy_server->node, &server_conf_list); @@ -1221,7 +1244,7 @@ conf_set_connect_aftype(void *data) if(strcasecmp(aft, "ipv4") == 0) yy_server->aftype = AF_INET; -#ifdef IPV6 +#ifdef RB_IPV6 else if(strcasecmp(aft, "ipv6") == 0) yy_server->aftype = AF_INET6; #endif @@ -1893,7 +1916,13 @@ static struct ConfEntry conf_serverinfo_table[] = { "vhost", CF_QSTRING, conf_set_serverinfo_vhost, 0, NULL }, { "vhost6", CF_QSTRING, conf_set_serverinfo_vhost6, 0, NULL }, - { "max_clients", CF_INT, NULL, 0, &ServerInfo.max_clients }, + { "ssl_private_key", CF_QSTRING, NULL, 0, &ServerInfo.ssl_private_key }, + { "ssl_ca_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_ca_cert }, + { "ssl_cert", CF_QSTRING, NULL, 0, &ServerInfo.ssl_cert }, + { "ssl_dh_params", CF_QSTRING, NULL, 0, &ServerInfo.ssl_dh_params }, + { "ssld_count", CF_INT, NULL, 0, &ServerInfo.ssld_count }, + + { "default_max_clients",CF_INT, NULL, 0, &ServerInfo.default_max_clients }, { "\0", 0, NULL, 0, NULL } }; @@ -2099,6 +2128,7 @@ newconf_init() add_top_conf("listen", conf_begin_listen, conf_end_listen, NULL); add_conf_item("listen", "port", CF_INT | CF_FLIST, conf_set_listen_port); + add_conf_item("listen", "sslport", CF_INT | CF_FLIST, conf_set_listen_sslport); add_conf_item("listen", "ip", CF_QSTRING, conf_set_listen_address); add_conf_item("listen", "host", CF_QSTRING, conf_set_listen_address);