mirror of
https://github.com/ThunixdotNet/ansible.git
synced 2026-01-25 21:40:19 +00:00
Adding znc stuff
This commit is contained in:
43
roles/shell/files/var/lib/znc/create-znc_account.sh
Executable file
43
roles/shell/files/var/lib/znc/create-znc_account.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ZNC account creation
|
||||
CONF="/var/lib/znc/.znc/configs/znc.conf"
|
||||
PID=$(pgrep -u znc znc)
|
||||
|
||||
# $username and $password are retrieved from create-account script
|
||||
if [[ -z $1 || -z $2 ]]
|
||||
then
|
||||
echo -e "Usage: $(basename $0) [username] [password]"
|
||||
exit
|
||||
fi
|
||||
|
||||
# search if $username has been added previously
|
||||
if grep -iq $1 $CONF
|
||||
then
|
||||
echo -e "User: '$1' already exists"
|
||||
exit
|
||||
fi
|
||||
|
||||
username=$1
|
||||
password=$2
|
||||
|
||||
kill -s USR1 $PID # Rewrite znc.conf
|
||||
sleep 1
|
||||
|
||||
# set username and password
|
||||
sed s/newuser/$username/g znc_account.newconf >> $CONF
|
||||
expect << EOF | grep -E 'Hash|Salt' | tr -d \\r >> $CONF
|
||||
spawn znc --makepass
|
||||
expect "*Enter password: "
|
||||
send "$password\r"
|
||||
expect "*Confirm password: "
|
||||
send "$password\r"
|
||||
expect eof
|
||||
EOF
|
||||
echo " </Pass>" >> $CONF
|
||||
echo "</User>" >> $CONF
|
||||
|
||||
sleep 1
|
||||
kill -s HUP $PID # Reload znc.conf
|
||||
sleep 1
|
||||
kill -s USR1 $PID # Rewrite znc.conf
|
||||
25
roles/shell/files/var/lib/znc/znc_account.newconf
Normal file
25
roles/shell/files/var/lib/znc/znc_account.newconf
Normal file
@@ -0,0 +1,25 @@
|
||||
<User newuser>
|
||||
Admin = false
|
||||
AltNick = newuser|znc
|
||||
AppendTimestamp = false
|
||||
AutoClearChanBuffer = true
|
||||
AutoClearQueryBuffer = true
|
||||
Buffer = 50
|
||||
DenyLoadMod = false
|
||||
DenySetBindHost = false
|
||||
Ident = newuser
|
||||
JoinTries = 10
|
||||
LoadModule = chansaver
|
||||
MaxJoins = 0
|
||||
MaxNetworks = 2
|
||||
MaxQueryBuffers = 50
|
||||
MultiClients = true
|
||||
Nick = newuser
|
||||
PrependTimestamp = true
|
||||
QuitMsg = bouncer provider phoenix.thunix.cf
|
||||
RealName = Got Thunix ?
|
||||
StatusPrefix = *
|
||||
TimestampFormat = [%H:%M:%S]
|
||||
|
||||
<Pass password>
|
||||
Method = SHA256
|
||||
Reference in New Issue
Block a user