feat(scanner): Set user http user agent to <name>/<version>

!11
This commit is contained in:
2024-02-24 20:01:53 +09:30
parent 8f7ed4888a
commit 15b0ddb068
4 changed files with 19 additions and 1 deletions

View File

@ -19,6 +19,18 @@ variables:
DOCKER_IMAGE_PUBLISH_REGISTRY: docker.io/nofusscomputing
DOCKER_IMAGE_PUBLISH_URL: https://hub.docker.com/r/nofusscomputing/$DOCKER_IMAGE_PUBLISH_NAME
RELEASE_ADDITIONAL_ACTIONS_BUMP: |
sed -E "/http_agent: nfc-phpipam-scan-agent/s/\/(.+)/\/$(cz version --project)/g" -i playbooks/tasks/scan_subnet.yaml;
git add playbooks/tasks/scan_subnet.yaml;
git status;
sed -E "/http_agent: nfc-phpipam-scan-agent/s/\/(.+)/\/$(cz version --project)/g" -i playbooks/tasks/api_call.yaml
git add playbooks/tasks/api_call.yaml;
git status;
include:

View File

@ -49,6 +49,8 @@
cached_file.stat.exists
# Note: Dont edit http_agent version as the build pipeline updates automagically!!
# see ci variable 'RELEASE_ADDITIONAL_ACTIONS_BUMP'
- name: >
PHPIPAM API Call - {{ api_path }}{%- if api_query_string is defined -%}
/?{{ api_query_string }}
@ -61,6 +63,7 @@
{%- endif %}
headers:
token: "{{ api_token }}"
http_agent: nfc-phpipam-scan-agent/0.2.0-a2
return_content: true
status_code:
- 200

View File

@ -65,10 +65,13 @@
subnet_scan_results: "{{ subnet_scan_results | from_yaml }}"
# Note: Dont edit http_agent version as the build pipeline updates automagically!!
# see ci variable 'RELEASE_ADDITIONAL_ACTIONS_BUMP'
- name: Upload Scan Results - {{ subnet.address }}
ansible.builtin.uri:
headers:
Authorization: "Bearer {{ nofusscomputing_phpipam_scan_agent.auth_token | default('no-token-set') }}"
http_agent: nfc-phpipam-scan-agent/0.2.0-a2
url: "{{
nofusscomputing_phpipam_scan_agent.http_server | default(nfc_c_http_server)
}}:{{ nofusscomputing_phpipam_scan_agent.http_port | default(nfc_c_http_port) }}/"