]> arthur.barton.de Git - ngircd-alex.git/blob - src/ngircd/conf.h
Optionally validate certificates on TLS server links
[ngircd-alex.git] / src / ngircd / conf.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  */
11
12 #ifndef __conf_h__
13 #define __conf_h__
14
15 /**
16  * @file
17  * Configuration management (header)
18  */
19
20 #include <time.h>
21
22 #include "defines.h"
23 #include "array.h"
24 #include "portab.h"
25 #include "tool.h"
26 #include "ng_ipaddr.h"
27 #include "proc.h"
28 #include "conf-ssl.h"
29
30 /**
31  * Configured IRC operator.
32  * Please note the the name of the IRC operaor and his nick have nothing to
33  * do with each other! The IRC operator is only identified by the name and
34  * password configured in this structure.
35  */
36 struct Conf_Oper {
37         char name[CLIENT_PASS_LEN];     /**< Name (ID) */
38         char pwd[CLIENT_PASS_LEN];      /**< Password */
39         char *mask;                     /**< Allowed host mask */
40 };
41
42 /**
43  * Configured server.
44  * Peers to which this daemon should establish an outgoing server link must
45  * have set a port number; all other servers are allowed to connect to this one.
46  */
47 typedef struct _Conf_Server
48 {
49         char host[HOST_LEN];            /**< Hostname */
50         char name[CLIENT_ID_LEN];       /**< IRC client ID */
51         char pwd_in[CLIENT_PASS_LEN];   /**< Password which must be received */
52         char pwd_out[CLIENT_PASS_LEN];  /**< Password to send to the peer */
53         UINT16 port;                    /**< Server port to connect to */
54         int group;                      /**< Group ID of this server */
55         time_t lasttry;                 /**< Time of last connection attempt */
56         PROC_STAT res_stat;             /**< Status of the resolver */
57         int flags;                      /**< Server flags */
58         CONN_ID conn_id;                /**< ID of server connection or NONE */
59         ng_ipaddr_t bind_addr;          /**< Source address to use for outgoing
60                                              connections */
61         ng_ipaddr_t dst_addr[2];        /**< List of addresses to connect to */
62 #ifdef SSL_SUPPORT
63         bool SSLConnect;                /**< Establish connection using SSL? */
64         bool SSLVerify;                 /**< Verify server certificate using CA? */
65 #endif
66         char svs_mask[CLIENT_ID_LEN];   /**< Mask of nicknames that should be
67                                              treated and counted as services */
68 } CONF_SERVER;
69
70
71 #ifdef SSL_SUPPORT
72 /** Configuration options required for SSL support */
73 struct SSLOptions {
74         char *KeyFile;                  /**< SSL key file */
75         char *CertFile;                 /**< SSL certificate file */
76         char *DHFile;                   /**< File containing DH parameters */
77         array ListenPorts;              /**< Array of listening SSL ports */
78         array KeyFilePassword;          /**< Key file password */
79         char *CipherList;               /**< Set SSL cipher list to use */
80         char *CAFile;                   /**< Trusted CA certificates file */
81         char *CRLFile;                  /**< Certificate revocation file */
82         bool RequireClientCert;         /**< Enforce client certifiactes? */
83 };
84 #endif
85
86
87 /** Pre-defined channels */
88 struct Conf_Channel {
89         char name[CHANNEL_NAME_LEN];    /**< Name of the channel */
90         char modes[CHANNEL_MODE_LEN];   /**< Initial channel modes */
91         char key[CLIENT_PASS_LEN];      /**< Channel key ("password", mode "k" ) */
92         char topic[COMMAND_LEN];        /**< Initial topic */
93         char keyfile[512];              /**< Path and name of channel key file */
94         unsigned long maxusers;         /**< User limit for this channel, mode "l" */
95 };
96
97
98 #define CONF_SFLAG_ONCE 1               /* Delete this entry after next disconnect */
99 #define CONF_SFLAG_DISABLED 2           /* This server configuration entry is disabled */
100
101
102 /** Name (ID, "nick") of this server */
103 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
104
105 /** Server info text */
106 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
107
108 /** Global server passwort */
109 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
110
111 /** Administrative information */
112 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
113 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
114 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
115
116 /** Network name (optional, no spaces allowed) */
117 GLOBAL char Conf_Network[CLIENT_INFO_LEN];
118
119 /** Message of the day (MOTD) of this server */
120 GLOBAL array Conf_Motd;
121
122 /** Help text of this server */
123 GLOBAL array Conf_Helptext;
124
125 /** Array of ports this server should listen on */
126 GLOBAL array Conf_ListenPorts;
127
128 /** Address to which sockets should be bound to or empty (=all) */
129 GLOBAL char *Conf_ListenAddress;
130
131 /** User and group ID this daemon should run with */
132 GLOBAL uid_t Conf_UID;
133 GLOBAL gid_t Conf_GID;
134
135 /** The directory to chroot() into */
136 GLOBAL char Conf_Chroot[FNAME_LEN];
137
138 /** Full path and name of a file to which the PID of daemon should be written */
139 GLOBAL char Conf_PidFile[FNAME_LEN];
140
141 /** Timeout (in seconds) for PING commands */
142 GLOBAL int Conf_PingTimeout;
143
144 /** Timeout (in seconds) for PONG replies */
145 GLOBAL int Conf_PongTimeout;
146
147 /** Seconds between connection attempts to other servers */
148 GLOBAL int Conf_ConnectRetry;
149
150 /** Array of configured IRC operators */
151 GLOBAL array Conf_Opers;
152
153 /** Array of configured IRC servers */
154 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
155
156 /** Array of pre-defined channels */
157 GLOBAL array Conf_Channels;
158
159 /** String containing all locally allowed channel prefixes for new channels */
160 GLOBAL char Conf_AllowedChannelTypes[8];
161
162 /** Flag indicating if IRC operators are allowed to always use MODE (true) */
163 GLOBAL bool Conf_OperCanMode;
164
165 /** Flag indicating if IRC operators get AutoOp in persistent (+P) channels */
166 GLOBAL bool Conf_OperChanPAutoOp;
167
168 /**
169  * If true, mask channel MODE commands of IRC operators to the server.
170  * Background: ircd2 will ignore channel MODE commands if an IRC operator
171  * gives channel operator privileges to someone without being a channel operator
172  * himself. This enables a workaround: it masks the MODE command as coming
173  * from the IRC server and not the IRC operator.
174  */
175 GLOBAL bool Conf_OperServerMode;
176
177 /** Flag indicating if remote IRC operators are allowed to manage this server */
178 GLOBAL bool Conf_AllowRemoteOper;
179
180 /** Cloaked hostname of the clients */
181 GLOBAL char Conf_CloakHost[CLIENT_ID_LEN];
182
183 /** Cloaked hostname for clients that did +x */
184 GLOBAL char Conf_CloakHostModeX[CLIENT_ID_LEN];
185
186 /** Salt for hostname hash for cloaked hostnames */
187 GLOBAL char Conf_CloakHostSalt[CLIENT_ID_LEN];
188
189 /** Use nickname as user name? */
190 GLOBAL bool Conf_CloakUserToNick;
191
192 /** Enable all DNS functions? */
193 GLOBAL bool Conf_DNS;
194
195 /** Enable IDENT lookups, even when compiled with support for it */
196 GLOBAL bool Conf_Ident;
197
198 /** Enable "more privacy" mode and "censor" some user-related information */
199 GLOBAL bool Conf_MorePrivacy;
200
201 /** Enable NOTICE AUTH messages on connect */
202 GLOBAL bool Conf_NoticeAuth;
203
204 /** Enable all usage of PAM, even when compiled with support for it */
205 GLOBAL bool Conf_PAM;
206
207 /** Don't require all clients to send a password an to be PAM authenticated */
208 GLOBAL bool Conf_PAMIsOptional;
209
210 /** Disable all CTCP commands except for /me ? */
211 GLOBAL bool Conf_ScrubCTCP;
212
213 /** Default user modes for new local clients */
214 GLOBAL char Conf_DefaultUserModes[CLIENT_MODE_LEN];
215
216 /*
217  * try to connect to remote systems using the ipv6 protocol,
218  * if they have an ipv6 address? (default yes)
219  */
220 GLOBAL bool Conf_ConnectIPv6;
221
222 /** Try to connect to remote systems using the IPv4 protocol (true) */
223 GLOBAL bool Conf_ConnectIPv4;
224
225 /** Idle timout (seconds), after which the daemon should exit */
226 GLOBAL int Conf_IdleTimeout;
227
228 /** Maximum number of simultaneous connections to this server */
229 GLOBAL int Conf_MaxConnections;
230
231 /** Maximum number of channels a user can join */
232 GLOBAL int Conf_MaxJoins;
233
234 /** Maximum number of connections per IP address */
235 GLOBAL int Conf_MaxConnectionsIP;
236
237 /** Maximum length of a nickname */
238 GLOBAL unsigned int Conf_MaxNickLength;
239
240 /** Maximum number of channels returned to /list */
241 GLOBAL int Conf_MaxListSize;
242
243 #ifndef STRICT_RFC
244
245 /** Require "AUTH PING-PONG" on login */
246 GLOBAL bool Conf_AuthPing;
247
248 #endif
249
250 #ifdef SYSLOG
251
252 /* Syslog "facility" */
253 GLOBAL int Conf_SyslogFacility;
254
255 #endif
256
257 GLOBAL void Conf_Init PARAMS((void));
258 GLOBAL bool Conf_Rehash PARAMS((void));
259 GLOBAL int Conf_Test PARAMS((void));
260
261 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
262 GLOBAL bool Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
263 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
264
265 GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
266 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
267 GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
268 GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
269
270 GLOBAL bool Conf_NickIsService PARAMS((int ConfServer, const char *Nick));
271 GLOBAL bool Conf_NickIsBlocked PARAMS((const char *Nick));
272
273 #ifdef SSL_SUPPORT
274 GLOBAL bool Conf_SSLInUse PARAMS((void));
275 #endif
276
277 /* Password required by WEBIRC command */
278 GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
279
280 #ifdef DEBUG
281 GLOBAL void Conf_DebugDump PARAMS((void));
282 #endif
283
284
285 #endif
286
287
288 /* -eof- */