Skip to content

Commit e97e494

Browse files
authored
Fix/260 complex db passwords (#398)
Fix quoting of passwords in schema imports Fixes #260
1 parent 23a610e commit e97e494

File tree

12 files changed

+17
-11
lines changed

12 files changed

+17
-11
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
env:
6464
MOLECULE_DISTRO: ${{ matrix.distro }}
6565

66-
icinga-default-scenario-ansible-2.18:
66+
icinga-default-scenario-ansible-2-18:
6767
runs-on: ubuntu-latest
6868

6969
env:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
bugfixes:
2+
- |
3+
More complex database passwords have been an issue when importing database schemas. The passwords are now properly quoted using the :code:`quote` filter.
4+
This means that passwords containing characters such as :code:`#` and :code:`\` should now work correctly.
5+
6+
The change affects Icinga 2 (IDO), Icinga for Kubernetes, Icinga DB and Icinga Web 2.

roles/icinga2/tasks/features/idomysql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
{% if icinga2_dict_features.idomysql.ssl_cipher is defined %} --ssl-cipher "{{ icinga2_dict_features.idomysql.ssl_cipher }}" {%- endif %}
3535
{% if icinga2_dict_features.idomysql.extra_options is defined %} {{ icinga2_dict_features.idomysql.extra_options }} {%- endif %}
3636
-u "{{ icinga2_dict_features.idomysql.user | default('icinga2') }}"
37-
-p"{{ icinga2_dict_features.idomysql.password }}"
37+
-p{{ icinga2_dict_features.idomysql.password | quote }}"
3838
"{{ icinga2_dict_features.idomysql.database | default('icinga2') }}"
3939
4040
- name: MySQL check for IDO schema

roles/icinga2/tasks/features/idopgsql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- name: build psql command
2424
set_fact:
2525
psqlcmd: >-
26-
PGPASSWORD="{{ icinga2_dict_features.idopgsql.password }}"
26+
PGPASSWORD={{ icinga2_dict_features.idopgsql.password | quote }}
2727
psql
2828
"host={{ icinga2_dict_features.idopgsql.host| default('localhost') }}
2929
port={{ icinga2_dict_features.idopgsql.port| default('5432') }}

roles/icinga_kubernetes/tasks/manage_schema_mysql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{% if icinga_kubernetes_database_cert is defined %} --ssl-cert "{{ icinga_kubernetes_database_cert }}" {%- endif %}
1111
{% if icinga_kubernetes_database_key is defined %} --ssl-key "{{ icinga_kubernetes_database_key }}" {%- endif %}
1212
-u "{{ icinga_kubernetes_database_user | default('kubernetes') }}"
13-
-p"{{ icinga_kubernetes_database_password }}"
13+
-p{{ icinga_kubernetes_database_password | quote }}
1414
"{{ icinga_kubernetes_database_name | default('kubernetes') }}"
1515
1616
- name: MySQL check for Kubernetes schema

roles/icinga_kubernetes/tasks/manage_schema_pgsql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# - name: Build pgsql command
77
# ansible.builtin.set_fact:
88
# _tmp_pgsqlcmd: >-
9-
# PGPASSWORD="{{ icinga_kubernetes_database_password }}"
9+
# PGPASSWORD={{ icinga_kubernetes_database_password | quote }}
1010
# psql
1111
# "{% if icinga_kubernetes_database_host %} host="{{ icinga_kubernetes_database_host }}" {%- endif %}
1212
# {% if icinga_kubernetes_database_port is defined %} port={{ icinga_kubernetes_database_port }} {%- endif %}

roles/icingadb/tasks/manage_schema_mysql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{% if icingadb_database_cert is defined %} --ssl-cert "{{ icingadb_database_cert }}" {%- endif %}
1111
{% if icingadb_database_key is defined %} --ssl-key "{{ icingadb_database_key }}" {%- endif %}
1212
-u "{{ icingadb_database_user | default('icingadb') }}"
13-
-p"{{ icingadb_database_password }}"
13+
-p{{ icingadb_database_password | quote }}
1414
"{{ icingadb_database_name | default('icingadb') }}"
1515
1616
- name: MySQL check for IcingaDB schema

roles/icingadb/tasks/manage_schema_pgsql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- name: Build pgsql command
55
ansible.builtin.set_fact:
66
_tmp_pgsqlcmd: >-
7-
PGPASSWORD="{{ icingadb_database_password }}"
7+
PGPASSWORD={{ icingadb_database_password | quote }}
88
psql
99
"{% if icingadb_database_host %} host="{{ icingadb_database_host }}" {%- endif %}
1010
{% if icingadb_database_port is defined %} port={{ icingadb_database_port }} {%- endif %}

roles/icingaweb2/tasks/modules/manage_mysql_imports.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{% if _db['ssl_cipher'] is defined %} --ssl-cipher "{{ _db['ssl_cipher'] }}" {%- endif %}
1919
{% if _db['ssl_extra_options'] is defined %} {{ _db['ssl_extra_options'] }} {%- endif %}
2020
-u "{{ _db['user'] }}"
21-
-p"{{ _db['password'] }}"
21+
-p{{ _db['password'] | quote }}
2222
"{{ _db['name'] }}"
2323
2424
- name: MySQL check for db schema

roles/icingaweb2/tasks/modules/manage_pgsql_imports.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- name: Build pgsql command
1010
ansible.builtin.set_fact:
1111
_tmp_pgsqlcmd: >-
12-
PGPASSWORD="{{ _db['password'] }}"
12+
PGPASSWORD={{ _db['password'] | quote }}
1313
psql
1414
"{% if _db['host'] | default('localhost') != 'localhost' %} host={{ _db['host'] }}{%- endif %}
1515
{% if _db['port'] is defined %} port={{ _db['port'] }}{%- endif %}

0 commit comments

Comments
 (0)