To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Configuration

From ZNC
Revision as of 23:24, 29 October 2014 by >Jpnurmi (→‎Chan)
Jump to navigation Jump to search

Creating a config file

To generate a basic configuration file, run znc --makeconf after installation. It is NOT a good idea to create a new config file manually, please use znc --makeconf!

File locations

  • Configuration - ZNC gets its configuration by reading the file ~/.znc/configs/znc.conf.
  • Misc - Other files are also stored in the ~/.znc directory, such as the SSL certificate (znc.pem) and the PidFile (znc.pid).
  • Local Modules - Stored in ~/.znc/modules. ZNC will look in the local module directory first when trying to load a module.
  • Global Modules - Stored in /usr/local/lib/znc by default (where /usr/local is the prefix you chose). This is /usr/lib/znc if you used the Debian package.
  • Binaries - znc, znc-config, and znc-buildmod are all stored in /usr/local/bin (or in /usr/bin) by default. You can change this when you configure by using ./configure --prefix=/whatever/path/you/want.

Editing config

In most cases you should NOT edit znc.conf directly. Use webadmin instead.

If you really need to edit znc.conf by hand, do the following:

  1. pkill -SIGUSR1 znc
    to save current runtime configuration to znc.conf
  2. pkill znc
    to shutdown running ZNC instance
  3. Edit znc.conf
  4. znc
    to start it again with new configuration

Config file structure

The following pseudo content illustrates the config structure with single listener, user, network and channel. Naturally, there can be multiple instances of each.

Key = Value

<Listener name>
    Key = Value
</Listener>

<User name>
    Key = Value

    <Network name>
        Key = Value

        <Chan name>
            Key = Value
        </Chan>
    </Network>
    
    <Pass password>
        Key = Value
    </Pass>
</User>

Config file settings

ZNC 1.6 configuration file consists of the following settings.

Global

Key Type Description
AnonIPLimit UInt Limits the number of unidentified connections per IP.
BindHost List This is a list of allowed bindhosts. It is used by the webadmin module for users to select one. (Set different bindhosts in "Settings" on your Webadmin-Interface first - one per line - to make them appear in users configs afterwards)
ConnectDelay UInt The time every connection will be delayed, in seconds. Some servers refuse your connection if you reconnect too fast. This affects the connection between ZNC and the IRC server; not the connection between your IRC client and ZNC.
LoadModule List Load a global module on startup.
MaxBufferSize UInt Sets the global Max Buffer Size a user can have.
Motd List The "message of the day" which is sent to clients on connect via notice from *status. Can be specified multiple times.
PidFile String Make ZNC write a pid file. ZNC does not need this itself. See the FAQ on info how to crontab ZNC.
ProtectedWebSessions Bool If set to true, IP changing during each web session is disallowed.
ServerThrottle UInt The time between two connect attempts to the same hostname.
Skin String The web interface skin.
SSLCertFile String It's the TLS/SSL certificate file from which ZNC reads its server certificate.
SSLCiphers String Allowed SSL ciphers. For example SSLCiphers = ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DS
StatusPrefix String The prefix for the status and module queries. This setting may be overwritten by users.
TrustedProxy List ...
Version String The ZNC version that wrote this file.

Listener

Definition of a port that ZNC should listen on.

Key Value Description
AllowIRC true/false Whether the port allows IRC connections.
AllowWeb true/false Whether the port allows web connections.
Host eg. 10.2.3.4 An optional host or IP on which ZNC listens.
IPv4 true/false Whether the port listens using IPv4.
IPv6 true/false Whether the port listens using IPv6.
Port 1025-65534 The port number. WARNING: Some web browsers reject port 6667.
SSL true/false Whether this port is listening using SSL.
URIPrefix eg. /znc/ Prefix that ZNC should make the web interface available under. This can be used to make ZNC available behind a reverse proxy.

User

The user definition, you can have more than one. Each user may only connect to one network, so you need a separate user for each network. This is intended behavior! (See the FAQ about multiple networks)

