Version 1 by Sasha Polonsky
on Jun 01, 2011 08:36.

compared with
Version 2 by Sasha Polonsky
on Jun 01, 2011 08:47.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (19)

View Page History
 
{kb-resolution}
The first thing you need to do is create a text file with valid control panel user accounts that you wish to grant access. I have named mine You can name this file /etc/r1user:
\\
{code}
[root@cpanel buagent]# [root@plesk ~]# cat /etc/r1user
redhouse neo
tom trinity
{code}
Next, you need to edit the appropriate authentication script located in /usr/lib/buagent: /usr/sbin/r1soft/lib/controlpanel (authentication scripts end with auth.pl):
{code}
[root@cpanel buagent]# ls -lha | grep buagentauth
-rwxr-----  1 root root 1.1K Feb  4 13:37 buagentauth
-rwxr-----  1 root root 1.1K Feb  4 13:37 buagentauth.cpanel
-rwxr-----  1 root root 2.3K Feb  4 13:37 buagentauth.directadmin
-rwxr-----  1 root root 1.6K Feb  4 13:37 buagentauth.ensim
-rwxrw----  1 root root 2.3K Mar 20 17:26 buagentauth.plesk
[root@plesk ~]# ls -l /usr/sbin/r1soft/lib/controlpanel
-rw-r--r-- 1 root root 1806 Apr 13 17:46 BuagentAuth.pm
-rwxr-xr-x 1 root root 1030 Apr 13 17:46 cpanel-auth.pl
-rwxr-xr-x 1 root root 966 Apr 13 17:46 cpanel-listusers.pl
-rwxr-xr-x 1 root root 3138 May 30 14:24 plesk-auth.pl
-rwxr-xr-x 1 root root 2676 Apr 13 17:46 plesk-listusers.pl
-rwxr-xr-x 1 root root 930 Apr 13 17:46 virtuozzo-listusers.sh
{code}
Next, create an array and load the text file (/etc/r1user) you just created into the array:

@userdb = <USERDB>;
{code}\\
Next, you need to create a variable which reflect the r1users privilege to access backups ($r1user_ref). Then we use a 'foreach' with an if statement to check whether the $user is in the array:
Next, you need to create a variable which reflect the r1users privilege to access backups ($r1user_ref) and use a 'foreach' loop to check whether the $user is in the array.
Code:
\\
\\
\\
{code}
my $r1user_ref = 0;
}
{code}
If the $user account is in the @userdb array, then $r1user_ref is set to '1'. The last thing we need to do is add an authentication condition to the following line:
If the $user account is in the @userdb array, then $r1user_ref is set to '1'. The last thing is to put all this code together and insert it into appropriate place of the authentication script. For pleask-auth.pl the changes should look like this:

Code:
{code}
Before:
if ($auth_ref->{auth_ok} == 1)
my $user = <>;
chomp($user);
my $pass = <>;
chomp($pass);
my $auth_ref = BuagentAuth::auth($user, $pass);
print "auth_ok:" . $auth_ref->{auth_ok} . "\n";
if ($auth_ref->{auth_ok} == 0) { exit; }


After:
if ($auth_ref->{auth_ok} == 1 && $r1user_ref == 1)
my $user = <>;
chomp($user);
my $pass = <>;
chomp($pass);

my @userdb;
open(USERDB, '/etc/r1user') or die "Couldn't open location file: $!";
@userdb = <USERDB>;

my $r1user_ref = 0;
my $t;
foreach $t (@userdb){
if ($t =~ $user) {
$r1user_ref = 1;
}
}

if ($r1user_ref != 1) {
print "auth_ok:0\n";
exit;
}

my $auth_ref = BuagentAuth::auth($user, $pass);
print "auth_ok:" . $auth_ref->{auth_ok} . "\n";
if ($auth_ref->{auth_ok} == 0) { exit; }
{code}\\
If the user account is in /etc/r1user the specified user will have access to their backups. In not, they will see no recovery points in the be denied access to CDP web interface.
\\
\\