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

MON-106121-gorgone-use-vault-autonomous-library #1791

Merged
merged 20 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
380ba1c
fix(gorgone): comment the function and code
Evan-Adam Oct 22, 2024
c96ba15
tests(gorgone): Add a whole gorgone configuration to be checked by un…
Evan-Adam Oct 22, 2024
bbca10b
tests(gorgone): finish tests of existing configuration
Evan-Adam Oct 22, 2024
500c88b
feat(gorgone): interpret vault secret in gorgone configuration
Evan-Adam Oct 22, 2024
3b83ce0
doc(gorgone): Add vault option in documentation
Evan-Adam Oct 22, 2024
c3bea24
ci(gorgone): launch gorgone build when tests are modified
Evan-Adam Oct 28, 2024
976f65b
feat(gorgone): Add Gorgone dependency on centreon-perl-libs-common fo…
Evan-Adam Nov 19, 2024
1769d0f
ci(gorgone): Gorgone unit test run on the CI.
Evan-Adam Nov 19, 2024
d17863d
ci(gorgone): fix unit tests
Evan-Adam Nov 25, 2024
1dedf95
ci(gorgone): fix cache key
Evan-Adam Nov 25, 2024
b6131f8
fix(gorgone): use new common libs.
Evan-Adam Nov 25, 2024
92f8ef6
tests(gorgone): use gorgone log format to fix automated tests
Evan-Adam Nov 25, 2024
b1e81e6
feat(gorgone): remove Gorgone specific log library
Evan-Adam Nov 26, 2024
8b3fc53
tests(gorgone): add more vault test in automated tests
Evan-Adam Nov 26, 2024
2c1ece1
ci(gorgone): don't deliver package if test don't pass
Evan-Adam Nov 27, 2024
f31eb5e
doc(gorgone): add vault documentation in gorgone
Evan-Adam Nov 27, 2024
7098a2d
fix(gorgone): change after review
Evan-Adam Dec 2, 2024
106b4ef
Apply suggestions from code review
Evan-Adam Dec 9, 2024
9f9e753
Apply suggestions from code review
Evan-Adam Dec 10, 2024
79f2f38
Merge branch 'develop' into MON-106121-gorgone-use-vault-autonomous-l…
Evan-Adam Dec 10, 2024
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
2 changes: 1 addition & 1 deletion .github/actions/package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ runs:
name: Upload package artifacts
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: ${{ inputs.arch != '' && format('packages-{0}-{1}', inputs.distrib, inputs.arch) || format('packages-{0}', inputs.distrib) }}
name: ${{ inputs.arch != '' && format('packages-{0}-{1}', inputs.distrib, inputs.arch) || format('packages-{0}', inputs.distrib) }}-${{ inputs.stability }}
path: ./*.${{ inputs.package_extension}}
retention-days: 1
6 changes: 3 additions & 3 deletions .github/workflows/gorgone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Run unit tests
run: yath -L test ./perl-libs/lib/
run: yath -L test ./perl-libs/lib/ ./gorgone/tests/unit/

- name: Upload logs as artifacts if tests failed
if: failure()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: plugin-installation-${{ matrix.distrib }}
name: centreon-collect-perl-unit-tests-${{ matrix.distrib }}
path: ./lastlog.jsonl
retention-days: 1

Expand Down Expand Up @@ -330,7 +330,7 @@ jobs:

deliver-deb:
runs-on: [self-hosted, common]
needs: [get-environment, package]
needs: [get-environment, package, robot-test-gorgone, unit-test-perl]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}

strategy:
Expand Down
11 changes: 11 additions & 0 deletions gorgone/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,17 @@ configuration:
proxy_name: proxy
```

## *centreon vault*

Centreon vault is a tool to secure passwords present in the Centreon configuration.\
Evan-Adam marked this conversation as resolved.
Show resolved Hide resolved
It allows to store the password in a vault and retrieve it when needed by each component.\
Evan-Adam marked this conversation as resolved.
Show resolved Hide resolved
Gorgone allow to use a vault to store any string in the configuration. It cannot store an array or an hash.
Evan-Adam marked this conversation as resolved.
Show resolved Hide resolved

To use vault, report to the official documentation to set up vault and the configuration file in `/var/lib/centreon/vault/vault.json`\
Evan-Adam marked this conversation as resolved.
Show resolved Hide resolved
Then replace any password present in the gorgone configuration with a vault string. See the official format here :
Evan-Adam marked this conversation as resolved.
Show resolved Hide resolved

https://github.com/centreon/centreon-collect/blob/develop/perl-libs/lib/centreon/common/centreonvault.pm#L391

## *modules*

See the *configuration* titles of the modules documentations listed [here](../docs/modules.md).
11 changes: 9 additions & 2 deletions gorgone/gorgone/class/core.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use gorgone::class::listener;
use gorgone::class::frame;
use Time::HiRes;
use Try::Tiny;

use centreon::common::centreonvault;
my ($gorgone);

use base qw(gorgone::class::script);
Expand Down Expand Up @@ -163,10 +163,17 @@ sub init {
$self->{logger}->writeLogError("[core] can't find config file '$self->{config_file}'");
exit(1);
}
# before loading the config, we need to load initialize vault.
# Gorgone don't know how to reload for now, but once it will be done, we will need to retry the vault connexion if it failed when starting, and read again the configuration
$self->{vault_file} = defined($self->{vault_file}) ? $self->{vault_file} : '/var/lib/centreon/vault/vault.json';
$self->{vault} = centreon::common::centreonvault->new(logger => $self->{logger}, 'config_file' => $self->{vault_file});

$self->{config} = $self->yaml_load_config(
file => $self->{config_file},
file => $self->{config_file},
# the filter is used to remove anything from the configuration not related to gorgone or centreon
filter => '!($ariane eq "configuration##" || $ariane =~ /^configuration##(?:gorgone|centreon)##/)'
);

$self->init_server_keys();

$self->{config}->{configuration}->{gorgone}->{gorgonecore}->{external_com_zmq_tcp_keepalive} =
Expand Down
256 changes: 0 additions & 256 deletions gorgone/gorgone/class/logger.pm

This file was deleted.

Loading