반응형

IIS, ASP.NET 기준으로 웹 서비스에 대한 보안 설정 정보 입니다. 항목별 상세 정보는 구글에서~ 최소 이정도는 설정해야 한다로 보시면 좋을 것 같습니다.

root 에 위치한 web.config 에 지정하면 되며 필요 시 소스코드의 META 에 넣어도 됩니다.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
       <stripHeaders>
          <header name="Server" />
          <header name="X-Powered-By" />
          <header name="X-Aspnet-Version" />
        </stripHeaders>
        <httpErrors errorMode="Custom">
            <remove statusCode="500" />
            <error statusCode="500" path="에러페이지 URL" responseMode="Redirect" />
         </httpErrors>
         <httpProtocol>
             <customHeaders>
                <add name="X-Frame-Options" value="SAMEORIGIN" />
                <add name="X-XSS-Protection" value="1;mode=block" />
                <add name="X-Content-Type-Options" value="nosniff" />
                <add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains" />
                <add name="Content-Security-Policy" value="default-src https: data: 'unsafe-inline' 'unsafe-eval'" />
              </customHeaders>
          </httpProtocol>
          <rewrite>
             <outboundRules>
                <rule name="Add HttpOnly" preCondition="No HttpOnly">
                    <match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="false" />
                    <action type="Rewrite" value="{R:0}; HttpOnly" />
                    <conditions>
                    </conditions>
                </rule>
                <preConditions>
                   <preCondition name="No HttpOnly">
                      <add input="{RESPONSE_Set_Cookie}" pattern="." />
                      <add input="{RESPONSE_Set_Cookie}" pattern="; HttpOnly" negate="true" />
                   </preCondition>
                 </preConditions>
              </outboundRules>
           </rewrite>
        </system.webServer>
        <system.web>
             <httpCookies httpOnlyCookies="true" requireSSL="true" />
             <identity impersonate="false" />
             <httpRuntime enableVersionHeader="false" />
    </system.web>
</configuration>

 

 

반응형

'IT > 기타' 카테고리의 다른 글

[Cookie] 보안설정  (0) 2023.03.08
Windows Server 세션 개수  (0) 2023.02.15
모든 폴더 삭제  (0) 2018.11.28
파워 포인트 글꼴 일괄 변경  (0) 2018.07.09
EXCEL 에 특정 문자를 포함하는 컬럼 개수 구하기  (0) 2018.01.23

+ Recent posts