자동 보안 업데이트
Debian과 Ubuntu의 unattended-upgrades, AlmaLinux의 dnf-automatic을 설정해 밤에 서비스가 중단되지 않으면서 패치가 스스로 설치되게 하는 방법을 알아봐요.
업데이트 2026년 8월 23일
대부분의 침해는 몇 달 전에 이미 패치된 취약점을 통해 발생해요. 수동 업데이트는 계속 미뤄지지만 자동 업데이트는 미뤄지지 않아요. 합리적인 구성은 보안 업데이트만 설치하고 나머지는 그대로 둬요.
Debian과 Ubuntu
apt install -y unattended-upgrades apt-listchanges
dpkg-reconfigure -plow unattended-upgrades
/etc/apt/apt.conf.d/50unattended-upgrades 파일:
Unattended-Upgrade::Allowed-Origins {
"${distro_id}:${distro_codename}-security";
};
Unattended-Upgrade::Package-Blacklist {
"postgresql-.*";
"docker-ce";
};
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::Automatic-Reboot "false";
Unattended-Upgrade::Mail "you@example.com";
일정은 /etc/apt/apt.conf.d/20auto-upgrades에 있어요:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
변경 없이 모의 실행:
unattended-upgrade --dry-run --debug
systemctl status unattended-upgrades
cat /var/log/unattended-upgrades/unattended-upgrades.log
AlmaLinux와 CentOS Stream
dnf install -y dnf-automatic
/etc/dnf/automatic.conf에서:
[commands]
upgrade_type = security
apply_updates = yes
reboot = never
systemctl enable --now dnf-automatic.timer
systemctl list-timers | grep dnf
제외할 항목
버전이 예기치 않게 바뀌면 문제가 생기는 모든 것을 제외 목록에 추가하세요. 데이터베이스 서버, Docker, 애플리케이션 엔진 자체가 여기 해당해요. 한산한 시간에 직접 업데이트하세요. 자세한 내용은 시스템 및 패키지 업데이트를 참고하세요.
커널 보안 업데이트도 설치되지만 재부팅 후에만 적용돼요:
test -f /var/run/reboot-required && cat /var/run/reboot-required.pkgs
재부팅: 사람만이 내릴 수 있는 결정
Automatic-Reboot "true"로 설정하고 싶은 유혹이 강하지만, 매일 밤 자동 재부팅은 아무도 지켜보지 않는 상태에서 서비스가 재시작된다는 뜻이에요. 무언가가 다시 올라오지 않으면 아침에 사용자에게서 그 소식을 듣게 될 거예요.
합리적인 절충안은 이래요. 업데이트는 스스로 설치되고, 한 달에 한 번 /hosting/vds/m/<id> 패널에서 콘솔을 지켜보며 직접 재부팅하는 거예요. 겸사겸사 서비스가 스스로 시작되는지도 확인하세요:
systemctl is-enabled nginx postgresql
systemctl list-units --state=failed
흔한 실수
| 실수 | 결과 | 해결 |
|---|---|---|
| 보안 저장소가 아닌 모든 저장소에 업데이트를 활성화 | 기능 변경이 도착함 | -security 소스만 유지 |
| 데이터베이스가 제외 목록에 없음 | 메이저 버전이 데이터를 망가뜨림 | Package-Blacklist에 추가 |
| 밤에 자동 재부팅 | 서비스가 올라오지 않았는데 아무도 몰랐음 | Automatic-Reboot "false" |
| 설정해 두고 잊어버림 | 커널은 업데이트되지만 업데이트가 적용되지 않음 | 한 달에 한 번 reboot-required 확인 |
| 다운로드한 패키지가 디스크를 가득 채움 | 공간이 부족해짐 | 자동 캐시 정리를 켜 둠 |
자동 업데이트는 보험이지 관심을 대신하지 않아요. 한 달에 한 번, 서버에 접속해서 업데이트 로그와 실패한 서비스 목록, 재부팅 필요 여부를 확인하세요. 한 달에 15분이면 침해 징후 문서의 대부분 시나리오를 커버할 수 있어요.