Re: [BackupPC-users] backuppc 3.x on openbsd 7.6
OK, my issue was that the static content was stored at /var/www/backuppc
and for some reason nginx proc on OpenBSD can never access this
directory, even though the user could.
changing nginx config to be /var/www/htdocs and then doing
cd /var/www/htdocs/
ln -s ../backuppc .
solved the issue.
All is working perfectly now. Thanks for the help :)
The full howto below.
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)
- email issues to mailing list
- 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 ;
listen [::]:;
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=1
HISTTIMEFORMAT='%Y-%m-%d %H:%M '
HISTIGNORE="cd:pwd:ls:l:ll:fg:bg:jobs:j"
HISTFILESIZE=
# 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 [email protected]
ssh [email protected]
```
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:/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 ngin
Re: [BackupPC-users] backuppc 3.x on openbsd 7.6
Hi there, On Tue, 26 Nov 2024, Divan Santana wrote: ... The css and the icons don't render right. I'm guessing I need to split the static content and the cgi part? I see 200 in the nginx logs, but no pictures or css is rendering. 192.168.77.6 - backuppc [25/Nov/2024:16:51:21 +0200] "GET /backuppc/ HTTP/1.1" 200 4172 "-" ... 192.168.77.6 - backuppc [25/Nov/2024:16:51:22 +0200] "GET /backuppc/BackupPC_stnd.css HTTP/1.1" 200 4359 ... 192.168.77.6 - backuppc [25/Nov/2024:16:51:22 +0200] "GET /backuppc/sorttable.js HTTP/1.1" 200 4309 ... 192.168.77.6 - backuppc [25/Nov/2024:16:51:22 +0200] "GET /backuppc/logo.gif HTTP/1.1" 200 4265 ... You're using a different Web server and a different browser, and I usually give css problems to my wife. :/ So I don't know how much help I can be, but I see that in response to the requests logged above your server seems to be sending much more data than Apache does in our setup. For example the file logo.gif on our server: 8<-- $ ls -l /var/www/html/BackupPC/logo.gif -r--r--r-- 1 backuppc backuppc 1394 Feb 12 2020 logo.gif $ md5sum /var/www/html/BackupPC/logo.gif 8f66b2226c1fdc72d012da62d598209d logo.gif 8<-- Does your version of the file 'logo.gif' resemble the one above? Here's an extract from the log when I hit CTRL-F5: 8<-- 192.168.44.15 - - [26/Nov/2024:13:41:48 +] "GET /BackupPC/logo.gif HTTP/1.1" 200 1681 ... 8<-- Obviously there could be some compression but at this distance I still don't really understand the very big differences. Maybe try 'wget' to keep it simple, to see if you're actually getting what you expect? -- 73, Ged. ___ BackupPC-users mailing list [email protected] List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:https://github.com/backuppc/backuppc/wiki Project: https://backuppc.github.io/backuppc/
Re: [BackupPC-users] backuppc 3.x on openbsd 7.6
> Hi there,
>
> On Mon, 25 Nov 2024, Divan Santana wrote:
>
>> ...
>>> ...
>>> 2) Second issue I see, is that if I modify /etc/backuppc/config.pl the
>>>changes DO take effect, but if I edit /etc/backuppc/swift.pl the
>>>changes do not get read ever. The permissions are the file look
>>>correct. The /etc/backuppc/hosts file looks correct to me too.
>>>
>>>How else could I try debug this further?
>>
>> This issue still remains though. Very odd. Anyone know why it wouldn't
>> read the hosts .pl file? Or how I could debug this?
>
> Is it as simple as putting swift.pl in the /pc/ directory?
>
> /etc/backuppc/pc/
>
> instead of
>
> /etc/backuppc/
>
> At one time I had an idea that at least in their packages, Debian was
> soft-linking /etc/backuppc/pc to /etc/backuppc/, which might have had
> the desired effect in your setup but which isn't done upstream.
You are a legend, thanks - I owe you.
It really was that simple. haha. I should better read upstream docs.
I was used to the Debian way.
Everything is working perfectly now EXCEPT for some web rendering
issues.
Anyone have an idea how to correctly setup nginx here?
the static web content on openbsd is at:
root@node1:backuppc# ls /var/www/backuppc/
000.gif0011000.gif1001100.gif
1100100.gif1101100.gif1110001.gif
000.gif111.gificon-file.png
011.gif0011001.gif101.gif
1100101.gif1101101.gif1110100.gif
001.gifBackupPC_stnd.css icon-hardlink.png
0001000.gif100.gif1010001.gif
1100110.gif1101110.gif1110101.gif
100.gifBackupPC_stnd_orig.css icon-symlink.png
001.gif1000100.gif1011000.gif
1100111.gif110.gif1110110.gif
101.giffavicon.icologo.gif
0010001.gif1001000.gif110.gif
1101000.gif111.gif1110111.gif
110.gificon-dir.png sorttable.js
The www is chrooted at /var/www I think.
I have an nginx config like so:
```
server {
listen ;
listen [::]:;
server_name node1.example.com;
root /var/www/backuppc/;
location /backuppc/ {
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;
}
```
The css and the icons don't render right.
I'm guessing I need to split the static content and the cgi part?
I see 200 in the nginx logs, but no pictures or css is rendering.
192.168.77.6 - backuppc [25/Nov/2024:16:51:21 +0200] "GET /backuppc/ HTTP/1.1"
200 4172 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/128.0.0.0 Safari/537.36"
192.168.77.6 - backuppc [25/Nov/2024:16:51:22 +0200] "GET
/backuppc/BackupPC_stnd.css HTTP/1.1" 200 4359
"http://192.168.77.113:/backuppc/"; "Mozilla/5.0 (X11; Linux x86_64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
192.168.77.6 - backuppc [25/Nov/2024:16:51:22 +0200] "GET
/backuppc/sorttable.js HTTP/1.1" 200 4309
"http://192.168.77.113:/backuppc/"; "Mozilla/5.0 (X11; Linux x86_64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
192.168.77.6 - backuppc [25/Nov/2024:16:51:22 +0200] "GET /backuppc/logo.gif
HTTP/1.1" 200 4265 "http://192.168.77.113:/backuppc/"; "Mozilla/5.0 (X11;
Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0
Safari/537.36"
___
BackupPC-users mailing list
[email protected]
List:https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:https://github.com/backuppc/backuppc/wiki
Project: https://backuppc.github.io/backuppc/
Re: [BackupPC-users] backuppc 3.x on openbsd 7.6
Hi there, On Mon, 25 Nov 2024, Divan Santana wrote: ... ... 2) Second issue I see, is that if I modify /etc/backuppc/config.pl the changes DO take effect, but if I edit /etc/backuppc/swift.pl the changes do not get read ever. The permissions are the file look correct. The /etc/backuppc/hosts file looks correct to me too. How else could I try debug this further? This issue still remains though. Very odd. Anyone know why it wouldn't read the hosts .pl file? Or how I could debug this? Is it as simple as putting swift.pl in the /pc/ directory? /etc/backuppc/pc/ instead of /etc/backuppc/ At one time I had an idea that at least in their packages, Debian was soft-linking /etc/backuppc/pc to /etc/backuppc/, which might have had the desired effect in your setup but which isn't done upstream. -- 73, Ged. ___ BackupPC-users mailing list [email protected] List:https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki:https://github.com/backuppc/backuppc/wiki Project: https://backuppc.github.io/backuppc/
Re: [BackupPC-users] backuppc 3.x on openbsd 7.6
> So I managed to get backuppc v3 web working on OpenBSD. I'll try document it
> sometime.
>
> The issue I have at the moment is:
>
> 1) config.pl has this:
>
>$Conf{RsyncClientCmd} = '$sshPath -q -x -l root $host $rsyncPath
> $argList+';
>$Conf{BackupFilesOnly} = ['/etc'];
>
> However, when the job kicks off to backup the remote host (swift), I see this
> in proc
>
> root 86157 56.1 0.2 80192 81640 ?? R/105:38PM0:33.57
> /usr/local/bin/rsync --server --sender --numeric-ids --perms --owner --group
> -D --links --hard-links --times --block-size=2048 --recursive --ignore-times
> . /
> root 10972 0.0 0.0 1240 808 ?? Ip 5:38PM0:00.00 ksh -c
> /usr/local/bin/rsync --server --sender --numeric-ids --perms --owner --group
> -D --links --hard-links --times --block-size=2048 --recursive --ignore-times
> . /
>
> noticeably missing is the part to restrict the backup to /etc only
>
> It seems like $argList+ is not getting created as intended. Perhaps some
> perl lib is missing in my install or something?
>
> If I update RsyncClientCmd and replace argList+ with some hard coded
> values, the changes do take effect, though that is obviously not ideal.
This issue is non existent now. I'm not quite sure what was wrong, but
the way I setup backuppc is different now and this issue has gone away.
> 2) Second issue I see, is that if I modify /etc/backuppc/config.pl the
>changes DO take effect, but if I edit /etc/backuppc/swift.pl the
>changes do not get read ever. The permissions are the file look
>correct. The /etc/backuppc/hosts file looks correct to me too.
>
>How else could I try debug this further?
This issue still remains though. Very odd. Anyone know why it wouldn't
read the hosts .pl file? Or how I could debug this?
___
BackupPC-users mailing list
[email protected]
List:https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:https://github.com/backuppc/backuppc/wiki
Project: https://backuppc.github.io/backuppc/
