-
Notifications
You must be signed in to change notification settings - Fork 6
/
zncrun
46 lines (39 loc) · 1.1 KB
/
zncrun
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
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Usage: $0 ZNC_USER ZNC_PASS"
exit 1
fi
ZNC_USER=$1
# FIXME: password will be visible in process list. Read it from stdin?
ZNC_PASS=$2
mkdir -p .znc/configs
# FIXME: call znc --makepass instead of generating the has manually
ZNC_SALT="$(dd if=/dev/urandom bs=16c count=1 | md5sum | awk '{print $1}')"
ZNC_HASH="sha256#$(echo -n ${ZNC_PASS}${ZNC_SALT} | sha256sum | awk '{print $1}')#$ZNC_SALT#"
cat >.znc/configs/znc.conf <<EOF
Listen = 6667
LoadModule = lastseen
<User $ZNC_USER>
Pass = $ZNC_HASH
Admin = true
Nick = $ZNC_USER
AltNick = _$ZNC_USER
Ident = $ZNC_USER
RealName = $ZNC_USER
Buffer = 200
KeepBuffer = false
ChanModes = +stn
MaxJoins = 1
LoadModule = admin
LoadModule = awaynick
LoadModule = keepnick
LoadModule = kickrejoin
LoadModule = log
LoadModule = nickserv
LoadModule = simple_away
Server = irc.freenode.net 6667
<Chan #dotcloud>
</Chan>
</User>
EOF
exec znc -f