Skip to content

Commit

Permalink
Merge pull request #546 from CrowdStrike/master-image-updates
Browse files Browse the repository at this point in the history
Master image updates
  • Loading branch information
redhatrises authored Aug 8, 2024
2 parents bc14fd9 + 2ac6bf8 commit 2106e53
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/falcon_configure_remove_aid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
ANSIBLE_FORCE_COLOR: 1
FALCON_CLIENT_ID: ${{ secrets.FALCON_CLIENT_ID }}
FALCON_CLIENT_SECRET: ${{ secrets.FALCON_CLIENT_SECRET }}
FALCON_PROV_TOKEN: ${{ secrets.FALCON_PROV_TOKEN }}
FALCON_CID: ${{ secrets.FALCON_CID }}
AWS_REGION: "us-west-2"
MOLECULE_VPC_SUBNET_ID: ${{ secrets.MOLECULE_VPC_SUBNET_ID }}
Expand Down
3 changes: 3 additions & 0 deletions changelogs/fragments/master-image-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- falcon_configure - fixed issue with master image and provisioning tokens (https://github.com/CrowdStrike/ansible_collection_falcon/pull/546)
- falconct_info - added support for querying provisioning tokens (https://github.com/CrowdStrike/ansible_collection_falcon/pull/546)
1 change: 1 addition & 0 deletions molecule/falcon_configure_remove_aid/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
vars:
falcon_option_set: yes
falcon_cid: "{{ lookup('env', 'FALCON_CID') }}"
falcon_provisioning_token: "{{ lookup('env', 'FALCON_PROV_TOKEN') }}"
falcon_tags: 'molecule,testing'
falcon_backend: 'bpf'
falcon_remove_aid: yes
1 change: 0 additions & 1 deletion molecule/falcon_configure_remove_aid/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ scenario:
- prepare
- converge
- idempotence
- side_effect
- verify
- destroy
28 changes: 28 additions & 0 deletions molecule/falcon_configure_remove_aid/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,31 @@
ansible.builtin.assert:
that:
- not info_verify.falconctl_info.aid

- name: Reboot system to force AID generation
ansible.builtin.reboot:

# Wait for aid to be generated
- name: Wait for Falcon Sensor to Generate AID
crowdstrike.falcon.falconctl_info:
name:
- aid
register: aid_info
retries: 6
delay: 10
until: aid_info.falconctl_info.aid

- name: Get new list of Falcon Sensor Options
crowdstrike.falcon.falconctl_info:
register: new_info_verify

- name: Validate a new AID is present
ansible.builtin.assert:
that:
- new_info_verify.falconctl_info.aid

- name: Validate CID and Tags are still present
ansible.builtin.assert:
that:
- new_info_verify.falconctl_info.cid
- new_info_verify.falconctl_info.tags
1 change: 0 additions & 1 deletion plugins/module_utils/falconctl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"message_log",
"billing",
"tags",
# 'provisioning_token', # Taking it out since this does not seem to be a perm option
"version",
"rfm_state",
"rfm_reason",
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/falconctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def main(): # pylint: disable=missing-function-docstring
module_args = dict(
state=dict(required=True, choices=["absent", "present"], type="str"),
cid=dict(required=False, type="str"),
provisioning_token=dict(required=False, no_log=True, type="str"),
provisioning_token=dict(required=False, no_log=False, type="str"),
aid=dict(required=False, type="bool"),
apd=dict(required=False, type="str"),
aph=dict(required=False, type="str"),
Expand Down
2 changes: 1 addition & 1 deletion roles/falcon_configure/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ falcon_client_secret:
# Installation tokens prevent unauthorized hosts from being accidentally or maliciously added
# to your Customer ID (CID). Installation tokens are an optional security
# measure for your CID. For more details:
# https://falcon.crowdstrike.com/support/documentation/20/falcon-sensor-for-linux#optional:-installing-to-a-cid-that-requires-installation-tokens
# https://falcon.crowdstrike.com/support/documentation/page/f4d593ca/installation-options-for-falcon-sensor-for-linux#l086f14c
#
falcon_provisioning_token:

Expand Down
12 changes: 11 additions & 1 deletion roles/falcon_configure/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,23 @@
- falconctl_result.changed
# noqa no-handler

- name: CrowdStrike Falcon | Remove Falcon Agent ID (AID) If Building A Primary Image
# Handle Master Image steps
- name: CrowdStrike Falcon | Master Image Prep | Removing AID
crowdstrike.falcon.falconctl:
aid: yes
state: absent
when:
- falcon_remove_aid

- name: CrowdStrike Falcon | Master Image Prep | Set Provisioning Token (if applicable)
crowdstrike.falcon.falconctl:
cid: "{{ options.cid }}"
provisioning_token: "{{ options.provisioning_token }}"
state: present
when:
- falcon_remove_aid
- options.provisioning_token

# Start of MacOSX Configuration
- name: CrowdStrike Falcon | Stat Falcon Sensor (macOS)
ansible.builtin.stat:
Expand Down
2 changes: 1 addition & 1 deletion roles/falcon_configure/tasks/remove_aid.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: CrowdStrike Falcon | Remove Falcon Agent ID (AID) If Building A Primary Image
- name: CrowdStrike Falcon | Remove Falcon Agent ID (AID)
crowdstrike.falcon.falconctl:
aid: yes
state: absent

0 comments on commit 2106e53

Please sign in to comment.