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

Fixes #10486: After running rudder-init, no connectivity to postgresql #1129

Merged
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
15 changes: 12 additions & 3 deletions techniques/system/server-roles/1.0/password-check.st
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ bundle agent root_password_check_file

"/root/.pgpass"
create => "true",
edit_line => root_password_check_file_pgpass("root_password_check_file.pgpass");
edit_line => root_password_check_file_pgpass("root_password_check_file.pgpass"),
classes => rudder_common_classes("rudder_postgres_pgpass");

methods:

root_server.file_ok.!file_repaired.!file_error::
root_server.file_ok.rudder_postgres_pgpass_kept.!(file_repaired|file_error|rudder_postgres_pgpass_repaired|rudder_postgres_pgpass_failed)::
"any" usebundle => rudder_common_report("server-roles", "result_success", "&TRACKINGKEY&", "Check rudder-passwords.conf and pgpass files", "None", "The Rudder passwords file is present and secure");

root_server.file_repaired.!file_error::
Expand All @@ -101,6 +102,14 @@ bundle agent root_password_check_file
root_server.file_error::
"any" usebundle => rudder_common_report("server-roles", "result_error", "&TRACKINGKEY&", "Check rudder-passwords.conf and pgpass files", "None", "EMERGENCY: THE ${g.rudder_base}/etc/rudder-passwords.conf FILE IS *ABSENT*. THIS RUDDER SERVER WILL *NOT* OPERATE CORRECTLY.");

root_server.rudder_postgres_pgpass_repaired.!rudder_postgres_pgpass_failed::
"any" usebundle => rudder_common_report("server-roles", "result_repaired", "&TRACKINGKEY&", "Check rudder-passwords.conf and pgpass files", "None", "The Postgresql .pgpass file was fixed");

root_server.rudder_postgres_pgpass_failed::
"any" usebundle => rudder_common_report("server-roles", "result_error", "&TRACKINGKEY&", "Check rudder-passwords.conf and pgpass files", "None", "Could not update the .pgpass file");



policy_server.!root_server::
"any" usebundle => rudder_common_report("server-roles", "result_success", "&TRACKINGKEY&", "Check rudder-passwords.conf and pgpass files", "None", "The Rudder passwords file does not need to be checked on relay servers. Skipping...");

Expand Down Expand Up @@ -230,7 +239,7 @@ bundle agent root_password_check_psql

commands:

psql_cant_connect::
psql_cant_connect|rudder_postgres_pgpass_repaired::

"/usr/bin/psql -q -c \"ALTER USER rudder WITH PASSWORD '${p.psql_password[2]}'\""
contain => setuid_sh("postgres"),
Expand Down