Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: TLS options #2

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 50 additions & 4 deletions meta/argument_specs.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,60 @@
---

# # bareos_dir_messages: Daemon

argument_specs:
main:
short_description: "Install and configure BareOS Console (bconsole) on your system."
short_description: "Install and configure Bareos Console (bconsole) on your system."
description: >
Install and configure BareOS Console (bconsole) on your system.
Install and configure Bareos Console (bconsole) on your system.
author: Adfinis
options:
bareos_console_directors:
type: "list"
description: "A list of directors to connect to."
elements: "dict"
required: true
options:
name:
type: "str"
required: true
description: >
The Director name used to identify the Director in the list of monitored daemons.
It is not required to be the same as the one defined in the Director’s configuration file.
address:
type: "str"
dir_port:
type: int
default: 9101
description:
type: "str"
address:
type: "str"
password:
type: "str"
required: true
description: "Will be stored as MD5 hash."
tls_enable:
type: "bool"
default: true
description: "Enable TLS support."
tls_verify_peer:
type: "bool"
default: false
description: >
If enabled, the CN of a certificate must match the Address or be in the “TLS Allowed CN” list.
tls_allowed_cns:
type: "list"
elements: "str"
description: >
CNs of the allowed peer certificates
tls_ca_cert:
type: "str"
description: >
Path of a PEM encoded TLS CA certificate(s) file.
tls_cert:
type: "str"
description: >
Path of a PEM encoded TLS certificate.
tls_key:
type: "str"
description: >
Path of a PEM encoded private key. It must correspond to the specified `tls_cert`.
16 changes: 12 additions & 4 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- name: Converge
hosts: all
become: yes
gather_facts: yes
become: true
gather_facts: true

roles:
- role: ansible-role-bareos_console
Expand All @@ -11,5 +11,13 @@
address: localhost
password: "MySuperSecretPassword"
description: "Bareos Console credentials for local Director"
tls_enable: yes
tls_verify_peer: no
tls_enable: true
tls_verify_peer: false
dir_port: 1337
tls_ca_cert: "/home/data/testCA.pem"
tls_cert: "/home/data/test.pem"
tls_key: "/home/data/test.key"
tls_allowed_cns:
- "bareos.example.com"
- "bareos-webui.example.com"
- "bareos-console.example.com"
30 changes: 22 additions & 8 deletions templates/bconsole.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,36 @@
{% if bareos_console_directors is defined %}
{% for director in bareos_console_directors %}
Director {
Name = "{{ director.name }}"
Name = "{{ director.name }}"
{% if director.description is defined %}
Description = "{{ director.description }}"
Description = "{{ director.description }}"
{% endif %}
{% if director.address is defined %}
Address = "{{ director.address }}"
Address = "{{ director.address }}"
{% endif %}
Dir Port = {{ director.dir_port | default("9101") }}
{% if director.password is defined %}
Password = "[md5]{{ director.password | md5 }}"
{% endif %}
{% if director.tls_enable is defined %}
TLS Enable = {{ director.tls_enable | ternary('Yes', 'No') }}
Password = "[md5]{{ director.password | md5 }}"
{% endif %}
TLS Enable = {{ director.tls_enable | default(true) | ternary('Yes', 'No') }}
{% if director.tls_verify_peer is defined %}
TLS Verify Peer = {{ director.tls_verify_peer | ternary('Yes', 'No') }}
TLS Verify Peer = {{ director.tls_verify_peer | ternary('Yes', 'No') }}
{% endif %}
{% if director.tls_ca_cert is defined %}
TLS Ca Certificate File = "{{ director.tls_ca_cert }}"
{% endif %}
{% if director.tls_cert is defined %}
TLS Certificate = "{{ director.tls_cert }}"
{% endif %}
{% if director.tls_key is defined %}
TLS Key = "{{ director.tls_key }}"
{% endif %}
{% if director.tls_allowed_cns is defined %}
{% for cn in director.tls_allowed_cns %}
TLS Allowed CN = "{{ cn }}"
{% endfor %}
{% endif %}

}
{% endfor %}
{% endif %}
Loading