1 /*
2    Bacula(R) - The Network Backup Solution
3 
4    Copyright (C) 2000-2020 Kern Sibbald
5 
6    The original author of Bacula is Kern Sibbald, with contributions
7    from many others, a complete list can be found in the file AUTHORS.
8 
9    You may use this file and others of this release according to the
10    license defined in the LICENSE file, which includes the Affero General
11    Public License, v3.0 ("AGPLv3") and some additional permissions and
12    terms pursuant to its AGPLv3 Section 7.
13 
14    This notice must be preserved when any source code is
15    conveyed and/or propagated.
16 
17    Bacula(R) is a registered trademark of Kern Sibbald.
18 */
19 /*
20  * Bacula User Agent specific configuration and defines
21  *
22  *     Kern Sibbald, Sep MM
23  *
24  */
25 
26 /*
27  * Resource codes -- they must be sequential for indexing
28  */
29 
30 bool parse_cons_config(CONFIG *config, const char *configfile, int exit_code);
31 
32 enum {
33    R_CONSOLE   = 1001,
34    R_DIRECTOR,
35    R_FIRST     = R_CONSOLE,
36    R_LAST      = R_DIRECTOR           /* Keep this updated */
37 };
38 
39 /*
40  * Some resource attributes
41  */
42 enum {
43    R_NAME     = 1020,
44    R_ADDRESS,
45    R_PASSWORD,
46    R_TYPE,
47    R_BACKUP
48 };
49 
50 
51 /* Definition of the contents of each Resource */
52 
53 /* Console "globals" */
54 struct CONRES {
55    RES   hdr;
56    char *rc_file;                     /* startup file */
57    char *password;                    /* UA server password */
58    bool comm_compression;             /* Enable comm line compression */
59    bool tls_authenticate;             /* Authenticate with TLS */
60    bool tls_enable;                   /* Enable TLS on all connections */
61    bool tls_psk_enable;               /* Enable TLS-PSK on all connections */
62    bool tls_require;                  /* Require TLS on all connections */
63    char *tls_ca_certfile;             /* TLS CA Certificate File */
64    char *tls_ca_certdir;              /* TLS CA Certificate Directory */
65    char *tls_certfile;                /* TLS Client Certificate File */
66    char *tls_keyfile;                 /* TLS Client Key File */
67    char *director;                    /* bind to director */
68    utime_t heartbeat_interval;        /* Interval to send heartbeats to Dir */
69    bool require_fips;                  /* Check for FIPS module */
70    TLS_CONTEXT *tls_ctx;              /* Shared TLS Context */
71    TLS_CONTEXT *psk_ctx;              /* Shared TLS-PSK Context */
72 };
73 
74 /* Director */
75 struct DIRRES {
76    RES   hdr;
77    uint32_t DIRport;                  /* UA server port */
78    char *address;                     /* UA server address */
79    char *password;                    /* UA server password */
80    bool tls_authenticate;             /* Authenticate with TLS */
81    bool tls_enable;                   /* Enable TLS */
82    bool tls_psk_enable;               /* Enable TLS-PSK */
83    bool tls_require;                  /* Require TLS */
84    bool require_fips;                  /* Check for FIPS module */
85    char *tls_ca_certfile;             /* TLS CA Certificate File */
86    char *tls_ca_certdir;              /* TLS CA Certificate Directory */
87    char *tls_certfile;                /* TLS Client Certificate File */
88    char *tls_keyfile;                 /* TLS Client Key File */
89    utime_t heartbeat_interval;        /* Interval to send heartbeats to Dir */
90    char *hist_file;                   /* command history file */
91    int32_t hist_file_size;            /* command history file size */
92 
93    TLS_CONTEXT *tls_ctx;              /* Shared TLS Context */
94    TLS_CONTEXT *psk_ctx;              /* Shared TLS-PSK Context */
95 };
96 
97 
98 /* Define the Union of all the above
99  * resource structure definitions.
100  */
101 union URES {
102    DIRRES res_dir;
103    CONRES res_cons;
104    RES hdr;
105 };
106 
107 /* Get the size of a give resource */
108 int get_resource_size(int type);
109