C.W.K.
Stream
Lesson 04 of 13 · published

Self-hosted runner 보안

~12 min · security, isolation, ephemeral

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Self-hosted runner 는 기본 신뢰 안 되는 코드 실행

Repo 가 누구의 PR 이든 받으면 그 PR 에 workflow 변경 포함 가능. 격리 없으면 악성 PR 이: filesystem 읽기, env var dump, backdoor 설치, 디스크 캐시 secret 빼돌리기. 기본 설정은 위험.

Hardening 체크리스트

  1. Public fork 에 노출 금지. Repo Settings → Actions → Require approval for outside collaborators (또는 모든 PR).
  2. Ephemeral runner 사용. VM 라이프사이클 당 한 job. Job 후 VM 파괴. 도구: actions-runner-controller (k8s), runs-on (AWS), philips-labs/terraform-aws-github-runner.
  3. Container 나 VM 에서 실행. Host OS 직접 runner agent 실행 금지.
  4. 엄격한 네트워크 egress. GitHub + 의도된 타겟 outbound 만 허용. 기본 allow 차단.
  5. 신뢰 계층 분리. Public-PR runner 와 신뢰 deploy-runner 는 host 공유 금지.
  6. 등록 시점 secret, 디스크 아님. Runner image 에 secret 굽지 마. OIDC + job 별 secret 주입.
  7. 패치 + rotation. Runner agent 는 자동 업데이트; OS 패치는 아빠 책임.

Code

Docker 통한 ephemeral runner·bash
# Run one ephemeral runner that picks up exactly one job
docker run --rm \
  -e RUNNER_TOKEN=$RUNNER_TOKEN \
  -e RUNNER_REPOSITORY_URL=https://github.com/my-org/my-repo \
  -e RUNNER_LABELS='self-hosted,linux-x64,ephemeral' \
  -e EPHEMERAL=true \
  --network=runner-net \
  --read-only --tmpfs /tmp --tmpfs /home/runner \
  ghcr.io/myrepo/runner:latest

External links

Exercise

Self-hosted runner 있으면 7 항목 hardening 체크리스트 실행. '아니오' 를 '예' 로 또는 위험 글로 수용. Audit 반쪽 두지 마.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.