aboutsummaryrefslogtreecommitdiffstats
path: root/roles/znc/templates/znc.conf.j2
blob: 17034d447bf0816b8893e120de7dd7540c0df7a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//
// WARNING
//
// Do NOT edit this file while ZNC is running!
// Use webadmin or *controlpanel instead.
//
// Altering this file by hand will forfeit all support.
//
// But if you feel risky, you might want to read help on:
//     /znc saveconfig
//     /znc rehash.
// Also check http://wiki.znc.in/Configuration
//

Version = 1.6.5
HideVersion = true
MaxBufferSize = {{ znc.buffer_size }}
SSLProtocols = +TLSv1.2 -TLSv1.1 -TLSv1 -SSLv3 -SSLv2

// SSL: https://wiki.znc.in/Signed_SSL_certificate
// Everything in a single file, in the order from the most *private* to
// the most *public* entries, except for the root certificate.
// i.e., cat ssl.key ssl.cert dhparam.pem > znc.allinone.pem
SSLCertFile = {{ znc.data_dir }}/znc.allinone.pem

// NOTE: SSLKeyFile & SSLDHParamFile requires version >=1.7
//SSLCertFile = {{ znc.data_dir }}/znc.ssl.crt
//SSLKeyFile = {{ znc.data_dir }}/znc.ssl.key
//SSLDHParamFile = /usr/local/etc/ssl/dhparam4096.pem

// NOTE: DragonFly BSD doesn't allow using "IPV6_V6ONLY=0" to bind on
//       both IPv4 & IPv6, therefore bind them separately.
{% for listener in ["ipv4", "ipv6"] %}
<Listener {{ listener }}>
    AllowIRC = true
    AllowWeb = false
    IPv4 = {% if listener == "ipv4" -%}
        true
    {% else -%}
        false
    {% endif -%}
    IPv6 = {% if listener == "ipv6" -%}
        true
    {% else -%}
        false
    {% endif -%}
    Port = {{ znc.port }}
    SSL = true
</Listener>
{% endfor %}

<User {{ znc.username }}>
    Admin = true
    Pass = {{ znc.password | znc_makepass }}
    Nick = {{ znc.username }}
    AltNick = {{ znc.username }}_
    Ident = {{ znc.username }}
    RealName = {{ znc.realname }}

    Buffer = {{ znc.buffer_size }}
    AutoClearChanBuffer = {{ znc.auto_clear_chan_buffer }}
    AppendTimestamp = false
    PrependTimestamp = true

    StatusPrefix = *
    ChanModes = +stn
    DenyLoadMod = false
    DenySetBindHost = false

    // Save channels to config when user joins and parts
    LoadModule = chansaver
    // Log chat activity to file
    LoadModule = log
    // Allow to add/remove/edit users/settings on the fly via IRC msgs
    LoadModule = controlpanel

    JoinTries = 10
    MaxJoins = 3
    MaxNetworks = 5
    MultiClients = true
    QuitMsg = {{ znc.quit_msg }}

{% for net in znc.networks %}
    <Network {{ net.name }}>
        // Automatically connects to the network
        IRCConnectEnabled = true

        // Automatically set you away on IRC when disconnected
        LoadModule = simple_away
        // Routes back answers to the right client when connected with
        // multiple clients
        LoadModule = route_replies
        // Try to get and keep the primary nick if it is taken
        LoadModule = keepnick
        // Auth with NickServ
        LoadModule = nickserv

        Server = {{ net.server }} {% if net.ssl|default(false) %}+{% endif%}{{ net.port }} {{ net.password|default("") }}
        {% if net.fingerprint is defined -%}
        TrustedServerFingerprint = {{ net.fingerprint }}
        {% endif %}

        {% for ch in net.channels -%}
        <Chan #{{ ch | regex_replace('^#', '') }}>
        </Chan>
        {% endfor %}

    </Network>

{% endfor %}
</User>