Skip to content

Commit

Permalink
feat(fips): update packaging tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rajrohanyadav committed Jan 8, 2025
1 parent c53421f commit d25f367
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 112 deletions.
3 changes: 2 additions & 1 deletion test/packaging/ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ localhost ansible_connection=local
[testing_hosts]
amd64:debian-buster ansible_host=192.168.1.12 ansible_user=admin ansible_python_interpreter=/usr/bin/python3
amd64:centos7 ansible_host=192.168.1.13 ansible_user=centos ansible_python_interpreter=/usr/bin/python
amd64:centos7 ansible_host=192.168.1.13 ansible_user=centos ansible_python_interpreter=/usr/bin/python
amd64:al-2023-fips ansible_host=192.168.1.14 ansible_user=ec2-user ansible_python_interpreter=/usr/bin/python3 ansible_ssh_common_args='-o Ciphers=aes256-ctr,aes192-ctr,aes128-ctr -o KexAlgorithms=ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521 -o MACs=hmac-sha2-256,hmac-sha2-512'
```

## Playbooks
Expand Down
2 changes: 2 additions & 0 deletions test/packaging/ansible/agent-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

tasks:
- name: agent upgrade tests suite
# TODO: https://new-relic.atlassian.net/browse/NR-355851 Update when two releases with FIPS are done
# Also add FIPS tests
vars:
target_agent_version: "1.57.1"

Expand Down
25 changes: 17 additions & 8 deletions test/packaging/ansible/installation-pinned.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---

- name: installation-pinned
- name: Installation-pinned
hosts: testing_hosts_linux
become: true
gather_facts: yes
gather_facts: true

pre_tasks:
- name: Initial cleanup
include_role:
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
uninstall: true
Expand All @@ -18,16 +17,26 @@
target_agent_version: "1.57.1" # minimum version for ubuntu sles 15.6

block:

- name: install agent
include_role:
- name: Install agent
# when: "'-fips' not in inventory_hostname"
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
target_version: "{{ target_agent_version }}"
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"

# TODO: https://new-relic.atlassian.net/browse/NR-355845 Uncomment when FIPS version is available for the minimum version
# - name: Install agent - FIPS
# when: "'-fips' in inventory_hostname"
# ansible.builtin.include_role:
# name: caos.ansible_roles.infra_agent
# vars:
# target_version: "{{ target_agent_version }}"
# repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"
# fips_enabled: true

- name: Assert version
include_role:
ansible.builtin.include_role:
name: caos.ansible_roles.assert_version
vars:
target_versions:
Expand Down
61 changes: 34 additions & 27 deletions test/packaging/ansible/installation-privileged.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---

- name: installation-privileged
- name: Installation-privileged
hosts: testing_hosts_linux
become: true
gather_facts: yes
gather_facts: true

pre_tasks:
- name: Initial cleanup
include_role:
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
uninstall: true
Expand All @@ -21,30 +20,38 @@
NRIA_MODE: PRIVILEGED

block:
- name: Install agent
when: "'-fips' not in inventory_hostname"
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"

- name: install agent
include_role:
name: caos.ansible_roles.infra_agent
vars:
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"
- name: Install agent - FIPS
when: "'-fips' in inventory_hostname"
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"
fips_enabled: true

- name: assert privileged caps
include_role:
name: caos.ansible_roles.assert_privileged_caps
vars:
executable: "/usr/bin/newrelic-infra"
caps:
- cap_dac_read_search
- cap_sys_ptrace.ep
- name: Assert privileged caps
ansible.builtin.include_role:
name: caos.ansible_roles.assert_privileged_caps
vars:
executable: "/usr/bin/newrelic-infra"
caps:
- cap_dac_read_search
- cap_sys_ptrace.ep

- name: Assert rootless
include_role:
name: caos.ansible_roles.assert_files
vars:
processes:
- name: newrelic-infra-service
owner: "{{ agent_user }}"
files:
- name: /usr/bin/newrelic-infra
permissions: "{{ bin_mode }}"
- name: Assert rootless
ansible.builtin.include_role:
name: caos.ansible_roles.assert_files
vars:
processes:
- name: newrelic-infra-service
owner: "{{ agent_user }}"
files:
- name: /usr/bin/newrelic-infra
permissions: "{{ bin_mode }}"
...
21 changes: 15 additions & 6 deletions test/packaging/ansible/installation-root.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---

- name: installation-root
- name: Installation-root
hosts: testing_hosts_linux
become: true
gather_facts: yes
gather_facts: true

pre_tasks:
- name: Initial cleanup
include_role:
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
uninstall: true
Expand All @@ -20,14 +20,23 @@

block:

- name: install agent
include_role:
- name: Install agent
when: "'-fips' not in inventory_hostname"
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"

- name: Install agent - FIPS
when: "'-fips' in inventory_hostname"
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"
fips_enabled: true

- name: Assert root
include_role:
ansible.builtin.include_role:
name: caos.ansible_roles.assert_files
vars:
processes:
Expand Down
57 changes: 32 additions & 25 deletions test/packaging/ansible/installation-unprivileged.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---

- name: installation-unprivileged
- name: Installation-unprivileged
hosts: testing_hosts_linux
become: true
gather_facts: yes
gather_facts: true

pre_tasks:
- name: Initial cleanup
include_role:
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
uninstall: true
Expand All @@ -21,28 +20,36 @@
NRIA_MODE: UNPRIVILEGED

block:
- name: Install agent
when: "'-fips' not in inventory_hostname"
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"

- name: install agent
include_role:
name: caos.ansible_roles.infra_agent
vars:
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"
- name: Install agent - FIPS
when: "'-fips' in inventory_hostname"
ansible.builtin.include_role:
name: caos.ansible_roles.infra_agent
vars:
repo_endpoint: "http://nr-downloads-ohai-staging.s3-website-us-east-1.amazonaws.com/infrastructure_agent"
fips_enabled: true

- name: assert no privileged caps
include_role:
name: caos.ansible_roles.assert_privileged_caps
vars:
executable: "/usr/bin/newrelic-infra"
caps: []
- name: Assert no privileged caps
ansible.builtin.include_role:
name: caos.ansible_roles.assert_privileged_caps
vars:
executable: "/usr/bin/newrelic-infra"
caps: []

- name: Assert rootless
include_role:
name: caos.ansible_roles.assert_files
vars:
processes:
- name: newrelic-infra-service
owner: "{{ agent_user }}"
files:
- name: /usr/bin/newrelic-infra
permissions: "{{ bin_mode }}"
- name: Assert rootless
ansible.builtin.include_role:
name: caos.ansible_roles.assert_files
vars:
processes:
- name: newrelic-infra-service
owner: "{{ agent_user }}"
files:
- name: /usr/bin/newrelic-infra
permissions: "{{ bin_mode }}"
...
Loading

0 comments on commit d25f367

Please sign in to comment.