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 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.
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? */
65 char svs_mask[CLIENT_ID_LEN]; /**< Mask of nicknames that should be
66 treated and counted as services */
71 /** Configuration options required for SSL support */
73 char *KeyFile; /**< SSL key file */
74 char *CertFile; /**< SSL certificate file */
75 char *DHFile; /**< File containing DH parameters */
76 array ListenPorts; /**< Array of listening SSL ports */
77 array KeyFilePassword; /**< Key file password */
78 char *CipherList; /**< Set SSL cipher list to use */
83 /** Pre-defined channels */
85 char name[CHANNEL_NAME_LEN]; /**< Name of the channel */
86 char *modes[512]; /**< Initial channel modes to evaluate */
87 char key[CLIENT_PASS_LEN]; /**< Channel key ("password", mode "k" ) */
88 char topic[COMMAND_LEN]; /**< Initial topic */
89 char keyfile[512]; /**< Path and name of channel key file */
90 unsigned long maxusers; /**< User limit for this channel, mode "l" */
91 unsigned int modes_num; /**< Number of channel modes to evaluate */
95 #define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
96 #define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
99 /** Name (ID, "nick") of this server */
100 GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
102 /** Server info text */
103 GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
105 /** Global server passwort */
106 GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
108 /** Administrative information */
109 GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
110 GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
111 GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
113 /** Network name (optional, no spaces allowed) */
114 GLOBAL char Conf_Network[CLIENT_INFO_LEN];
116 /** Message of the day (MOTD) of this server */
117 GLOBAL array Conf_Motd;
119 /** Help text of this server */
120 GLOBAL array Conf_Helptext;
122 /** Array of ports this server should listen on */
123 GLOBAL array Conf_ListenPorts;
125 /** Address to which sockets should be bound to or empty (=all) */
126 GLOBAL char *Conf_ListenAddress;
128 /** User and group ID this daemon should run with */
129 GLOBAL uid_t Conf_UID;
130 GLOBAL gid_t Conf_GID;
132 /** The directory to chroot() into */
133 GLOBAL char Conf_Chroot[FNAME_LEN];
135 /** Full path and name of a file to which the PID of daemon should be written */
136 GLOBAL char Conf_PidFile[FNAME_LEN];
138 /** Timeout (in seconds) for PING commands */
139 GLOBAL int Conf_PingTimeout;
141 /** Timeout (in seconds) for PONG replies */
142 GLOBAL int Conf_PongTimeout;
144 /** Seconds between connection attempts to other servers */
145 GLOBAL int Conf_ConnectRetry;
147 /** Array of configured IRC operators */
148 GLOBAL array Conf_Opers;
150 /** Array of configured IRC servers */
151 GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
153 /** Array of pre-defined channels */
154 GLOBAL array Conf_Channels;
156 /** String containing all locally allowed channel prefixes for new channels */
157 GLOBAL char Conf_AllowedChannelTypes[8];
159 /** Flag indicating if IRC operators are allowed to always use MODE (true) */
160 GLOBAL bool Conf_OperCanMode;
162 /** Flag indicating if IRC operators get AutoOp in persistent (+P) channels */
163 GLOBAL bool Conf_OperChanPAutoOp;
166 * If true, mask channel MODE commands of IRC operators to the server.
167 * Background: ircd2 will ignore channel MODE commands if an IRC operator
168 * gives channel operator privileges to someone without being a channel operator
169 * himself. This enables a workaround: it masks the MODE command as coming
170 * from the IRC server and not the IRC operator.
172 GLOBAL bool Conf_OperServerMode;
174 /** Flag indicating if remote IRC operators are allowed to manage this server */
175 GLOBAL bool Conf_AllowRemoteOper;
177 /** Cloaked hostname of the clients */
178 GLOBAL char Conf_CloakHost[CLIENT_ID_LEN];
180 /** Cloaked hostname for clients that did +x */
181 GLOBAL char Conf_CloakHostModeX[CLIENT_ID_LEN];
183 /** Salt for hostname hash for cloaked hostnames */
184 GLOBAL char Conf_CloakHostSalt[CLIENT_ID_LEN];
186 /** Use nickname as user name? */
187 GLOBAL bool Conf_CloakUserToNick;
189 /** Enable all DNS functions? */
190 GLOBAL bool Conf_DNS;
192 /** Enable IDENT lookups, even when compiled with support for it */
193 GLOBAL bool Conf_Ident;
195 /** Enable "more privacy" mode and "censor" some user-related information */
196 GLOBAL bool Conf_MorePrivacy;
198 /** Enable "NOTICE *" messages on connect */
199 GLOBAL bool Conf_NoticeBeforeRegistration;
201 /** Enable all usage of PAM, even when compiled with support for it */
202 GLOBAL bool Conf_PAM;
204 /** Don't require all clients to send a password an to be PAM authenticated */
205 GLOBAL bool Conf_PAMIsOptional;
207 /** The service name to use for PAM */
208 GLOBAL char Conf_PAMServiceName[MAX_PAM_SERVICE_NAME_LEN];
210 /** Disable all CTCP commands except for /me ? */
211 GLOBAL bool Conf_ScrubCTCP;
213 /** Default user modes for new local clients */
214 GLOBAL char Conf_DefaultUserModes[CLIENT_MODE_LEN];
217 * try to connect to remote systems using the ipv6 protocol,
218 * if they have an ipv6 address? (default yes)
220 GLOBAL bool Conf_ConnectIPv6;
222 /** Try to connect to remote systems using the IPv4 protocol (true) */
223 GLOBAL bool Conf_ConnectIPv4;
225 /** Idle timout (seconds), after which the daemon should exit */
226 GLOBAL int Conf_IdleTimeout;
228 /** Maximum number of simultaneous connections to this server */
229 GLOBAL int Conf_MaxConnections;
231 /** Maximum number of channels a user can join */
232 GLOBAL int Conf_MaxJoins;
234 /** Maximum number of connections per IP address */
235 GLOBAL int Conf_MaxConnectionsIP;
237 /** Maximum length of a nickname */
238 GLOBAL unsigned int Conf_MaxNickLength;
240 /** Maximum number of channels returned to /list */
241 GLOBAL int Conf_MaxListSize;
243 /** Maximium seconds to add per "penalty". -1 = unlimited. */
244 GLOBAL time_t Conf_MaxPenaltyTime;
248 /** Require "AUTH PING-PONG" on login */
249 GLOBAL bool Conf_AuthPing;
255 /* Syslog "facility" */
256 GLOBAL int Conf_SyslogFacility;
260 GLOBAL void Conf_Init PARAMS((void));
261 GLOBAL bool Conf_Rehash PARAMS((void));
262 GLOBAL int Conf_Test PARAMS((void));
264 GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
265 GLOBAL bool Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
266 GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
268 GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
269 GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
270 GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
271 GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
273 GLOBAL bool Conf_NickIsService PARAMS((int ConfServer, const char *Nick));
274 GLOBAL bool Conf_NickIsBlocked PARAMS((const char *Nick));
277 GLOBAL bool Conf_SSLInUse PARAMS((void));
280 /* Password required by WEBIRC command */
281 GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
284 GLOBAL void Conf_DebugDump PARAMS((void));