Key Type Description
Admin Bool If set to true, the user has admin rights (e.g. in the webadmin module).
Allow List By default everyone is able to connect to ZNC as this user. With an Allow line you can restrict access to the specified IPs. Wildcards (*) are supported and multiple Allow lines can be set up.
AltNick String The alternate nick ZNC will use if your main nick is in use.
AppendTimestamp Bool Whether to append the timestamps to the message or not
AutoClearChanBuffer Bool If set to false, it will buffer channels even while you are attached, and play the whole buffer back to you each time you connect. If set to true, it won't buffer channels while you are attached, and the buffer will be reset upon each playback.
AutoClearQueryBuffer Bool If set to false, it will buffer queries even while you are attached, and play the whole buffer back to you each time you connect. If set to true, it won't buffer queries while you are attached, and the buffer will be reset upon each playback.
BindHost String ...
Buffer UInt This is the amount of lines that the playback buffer will store before dropping off the oldest line. The buffers are stored in the memory by default.
ChanModes String Default modes ZNC will set when you join an empty channel.
ClientEncoding String ...
CTCPReply List A request-reply-pair for CTCP-requests. Format: <request> <reply>, e.g. VERSION unknown v1.0
DCCBindHost String ...
DenyLoadMod Bool If set to true, the user isn't able to load modules.
DenySetBindHost Bool If set to true, the user isn't able to change his vhost.
Ident String ...
JoinTries UInt How often should ZNC try to join if the first join failed, e.g. due to channel mode +i/+k or if you're banned.
LoadModule List Load a module for this user on startup.
MaxJoins UInt How many channels should ZNC join at once. Lower this if you get disconnected for 'Excess flood.
MaxNetworks UInt Maximum number of networks a user is allowed to have.
MaxQueryBuffers UInt Maximum number of query buffers that are stored. 0 is unlimited.
MultiClients Bool Set this to true, if you want to be able to connect with multiple clients at once.
Nick String Your primary nick.
PrependTimestamp Bool Whether to prepend the timestamps to the message or not
QuitMsg String The default quit message ZNC will use when you jump servers or call shutdown.
RealName String ...
Skin String ...
StatusPrefix String The prefix for the status and module queries.
TimestampFormat String The format for the timestamps used in buffers, for example [%H:%M:%S]
Timezone String Set this to your local setting, so you'll get correct times in your timestamps. Format is Europe/Berlin, and is case sensitive, dropdown box will not work in IE.

Network

The user definition, you can have more than one. Each user may only connect to one network, so you need a separate user for each network. This is intended behavior! (See the FAQ about multiple networks)

Key Type Description
AltNick String Overrides the AltNick setting in the User section.
BindHost String Overrides the BindHost setting in the User section.
Encoding String ...
FloodBurst Double How many lines ZNC sends at once.
FloodRate Double How many lines per second ZNC sends after the FloodBurst
Ident String Overrides the Ident setting in the User section.
IRCConnectEnabled Bool If set to false, user doesn't connect to IRC servers.
JoinDelay UInt Defines the delay in seconds, until channels are joined after getting connected.
LoadModule List Load a module for this network on startup.
Nick String Overrides the Nick setting in the User section.
QuitMsg String Overrides the QuitMsg setting in the User section.
RealName String Overrides the RealName setting in the User section.
Server List Adds a server to the list of servers this user will be able to connect to. If you want ZNC to connect to the IRC server using SSL, put '+' in front of the port number. The IP can be IPv6. If the server requires a password, just add it as the third argument. Format: Server = <IP-Address/Host> [+]<Port> [<Password>]

Chan

Channels you want ZNC to join when connecting.

Key Value Description
AutoClearChanBuffer true/false Overrides the User-level AutoClearChanBuffer setting.
Buffer eg. 500 Overrides the User-level Buffer setting.
Detached true/false Whether the channel is detached ie. visible to clients.
Disabled true/false Whether ZNC joins the channel.
Key eg. secret An optional channel key.
Modes eg. +stn Overrides the User-level ChanModes setting.

Pass

Used by the client to connect to ZNC. A hash may be generated using znc --makepass.

Key Value Description
Hash eg. 746abef79c6259bf8... Hash of salted password
Method sha256 The hashing method.
Salt eg. DhMI_/(iywC:/,cU+GKr Random 20 characters

Config file change history

Added in 1.6

  • SSLCiphers and TrustedProxy (Global)
  • URIPrefix (Listener)
  • AutoClearQueryBuffer, ClientEncoding, and MaxQueryBuffers (User)
  • Encoding, JoinDelay and QuitMsg (Network)
  • Disabled (Chan)

Added in 1.2

  • MaxJoins (User)

Older pre 1.x settings

  • DCCVHost - This is the IP address used for DCC bouncing.
  • BounceDCCs - If set to true, the DCCs will be bounced by ZNC.
  • DCCLookupMethod - If set to default, ZNC will use the IP the clients sends for the DCC connections; if set to client, ZNC will use the IP the client connects from.
  • Listener = [web_only|irc_only] [host or IP] [+]port - Configuration of listening port. Use web_only or irc_only, if you don't want port to be universal. Put host/IP before the port with a space between to bind to a specific IP (notice that in this case the listener can't listen on both ipv4 and ipv6). Then goes the port ZNC will listen on. If the port is prepended with a '+' (without space) then ZNC listens using SSL. You can have several listeners in one ZNC. (Introduced in 0.090, see next chapter for older versions)
  • Listener4 or Listener6 - Exactly the same as Listener, but will use only IPv4 or IPv6.
  • ISpoofFile - ZNC will write the ident of the user trying to connect to this file. Very useful if your shell supports oidentd.
  • ISpoofFormat - The format of the ISpoofFile.

Before 0.096

  • BindHost was named vHost

Before 0.090:

  • Listen was similar to Listener4 from last version, without irc_only/web_only support.
  • Listen6 was similar to Listener or Listener6 (depending on your OS) from last version, without irc_only/web_only support.
  • TODO: When did Listeners become their own substructure?