티스토리 뷰

앞서 ATS에 대해 설명과 옵션에 대해 간략히 설명했으니 바로 본론으로 들어가겠다.

ATS를 만족하면서 TLS 1.2 버전 아래나, HTTP 프로토콜을 사용하는 법은

App Transport Security에 Exception Domains를 등록하면되는데,

이게 무턱대고 등록한다고 다 통신을 할 수 있는게 아니다.


ATS Exception 옵션을 중에 어떤것은 키고 어떤것은 끄고 해야 하는데 

이를 애플에서 간단한 명령어 하나로 확인 할 수 있도록 지원해준다.


일단 터미널을 킨다.

command :

nscurl -- ats diagnostics DOMAIN --verbose 


DOMAIN 에다가 넣고싶은 도메인을 넣으면 된다.

일단 예제로, 


nscurl -- ats diagnostics https://google.com --verbose

이렇게 쳐보자 아래 설명에도 잘 나와 있드시 PASS, FAIL로 옵션에 따른 결과를 알려줄 것이다.


[InKwonui-MacBook-Pro:~ InKwon$ nscurl --ats-diagnostics https://google.com --verbose

Starting ATS Diagnostics


Configuring ATS Info.plist keys and displaying the result of HTTPS loads to https://google.com.

A test will "PASS" if URLSession:task:didCompleteWithError: returns a nil error.

================================================================================


Default ATS Secure Connection

---

ATS Default Connection

ATS Dictionary:

{

}

Result : PASS

---


================================================================================


Allowing Arbitrary Loads


---

Allow All Loads

ATS Dictionary:

{

    NSAllowsArbitraryLoads = true;

}

Result : PASS

---


================================================================================


Configuring TLS exceptions for google.com


---

TLSv1.2

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionMinimumTLSVersion = "TLSv1.2";

        };

    };

}

Result : PASS

---


---

TLSv1.1

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionMinimumTLSVersion = "TLSv1.1";

        };

    };

}

Result : PASS

---


---

TLSv1.0

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionMinimumTLSVersion = "TLSv1.0";

        };

    };

}

Result : PASS

---


================================================================================


Configuring PFS exceptions for google.com


---

Disabling Perfect Forward Secrecy

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionRequiresForwardSecrecy = false;

        };

    };

}

Result : PASS

---


================================================================================


Configuring PFS exceptions and allowing insecure HTTP for google.com


---

Disabling Perfect Forward Secrecy and Allowing Insecure HTTP

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionAllowsInsecureHTTPLoads = true;

            NSExceptionRequiresForwardSecrecy = false;

        };

    };

}

Result : PASS

---


================================================================================


Configuring TLS exceptions with PFS disabled for google.com


---

TLSv1.2 with PFS disabled

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionMinimumTLSVersion = "TLSv1.2";

            NSExceptionRequiresForwardSecrecy = false;

        };

    };

}

Result : PASS

---


---

TLSv1.1 with PFS disabled

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionMinimumTLSVersion = "TLSv1.1";

            NSExceptionRequiresForwardSecrecy = false;

        };

    };

}

Result : PASS

---


---

TLSv1.0 with PFS disabled

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionMinimumTLSVersion = "TLSv1.0";

            NSExceptionRequiresForwardSecrecy = false;

        };

    };

}

Result : PASS

---


================================================================================


Configuring TLS exceptions with PFS disabled and insecure HTTP allowed for google.com


---

TLSv1.2 with PFS disabled and insecure HTTP allowed

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionAllowsInsecureHTTPLoads = true;

            NSExceptionMinimumTLSVersion = "TLSv1.2";

            NSExceptionRequiresForwardSecrecy = false;

        };

    };

}

Result : PASS

---


---

TLSv1.1 with PFS disabled and insecure HTTP allowed

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionAllowsInsecureHTTPLoads = true;

            NSExceptionMinimumTLSVersion = "TLSv1.1";

            NSExceptionRequiresForwardSecrecy = false;

        };

    };

}

Result : PASS

---


---

TLSv1.0 with PFS disabled and insecure HTTP allowed

ATS Dictionary:

{

    NSExceptionDomains =     {

        "google.com" =         {

            NSExceptionAllowsInsecureHTTPLoads = true;

            NSExceptionMinimumTLSVersion = "TLSv1.0";

            NSExceptionRequiresForwardSecrecy = false;

        };

    };

}

Result : PASS

---


================================================================================


보이는가 Result에 PASS 라고 뜬다. 실패일 경우 (예로 네이버)


ATS Dictionary:

{

    NSExceptionDomains =     {

        "www.naver.com" =         {

            NSExceptionAllowsInsecureHTTPLoads = true;

            NSExceptionMinimumTLSVersion = "TLSv1.0";

            NSExceptionRequiresForwardSecrecy = false;

        };

    };

}

Result : FAIL

Error : Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={NSUnderlyingError=0x7fe35171e680 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSErrorFailingURLStringKey=https://www.naver.com/, NSErrorFailingURLKey=https://www.naver.com/, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=61, NSLocalizedDescription=Could not connect to the server.}

Result에 Fail 보이는가, 요래 나오니까 어떠한 옵션을 사용하면 될지 어느정도 감을 잡을 수 있다.


허나, 위의 명령어로 얻어진 ATS Exception Domains option이 꼭 옳은 것은 아니다.


테스트를 해보니 HTTP 프로토콜일 경우, 위의 명령어를 사용하면 먼 옵션을 써도 FAIL이라고 나오는데, 정작 프로젝트에서 info.plist에다 옵션을 주고 테스트 해보면 통신이 잘된다. 그러니 위의 명령어를 맹신하지말고 실제로 테스트를 해봐야 하는 경우가 있다.


최근 보안 공부를 하면서 느끼는 거지만, 우리나라 같은 경우 HTTPS를 사용하지 않는 곳도 은근히 많으며, HTTPS를 사용한다 하더라도 TLS 버전이 낮은 버전을 사용하는 곳이 태반인듯하다. 

애플에서 HTTPS, TLS1.2 이상을 사용하도록 enforce 하는데, 당장은 개발자들한테는 귀찮고 피곤해 보이는 일일지 몰라도, 사용자, 고객의 입장에서는 당연히 준수해야만 하는 사항인듯 하다. 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함