Greetings all :)

So I got backuppc working on openbsd7.6, though it took me a while.

Anyway, below is a howto which will hopefully help someone else out
there.

The web interface and everything works following the below.

But as you can see there is a few issues.

The readme should be updated in line with some of the below (it still
references apache).

Secondly, the nginx config in my howto should be replaced with an httpd
equivalent, I guess that is possible?

Also the port should be upgraded to 4.x but that's less of an issue,
since 3.x does the job and works.



---------------------------------------------

This is how to get backuppc 3.3.2p3 working on OpenBSD 7.6, including
the web admin.

!!! todo

    - switch out nginx for httpd if possible
    - update to backuppc 4.x (ports on 7.6 has 3.x)
    - mention the readme needs updating (there is no apache)
    - configure email

```bash
pkg_add backuppc
```

Add a webserver to front the fcgi.

```bash
pkg_add nginx
```

Populate the nginx config: `/etc/nginx/nginx.conf`

(Only relevant parts of the config)

```
    server {
        listen       8888;
        listen       [::]:8888;
        server_name  node1.example.com;
        root         /var/www/htdocs;

        location /backuppc/ {
        }

        location /BackupPC_Admin/ {
            auth_basic "BackupPC";
            auth_basic_user_file backuppc.users;
            fastcgi_pass   127.0.0.1:1028;
            fastcgi_split_path_info ^(/cgi-bin/[^/]+)(.*);
            fastcgi_param REMOTE_USER $remote_user;
            fastcgi_param SCRIPT_NAME $document_uri;
            include   fastcgi_params;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root  htdocs;
        }
```

Then create a link so the web server can access the static content:

```bash
cd /var/www/htdocs/
ln -s ../backuppc .
```

Create the htpasswd file:

```bash
mkdir -p /var/www/etc/nginx
htpasswd /var/www/etc/nginx/backuppc.users backuppc
chown www /var/www/etc/nginx/backuppc.users backuppc
```

`backuppc` would fail to start with missing programs it expects
(relating to backing up windows hosts).  I don't need these, so I'll
work around it like this for now.

```bash
install -o root -g bin -m 0755 /dev/null /usr/local/bin/smbclient
install -o root -g bin -m 0755 /dev/null /usr/local/bin/nmblookup
```

Likewise `wwbackuppc` would fail to start with some missing perl
libraries, we install them like so:

```bash
pkg_add p5-CGI p5-CGI-Fast
```

The `_backuppc` user by default has `/var/empty` as it's home
directory.  AFAIK, this should rather be `/var/db/backuppc` so that
the `_backuppc` user can create a ssh private key and accept the public
keys of the remote hosts in it's `~/.ssh`.  Additionally I configure a
minimal bash to make life more pleasant working as the user.

```bash
export EDITOR=mg && vipw  # and change the home dir
chsh -s /usr/local/bin/bash _backuppc
cp -r /etc/skel/{.ssh,.profile,.login} /var/db/backuppc
```

Append this into the users `.profile`:

```bash
if [ -n "$BASH_VERSION" ]; then
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi
```

And create a `.bashrc` with this:

```bash
# -*- mode: sh -*-

# If not running interactively, do nothing.
[ -z "$PS1" ] && return

PS1="\u@\h \w \$ "

###########
# History #
###########
# I dont' want ignorespace in HISTCONTROL because I paste commands
# with leading spaces and I do want them remembered.  Some people like
# to add ignorespace to HISTCONTROL so they can get the shell to not
# store dangerous commands or commands that have secrets in I don't
# want written to disk and stored in plain text, though I don't use it like 
that.
HISTCONTROL=erasedups:ignoredups
HISTSIZE=10000
HISTTIMEFORMAT='%Y-%m-%d %H:%M  '
HISTIGNORE="cd:pwd:ls:l:ll:fg:bg:jobs:j"
HISTFILESIZE=9999

# Double check of history substitutions.
shopt -s histverify
# All terminals use .bash_history file without overwriting it.
shopt -s histappend

###########
# aliases #
###########

alias ll='ls -lh'
```

Lastly fix the perms: `chown _backuppc:_backuppc 
/var/db/backuppc/{.ssh,.profile,.login,.bashrc}`

Next, create an ssh key for and as the `_backuppc` user.

```bash
ssh-keygen -t ed25519
```

Then install the `_backuppc` ssh public key in the target hosts
`authorized_keys` file.

Now as the `_backuppc` user, connect to the target uses ssh and accept
it's public key (if it's correct):

```bash
ssh root@clientnode
ssh r...@clientnode.example.com
ssh root@192.168.1.7
```

Next, update this in the `config.pl` with these changes:

```
$Conf{ServerHost} = 'node1.example.com';
$Conf{XferMethod} = 'rsync';
$Conf{CgiAdminUsers}     = 'backuppc';
$Conf{CgiURL} = 'http://node1.example.com:8888/BackupPC_Admin/;
```

I have a large `/data` file system which is backed by RAID5 using
bioctl, so I'd prefer to store my backups there.  I move it there like
so:

```bash
rsync -aHSx /var/db/backuppc/ /data/backuppc/
rm -rf /var/db/backuppc/
ln -s /data/backuppc /var/db/backuppc
```

Enable and start all:

```bash
rcctl enable backuppc ; rcctl enable wwbackuppc ; rcctl enable nginx
rcctl start backuppc ; rcctl start wwbackuppc ; rcctl start nginx
```

Populate the individual host config files under `/etc/backuppc/pc/` dir.

Browse and login at http://node1.example.com:8888/backuppc

Reply via email to