module:backuppc

Available NS6 and NS7

BackupPC is a high-performance, enterprise-grade system for backing up Linux, WinXX and MacOSX PCs and laptops to a server's disk. BackupPC is highly configurable and easy to install and maintain. See http://backuppc.sourceforge.net/

Stephane de Labrusse at stephdl@de-labrusse.fr

Is this Module helpful to you ? Please consider donating

First you need to install my repository, see how to do it

Then you can proceed to the nethserver-BackupPC installation.

yum install nethserver-BackupPC --enablerepo=stephdl

Once installed, the admin cgi user is 'admin' (think to set a password for ns6 and create the user for NS7 in the user panel of the server-manager) but any users can perform a login however they can manage only the their backups(eg the admin user needs to set backups for this user). If you want to restrict the cgi interface only for the admin, then set the db 'CgiMultiUser' to disabled

The user with the administrator privileges is the user 'admin', think to create it and set a password

Then go to Dashboard→Applications→BackupPC You will find two urls

https://yourIP/BackupPC → the cgi interface

https://yourIP/cygwin → a web page to help the cygwin-rsyncd settings for windows

To configure a Linux host client to be backed up, configure SSH from the backup server as follows in order to exchange certificates and to perform a login without passwords. Automatically, a rsa key is created in /var/lib/BackupPC/.ssh (4098 bits) you can use it to authenticate without password if you want to backup a linux host

first you need to export the public key

  su -s /bin/sh backuppc
  ssh-copy-id -i ~backuppc/.ssh/id_rsa.pub root@192.168.xxx.xxx

and test if all is ok

   ssh root@192.168.xxx.xxx

if it is ok you can log without password, then do 'exit' to go out of the shell. Now you can go to the admin backuppc panel to set the backup of your host by the rsync protocol

Note: There are times when the backuppc user needs a real shell specified in /etc/passwd, for example, when the backuppc user is used to run sudo commands or pre/post scripts.

Of course you can use a lot of other protocols (smb,ftp,rync,rsynd,tar,…)

To configure a Windows client to be backed up via the protocol rsyncd, install rsync on the Windows client. rysnc needs to be running as a service on the Windows client to ensure communication.

You have a web folder to ease this installation, go to https://YourIP/cygwin and log in with the user 'admin' (create it and set a password in the server-manager)

When you download and run cygwin-rsyncd, the cygwin and rsync files are installed in c:\rsyncd. A new windows service called RsyncServer is created and activated (ie: run). The c:\rsyncd directory will have an uninstall executable which will remove the service and installation files.

You will need to edit the c:\rsyncd\rsyncd.conf and c:\rsyncd\rsyncd.secrets files to set your client-specific shares, backup user name and password. You should restart the Windows RsyncServer service to get the new settings or restart your computer.

You can find the rsyncd.conf and the rsyncd.secrets files. They can be used as configuration files, but you can also write your own options in rsyncd.conf. The file rsyncd.secrets contains the master password, you can use it or change it to increase the security. Dont let in all hands this secret file.

Once rsyncd.conf and rsyncd.secrets saved on your windows client and the settings adjusted to the correct values, you need to run a .bat file to adjust the windows firewall (the TCP port 873 need to be opened and the ping incoming request must be allowed). Please use the correct version backuppc-fw-W7.bat or backuppc-fw-xp.bat files. Past the content in a file, name it with a .bat and run it as an Administrator

you can find (copy and paste the content or save the file)

  • cygwin-rsyncd.exe
  • rsyncd.conf (use it as is or like a template)
  • rsyncd.secrets (your random password, change it if you want)
  • backuppc-fw-W7.bat (a bat to open the 873 port in the W7 firewall)
  • backuppc-fw-xp.bat (a bat to open the 873 port in the XP firewall)

We have share name (cdocs), path, the valid user , the path to the rysnc.secrets file, an allowable host (this being the local backup server IP), modes, read only and list. The options are mostly explained in the file.

