Conversation
…ailures (#19, #20) [이슈 #20] report 모드에서 실제 변경 및 권한 오류 발생 해결 - account/file/service/system.yml 전체를 check_mode 블록으로 격리하여 include_tasks 전파에 의존하지 않고 role 차원에서 report 모드 변경 차단 - 변경 유발 shell 4종(.rhosts 제거, world-writable 제거, 고아 파일, 홈 환경파일 권한)을 [점검](read-only, report에서도 실행) / [조치](apply 전용)로 분리 - main.yml에서 id -u 기반 실행 권한 사전 판정(os_security_privileged) 추가, /root 접근이 필요한 점검은 비특권 시 [검사 불가]로 명확히 보고 - 재시작 핸들러 4종에 check_mode 적용, read-only 사전 점검에 check_mode: false 명시 [이슈 #19] systemd-timesyncd 검사 오류 은닉 해결 (system.yml) - 구동 태스크의 ignore_errors / 실패 상태 재조정 set_fact / timedatectl failed_when: false 전면 제거 - systemd 환경(/run/systemd/system) 및 서비스 유닛 존재 여부 사전 판정, 유닛 부재 시 대체 시간 동기화 서비스(chrony 등) 판정 후 [검사 실패]로 보고(report: 조치 필요 집계 / apply: 실행 중단), 비-systemd 환경은 [검사 불가]로 보고 [검증 중 발견된 추가 수정] - 같은 플레이에서 timesyncd 신규 설치 시 timedatectl set-ntp가 "NTP not supported"로 실패하는 문제 → 설치 시에만 systemd-timedated 재기동 + set-ntp 재시도 추가 - pam-auth-update --force가 매 apply마다 common-password를 재생성해 enforce_for_root가 무한 changed 되는 멱등성 순환 → faillock 미적용 또는 프로필 변경 시에만 실행하도록 조건 추가 검증: 테스트베드 6단계 릴레이 테스트(1·2차 Dry-run → 1·2차 Enforce → 3·4차 Dry-run) 통과 — report 모드 무변경 diff 확인, 취약 27건 전량 검출·조치, 2차 Enforce 조치 필요 0건(완전 멱등)
- 구현 task 표 갱신: main.yml(권한 사전 판정 + report 모드 check_mode 강제), handlers/main.yml(report 모드 재시작 시뮬레이션) 행 추가, account/file/system.yml 설명을 수정된 코드 기준으로 갱신 ([점검]/[조치] 분리, [검사 불가]/[검사 실패] 보고, timesyncd 사전 판정) - 적용 시 변경점 갱신: pam-auth-update 조건 실행(멱등성 보장), timesyncd 신규 설치 시 systemd-timedated 재기동 내용 반영 - 변수 설명에 실행 모드 변수 섹션(apply_policy) 추가 - 계정 정책 변수 표의 중복 행을 sshd_password_authentication으로 수정
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
이 PR은 이슈별로 분리한 새 PR(#28, #29)로 대체되었습니다
💡 설명
os-security role의 이슈 #19(systemd-timesyncd 검사 오류 은닉), #20(report 모드에서
실제 변경 및 /root 권한 오류 발생)을 해결합니다. report 모드에서는 어떤 경로로 호출되어도
role 차원에서 시스템 변경이 차단되도록 하고, 시간 동기화 검사 실패를 숨기지 않고 명확히
보고하도록 수정했습니다. 변경된 동작에 맞춰 README도 함께 갱신했습니다.
✅ 작업 상세 내용
전파에 의존하지 않는 role 차원 방어)
권한)를 [점검] (read-only) / [조치](apply 전용)로 분리
필요한 점검은 비특권 시 [검사 불가]로 명확히 보고
전면 제거, systemd 환경·서비스 유닛 존재 사전 판정 후 대체 시간 동기화 서비스
판정 및 [검사 실패]/[검사 불가] 보고 추가
문제 수정 (systemd-timedated 재기동 + 재시도 추가)
프로필 변경 시에만 실행)
설명을 수정된 코드 기준으로 반영)
📝 추가 설명(선택)
테스트베드(Azure VM)에서 취약화 스크립트로 위반 상태를 주입한 뒤 6단계 릴레이 테스트
(1·2차 Dry-run → 1·2차 Enforce → 3·4차 Dry-run)로 검증했습니다. report 모드 무변경
diff 확인, 취약 상태 27건 전량 검출·조치, 2차 Enforce 조치 필요 0건(완전 멱등),
3·4차 Dry-run 상태 고정까지 전 구간 통과했습니다.
📚 참고 자료(선택)