-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add auditd logging to platform for intrusion detection #314
Conversation
WalkthroughThe recent changes enhance the server provisioning setup by integrating the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Ansible
participant Auditd
participant Grafana
participant Promtail
User->>Ansible: Trigger server provisioning
Ansible->>Auditd: Install and configure
Auditd-->>Ansible: Confirm installation
Ansible->>Grafana: Update dashboard configuration
Grafana-->>User: Provide audit log dashboard
User->>Promtail: Scrape logs
Promtail-->>User: Display processed logs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- infrastructure/ansible/playbooks/provision_servers.yml (1 hunks)
- infrastructure/ansible/roles/auditd/tasks/main.yml (1 hunks)
- infrastructure/ansible/roles/docker/handlers/main.yml (1 hunks)
- monitoring/docker-compose.yml (2 hunks)
- monitoring/grafana/dashboards/security/auditlogs.json (1 hunks)
- monitoring/promtail/promtail-config.yml (1 hunks)
Files skipped from review due to trivial changes (1)
- infrastructure/ansible/roles/docker/handlers/main.yml
Additional context used
yamllint
infrastructure/ansible/roles/auditd/tasks/main.yml
[error] 1-1: wrong new line character: expected \n
(new-lines)
Gitleaks
monitoring/grafana/dashboards/security/auditlogs.json
162-162: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
201-201: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
Additional comments not posted (13)
infrastructure/ansible/playbooks/provision_servers.yml (1)
7-7
: LGTM! Addition ofauditd
role is correct.The syntax is correct and the role is correctly placed under the roles section.
infrastructure/ansible/roles/auditd/tasks/main.yml (4)
2-5
: LGTM! Task to installauditd
is correctly defined.The task uses
apt
to installauditd
and ensures it is in the latest state.
7-10
: LGTM! Task to fetchauditd
config is correctly defined.The task fetches the
audit.rules
file from a URL and places it in the correct destination.
12-17
: LGTM! Task to ensurename_format
is set toHOSTNAME
is correctly defined.The task uses
lineinfile
to ensurename_format
is set toHOSTNAME
in theauditd.conf
file.
19-22
: LGTM! Task to restartauditd
service is correctly defined.The task uses
ansible.builtin.service
to restart theauditd
service.monitoring/promtail/promtail-config.yml (2)
12-46
: LGTM! Job configuration forcontainers
is correctly defined.The job configuration includes pipeline stages for log processing, such as JSON parsing, regex extraction, timestamp formatting, and label assignment.
48-69
: LGTM! Job configuration forauditd
is correctly defined.The job configuration includes pipeline stages for log processing, such as regex extraction and label assignment.
monitoring/grafana/dashboards/security/auditlogs.json (4)
1-23
: Annotations section looks good.The annotations section is well-formed and correctly configured for Grafana.
29-208
: Panels section looks good.The panels are well-configured and provide useful visualizations and information about audit logs.
Tools
Gitleaks
162-162: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
201-201: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
214-264
: Templating section looks good.The templating section is well-configured for querying and filtering logs.
267-277
: Time and metadata sections look good.The time, timepicker, and other metadata sections are correctly configured.
monitoring/docker-compose.yml (2)
233-237
: New entry forauditlogs.json
inconfigs
section looks good.The new entry for
auditlogs.json
is correctly configured with the file path and associated labels.
67-68
: New entry forauditlogs.json
inservices
section looks good.The new entry for
auditlogs.json
is correctly configured with the target and source paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (4)
infrastructure/ansible/README.md (4)
21-21
: Improve readability with punctuation and preposition correction.Consider adding a comma after "remote servers" and replacing "on" with "to".
- To authenticate users and to allow them to have sudo access on the remote servers your ssh key will need to be added to the `sudoers` var in the _/inventories/{ENVIRONMENT}/group_vars/all.yml_. + To authenticate users and to allow them to have sudo access to the remote servers, your ssh key will need to be added to the `sudoers` var in the _/inventories/{ENVIRONMENT}/group_vars/all.yml_.Tools
LanguageTool
[uncategorized] ~21-~21: The preposition ‘to’ seems more likely in this position.
Context: ...s and to allow them to have sudo access on the remote servers your ssh key will ne...(AI_HYDRA_LEO_REPLACE_ON_TO)
[uncategorized] ~21-~21: Possible missing comma found.
Context: ... them to have sudo access on the remote servers your ssh key will need to be added to t...(AI_HYDRA_LEO_MISSING_COMMA)
23-23
: Improve readability with punctuation correction.Consider adding a comma after "docker access".
- To authenticate users and to allow them to have docker access you need to add your ssh key to the `docker_users` var in the _/inventories/{ENVIRONMENT}/group_vars/all.yml_. + To authenticate users and to allow them to have docker access, you need to add your ssh key to the `docker_users` var in the _/inventories/{ENVIRONMENT}/group_vars/all.yml_.Tools
LanguageTool
[uncategorized] ~23-~23: Possible missing comma found.
Context: ... users and to allow them to have docker access you need to add your ssh key to the `d...(AI_HYDRA_LEO_MISSING_COMMA)
27-27
: Improve readability and grammar.Consider replacing "An" with "Any" and rephrasing to avoid repetition.
- An pre-authorised user will need to run the `provision_servers.yml` playbook the first time to add your ssh key to the servers. + Any pre-authorised user will need to run the `provision_servers.yml` playbook initially to add your ssh key to the servers.Tools
LanguageTool
[style] ~27-~27: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...edentials. An pre-authorised user will need to run theprovision_servers.yml
playboo...(REP_NEED_TO_VB)
37-37
: Correct verb agreement.Consider replacing "allow" with "allows" to agree with the subject.
- which only allow that communication to happen on the particular subset specified by this property. + which only allows that communication to happen on the particular subset specified by this property.Tools
LanguageTool
[uncategorized] ~37-~37: This verb does not appear to agree with the subject. Consider using a different form.
Context: ... firewall on each node (UFW) which only allow that communication to happen on the par...(AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- infrastructure/ansible/README.md (2 hunks)
Additional context used
LanguageTool
infrastructure/ansible/README.md
[uncategorized] ~21-~21: The preposition ‘to’ seems more likely in this position.
Context: ...s and to allow them to have sudo access on the remote servers your ssh key will ne...(AI_HYDRA_LEO_REPLACE_ON_TO)
[uncategorized] ~21-~21: Possible missing comma found.
Context: ... them to have sudo access on the remote servers your ssh key will need to be added to t...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~23-~23: Possible missing comma found.
Context: ... users and to allow them to have docker access you need to add your ssh key to the `d...(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~26-~26: “an” (indefinite article before a vowel sound) seems less likely than “any”.
Context: ...nch of Jembi staff's user credentials. An pre-authorised user will need to run th...(AI_HYDRA_LEO_CP_AN_ANY)
[style] ~27-~27: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...edentials. An pre-authorised user will need to run theprovision_servers.yml
playboo...(REP_NEED_TO_VB)
[uncategorized] ~37-~37: This verb does not appear to agree with the subject. Consider using a different form.
Context: ... firewall on each node (UFW) which only allow that communication to happen on the par...(AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)
Additional comments not posted (2)
infrastructure/ansible/README.md (2)
15-15
: Clarification improves documentation.The change to "server's domain name/s that you created via terraform" enhances clarity and flexibility in server identification.
25-25
: Security improvement.The change emphasizes the importance of removing unauthorized users, which enhances security.
Summary by CodeRabbit
New Features
auditd
service support for enhanced security and compliance during server provisioning.auditd
logs, improving log management and analysis capabilities.Bug Fixes
include
withimport_tasks
for better task organization in playbooks.Chores