[cdocs]
 Path = /cygdrive/c/Users/<USERNAME>
 comment = c: User Data
 strict modes = false
 auth users = <valid-back-up-user>
 secrets file = c:/rsyncd/rsyncd.secrets
 hosts allow = 192.168.1.1
 read only = false
 list = false

This is strings to write in the configuration of your host in backuppc

RsyncShareName    <->     value of [cdocs] (eg cdocs and all other shares in rsynd in your window host)
RsyncdUserName    <->     value of auth users
RsyncdPasswd      <->     written in the secrets file
XferMethod        <->     rsynd

The final thing that must happen to make rsync work properly is to load rysnc as a service on the Windows client. The file service.bat shows the following command to accomplish this:

c:/rsyncd/rsync.exe -a "--config=c:/rsyncd/rsyncd.conf --daemon --no-detach"

There is also a “gotcha” – sometimes port 873 is blocked by Windows Firewall, so you may need to fix that ( use the provided .bat following your microsoft OS)

sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_nightly 0 255

then

  rm -rf /var/lib/BackupPC/pc/client/
  sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg BackupPC_nightly run
  cd /var/lib/BackupPC/pc/client/
  ls
  rm -fR backup_number
  sudo -u backuppc /usr/share/BackupPC/bin/BackupPC_serverMesg BackupPC_nightly run

Removing a single backup must be done with extreme care. You can safely remove the last backup for example, but if you remove a backup on which another one is based on, you can screw up your backups

After this, you will see space reclaimed and you can check it with df, but you still need to remove statistic line, otherwise you will see it in your web interface. To do that:

   vi /var/lib/BackupPC/pc/client/backups
you can remove the line with the backup_number.

Relog to your web interface and voila! No more backup_number.

The settings of e-smith database are workable as is, they are here for documentation purpose

# config show backuppc
backuppc=service
      CgiMultiUser=enabled
      examples=enabled
      status=enabled
      sudo=/usr/bin/rsync,/bin/gtar,/bin/tar
  • CgiMultiUser → enabled all users in ldap can use the backuppc CGI, disabled and only admin can do it
  • sudo→ you can add here more commands available by sudo to backuppc

if you want to modify something, then

  config setprop backuppc CgiMultiUser disabled
  signal-event nethserver-BackupPC-update

* Only NS6

other DB available

  # config show httpd-bkpc 
  httpd-bkpc=service
      TCPPort=950
      access=none
      status=enabled

the service which run the other apache session can be controlled by

service  httpd-bkpc restart 

Available are stop, start, restart, status or with the ns way (enabled or disabled)

  config setprop httpd-bkpc status disabled 
  signal-event nethserver-BackupPC-update

Sometime the backup fails with this error, this error is related to the remote ssh service. You must set in the /etc/ssh/ssh_config of your remote host

ServerAliveInterval 120

then restart your ssh service

One other way could be to set in the setting of backupPC (RsyncClientCmd)the default value for all hosts

$Conf{RsyncClientCmd} = '$sshPath -o ServerAliveInterval=120 -q -x -l root $host $rsyncPath $argList+';

some scripts to wake on lan computer before to backup them some scripts to backup windows computers with shadows copy

well a lot of more of course, i'm waiting your scripts and your ideas.

There is some logs if you need to debug

* Only NS6

  ll /var/log/httpd-bkpc/
  total 8
  -rw-r--r--. 1 root root 694 May  4 06:03 bkpc_access_log
  -rw-r--r--. 1 root root 749 May  4 06:03 bkpc_error_log
  -rw-r--r--. 1 root root   0 Apr 19 05:09 httpd-bkpc-service_log

* You can have a look also

  less /var/log/httpd/error_log
  less /var/log/messages
  less /var/log/BackupPC/LOG
  

In order to debug you can launch the event and look if something goes wrong in log after you launch it

  signal-event nethserver-BackupPC-update

Please raise Issues on github

BackupPC
perl-File-RsyncP
perl-Net-FTP-AutoReconnect
perl-Net-FTP-RetrHandle