Bacula-users

Re: [Bacula-users] Special Permissions to Stop and Start Services during backup

2017-04-28 07:10:19
Subject: Re: [Bacula-users] Special Permissions to Stop and Start Services during backup
From: Martin Simmons <martin AT lispworks DOT com>
To: Jim Richardson <jim AT securit360 DOT com>
Date: Fri, 28 Apr 2017 12:09:09 +0100
>>>>> On Fri, 28 Apr 2017 00:46:09 +0000, Jim Richardson said:
> 
> I am starting to get into a few special circumstances that I need to have a
> service stopped before I can back it up I am receiving the errors below.  I
> have established a Bacula sudoers file that should allow for things, but
> still run into the permission denied see information below.
> 
> 
> 
> Thank you in advance.
> 
> 
> 
> 
> 
> # cat /etc/sudoers.d/bacula
> 
> bacula ALL=NOPASSWD: /usr/bin/systemctl.
> 
> 
> 
> # cat /etc/bacula/bacula-dir.conf
> <snip>
> Job {
>   Name = "D2D-MyService-Application"
>   Client = myservice-fd
>   JobDefs = "2Disk Full Jobs"
>   Pool = Daily_Disk
>   FileSet = "MyService-Application"
>   Schedule = "Days-MTWHFSU"
>   Write Bootstrap = "/backup/bacula/spool/%n.bsr"
>   Priority = 6
>   RunScript {
>     Command = "/usr/bin/sudo /usr/bin/systemctl start myservice"
>     RunsWhen = After
>     RunsOnClient = yes
>   }
>   RunScript {
>     Command = "/usr/bin/sudo /usr/bin/systemctl stop myservice "
>     RunsWhen = Before
>     RunsOnClient = yes
>   }
> 
> }
> <snip>
> 
> 
> 
> # Relevant Job error output
> 
> 27-Apr 18:53 bacula-dir JobId 79: Start Backup JobId 79, 
> Job=D2D-MyService-Application.2017-04-27_18.52.58_08
> 27-Apr 18:53 bacula-dir JobId 79: Using Device "FileChgr1-Dev1" to write.
> 27-Apr 18:53 myservice-fd JobId 79: shell command: run ClientBeforeJob 
> "/usr/bin/sudo /usr/bin/systemctl stop myservice"
> 27-Apr 18:53 myservice-fd JobId 79: Error: Runscript: ClientBeforeJob 
> returned non-zero status=200. ERR=Permission denied
> 27-Apr 18:53 bacula-dir JobId 79: Fatal error: Bad response to RunBeforeNow 
> command: wanted 2000 OK RunBeforeNow , got 2905 Bad RunBeforeNow command.
> 27-Apr 18:53 bacula-dir JobId 79: Fatal error: Client " myservice-fd" 
> RunScript failed.
> 27-Apr 18:53 bacula-dir JobId 79: Error: Bacula bacula-dir 7.4.7 (16Mar17):

Which user are you using to run bacula-fd (note "fd", not "dir")?  Normally
bacula-fd is run as root, so you don't need the sudo.

__Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users