summaryrefslogtreecommitdiffstats
path: root/roles/common/templates
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-06-03 21:13:10 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 02:54:20 +0200
commit00d6d904dc26592553ba93710c205603757e3faf (patch)
tree09ce9d1f3257da4303362317b04a596f4e0df741 /roles/common/templates
parentab03c7c75d91667dbc30f9ce1f66fe343fb9f93b (diff)
Configure Bacula File Daemon / Storage Daemon / Director.
Using client-side data signing/encryption and wrapping inter-host communication into stunnel.
Diffstat (limited to 'roles/common/templates')
-rw-r--r--roles/common/templates/etc/bacula/bacula-fd.conf.j241
-rw-r--r--roles/common/templates/etc/iptables/services.j210
-rw-r--r--roles/common/templates/etc/stunnel/bacula-fd.conf.j262
3 files changed, 113 insertions, 0 deletions
diff --git a/roles/common/templates/etc/bacula/bacula-fd.conf.j2 b/roles/common/templates/etc/bacula/bacula-fd.conf.j2
new file mode 100644
index 0000000..a47bb90
--- /dev/null
+++ b/roles/common/templates/etc/bacula/bacula-fd.conf.j2
@@ -0,0 +1,41 @@
+#
+# Default Bacula File Daemon Configuration file
+#
+# For Bacula release 5.2.6 (21 February 2012) -- debian jessie/sid
+
+#
+# List Directors who are permitted to contact this File daemon
+#
+{% for dir in groups['bacula-dir'] | sort %}
+Director {
+ Name = {{ hostvars[dir].inventory_hostname_short }}-dir
+ @|"sed -n '/^{{ hostvars[dir].inventory_hostname_short }}-dir\\s/ {s//Password = /p; q}' /etc/bacula/passwords-fd"
+}
+
+# Send all messages except skipped files back to Director
+Messages {
+ Name = Standard
+ director = {{ hostvars[dir].inventory_hostname_short }}-dir = all, !skipped, !restored
+}
+{% endfor %}
+
+#
+# "Global" File daemon configuration specifications
+#
+FileDaemon { # define myself
+ Name = {{ inventory_hostname_short }}-fd
+ Working Directory = /var/lib/bacula
+ Pid Directory = /var/run/bacula
+ Maximum Concurrent Jobs = 20
+ FDAddress = 127.0.0.1
+ FDPort = 9112
+ FDSourceAddress = 127.0.0.1
+{% if 'bacula-dir' not in group_names or 'bacula-sd' not in group_names %}
+ Heartbeat Interval = 60s
+{% endif %}
+
+ PKI Signatures = Yes # Enable Data Signing
+ PKI Encryption = Yes # Enable Data Encryption
+ PKI Keypair = /etc/bacula/ssl/{{ inventory_hostname_short }}.pem # Public and Private Keys
+ PKI Master Key = /etc/bacula/ssl/master.pem # ONLY the Public Key
+}
diff --git a/roles/common/templates/etc/iptables/services.j2 b/roles/common/templates/etc/iptables/services.j2
index 187e588..a0bb714 100644
--- a/roles/common/templates/etc/iptables/services.j2
+++ b/roles/common/templates/etc/iptables/services.j2
@@ -59,6 +59,16 @@ in tcp 80,443 # HTTP/HTTPS
out tcp 993 # IMAP
out tcp 4190 # MANAGESIEVE
{% endif %}
+{% if 'bacula-dir' in group_names and groups.all | difference(groups['bacula-dir']) %}
+out tcp 9102 # BACULA-FD
+{% elif groups['bacula-dir'] | difference([inventory_hostname]) %}
+in tcp 9102 # BACULA-FD
+{% endif %}
+{% if 'bacula-sd' in group_names and groups.all | difference(groups['bacula-sd']) %}
+in tcp 9103 # BACULA-SD
+{% elif groups['bacula-sd'] | difference([inventory_hostname]) %}
+out tcp 9103 # BACULA-SD
+{% endif %}
{% if 'LDAP-provider' in group_names %}
out tcp 11371 # HKP
diff --git a/roles/common/templates/etc/stunnel/bacula-fd.conf.j2 b/roles/common/templates/etc/stunnel/bacula-fd.conf.j2
new file mode 100644
index 0000000..74364c9
--- /dev/null
+++ b/roles/common/templates/etc/stunnel/bacula-fd.conf.j2
@@ -0,0 +1,62 @@
+; **************************************************************************
+; * Global options *
+; **************************************************************************
+
+; setuid()/setgid() to the specified user/group in daemon mode
+setuid = stunnel4
+setgid = stunnel4
+
+; PID is created inside the chroot jail
+pid = /var/run/stunnel4/bacula-fd.pid
+
+; Only log messages at severity warning (4) and higher
+debug = 4
+
+; **************************************************************************
+; * Service defaults may also be specified in individual service sections *
+; **************************************************************************
+
+; Certificate/key is needed in server mode and optional in client mode
+cert = /etc/stunnel/certs/{{ inventory_hostname_short }}-fd.pem
+key = /etc/stunnel/certs/{{ inventory_hostname_short }}-fd.key
+
+; Some performance tunings
+socket = l:TCP_NODELAY=1
+socket = r:TCP_NODELAY=1
+
+; Prevent MITM attacks
+verify = 4
+
+; Disable support for insecure protocols
+options = NO_SSLv2
+options = NO_SSLv3
+options = NO_TLSv1
+options = NO_TLSv1.1
+
+; These options provide additional security at some performance degradation
+options = SINGLE_ECDH_USE
+options = SINGLE_DH_USE
+
+; Select permitted SSL ciphers
+ciphers = EECDH+AES:EDH+AES:!MEDIUM:!LOW:!EXP:!aNULL:!eNULL:!SSLv2:!SSLv3:!TLSv1:!TLSv1.1
+
+; **************************************************************************
+; * Service definitions (remove all services for inetd mode) *
+; **************************************************************************
+
+[{{ inventory_hostname_short }}-fd]
+client = no
+accept = 9102
+connect = 9112
+CAfile = /etc/stunnel/certs/bacula-dirs.pem
+
+{% if 'bacula-sd' not in group_names %}
+[{{ hostvars[ groups['bacula-sd'][0] ].inventory_hostname_short }}-sd]
+client = yes
+accept = 127.0.0.1:9113
+connect = {{ groups['bacula-sd'][0] }}:9103
+delay = yes
+CAfile = /etc/stunnel/certs/{{ hostvars[ groups['bacula-sd'][0] ].inventory_hostname_short }}-sd.pem
+{% endif %}
+
+; vim:ft=dosini