TrollabWikiserverznc

Installer un ZNC

Présentation

ZNC est un bouncer IRC ou BNC.
Il peut se détacher du client à partir du serveur IRC réel, et aussi de canaux sélectionnés.
Plusieurs clients des sites différents peuvent se connecter à un compte ZNC unique simultanément et apparaissent donc sous le même pseudo sur IRC.
Il prend en charge les connexions SSL sécurisées et IPv6.
ZNC est écrit en C + + et sous licence GNU General Public.

Installation

Installation classique

Tout d'abord il va vous falloir ajouter les dépots backports afin d'avoir une version à peu prés à jour, pour celà il vous faut ajouter :

deb http://backports.debian.org/debian-backports squeeze-backports main

dans le fichier

/etc/apt/sources.list

Suivi d'un :

aptitude update
aptitude upgrade

Ensuite installer ZNC complet et ses pré-requis :

aptitude install build-essential libssl-dev libperl-dev pkg-config libc-ares-dev znc znc-dev znc-extra znc-perl znc-tcl

Premier lancement de znc ;

znc restart --makeconf

et répondez :

[ ** ] Building new config
[ ** ]
[ ** ] First lets start with some global settings...
[ ** ]
[ ?? ] What port would you like ZNC to listen on? (1 to 65535):                  # ------------ le port que vous voulez 
[ ?? ] Would you like ZNC to listen using SSL? (yes/no) [no]: yes                 
[ ** ] Unable to locate pem file: [/home/znc/.znc/znc.pem]
[ ?? ] Would you like to create a new pem file now? (yes/no) [yes]: yes
[ ?? ] hostname of your shell (including the '.com' portion):                    # ------------ hostname de votre serveur
[ ok ] Writing Pem file [/home/znc/.znc/znc.pem]...
[ ?? ] Would you like ZNC to listen using ipv6? (yes/no) [no]: yes
[ ?? ] Listen Host (Blank for all ips):
[ ** ]
[ ** ] -- Global Modules --
[ ** ]
[ ?? ] Do you want to load any global modules? (yes/no): yes
[ ** ] +-----------+----------------------------------------------------------+
[ ** ] | Name      | Description                                              |
[ ** ] +-----------+----------------------------------------------------------+
[ ** ] | partyline | Internal channels and queries for users connected to znc |
[ ** ] | webadmin  | Web based administration module                          |
[ ** ] +-----------+----------------------------------------------------------+
[ ** ] And 10 other (uncommon) modules. You can enable those later.
[ ** ]
[ ?? ] Load global module <partyline>? (yes/no) [no]: yes
[ ?? ] Load global module <webadmin>? (yes/no) [no]: yes
[ ** ]
[ ** ] Now we need to setup a user...
[ ** ]
[ ?? ] Username (AlphaNumeric): znc
[ ?? ] Enter Password:
[ ?? ] Confirm Password:
[ ?? ] Would you like this user to be an admin? (yes/no) [yes]: yes
[ ?? ] Nick [znc]:
[ ?? ] Alt Nick [znc_]:
[ ?? ] Ident [znc]:
[ ?? ] Real Name [Got ZNC?]:
[ ?? ] VHost (optional):
[ ?? ] Number of lines to buffer per channel [50]:
[ ?? ] Would you like to keep buffers after replay? (yes/no) [no]:
[ ?? ] Default channel modes [+stn]:
[ ** ]
[ ** ] -- User Modules --
[ ** ]
[ ?? ] Do you want to automatically load any user modules for this user? (yes/no): yes
[ ** ] +-------------+-------------------------------------------------------------------+
[ ** ] | Name        | Description                                                       |
[ ** ] +-------------+-------------------------------------------------------------------+
[ ** ] | admin       | Dynamic configuration of users/settings through irc               |
[ ** ] | chansaver   | Keep config up-to-date when user joins/parts                      |
[ ** ] | keepnick    | Keep trying for your primary nick                                 |
[ ** ] | kickrejoin  | Autorejoin on kick                                                |
[ ** ] | nickserv    | Auths you with NickServ                                           |
[ ** ] | perform     | Keeps a list of commands to be executed when ZNC connects to IRC. |
[ ** ] | simple_away | Auto away when last client disconnects                            |
[ ** ] +-------------+-------------------------------------------------------------------+
[ ** ] And 33 other (uncommon) modules. You can enable those later.
[ ** ]
[ ?? ] Load module <admin>? (yes/no) [no]: yes
[ ?? ] Load module <chansaver>? (yes/no) [no]: yes
[ ?? ] Load module <keepnick>? (yes/no) [no]:
[ ?? ] Load module <kickrejoin>? (yes/no) [no]: yes
[ ?? ] Load module <nickserv>? (yes/no) [no]:
[ ?? ] Load module <perform>? (yes/no) [no]:
[ ?? ] Load module <simple_away>? (yes/no) [no]: yes
[ ** ]
[ ?? ] Would you like to setup another user? (yes/no) [no]: no
[ ok ] Writing config [/home/znc/.znc/configs/restart]...
[ ** ]
[ ** ] To connect to this znc you need to connect to it as your irc server
[ ** ] using the port that you supplied.  You have to supply your login info
[ ** ] as the irc server password like so... user:pass.
[ ** ]
[ ** ] Try something like this in your IRC client...
[ ** ] /server <znc_server_ip> <port> znc:<pass>
[ ** ]
[ ?? ] Launch znc now? (yes/no) [yes]: yes
[ ok ] Opening Config [/home/znc/.znc/configs/restart]...
[ ok ] Binding to port [port]...
[ ** ] Loading user [znc]
[ ok ] Loading Module [admin]... [/usr/lib/znc/admin.so]
[ ok ] Loading Module [chansaver]... [/usr/lib/znc/chansaver.so]
[ ok ] Loading Module [kickrejoin]... [/usr/lib/znc/kickrejoin.so]
[ ok ] Loading Module [simple_away]... [/usr/lib/znc/simple_away.so]
[ ok ] Adding Server [cactus.trollab.org +7000]...
[ ok ] Loading Global Module [partyline]... [/usr/lib/znc/partyline.so]
[ ok ] Loading Global Module [webadmin]... [/usr/lib/znc/webadmin.so]
[ ok ] Forking into the background... [pid: 16931]
[ ** ] ZNC 0.092+deb3 - http://znc.sourceforge.net

