4 \chapter{Baculum API and Web GUI Tools}
7 This chapter presents the Bacula Web based interface that has been added to
8 the Bacula project for version 7.0 and later.
10 \section{Base Features}
12 Baculum provides the following base features:
15 \item Running Bacula jobs (backup, restore, verify...).
16 \item Baculum API with OAuth2 authorization and HTTP Basic authentication
17 \item Baculum Web GUI interface
18 \item Configuring Bacula on local and remote hosts
19 \item Monitoring Bacula service status.
20 \item Bacula console available via a Web window.
21 \item Multi-user interface.
22 \item Support for customized and restricted consoles (Console ACL function).
23 \item Volume management.
24 \item User friendly graphs and metrics.
25 \item Basic storage daemon operations (mount, umount, release, ...).
26 \item Easy to use configuration and restore wizards.
27 \item Multiple Director support.
28 \item Live AJAX based statuses.
31 \section{General Requirements}
33 Environment for Baculum Web installation should have following components
37 \item A Web Server - with mod\_rewrite module loaded. Baculum Web has been
38 tested with Apache and Lighttpd web servers.
39 \item PHP 5.3.4 or higher with following modules installed:
41 \item cURL PHP module.
42 \item MB String PHP module.
43 \item JSON PHP module.
47 Environment for Baculum API installation should have following components
51 \item A Web Server - with mod\_rewrite module loaded. Baculum has been
52 tested with Apache and Lighttpd web servers.
53 \item PHP 5.3.4 or higher with following modules installed:
55 \item PDO PHP support - depending on your catalog database: PDO PostgreSQL
56 or PDO MySQL. Note, in case using MySQL database there is required to use MySQL
57 native driver. It is php-mysqlnd for PHP, not php-mysql.
58 \item BCMath PHP module.
59 \item JSON PHP module.
61 \item A working Bacula bconsole - configured Bacula text based console
62 \item Direct access to the Bacula Catalog database (local or remote)
66 With installation from binary packages (deb, rpm) all requirements
67 will be automatically installed as packages dependencies.
69 \section{Installation Baculum API from rpm binary packages}
72 Before start using Baculum API and Baculum Web version 9.0.0 please backup
73 your Bacula configuration in safe place. It is specially important because
74 on first save config action the Bacula configuration is joined into one file
75 per Bacula component.\\
77 For rpm binary there are the following packages:
80 \item baculum-api - main Baculum API package with application files
81 \item baculum-api-httpd - Apache web server configuration files for Baculum API
82 \item baculum-api-lighttpd - Lighttpd web server configuration files for Baculum API
83 \item baculum-common - Common files for Baculum API and Baculum Web
84 \item baculum-web - main Baculum Web package with application files
85 \item baculum-web-httpd - Apache web server configuration files for Baculum Web
86 \item baculum-web-lighttpd - Lighttpd web server configuration files for Baculum Web
89 \subsection{Add the Baculum rpm repository}
91 To add the Baculum repository, first you must import the Baculum public key:
94 rpm --import http://bacula.org/downloads/baculum/baculum.pub
97 Once the key is imported, the next step is to add the repository
98 definition. First you must create the following file:
101 /etc/yum.repos.d/baculum.repo
104 The for CentOS 7, put the following in the file just created:
108 name=Baculum CentOS repository
109 baseurl=http://bacula.org/downloads/baculum/stable/centos
114 For Fedora 25 the {\bf bacula.repo} file should have the following contents:
118 name=Baculum Fedora repository
119 baseurl=http://bacula.org/downloads/baculum/stable/fedora
124 \subsection{Installation for the Apache}
126 Install the Baculum API for the Apache Web server as follows:
129 yum install baculum-common baculum-api baculum-api-httpd
132 Restart your Apache Web server:
135 service httpd restart
139 \subsection{Installation for Lighttpd}
141 Installation on system with access via Lighttpd is as follows
144 yum install baculum-common baculum-api baculum-api-lighttpd
147 Please note that in case CentOS distribution the Lighttpd web server is
148 available in the distribution packages after enabling the EPEL repository.
150 Start Baculum as application using the Lighttpd Web server:
153 service baculum-api-lighttpd start
156 \subsection{Access to bconsole via sudo for Apache and Lighttpd}
158 Baculum API requires access to Bconsole and to Bacula JSON programs.
159 To configure Bconsole sudo access and the Bacula JSON programs access
160 there can use following entries in newly created Baculum sudoers.d file
161 (usually in path /etc/sudoers.d/baculum):\\
163 In case default Apache user, the file contents must be:
166 Defaults:apache !requiretty
167 apache ALL=NOPASSWD: /usr/sbin/bconsole
168 apache ALL=NOPASSWD: /usr/sbin/bdirjson
169 apache ALL=NOPASSWD: /usr/sbin/bsdjson
170 apache ALL=NOPASSWD: /usr/sbin/bfdjson
171 apache ALL=NOPASSWD: /usr/sbin/bbconsjson
174 In case default Lighttpd user the file contents must be:
177 Defaults:lighttpd !requiretty
178 lighttpd ALL=NOPASSWD: /usr/sbin/bconsole
179 lighttpd ALL=NOPASSWD: /usr/sbin/bdirjson
180 lighttpd ALL=NOPASSWD: /usr/sbin/bsdjson
181 lighttpd ALL=NOPASSWD: /usr/sbin/bfdjson
182 lighttpd ALL=NOPASSWD: /usr/sbin/bbconsjson
185 \section{Installation Baculum API from deb binary packages}
188 Before start using Baculum API and Baculum Web version 9.0.0 please backup
189 your Bacula configuration in safe place. It is specially important because
190 on first save config action the Bacula configuration is joined into one file
191 per Bacula component.\\
193 For deb binary there are the following packages:
196 \item baculum-api - main Baculum API package with application files
197 \item baculum-api-apache2 - Apache web server configuration files for Baculum API
198 \item baculum-api-lighttpd - Lighttpd web server configuration files for Baculum API
199 \item baculum-common - Common files for Baculum API and Baculum Web
200 \item baculum-web - main Baculum Web package with application files
201 \item baculum-web-apache2 - Apache web server configuration files for Baculum Web
202 \item baculum-web-lighttpd - Lighttpd web server configuration files for Baculum Web
205 \subsection{Add the Baculum deb repository}
207 To add the Baculum repository, first import the Baculum public key:
210 wget -qO - http://bacula.org/downloads/baculum/baculum.pub | apt-key add -
213 Once the key is imported, the next step is to create
217 /etc/apt/sources.list.d/baculum.list
220 For Debian 8 Jessie the contents should be:
223 deb http://bacula.org/downloads/baculum/stable/debian jessie main
224 deb-src http://bacula.org/downloads/baculum/stable/debian jessie main
227 For Debian 9 Stretch the contents should be:
230 deb http://bacula.org/downloads/baculum/stable/debian stretch main
231 deb-src http://bacula.org/downloads/baculum/stable/debian stretch main
234 For Ubuntu 16.04 Xenial the contents should be:
236 deb [ arch=amd64 ] http://bacula.org/downloads/baculum/stable/ubuntu xenial main
237 deb-src http://bacula.org/downloads/baculum/stable/ubuntu xenial main
241 After adding repository definition, please refresh repository indexes:
246 \subsection{Installation for Apache}
248 To install Baculum API access via Apache Web server by using apt
249 packages manager use the command:
252 apt-get install baculum-common baculum-api baculum-api-apache2
255 Next you must enable mod\_rewrite module for Apache, with the
262 and include Baculum VirtualHost definition in the Apache configuration
269 The restart your Apache server with:
272 service apache2 restart
275 \subsection{Installation for Lighttpd}
277 Example installation with access via Lighttpd web server looks following:
280 apt-get install baculum-common baculum-api baculum-api-lighttpd
283 Start Baculum API as application available through Lighttpd web server:
286 service baculum-api-lighttpd start
289 \subsection{Access to bconsole via sudo for Apache and Lighttpd}
291 Baculum API requires access to Bconsole and to the Bacula JSON programs.
292 To configure Bconsole sudo access we strongly recommend that you create
293 a Baculum sudoers.d file, which should be in /etc/sudoers.d/baculum:
295 {\bf Note}, please define sudo for the Bacula JSON programs only when
296 you are going use Bacula configuration module in the Baculum.
298 Both for Apache and Lighttpd user the file contents can be:
301 Defaults:www-data !requiretty
302 www-data ALL=NOPASSWD: /usr/sbin/bconsole
303 www-data ALL=NOPASSWD: /usr/sbin/bdirjson
304 www-data ALL=NOPASSWD: /usr/sbin/bsdjson
305 www-data ALL=NOPASSWD: /usr/sbin/bfdjson
306 www-data ALL=NOPASSWD: /usr/sbin/bbconsjson
309 \section{Debugging your First Baculum API Login}
310 At each step of the initial login to Baculum, the
311 screen will have a test button that will allow you
312 to check to see if your parameters were correctly
313 entered. If not, you will see error message on the
314 wizard page. You can also get additional detail by
315 examining the Apache error log, that is usually
319 /var/log/httpd/baculum-api-error.log
322 If you use Lighttpd thento get additional detail you can check:
325 /var/log/lighttpd/baculum-api-error.log
328 In addition, special debug output is placed by Baculum in
332 /usr/share/baculum/htdocs/protected/API/Logs/baculum-api.log
335 The debug you can enable in file:
337 /usr/share/baculum/htdocs/protected/API/Config/api.conf
340 by switching in [api] section option debug to "1".
342 With the information in those two files, you can usually quickly
343 find and correct most problems.
347 \section{Installation Baculum Web from rpm binary packages}
349 \subsection{Installation for the Apache}
351 Install the Baculum Web for the Apache Web server as follows:
354 yum install baculum-common baculum-web baculum-web-httpd
357 Restart your Apache Web server:
360 service httpd restart
363 \subsection{Installation for Lighttpd}
365 Installation on system with access via Lighttpd is as follows
368 yum install baculum-common baculum-web baculum-web-lighttpd
371 Please note that in case CentOS distribution the Lighttpd web server is
372 available in the distribution packages after enabling the EPEL repository.
374 Start Baculum as application using the Lighttpd Web server:
377 service baculum-web-lighttpd start
380 \section{Installation Baculum Web from deb binary packages}
382 \subsection{Installation for Apache}
384 To install Baculum Web access via Apache Web server by using apt
385 packages manager use the command:
388 apt-get install baculum-common baculum-web baculum-web-apache2
391 Next you must enable mod\_rewrite module for Apache, with the
398 and include Baculum VirtualHost definition in the Apache configuration
405 The restart your Apache server with:
408 service apache2 restart
411 \subsection{Installation for Lighttpd}
413 Example installation with access via Lighttpd web server looks following:
416 apt-get install baculum-common baculum-web baculum-web-lighttpd
419 Start Baculum Web as application available through Lighttpd web server:
422 service baculum-web-lighttpd start
425 \section{Running Baculum API and Web for the First Time}
427 \subsection{Running Baculum API}
429 Access to Baculum API from web browser: \textbf{http://localhost:9096}
431 First time login: \textbf{admin}
433 First time password: \textbf{admin}
436 \subsection{Running Baculum Web}
438 Access to Baculum Web from web browser: \textbf{http://localhost:9095}
440 First time login: \textbf{admin}
442 First time password: \textbf{admin}
444 \section{Installation wizards}
446 \textbf{Installation with HTTP Basic authentication}
448 \includegraphics[width=\linewidth]{baculum_install_basic.png}
452 \textbf{Installation with OAuth2 authorization}
454 \includegraphics[width=\linewidth]{baculum_install_oauth2.png}
458 \section{Baculum API endpoints}
462 GET /api/clients - get records all clients
464 GET /api/clients/limit/4 - get records first 4 clients
466 GET /api/clients/2 - get records only for client with clientid equal 2
468 GET /api/clients/show - get 'show clients' bconsole command
470 GET /api/clients/show/2 - get 'show client=xxx' bconsole command for client with clientid equal 2
472 GET /api/clients/status/2 - get 'status client=xxx' bconsole command for client with clientid equal 2
474 GET /api/clients/jobs/2 - get all jobs done by client with clientid equal 2\\
483 2 - Problem with connection to database.
485 3 - Database access is not supported by this API instance.
487 4 - Problem with connection to bconsole.
489 5 - Invalid director.
491 6 - Problem with authorization to Baculum API.
493 7 - Access attempt to not allowed resource. Permission denied.
495 10 - Client with inputted clientid does not exists.
497 1000 - Internal error.
499 \subsection{Storages}
501 GET /api/storages/ - get records all storages.
503 GET /api/storages/limit/25 - get records first 25 storages.
505 GET /api/storages/3 - get records only for storage with storageid equal 3.
507 GET /api/storages/show - get 'show storages' bconsole command.
509 GET /api/storages/show/3 - get 'show storage=xxx' bconsole command for storage with storageid equal 3.
511 GET /api/storages/status/3 - get 'status storage=xxx' bconsole command for storage with storageid equal 3.
513 GET /api/storages/mount/3/2/17 - mount storage with storageid equal 3, drive number 2 and volume in slot number 17.
515 GET /api/storages/umount/3/1 - umount storage with storageid equal 3 and drive number 1.
517 GET /api/storages/release/3 - release storage with storageid equal 3.\\
526 2 - Problem with connection to database.
528 3 - Database access is not supported by this API instance.
530 4 - Problem with connection to bconsole.
532 5 - Invalid director.
534 6 - Problem with authorization to Baculum API.
536 7 - Access attempt to not allowed resource. Permission denied.
538 20 - Storage with inputted storageid does not exists.
540 1000 - Internal error.
544 GET /api/volumes/ - get records all volumes.
546 GET /api/volumes/limit/50 - get records first 50 volumes.
548 GET /api/volumes/5 - get records only for volume with mediaid equal 5.
550 GET /api/volumes/prune/5 - call prune action on volume with mediaid equal 5.
552 GET /api/volumes/purge/5 - call purge action on volume with mediaid equal 5.
554 GET /api/volumes/jobs/5 - get all jobs done on volume with mediaid equal 5.\\
563 2 - Problem with connection to database.
565 3 - Database access is not supported by this API instance.
567 4 - Problem with connection to bconsole.
569 5 - Invalid director.
571 6 - Problem with authorization to Baculum API.
573 7 - Access attempt to not allowed resource. Permission denied.
575 30 - Volume with inputted mediaid does not exists.
577 1000 - Internal error.
581 GET /api/pools/ - get records all pools.
583 GET /api/pools/limit/15 - get records first 15 pools.
585 GET /api/pools/7 - get records only for pool with poolid equal 7.
587 GET /api/pools/show - get 'show pools' bconsole command.
589 GET /api/pools/show/7 - get 'show pool=xxx' bconsole command for pool with poolid equal 7.
591 PUT /api/pools/update/7 - call 'update pool=xxx' bconsole command for pool with poolid equal 7.\\
600 2 - Problem with connection to database.
602 3 - Database access is not supported by this API instance.
604 4 - Problem with connection to bconsole.
606 5 - Invalid director.
608 6 - Problem with authorization to Baculum API.
610 7 - Access attempt to not allowed resource. Permission denied.
612 40 - Pool with inputted poolid does not exists.
614 1000 - internal error.\\
618 GET /api/jobs/ - get records all jobs.
620 GET /api/jobs/limit/20 - get records first 20 jobs.
622 GET /api/jobs/8 - get records only for job with jobid equal 8.
624 GET /api/jobs/tasks/ - get job names for all directors
626 GET /api/jobs/tasks/type/B - get backup job names
628 GET /api/jobs/tasks/type/R/limit/5 - get first 5 restore job names
630 GET /api/jobs/recent/myjob/client/myclient-fd/filesetid/62/ - get most
631 recent job identifiers for job "myjob", client "myclient-fd" and fileset
634 GET /api/jobs/recent/myjob/clientid/31/filesetid/62/ - get most
635 recent job identifiers for job "myjob", client with clientid 21 and fileset
638 POST /jobs/estimate/ - call estimate action on a job.
641 +-----------------------------------------------------------------------------+
642 | /api/jobs/estimate/ POST request |
643 +-------------------+---------+-----------------------------------------------+
644 | Name | Type | Description |
645 +-------------------+---------+-----------------------------------------------+
646 | create[id] * | integer | job id to get job name for estimate purpose |
647 | | | (used instead job name) |
648 +-------------------+---------+-----------------------------------------------+
649 | create[name] * | string | job name to estimate (used instead of jobid) |
651 +-------------------+---------+-----------------------------------------------+
652 | create[fileset] * | string | FileSet resource name |
654 +-------------------+---------+-----------------------------------------------+
655 | create[level] * | string | Job level in short form. |
656 | | | One case sensitive letter: |
658 | | | I => Incremental |
659 | | | D => Differential |
661 | | | f => VirtualFull |
662 | | | V => InitCatalog |
664 | | | O => VolumeToCatalog |
665 | | | d => DiskToCatalog |
666 +-------------------+---------+-----------------------------------------------+
667 | create[clientid] *| integer | Client identifier |
668 | | | (used instead of client name) |
669 +-------------------+---------+-----------------------------------------------+
670 | create[client] * | string | Client name (used instead of client id) |
672 +-------------------+---------+-----------------------------------------------+
673 | create[accurate] *| integer | Enable accurate mode: 0 - no, 1 - yes |
675 +-------------------+---------+-----------------------------------------------+
680 POST /api/jobs/run/ - call run action on job (run job).
683 +-----------------------------------------------------------------------------+
684 | /api/jobs/run/ POST request |
685 +-------------------+---------+-----------------------------------------------+
686 | Name | Type | Description |
687 +-------------------+---------+-----------------------------------------------+
688 | create[id] * | integer | job id to get job name to run |
689 | | | (used instead job name) |
690 +-------------------+---------+-----------------------------------------------+
691 | create[name] * | string | job name to run (used instead of jobid) |
693 +-------------------+---------+-----------------------------------------------+
694 | create[level] * | string | Job level in short form. |
695 | | | One case sensitive letter: |
697 | | | I => Incremental |
698 | | | D => Differential |
700 | | | f => VirtualFull |
701 | | | V => InitCatalog |
703 | | | O => VolumeToCatalog |
704 | | | d => DiskToCatalog |
705 +-------------------+---------+-----------------------------------------------+
706 | create[fileset] * | string | FileSet resource name |
708 +-------------------+---------+-----------------------------------------------+
709 | create[clientid] *| integer | Client identifier |
710 | | | (used instead of client name) |
711 +-------------------+---------+-----------------------------------------------+
712 | create[client] * | string | Client name (used instead of client id) |
714 +-------------------+---------+-----------------------------------------------+
715 | create[storageid]*| integer | Storage identifier |
716 | | | (used instead of storage name) |
717 +-------------------+---------+-----------------------------------------------+
718 | create[storage] * | string | Storage name (used instead of storage id) |
720 +-------------------+---------+-----------------------------------------------+
721 | create[poolid] * | integer | Pool identifier (used instead of pool name) |
723 +-------------------+---------+-----------------------------------------------+
724 | create[pool] * | string | Pool name (used instead of pool id) |
726 +-------------------+---------+-----------------------------------------------+
727 | create[priority] | integer | Job priority to run |
729 +-------------------+---------+-----------------------------------------------+
730 | create[jobid] | integer | Job identifier for verify job |
732 +-------------------+---------+-----------------------------------------------+
733 | create[verifyjob] | string | Verify job name |
735 +-------------------+---------+-----------------------------------------------+
740 POST /api/jobs/restore/ - call restore action.
743 +-----------------------------------------------------------------------------+
744 | /api/jobs/restore/ POST request |
745 +-------------------+---------+-----------------------------------------------+
746 | Name | Type | Description |
747 +-------------------+---------+-----------------------------------------------+
748 | create[rpath] * | string | Bvfs temporary table name for restore purpose |
749 | | | in form: b2[0-9]+ |
750 +-------------------+---------+-----------------------------------------------+
751 | create[clientid] *| integer | Client identifier |
752 | | | (used instead of client name) |
753 +-------------------+---------+-----------------------------------------------+
754 | create[client] * | string | Client name (used instead of client id) |
756 +-------------------+---------+-----------------------------------------------+
757 | create[priority] | integer | Job priority to run |
759 +-------------------+---------+-----------------------------------------------+
760 | create[where] * | string | Destination directory for restored files |
762 +-------------------+---------+-----------------------------------------------+
763 | create[replace] * | string | Replace files in destination directory for |
764 | | | restored files. Available options: |
769 +-------------------+---------+-----------------------------------------------+
770 | create[restorejob]| string | Restore job name |
772 +-------------------+---------+-----------------------------------------------+
777 DELETE /api/jobs/8 - delete by bconsole job with jobid equal 8.\\
785 2 - Problem with connection to database.
787 3 - Database access is not supported by this API instance.
789 4 - Problem with connection to bconsole.
791 5 - Invalid director.
793 6 - Problem with authorization to Baculum API.
795 7 - Access attempt to not allowed resource. Permission denied.
797 50 - Job with inputted jobid does not exist.
799 51 - Inputed job level is invalid.
801 52 - Fileset resource does not exist.
803 53 - Client does not exist.
805 54 - Storage does not exist.
807 55 - Pool does not exist.
809 56 - [restore only] inputted rpath for restore is invalid. Proper format
812 57 - [restore only] inputted "where" option is invalid.
814 58 - [restore only] inputted "replace" option is invalid.
816 1000 - internal error.\\
820 PUT /api/bvfs/lsdirs/ - listing from Bvfs cache directories
822 PUT /api/bvfs/lsdirs/limit/250 - listing from Bvfs cache directories
823 limited to 250 elements.
825 PUT /api/bvfs/lsdirs/limit/250/100/ - listing from Bvfs cache directories
826 limited to 250 elements with offset equal 100.
829 +-----------------------------------------------------------------------------+
830 | /api/bvfs/lsdirs/ PUT request |
831 +-------------------+---------+-----------------------------------------------+
832 | Name | Type | Description |
833 +-------------------+---------+-----------------------------------------------+
834 | update[jobids] * | string | Job identifiers separated by comma character |
836 +-------------------+---------+-----------------------------------------------+
837 | update[path] * | string | Path to list directories in Bvfs job cache |
839 +-------------------+---------+-----------------------------------------------+
842 PUT /api/bvfs/lsfiles/ - listing from Bvfs cache files.
844 PUT /api/bvfs/lsfiles/limit/60/ - listing from Bvfs cache files limited
847 PUT /api/bvfs/lsfiles/limit/120/60/ - listing from Bvfs cache files limited
848 to 120 elements with offset equal 60
851 +-----------------------------------------------------------------------------+
852 | /api/bvfs/lsfiles/ PUT request |
853 +-------------------+---------+-----------------------------------------------+
854 | Name | Type | Description |
855 +-------------------+---------+-----------------------------------------------+
856 | update[jobids] * | string | Job identifiers separated by comma character |
858 +-------------------+---------+-----------------------------------------------+
859 | update[path] * | string | Path to list directories in Bvfs job cache |
861 +-------------------+---------+-----------------------------------------------+
864 GET /api/bvfs/versions/abc-fd/123/456/789/ - listing from Bvfs cache all
865 files versions for client named abc-fd, for jobid equal 123, for pathid
866 equal 456 and for filenameid equal 789. URL-encoded client name is necessary.
868 GET /api/bvfs/getjobids/9/ - listing from Bvfs cache all elementary jobids which
869 are necessary for restore all files from job with jobid equal 9 (eg. if jobid 9
870 is job type incremental or differential).
872 PUT /api/bvfs/update/ - updating Bvfs cache for specific job.
875 +-----------------------------------------------------------------------------+
876 | /api/bvfs/update/ PUT request |
877 +-------------------+---------+-----------------------------------------------+
878 | Name | Type | Description |
879 +-------------------+---------+-----------------------------------------------+
880 | update[jobids] * | string | Job identifiers separated by comma character |
882 +-------------------+---------+-----------------------------------------------+
885 POST /api/bvfs/restore/ - preparing Bvfs paths for restore command.
888 +-----------------------------------------------------------------------------+
889 | /api/bvfs/restore/ POST request |
890 +-------------------+---------+-----------------------------------------------+
891 | Name | Type | Description |
892 +-------------------+---------+-----------------------------------------------+
893 | create[jobids] * | string | job identifiers comma separated |
895 +-------------------+---------+-----------------------------------------------+
896 | create[dirid] | string | directory identifiers comma separated |
898 +-------------------+---------+-----------------------------------------------+
899 | create[fileid] | string | file identifiers comma separated |
901 +-------------------+---------+-----------------------------------------------+
902 | create[path] * | string | temporary Bvfs table table name |
903 | | | in form b2[0-9]+ |
904 +-------------------+---------+-----------------------------------------------+
909 PUT /api/bvfs/clear/ - call '.bvfs\_clear\_cache yes' bconsole command.\\
918 2 - Problem with connection to database.
920 3 - Database access is not supported by this API instance.
922 4 - Problem with connection to bconsole.
924 5 - Invalid director.
926 6 - Problem with authorization to Baculum API.
928 7 - Access attempt to not allowed resource. Permission denied.
930 70 - Job with inputted jobid does not exist.
932 71 - Inputted path for restore is invalid. Proper format is b2[0-9]+.
934 1000 - Internal error.
938 To configure the Bacula resources is used request in the following URL form:\\
940 PUT /api/config/COMPONENT\_TYPE/RESOURCE\_TYPE/RESOURCE\_NAME
943 \item COMPONENT\_TYPE: dir for Director, sd for Storage Daemon, fd for
944 File Daemon and bcons for Consoles
945 \item RESOURCE\_TYPE: Job, Client, Pool, Messages, Schedule, Storage...etc.
946 \item RESOURCE\_NAME: Resource name from 'Name' resource directive like
947 'My Client 123', 'Device-01', 'Pool-Incremental-2' ...etc.
950 Example config URLs:\\
952 PUT /api/config/dir/Client/myclient-fd - editing client 'myclient-fd'. If
953 the Client doesn't exist, it is created in config.
955 PUT /api/config/sd/Device/Drive-01 - editing device 'Drive-01'. If
956 the Device doesn't exist, it is created in config.
959 +-----------------------------------------------------------------------------+
960 | /api/config/component_type/resource_type/resource_name/ PUT request |
961 +-------------------+---------+-----------------------------------------------+
962 | Name | Type | Description |
963 +-------------------+---------+-----------------------------------------------+
964 | update[config] * | string | Bacula config in JSON format. |
966 | | | In versions lower than 9.0.6 instead of JSON |
967 | | | string there was used serialized associative |
969 +-------------------+---------+-----------------------------------------------+
978 6 - Problem with authorization to Baculum API.
980 7 - Access attempt to not allowed resource. Permission denied.
982 80 - JSON tools support is disabled.
984 81 - Problem with connection to a JSON tool.
986 82 - JSON tool returned wrong exitcode.
988 83 - JSON tool output was unable to parse.
990 84 - JSON tool not configured.
992 93 - Write to config file error.
994 94 - Config validation error.
996 1000 - Internal error.\\
999 Example cURL commands to test:
1002 curl -X PUT -d update["config"]='{"AutoPrune":false,"Catalog":"MyCatalog",
1003 "FdPort":9102,"MaximumConcurrentJobs":5,"Name":"easystar-fd","Address":
1004 "172.16.10.12","Password":"mypass"}'
1005 http://user:pass@apihost:9096/api/config/dir/Client/easystar-fd
1007 curl -X PUT -d update["config"]='{"RemovableMedia":true,"RandomAccess":false,
1008 "AutomaticMount":true,"AlwaysOpen":true,"OfflineOnUnmount":true,"DeviceType":
1009 "Tape","Name":"TapeDrive","MediaType":"LTO5","ArchiveDevice":"/dev/nst0",
1010 "SpoolDirectory":"/mnt/backup","MaximumOpenWait":300}'
1011 http://user:pass@apihost:9096/api/config/sd/Device/TapeDrive
1014 \section{Installation from the Source Tar File}
1016 You may also install Baculum from the source bacula-gui tar archive.
1018 To prepare Baculum runtime files one uses the Makefile file.
1019 To do this, after unpacking bacula-gui archive please go to Baculum main
1026 Then please run (depending on used distribution):
1028 For rpm-based distributions (example with /tmp/baculum-runtime destination
1032 make build DESTDIR=/tmp/baculum-runtime
1035 For deb-based distributions (example with /tmp/baculum-runtime destination
1039 make build DESTDIR=/tmp/baculum-release SAMPLETYPE=deb-template \
1040 HTTPDNAME=apache2 HTTPDSITECONF=sites-available
1043 After execution above command, in path /tmp/baculum-runtime should
1044 contain all required runtime files.
1046 The Base Baculum source files will be located in:
1049 /tmp/baculum-runtime/usr/share/baculum/htdocs/
1052 These are the files that should be placed in web server's document root (or
1053 Virtual Host document root) directory.
1055 Please note that for language files (including English)
1056 symbolic links must be created as shown below:
1059 /usr/share/locale/en/LC_MESSAGES/baculum.mo
1060 => /tmp/baculum-runtime/usr/share/baculum/htdocs/protected/Lang/en/baculum.mo
1062 /usr/share/locale/pl/LC_MESSAGES/baculum.mo
1063 => /tmp/baculum-runtime/usr/share/baculum/htdocs/protected/Lang/pl/baculum.mo
1065 /usr/share/locale/pt/LC_MESSAGES/baculum.mo
1066 => /tmp/baculum-runtime/usr/share/baculum/htdocs/protected/Lang/pt/baculum.mo
1068 /usr/share/locale/ja/LC_MESSAGES/baculum.mo
1069 => /tmp/baculum-runtime/usr/share/baculum/htdocs/protected/Lang/ja/baculum.mo
1072 Please also update the symbolic link to the Baculum settings directory in
1073 the following paths:
1076 /tmp/baculum-runtime/usr/share/baculum/htdocs/protected/API/Config
1077 /tmp/baculum-runtime/usr/share/baculum/htdocs/protected/Web/Config
1080 Other files are: web servers configuration files, systemd units, SELinux
1081 policy module and others. Please select and copy appropriate files to your
1082 system environment and edit their content if needed.
1084 You must set read/write privileges for the Web server user
1085 to the files and directories listed below:
1089 ./baculum/protected/Web/Config
1090 ./baculum/protected/API/Config
1091 ./baculum/protected/Web/baculum.users
1092 ./baculum/protected/API/baculum.users
1093 ./baculum/protected/runtime/
1096 \section{OAuth2 authorization}
1098 Baculum API can use OAuth2 for authorization and authentication.
1100 To obtain tokens there is used {\bf Authorization Code Grant} flow.
1101 Authorization and access token URLs are as follows:
1104 Authorization URL: /api/auth/
1105 Access Token URL: /api/token/
1108 Baculum API doesn't use refresh tokens. After expiration token the client
1109 application has to re-authorize again.
1111 Default expiration time for authorization code is 7 seconds, for access
1112 token 60 seconds. These values are changed in:
1115 /usr/share/baculum/htdocs/protected/Common/Class/OAuth2.php
1118 in constants AUTHORIZATION\_ID\_EXPIRES\_TIME and ACCESS\_TOKEN\_EXPIRES\_TIME.
1120 Default OAuth2 callback URL in Baculum Web is following:
1123 https://baculumgui:9095/web/redirect
1126 \subsection{Before running OAuth2}
1128 {\bf Important note before using OAuth2}
1130 When you decide to use OAuth2, you must change default HTTP Basic authorization
1131 setting. Otherwise OAuth2 will not work. It is for enabling OAuth2 acces for
1132 /api/ endpoints but still keep HTTP Basic protection for the Baculum API panel
1135 For Apache the change is about switching in Baculum API Apache config
1136 the Location tag from / to /api/page.
1139 # NOTE: When you use OAuth2 then change this location section
1140 # From: <Location />
1141 # To: <Location /api/page>
1145 AuthName "Baculum Auth"
1146 AuthUserFile /usr/share/baculum/htdocs/protected/API/Config/baculum.users
1152 For Lighttpd the change is about uncommenting in API Lighttpd config lines as
1153 described in comment below.
1157 # Uncomment this line and closing braces below when you use OAuth2
1159 # $HTTP["url"] =~ "^/web/page/.*$" {
1160 auth.backend = "htpasswd"
1161 auth.backend.htpasswd.userfile = "/usr/share/baculum/htdocs/protected/API/Config/baculum.users"
1162 auth.require = ( "/" => (
1163 "method" => "basic",
1164 "realm" => "Baculum Auth",
1165 "require" => "valid-user"
1172 \section{Screenshots}
1174 \includegraphics[width=\linewidth]{baculum01.png}
1178 \includegraphics[width=\linewidth]{baculum02.png}
1182 \includegraphics[width=\linewidth]{baculum03.png}
1186 \includegraphics[width=\linewidth]{baculum04.png}
1190 \includegraphics[width=\linewidth]{baculum05.png}
1194 \includegraphics[width=\linewidth]{baculum06.png}
1198 \includegraphics[width=\linewidth]{baculum07.png}