Problem: backuppc is missing essential menu items in its web interface. Items "Edit Hosts", "Edit Config" etc are missing.
backuppc
is installed on Ubuntu 14.04.4 LTS.
I have even completely removed the backuppc
application (using dpkg --purge backupppc
), and re-installed it (apt-get install backuppc). Menu items are still missing.
When running /usr/lib/backuppc/cgi-bin/index.cgi directly in the CLI, I do get the missing menu items. The HTML output from index.cgi includes:
<a href="?action=editConfig">Edit Config</a>
<a href="?action=editConfig&newMenu=hosts">Edit Hosts</a>
I tried running de index.cgi on command line as root, backuppc and www-data, all having the same output. (I had to enable a login shell for www-data)
However, that is missing when accessing the backuppc
admin from the console in the browser.
The file /etc/backuppc/config.pl contains:
$Conf{CgiAdminUserGroup} = 'backuppc';
$Conf{CgiAdminUsers} = 'backuppc';
When I change $Conf{CgiAdminUsers}
to '*'
instead of 'backuppc'
, it works, but I prefer not to give admin access to all users, so this can only serve as a temporarily workaround.
apache configuration is default by installing backuppc package:
<Directory /usr/share/backuppc/cgi-bin/>
AllowOverride None
Allow from all
Options ExecCGI FollowSymlinks
AddHandler cgi-script .cgi
DirectoryIndex index.cgi
AuthUserFile /etc/backuppc/htpasswd
AuthType basic
AuthName "BackupPC admin"
require valid-user
</Directory>
The contents above are in /etc/backuppc/apache.conf
which is symbolically linked from /etc/apache2/conf.d/backuppc.conf
.
For problem analysis, I have added the following script to /usr/lib/backuppc/cgi-bin/debug.cgi
:
#!/usr/bin/perl
printf("My userid is $> (%s)\n", (getpwuid($>))[0]);
The output, written in the apache error.log
, after authentication, was:
My userid is 33 (www-data)
So the userid is incorrectly passed to BackupPc. The user id passed is www-data
where I expected that the authenticated user id, passed to BackupPc would be backuppc
as the latter is the one I used to login with. So probably, this is an apache configuration issue.
I have added a second cgi script printenv.cgi
which output the environment variables. The script contains:
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
The output contained:
REMOTE_USER="$REDIRECT_REMOTE_USER="
where backuppc requires that this environment variable REMOTE_USER
contains the authenticated user (backuppc
in my example). Turns out that an incorrect REMOTE_USER
is the cause of the problem.
The diagnostic scripts were placed in /usr/lib/backuppc/cgi-bin/
and were symbolically linked from /usr/share/backuppc/cgi-bin/
. Their ownership was backupc:www-data
and they were granted chmod a+x
and u+s
permissions.