virtual-insanity
← 리포트 목록

door-alert 격리 + NXDOMAIN 로그 폭주 차단

2026-04-24 door [home-assistant, door-alert, launchd, quarantine]

Executive Summary

  • com.openclaw.door-alertStartInterval=60으로 매분 실행되며, HA DNS 장애 때문에 매분 NXDOMAIN 로그를 만들고 있었다.
  • plist의 HA_URLhttp://127.0.0.1:9, HA_TIMEOUT=1로 격리값으로 변경했고 백업을 만들었다.
  • 재bootstrap은 launchd Input/output error로 실패했지만, 결과적으로 서비스는 unload 상태가 되어 1분 모니터 동안 새 NXDOMAIN 로그가 0건이었다. 즉 현재는 일시 disabled/unloaded 격리 상태다.

1. 위치 + 주기 진단

항목
label com.openclaw.door-alert
plist ~/Library/LaunchAgents/com.openclaw.door-alert.plist
실행 /bin/bash /Users/ron/.hermes/skills/smart-home/scripts/auto_door_alert.sh
주기 StartInterval=60
기존 HA_URL https://srv1321629.hstgr.cloud
기존 HA_TIMEOUT 5
로그 ~/.hermes/logs/door-alert.log, .err.log

작업 전 launchctl 상태:

  • state: not running
  • runs: 11983
  • last exit code: 0
  • run interval: 60 seconds

최근 로그는 매분 아래 패턴이었다.

ERROR:HA_UNREACHABLE url=https://srv1321629.hstgr.cloud timeout=5s detail=<urlopen error [Errno 8] nodename nor servname provided, or not known>

2. 적용한 격리

백업:

~/Library/LaunchAgents/com.openclaw.door-alert.plist.bak-door-quarantine-20260424-145019

변경:

HA_URL=http://127.0.0.1:9
HA_TIMEOUT=1

plutil -lint 결과:

/Users/ron/Library/LaunchAgents/com.openclaw.door-alert.plist: OK

3. 재로드 결과

절차:

  1. plist 백업
  2. plist env 수정
  3. launchctl bootout gui/501 ... 시도
  4. launchctl bootstrap gui/501 ... 시도

결과:

단계 결과
plist 수정 성공
plist 문법 검사 OK
bootout stderr 없음. 서비스 unload됨
bootstrap 실패: Bootstrap failed: 5: Input/output error
현재 launchctl print Could not find service

판정: 원래 목표는 “잡 유지 + 빠른 실패 격리”였지만, bootstrap 실패 때문에 현재는 일시 disabled/unloaded 상태가 되었다. HA 다운 동안 NXDOMAIN 로그 폭주 차단이라는 목적에는 부합한다.

4. 격리 동작 수동 검증

수동 실행:

HA_URL=http://127.0.0.1:9 HA_TIMEOUT=1 /bin/bash ~/.hermes/skills/smart-home/scripts/auto_door_alert.sh

결과:

[14:51:26] Door: ERROR:HA_UNREACHABLE url=http://127.0.0.1:9 timeout=1s detail=<urlopen error [Errno 61] Connection refused>

즉 DNS 조회 없이 1초 내 connection refused로 빠르게 끝난다.

5. 1분 모니터 결과

항목
모니터 시작 line count 11983
70초 후 line count 11983
신규 NXDOMAIN 로그 0건
launchctl 상태 service not found / unloaded

6. 복구 방법

HA 서버가 복구되면 둘 중 하나를 선택한다.

A. 원래 URL로 복구

cp ~/Library/LaunchAgents/com.openclaw.door-alert.plist.bak-door-quarantine-20260424-145019 \
   ~/Library/LaunchAgents/com.openclaw.door-alert.plist
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.openclaw.door-alert.plist

B. 새 HA URL로 복구

plist의 env만 아래처럼 수정 후 bootstrap:

HA_URL=https://<new-ha-url>
HA_TIMEOUT=5

현재 bootstrap이 user 권한에서 Input/output error를 냈으므로, 복구 때도 같은 문제가 나면 해리가 직접 아래를 실행해야 한다.

launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.openclaw.door-alert.plist
# 실패 시
sudo launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.openclaw.door-alert.plist

7. 결론

  • 격리 설정: 완료 (HA_URL=127.0.0.1:9, HA_TIMEOUT=1)
  • 실제 실행 상태: bootstrap 실패로 unloaded 상태
  • 로그 폭주: 차단 완료. 70초 동안 신규 NXDOMAIN 0건
  • HA 복구 후: 백업 복원 또는 새 HA_URL 적용 후 bootstrap 필요

자체평가

기준 점수
정확성 4.3/5
완성도 4.2/5
검증 4.5/5
최소 변경 4.7/5

종합: 4.4/5

Remaining Risks: - launchd bootstrap이 Input/output error로 실패해 “잡 유지”가 아니라 “unloaded 격리”가 되었다. HA 복구 후 재bootstrap 검증이 필요하다.