From baf5b14d44c49ac23af327affce4f253f23cdbb1 Mon Sep 17 00:00:00 2001 From: ByeonJungHun Date: Thu, 4 Jan 2024 16:42:13 +0900 Subject: [PATCH] update --- roles/security_check/files/ubuntu.sh | 2 +- roles/security_check/tasks/start.yml | 2 +- roles/security_check/templates/README.md.j2 | 8 ++++---- security_check | 1 + server_check.yml | 3 +++ 5 files changed, 10 insertions(+), 6 deletions(-) create mode 160000 security_check diff --git a/roles/security_check/files/ubuntu.sh b/roles/security_check/files/ubuntu.sh index 2b538f4..1a6d551 100644 --- a/roles/security_check/files/ubuntu.sh +++ b/roles/security_check/files/ubuntu.sh @@ -1,6 +1,6 @@ #!/bin/bash -resultfile="/tmp/$(hostname).txt" +resultfile="/tmp/$(hostname).$(hostname -I | awk '{print $1}').txt" U_01() { echo "" >> $resultfile 2>&1 diff --git a/roles/security_check/tasks/start.yml b/roles/security_check/tasks/start.yml index 8f99077..9996089 100644 --- a/roles/security_check/tasks/start.yml +++ b/roles/security_check/tasks/start.yml @@ -27,7 +27,7 @@ - name: Copy Result File to Local fetch: - src: "/tmp/{{ ansible_hostname }}.txt" + src: "/tmp/{{ ansible_hostname }}.{{ ansible_host }}.txt" dest: "~/checklist/" flat: yes when: ansible_distribution == 'Ubuntu' diff --git a/roles/security_check/templates/README.md.j2 b/roles/security_check/templates/README.md.j2 index cc6adbc..c26c897 100644 --- a/roles/security_check/templates/README.md.j2 +++ b/roles/security_check/templates/README.md.j2 @@ -1,8 +1,8 @@ -| 이름 | 상태 요약 | 상세 보기 | -| --- | --- | --- | +| 이름 | 아이피 | 상태 요약 | 상세 보기 | +| --- | --- | --- | --- | {% for vulnerable in check_status.stdout_lines %} -| {{ vulnerable|splitext|first }} | 취약 | http://10.10.43.42:8080/{{ vulnerable }} | +| {{ vulnerable.split('.')[0] }} | {{ vulnerable.split('.')[1] }}.{{ vulnerable.split('.')[2] }}.{{ vulnerable.split('.')[3] }}.{{ vulnerable.split('.')[4] }} | 취약 | http://10.10.43.42:8080/{{ vulnerable }} | {% endfor %} {% for good in check_ok.stdout_lines %} -| {{ good|splitext|first }} | 양호 | http://10.10.43.42:8080/{{ good }} | +| {{ good.split('.')[0] }} | {{ good.split('.')[1] }}.{{ good.split('.')[2] }}.{{ good.split('.')[3] }}.{{ good.split('.')[4] }} | 양호 | http://10.10.43.42:8080/{{ good }} | {% endfor %} \ No newline at end of file diff --git a/security_check b/security_check new file mode 160000 index 0000000..d8f842b --- /dev/null +++ b/security_check @@ -0,0 +1 @@ +Subproject commit d8f842ba1a9373ae484e2b949c0b8b805d9ae338 diff --git a/server_check.yml b/server_check.yml index d8cf498..1435aac 100644 --- a/server_check.yml +++ b/server_check.yml @@ -2,5 +2,8 @@ - hosts: all become: false gather_facts: true + vars: + git_user: sa_8001 + git_key: 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 roles: - role: security_check