카테고리 보관물:  IT

Apache Upgrade(2.2 -> 2.4)

아파치 2.2에서 2.4로 업그레이드 되면서 일부 설정 파일의 변화가 있었습니다. 내용을 간략히 정리해 보았습니다.

기존 2.2 설정을 유지한 상태로 서비스를 기동하게 되면 서비스 기동이 실패할 확률이 높으므로 설정 파일에 대한 검토가 선행 되어야 합니다.

주요 설정 차이는 아래와 같습니다.

Version2.2
PolicyOrder allow,denyAllow from all
VhostsNameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot “D:\webapp\testlocalhost”
    ServerName testlocalhost
    ServerAlias testlocalhost
    ErrorLog “logs/testlocalhost -error.log”
    CustomLog “logs/testlocalhost -access.log” common
</VirtualHost>
cgid_modulesLoadModule cgid_module modules/mod_cgid.so
on httpd.conf
Version2.4
PolicyRequire all granted
Vhosts<VirtualHost testlocalhost:80>
    DocumentRoot “D:\webapp\testlocalhost”
    ServerName testlocalhost
    ErrorLog “logs/testlocalhost -error.log”
    CustomLog “logs/testlocalhost -access.log” common
</VirtualHost>
cgid_modules주석처리
on httpd.conf
refer(예시)
DocumentRoot /some/local/dir

<Directory /some/local/dir/>
   <RequireAll>
      Require all granted
      Include conf/IPList.conf
   </RequireAll>
</Directory>

#this will also work
<Location />
   <RequireAll>
      Require all granted
      Include conf/IPList.conf
   </RequireAll>
</Directory>
And inside conf/IPList.conf, you will have individual lines with entries like the following
conf/IPList.conf에 아래와 같이 개별 접근 제어할 IP 리스트를 파일로 보관할 수 있으며 2.2의 Allow 대신 Require를 사용하게 되었습니다.

Require not ip 10.10.1.23
Require not ip 192.168.22.199
Require not ip 10.20.70.100

그 외의 기능은 아래 출처를 통해 추가로 확인할 수 있습니다.

출처> http://httpd.apache.org/docs/trunk/upgrading.html

웹 취약점 보완 기본 I

  1. 아파치 설치 후 기본적인 SSL 설정만 적용한 상태에서 webpage test를 진행해 보았습니다.
F Score에 좌절할 필요 없이 다음 단계로….

2. 신속히 httpd.conf가 있는 곳으로 가서 다음 설정을 입력해 줍니다…

# HSTS(Strict Transport Security) Config
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

# X Frame Options Config
Header always set X-Frame-Options "SAMEORIGIN"

# X Content Type Options Config
Header always set X-Content-Type-Options nosniff

# X XSS Protection Config
Header always set X-XSS-Protection "1; mode=block"

3. 이제 아파치를 재시작 한 후 다시 테스트를 진행해 봅니다…

Strict Transport Security
X Content Type Options
X Frame Options
X XSS Protection
해결…
A Score….

※ Content Security Policy 부분이 남아 있지만 이부분은 적용시 실제 서비스에 영향을 크게 끼치므로 코드와 도메인 부분의 검토가 필요합니다.

내용을 준비해서 이후에 별도로 다뤄보도록 하겠습니다…

Rsyslog Log Analyzer Overview

rsyslog 데몬을 사용하여 리눅스, 윈도우, 네트워크 장비로 부터 수신 로그를  mariadb에 적재하게 되고 아파치로 간단한 통계로도 볼 수 있게 구축 해서 사용하고 있습니다.

나온지도 오래되었고 UI가 상당히 구식이지만 간단하게 보기에는 쓸만하여 종종 사용하는 편 입니다.

단점은 DB에 로그가 장기간 쌓이면 통계 페이지를 제대로 표시하지 못하는 경우도 있고 특정 호스트의 로그 발생 빈도가 높으면 통계 페이지를 보기 불편한 부분이 있었습니다. 저는 일정 기간 이전의 로그를 삭제하는 SQL스크립트를 crontab에 등록 하여 유지하고 있습니다.

그와 별개로 DB에 있는 로그 데이터를 elasticsearch등으로 시각화 시키는 것도 좋은 방법인 것 같습니다.

※ 테스트를 해보진 않았지만 Log Analyzer 최신 버전은 그래프 생성 관련 타임 아웃 현상을 해결 했다고 합니다.