콘텐츠로 이동

Main Gateway 보안 운영 정책

회사 내부 인프라의 Main Gateway 서버에 대한
운영 보안 기준을 정의함.


1. 역할 정의

Main Gateway는 다음 역할을 수행함:

  • Reverse Proxy
  • Node / Next Application Host
  • DB / Redis 운영
  • 내부 서비스 진입점

2. 네트워크 정책

허용 포트:

  • 22 (SSH, 내부망만 허용)
  • 80 (HTTP)
  • 443 (HTTPS)

DB 및 Redis 외부 공개 금지.


3. firewalld 최종 정책

sudo systemctl enable --now firewalld

sudo firewall-cmd --permanent --remove-service=ssh
sudo firewall-cmd --permanent --remove-port=22/tcp
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.0.0/24" service name="ssh" accept'
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https

sudo firewall-cmd --permanent --remove-port=3306/tcp
sudo firewall-cmd --permanent --remove-port=5432/tcp
sudo firewall-cmd --permanent --remove-port=6379/tcp

sudo firewall-cmd --reload

4. SSH 보안 기준

/etc/ssh/sshd_config

Port 22

PermitRootLogin no
PubkeyAuthentication yes

# Main Gateway는 SSH를 내부망으로만 제한하므로 운영 편의상 예외 허용 가능
PasswordAuthentication yes
# 외부에 SSH를 노출하는 서버라면 반드시 no
# PasswordAuthentication no

ChallengeResponseAuthentication no
UsePAM yes

MaxAuthTries 3
LoginGraceTime 30

X11Forwarding no
AllowTcpForwarding no
ClientAliveInterval 300
ClientAliveCountMax 2

5. 계정 정책

  • root SSH 금지
  • 서비스 계정 로그인 금지
  • sudo 최소화
  • 공개키 인증 우선, 내부망 전용 관리 서버만 패스워드 예외 허용

6. 서비스 실행 정책

  • systemd 또는 PM2만 사용
  • screen, tmux 사용 금지
  • 백그라운드 임의 실행 금지

7. 배포 정책

  • Git 기반 배포
  • 프로덕션 서버에서 root npm install 금지
  • 배포 계정과 실행 계정 분리

8. 보안 점검 체크리스트

sudo getenforce
sudo mount | grep tmp
sudo ss -tulnp
sudo systemctl status firewalld

조건:

  • SELinux Enforcing
  • /tmp noexec
  • SSH는 내부망만 허용
  • PasswordAuthentication 설정은 운영 프로파일과 일치
  • Fail2ban은 외부에 SSH를 노출하는 서버에서 활성화
  • DB/Redis localhost 바인딩

9. 침해 대응 원칙

  • 의심 발생 시 즉시 네트워크 차단
  • 부분 복구 금지
  • 서버 재설치 원칙 적용