Maintenant rendez vous sur votre page webadmin qui se trouve à l'adresse :

https://votre.serveur:port

(mettez http si vous n'avez pas mis le SSL)
Vous pouvez ajouter les utilisateurs.

Installation avancée

Pré-requis

build-essential (dpkg-dev g++ gcc libc6-dev libc-dev libc6-dev-sparc64 libc6.1-dev libc-dev make)

Installation chrootée

Ce script télécharge la dernière version de ZNC et l'installe de sorte qu'il puisse être utilisé dans un environnement chrooté.

#!/bin/bash
# The source .tar.gz that is installed for chrooting
SOURCE="http://znc.in/nightly/znc-latest.tar.gz"
# The chroot used
CHROOT="/var/chroot/znc"
# The user for running ZNC
USER="znc"
# Arguments to configure (like --disable-shit etc)
CONFIGURE_ARGS=""
# Arguments to make
MAKE_ARGS="-j3"
 
# Don't change stuff after here
 
if [[ $UID == 0 ]]
then
  echo "You don't need to (and shouldn't) run this file as root!"
  exit
fi
 
DL="dl-znc.tar.gz"
TMPDIR=$(mktemp -d)
# Automatically clean up
trap 'rm -rf $TMPDIR' EXIT INT HUP QUIT TERM
 
cd $TMPDIR
 
log()
{
  echo
  tput smso
  echo $@
  tput rmso
}
 
log Downloading...
wget -O $TMPDIR/$DL $SOURCE || exit
 
log Extracting...
tar -xzf $DL || exit
 
# We assume this extracts to znc*
cd znc* || exit
 
log Configuring...
./configure $CONFIGURE_ARGS --prefix=/usr || exit
 
log Compiling...
make $MAKE_ARGS || exit
 
log Installing to ${CHROOT}...
make install DESTDIR=${CHROOT} || exit
 
mkdir -p $CHROOT/etc
mkdir -p $CHROOT/lib
mkdir -p $CHROOT/usr/lib
mkdir -p $CHROOT/dev
mkdir -p $CHROOT/home
mkdir -p $CHROOT/home/$USER
 
log "Copying needed libs... (All are saved in ${CHROOT}/usr/lib)"
cd $CHROOT
ldd $CHROOT/usr/bin/znc |
  sed -e 's/[ \t]*//g' -e 's/^.*=>//' -e 's/(.*)$//' |
  while read file
  do
    if [[ $file == '' ]]
    then
      continue
    fi
 
    if [[ -f $CHROOT/$file ]]
    then
      rm $CHROOT/$file
    fi
 
    echo "Copying ${file}..."
    dir=$(echo $file | sed 's:/[^/]*$::')
    f=$(echo $file | sed 's:^.*/::')
    mkdir -p ${CHROOT}/$dir
    cp -p $file $CHROOT/lib/$f
  done
 
log "Symlinking /usr/lib64 to /usr/lib... (just in case ;)"
ln -s lib $CHROOT/usr/lib64
 
log Trying to copy files needed for DNS...
cp -p /etc/hosts  $CHROOT/etc/
cp -p /etc/resolv.conf  $CHROOT/etc/
cp -p /lib/libnss_dns.so.2 $CHROOT/lib \
  || log Copying libnss_dns.so.2 failed, DNS may be broken!
cp -p /lib/libresolv.so.2 $CHROOT/lib \
  || log Copying libresolv.so.2 failed, DNS may be broken!
 
cat <<OUT
 
Done
 
You should now su to root.
 
There are some files in the chroot which need to be created by root:
(This assumes you are using linux, good luck for other OS)
    mknod -m 644 ${CHROOT}/dev/random c 1 8
    mknod -m 644 ${CHROOT}/dev/urandom c 1 9
    mknod -m 666 ${CHROOT}/dev/null c 1 3
 
You need a user and a group which will be used to run ZNC:
    useradd --user-group --home-dir=/home/$USER $USER
    chown -R $USER:$USER ${CHROOT}
 
After this, you should be able to start ZNC.
 
To start up ZNC for creating a configuration, run this:
    su $USER -- -c '${CHROOT}/usr/bin/znc --makeconf --datadir ${CHROOT}/home/$USER/.znc'
 
To start and stop use these commands:
    start-stop-daemon --chroot ${CHROOT} --chuid $USER:$USER --start --exec /usr/bin/znc
    start-stop-daemon --chroot ${CHROOT} --chuid $USER:$USER --stop --exec /usr/bin/znc
OUT

Pour en savoir plus sur l'installation dans un environnement chrooté
Source de ce script d'installation

Administration

Modules

vide.

Commandes

vide.

Exemple

/msg *status listmods
 
<yehezkel> listmods
<*status> +---------------+---------------+
<*status> | Name          | Arguments     |
<*status> +---------------+---------------+
<*status> | ctcpflood     | 4 2           |
<*status> | fix_lagchk    |               |
<*status> | route_replies |               |
<*status> | savebuff      |               |
<*status> | schat         |               |
<*status> | simple_away   | Déconnecté.   |
<*status> +---------------+---------------+

Liste des commandes utilisateur

Commande Arguments Description
version Prints which version of znc this is
listdccs List all active DCCs
listmods List all loaded modules
listavailmods List all available modules
listchans List all channels
listnicks <#salon> List all nicks on a channel
listservers List all servers
addserver <host>[[+]port] [pass] Add a server to the list
semserver <host> Remove a server from the list
enablechan <#salon> Enable the channel
detach <#salon> Detach from the channel
topics Show topics in all channels
playbuffer <#salon> Play back the buffer for a given channel
clearbuffer <#salon> Clear the buffer for a given channel
clearallchannelbuffers Clear the channel buffers
setbuffer <#salon> [linecount] Set the buffer count for a channel
setvhost <vhost (ip preferred)> Set the VHost for this connection
clearvhost Clear the VHost for this connection
Jump Jump to the next server in the list
disconnect Se déconnecter de l'IRC
Connect Se reconnecter à l'IRC
send <nick> <file> Send a shell file to a nick on IRC
get <file> Send a shell file to yourself
loadmod <module> Charge un module
unloadmod <module> Dé-charge a module
reloadmod <module> Re-charge a module
showmotd Voir le MOTD (Message Of The Day/Message du jour)
setmotd <Message> Défini le MOTD (Message Of The Day/Message du jour)
addmotd <Message> Append <Message> to MOTD
clearmotd Efface le MOTD (Message Of The Day/Message du jour)
rehash Reload znc.conf from disk
saveconfig Save the current settings to disk
listusers List all users/clients connected to znc
listclients [utilisateur] List all clients connected to your znc user
traffic Show basic traffic stats for all znc users
uptime Show how long ZNC is already running
broadcast [message] Broadcast a message to all users
shutdown [message] Eteint complémtement znc
restart [message] Re-démarre znc

Voir aussi


Fichier : wiki › server › znc - dernière modification le 10/10/2016 à 02:11 par Trollab


trollab.org, Since .... a long time ago, in a galaxy far, far away ...