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

sap_hana_install: Add support for fapolicyd #727

Merged
merged 28 commits into from
Jun 14, 2024

Conversation

berndfinger
Copy link
Member

@berndfinger berndfinger commented Apr 26, 2024

This PR adds support for fapolicyd:

  • The presence of the package fapolicyd is ensured.
  • The integrity setting in /etc/fapolicyd/fapolicyd.conf will be sha256 instead of the default none.
  • The presence of a new fapolicyd rule file in /etc/faplicyd/rules.d, for protecting shell scripts, is ensured.
  • The presence of all executables under /hana and /usr/sap in fapolicyd trust files in /etc/faplicyd/trust.d is ensured.
  • The service fapolicyd is enabled and running.

I introduced a new role parameter, sap_hana_install_root_path which is needed for this functionality, and replaced /hana by this variable and /hana/shared by its corresponding variable.

I also modified yes/no to true/false in defaults/main.yml so we over time only use those for all roles.

Solves #728.

Also use role parameters for /hana and /hana/shared where possible.

Signed-off-by: Bernd Finger <[email protected]>
... for the name of the fapolicyd trusted files file.

Signed-off-by: Bernd Finger <[email protected]>
... if fapolicyd is to be used.
Also replace yes by true and no by false in defaults/main.yml.

Signed-off-by: Bernd Finger <[email protected]>
- Add all files with mime type pattern '/x-'
- Support more than one directory which contains executable files
- Use a separate fapolicyd trust file for each directory

Signed-off-by: Bernd Finger <[email protected]>
- add support for setting the fapolicyd integrity levels
  default: sha256
- use /hana/shared and /usr/sap for the directories to be scanned
- rename parameter sap_hana_install_directories_with_executables to
  sap_hana_install_fapolicyd_trusted_directories
- reduce line lengths in some cases

Signed-off-by: Bernd Finger <[email protected]>
... for the paths to be searched for executables, so the paths are
identical to those used to set the file contexts for SELinux

Signed-off-by: Bernd Finger <[email protected]>
...after modifying the fapolicyd config file

Signed-off-by: Bernd Finger <[email protected]>
... for multiple directories

Signed-off-by: Bernd Finger <[email protected]>
... and some further tweaking

Signed-off-by: Bernd Finger <[email protected]>
Copy link
Member

@rhmk rhmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please correct the comments, they are misleading. The rest looks fine for me

@berndfinger
Copy link
Member Author

berndfinger commented Jun 7, 2024

please correct the comments, they are misleading. The rest looks fine for me

Thanks for your review! All good now (I hope).

- We use sap_hana_install_shared_path in favor of sap_hana_install_install_path
- If present (e.g. in playbooks or inventories), we use the first directory component
  of sap_hana_install_install_path for sap_hana_install_root_path and we assign
  sap_hana_install_install_path to sap_hana_install_shared_path.

Examples:
If sap_hana_install_install_path is defined as '/hana_01/shared', the following variables
will be set:

sap_hana_install_root_path.: '/hana_01'
sap_hana_install_shared_path: '/hana_01/shared'

If sap_hana_install_install_path is not defined, the following variables will be set:

sap_hana_install_root_path.: '/hana'
sap_hana_install_shared_path: '/hana/shared'

Signed-off-by: Bernd Finger <[email protected]>
Copy link
Member

@rhmk rhmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@sean-freeman sean-freeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with backwards compatibility for the var names of directory paths (i.e. /hana)

@berndfinger berndfinger merged commit f5ffb3a into sap-linuxlab:dev Jun 14, 2024
3 of 4 checks passed
@berndfinger berndfinger deleted the hana_install_fapolicyd branch June 14, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants