2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
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.
17 * Configuration management (header)
26 #include "ng_ipaddr.h"
31 * Configured IRC operator.
32 * Please note that the name of the IRC operator 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.
37 char name[CLIENT_PASS_LEN]; /**< Name (ID) */
38 char pwd[CLIENT_PASS_LEN]; /**< Password */
39 char *mask; /**< Allowed host mask */
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.
47 typedef struct _Conf_Server
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
61 ng_ipaddr_t dst_addr[2]; /**< List of addresses to connect to */
63 bool SSLConnect; /**< Establish connection using SSL? */
64 bool SSLVerify; /**< Verify server certificate using CA? */
66 char svs_mask[CLIENT_ID_LEN]; /**< Mask of nicknames that should be
67 treated and counted as services */
72 /** Configuration options required for SSL support */
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 */
86 /** Pre-defined channels */
88 char name[CHANNEL_NAME_LEN]; /**< Name of the channel */
89 char *modes[512]; /**< Initial channel modes to evaluate */
90 char key[CLIENT_PASS_LEN]; /**< Channel key ("password", mode "k" ) */
91 char topic[COMMAND_LEN]; /**< Initial topic */
92 char keyfile[512]; /**< Path and name of channel key file */
93 bool autojoin; /**< 1 to make all users autojoin this channel */
94 unsigned long maxusers; /**< User limit for this channel, mode "l" */
95 unsigned int modes_num; /**< Number of channel modes to evaluate */
99 #define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
100 #define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
103 /** Name (ID, "nick") of this server */
104 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
106 /** Server info text */
107 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
109 /** Global server passwort */
110 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
112 /** Administrative information */
113 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
114 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
115 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
117 /** Network name (optional, no spaces allowed) */
118 GLOBAL char Conf_Network[CLIENT_INFO_LEN];
120 /** Message of the day (MOTD) of this server */
121 GLOBAL array Conf_Motd;
123 /** Help text of this server */
124 GLOBAL array Conf_Helptext;
126 /** Array of ports this server should listen on */
127 GLOBAL array Conf_ListenPorts;
129 /** Address to which sockets should be bound to or empty (=all) */
130 GLOBAL char *Conf_ListenAddress;
132 /** User and group ID this daemon should run with */
133 GLOBAL uid_t Conf_UID;
134 GLOBAL gid_t Conf_GID;
136 /** The directory to chroot() into */
137 GLOBAL char Conf_Chroot[FNAME_LEN];
139 /** Full path and name of a file to which the PID of daemon should be written */
140 GLOBAL char Conf_PidFile[FNAME_LEN];
142 /** Timeout (in seconds) for PING commands */
143 GLOBAL int Conf_PingTimeout;
145 /** Timeout (in seconds) for PONG replies */
146 GLOBAL int Conf_PongTimeout;
148 /** Seconds between connection attempts to other servers */
149 GLOBAL int Conf_ConnectRetry;
151 /** Array of configured IRC operators */
152 GLOBAL array Conf_Opers;
154 /** Array of configured IRC servers */
155 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
157 /** Array of pre-defined channels */
158 GLOBAL array Conf_Channels;
160 /** String containing all locally allowed channel prefixes for new channels */
161 GLOBAL char Conf_AllowedChannelTypes[8];
163 /** Flag indicating if IRC operators are allowed to always use MODE (true) */
164 GLOBAL bool Conf_OperCanMode;
166 /** Flag indicating if IRC operators get AutoOp in persistent (+P) channels */
167 GLOBAL bool Conf_OperChanPAutoOp;
170 * If true, mask channel MODE commands of IRC operators to the server.
171 * Background: ircd2 will ignore channel MODE commands if an IRC operator
172 * gives channel operator privileges to someone without being a channel operator
173 * himself. This enables a workaround: it masks the MODE command as coming
174 * from the IRC server and not the IRC operator.
176 GLOBAL bool Conf_OperServerMode;
178 /** Flag indicating if remote IRC operators are allowed to manage this server */
179 GLOBAL bool Conf_AllowRemoteOper;
181 /** Cloaked hostname of the clients */
182 GLOBAL char Conf_CloakHost[CLIENT_ID_LEN];
184 /** Cloaked hostname for clients that did +x */
185 GLOBAL char Conf_CloakHostModeX[CLIENT_ID_LEN];
187 /** Salt for hostname hash for cloaked hostnames */
188 GLOBAL char Conf_CloakHostSalt[CLIENT_ID_LEN];
190 /** Use nickname as user name? */
191 GLOBAL bool Conf_CloakUserToNick;
193 /** Enable all DNS functions? */
194 GLOBAL bool Conf_DNS;
196 /** Enable IDENT lookups, even when compiled with support for it */
197 GLOBAL bool Conf_Ident;
199 /** Enable "more privacy" mode and "censor" some user-related information */
200 GLOBAL bool Conf_MorePrivacy;
202 /** Enable "NOTICE *" messages on connect */
203 GLOBAL bool Conf_NoticeBeforeRegistration;
205 /** Enable all usage of PAM, even when compiled with support for it */
206 GLOBAL bool Conf_PAM;
208 /** Don't require all clients to send a password an to be PAM authenticated */
209 GLOBAL bool Conf_PAMIsOptional;
211 /** The service name to use for PAM */
212 GLOBAL char Conf_PAMServiceName[MAX_PAM_SERVICE_NAME_LEN];
214 /** Disable all CTCP commands except for /me ? */
215 GLOBAL bool Conf_ScrubCTCP;
217 /** Default user modes for new local clients */
218 GLOBAL char Conf_DefaultUserModes[CLIENT_MODE_LEN];
221 * try to connect to remote systems using the ipv6 protocol,
222 * if they have an ipv6 address? (default yes)
224 GLOBAL bool Conf_ConnectIPv6;
226 /** Try to connect to remote systems using the IPv4 protocol (true) */
227 GLOBAL bool Conf_ConnectIPv4;
229 /** Idle timeout (seconds), after which the daemon should exit */
230 GLOBAL int Conf_IdleTimeout;
232 /** Maximum number of simultaneous connections to this server */
233 GLOBAL int Conf_MaxConnections;
235 /** Maximum number of channels a user can join */
236 GLOBAL int Conf_MaxJoins;
238 /** Maximum number of connections per IP address */
239 GLOBAL int Conf_MaxConnectionsIP;
241 /** Maximum length of a nickname */
242 GLOBAL unsigned int Conf_MaxNickLength;
244 /** Maximum number of channels returned to /list */
245 GLOBAL int Conf_MaxListSize;
247 /** Maximum seconds to add per "penalty". -1 = unlimited. */
248 GLOBAL time_t Conf_MaxPenaltyTime;
252 /** Require "AUTH PING-PONG" on login */
253 GLOBAL bool Conf_AuthPing;
259 /* Syslog "facility" */
260 GLOBAL int Conf_SyslogFacility;
264 GLOBAL void Conf_Init PARAMS((void));
265 GLOBAL bool Conf_Rehash PARAMS((void));
266 GLOBAL int Conf_Test PARAMS((void));
268 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
269 GLOBAL bool Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
270 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
272 GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
273 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
274 GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
275 GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
277 GLOBAL bool Conf_NickIsService PARAMS((int ConfServer, const char *Nick));
278 GLOBAL bool Conf_NickIsBlocked PARAMS((const char *Nick));
281 GLOBAL bool Conf_SSLInUse PARAMS((void));
284 /* Password required by WEBIRC command */
285 GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
287 GLOBAL void Conf_DebugDump PARAMS((void));