| FOTO | AUTO | EDV | AUDIO |

Installation und Konfiguration von rsync

1. Installation mit apt-get install rsync auf beiden Servern
2. Am Naster Datei /etc/xinetd.d/rsync erstellen

# default: on
# description: The rsync server is a good addition to an ftp server, as it \
#       allows crc checksumming etc.
service rsync
{
        disable 	   	= no
        socket_type  	   	= stream
        wait            	   	= no					
        user            	   	= root					# Welcher User führt rsync aus
        server          	   	= /usr/bin/rsync				# wo liegt rsync
        server_args   	     	= --daemon				# wie startet der Dienst
        log_on_failure  +	= USERID HOST ATTEMPT
        log_on_success  +	= USERID HOST PID EXIT DURATION
        only_from       	= drbd-dge-s02				# Erlaubter Partner
        bind            		= 10.49.8.41				# Eigene IP
}
3. Partner Server in /etc/hosts eintragen
4. Datei etc/rsyncd.conf anpassen
motd file = /etc/rsyncs.motd
log file    = /var/log/rsyncd.log
pid file    = /var/run/rsyncd.pid
lock file   = /var/run/rsync.lock
 
 
max connections = 11				# Max erlaubte gleichzeitige Verbindungen
timeout = 60					# Abbruch bei Fehler in Sekunden
 
[drbd-dge-s01]
        path = /etc					# Hier oder darunter dürfen Dateien gesynct werden
        comment = drbd-dge RSYNCoverSTUNNEL		# frei wählbarer Kommentar
        uid = root					# Wer führt rsync aus 
        gid = root			
        hosts allow = 10.49.8.42			# Erlaubter Partner
        read only = no
        list = yes
        ignore nonreadable = yes			# Ignoriert ob Zugriff beim Sync
        refuse options = checksum
        dont compress = *
        auth users = rsync-etc				# Name des Users im Passwortfile
        secrets file = /etc/rsyncd.scrt			# Lage des Passwortfiles
5. Passwoer in /etc/rsyncd.scrt eintragen: rsync-etc:Passwort und Berechtigung 0600 geben
6. Am Client Cronjob erstellen /usr/local/bin/rsync-etc.sh
#!/bin/bash
connectionstring="-a --password-file=/etc/rsync.scrt rsync-etc@10.49.8.41::drbd-dge-s01"
err_log=/var/log/rsync_err.log
log=/var/log/rsync.log
filelist="rstest.txt vsftpd/vsftpd.conf vsftpd.user_list vsftpd.ftpusers ha.d/authkeys ha.d/haresources passwd group shadow drbd.conf"
{
timest=`date`
if [ `ps -ef|grep  $0|grep -c "/bin/bash"` -ge 4 ]; then
   echo $timest Synchronisation nicht durchgefuehrt, sie laeuft bereits. >&2
  exit
fi
echo "###################- rsync start -####################"
date
echo "------------------------------------------------------"
 /var/log/rsync.log
 
for file in $filelist;
        do
                echo "syncing $file"
                sleep 5
                /usr/bin/rsync $connectionstring/$file /etc/$file
        done
echo "###################- rsync end -####################"
} 2>> $err_log |awk '{ if ($0 !~ /^$/) print $0}' >> $log
Berechtigung 0700 root:root geben
7. Zur Automatisierung /etc/cron.d/rsync-etc diese Zeile einfügen
*/2 * * * * root /usr/local/bin/rsync-etc.sh
8. Datei /etc/rsyncd.conf am Client anpassen
motd file = /etc/rsyncs.motd
log file  = /var/log/rsyncd.log
pid file  = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
 
max connections = 11
timeout = 60
 
[drbd-dge-s02]
        path = /etc
        comment = drbd-dge RSYNCoverSTUNNEL
        uid = root
        gid = root
        hosts allow = 10.49.8.41
        read only = no
        list = yes
        ignore nonreadable = yes
        refuse options = checksum
        dont compress = *
        auth users = rsync-etc
        secrets file = /etc/rsync.scrt
9. Zur Autentifizierung in die Datei /etc/rsync.scrt das Passwort geschrieben und die Berechtigung 0600 root:root gesetzt
10 rsysnc starten mit /etc/init.d/xinetd restart (am Master)
11. Test mit netstat -la | grep rsync

Weitere Infos