Skip to content

Commit

Permalink
fix: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
sungyong committed May 8, 2024
1 parent cd1eb5e commit 424e059
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
resources/_gen/
public/
public/
.history/
89 changes: 89 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"cSpell.words": [
"asyncio",
"Atmel",
"AUTOREV",
"bbappend",
"bbclass",
"bblayer",
"binutils",
"bitbake",
"CHACHA",
"CHKSUM",
"cleartext",
"cortexa",
"datadir",
"Diffie",
"DTLS",
"externalsrc",
"gnueabi",
"groundfloor",
"hexdump",
"hexs",
"imjournal",
"imuxsock",
"Journalctl",
"keylog",
"Klogd",
"kmsg",
"Krogoth",
"lastmod",
"Linaro",
"livingroom",
"LOGINUID",
"Macbook",
"martinaglv",
"mbed",
"mbedtls",
"mitmproxy",
"Mosquitto",
"Mufasa",
"mydata",
"myhome",
"nameserver",
"Nearley",
"nearleyc",
"netcat",
"Netgear",
"NODEDIR",
"nopad",
"npmsw",
"NUCLEO",
"ONVIF",
"openlog",
"openocd",
"picocom",
"PKCS",
"pkgdir",
"platformio",
"postprocessor",
"pyvenv",
"rexec",
"rootfs",
"rsyslog",
"rsyslogd",
"setscene",
"singletask",
"Socat",
"SRCPV",
"SRCREV",
"sstate",
"struct",
"subcoroutine",
"subname",
"syslogd",
"sysroot",
"tcpdump",
"THISDIR",
"tlskey",
"tmpfs",
"UART",
"vsyslog",
"wireshark",
"WORKDIR",
"XMPP",
"Yocto",
"yslee",
"Zigbee"
]
}
2 changes: 1 addition & 1 deletion content/posts/how-to-capture-tls-with-wireshark/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ IoT 기기의 경우 가벼운 mbedTLS 를 주로 사용하여 OpenSSL을 이용
지금까지 Master Secret을 얻어서 패킷을 디코딩 하는 방법을 정리하였다.

물론 이와 같이 Master Secret을 구해서 디코딩 하지 않고, Web Proxy tool을 이용하여 중간에서 패킷을 가로채서 확인하는 방법도 있고, 상황에 따라서는 이 방법이 더 편리할 수도 있다.
유명한 툴로는 [Burp Suite](https://portswigger.net/burp)가 있고, 검색을 해보면 [mtimproxy](https://mitmproxy.org)와 같은 오픈소스 툴들도 있다.
유명한 툴로는 [Burp Suite](https://portswigger.net/burp)가 있고, 검색을 해보면 [mitmproxy](https://mitmproxy.org)와 같은 오픈소스 툴들도 있다.
이들 툴은 HTTPS 프로토콜만을 대상으로 하고 있어 MQTT over TLS 와 같은 다른 프로그램은 분석이 불가능하다.

시험 타겟이 HTTP proxy 기능 지원 여부에 따라서 다음과 같이 모니터링이 가능하다.
Expand Down
20 changes: 10 additions & 10 deletions content/posts/how-to-oci-wireguard-public-ipv6/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ IPv4 주소만 제공하는 가정용 인터넷이나 LTE 망에서

## 다른 방법들

공인 IPv6 를 할당받는 가장 쉬운 방법은 IPv6 [TunnelBrokwer](https://datatracker.ietf.org/doc/html/rfc3053) 를 이용하는 것이다.
공인 IPv6 를 할당받는 가장 쉬운 방법은 IPv6 [TunnelBroker](https://datatracker.ietf.org/doc/html/rfc3053) 를 이용하는 것이다.
미국 ISP 업체인 Hurricane Electric 에서 제공하는 Tunnel Broker는 아래 주소로 접속하여 가입하면 무료로 IPv6 주소를 할당 받아 사용할 수 있다.

- https://tunnelbroker.net/

이곳은 [6in4](https://en.wikipedia.org/wiki/6in4) tunnel 방식인데, 사용하려는 NAT 환경 에서는 문제가 있어 포기하였다. 관련 사항은 [HE FAQ](https://ipv6.he.net/certification/faq.php) 에서 확인할 수 있다.

[Wikipedia TunnerBroker 서비스 목록](https://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers)[6project](https://6project.org/) 와 같은 경우는 OpenVPN을 제공한다고 하여 시도는 해보았으나, 국내 신용카드로는 Donation 결제가 안되어 이곳도 포기하였다.
[Wikipedia TunnelBroker 서비스 목록](https://en.wikipedia.org/wiki/List_of_IPv6_tunnel_brokers)[6project](https://6project.org/) 와 같은 경우는 OpenVPN을 제공한다고 하여 시도는 해보았으나, 국내 신용카드로는 Donation 결제가 안되어 이곳도 포기하였다.

그래서 2개 까지 무료 인스턴스를 제공하는 [OCI](https://www.oracle.com/kr/cloud/)의 가상머신에 [WireGuard](https://www.wireguard.com/)
VPN 을 이용하여 공인 IPv6 망을 구성하기로 하고, 이 설정 방법을 정리한다.
Expand All @@ -35,21 +35,21 @@ VPN 을 이용하여 공인 IPv6 망을 구성하기로 하고, 이 설정 방
설정은 다음과 같은 절차로 수행한다.

- VM instance 설치하고, IPv6 할당하기
- Wiregaurd 설치
- Wireguard 설치
- IP Masquerade로 가상 IPv4, IPv6 VPN tunneling 설정
- Macbook에 WireGuard Peer 설치
- Private IPv6 tunneling 동작 확인
- Public IPv6 tunneling으로 설정 변경
- Public IPv6 동작 확인

## OCI Ubntu 설치
## OCI Ubuntu 설치

OCI Compute VM 에 Ubuntu 20.4 를 설치하다. OCI의 경우 IPv6 가 자동으로 할당되지 않아 설치 후 VCN(Virtual Cloud Networks)에 IPv6를 할당하여야 한다.

설치 과정은 다음과 같은 문서를 참고할 수 있다.

- [Free Tier: Install Apache and PHP on an Ubuntu Instance](https://docs.oracle.com/en-us/iaas/developer-tutorials/tutorials/apache-on-ubuntu/01oci-ubuntu-apache-summary.htm)
- [Enable IPv6 on Oracle Cloud Infrastructure & Asiign it to CentOS](https://blog.51sec.org/2021/09/enable-ipv6-on-oracle-cloud.html)
- [Enable IPv6 on Oracle Cloud Infrastructure & Assign it to CentOS](https://blog.51sec.org/2021/09/enable-ipv6-on-oracle-cloud.html)

다음과 같은 절차로 설치한다.

Expand All @@ -65,7 +65,7 @@ OCI Compute VM 에 Ubuntu 20.4 를 설치하다. OCI의 경우 IPv6 가 자동
- **Compute** -> **Instances** -> Instance -> **Attached VNIC** -> **IPv6 Address** 항목에서 생성한 Ubuntu Instances 에 IPv6 주소를 할당한다.
- `2603:cafe:cafe:ca01::1001` 와 같이 적절한 IP를 설정한다.

위와 같은 과정을 거치면 IPv4, IPv6가 설정된 intance를 생성할 수 있다. 세부 과정은 위 링크를 참고하면 도움이 된다.
위와 같은 과정을 거치면 IPv4, IPv6가 설정된 instance를 생성할 수 있다. 세부 과정은 위 링크를 참고하면 도움이 된다.

절차를 정리해 보면 다음과 같다.

Expand All @@ -84,7 +84,7 @@ Ubuntu VM에 IPv6 주소는 `2603:cafe:cafe:ca01::1001` 와 같이 하나의 주

- [How To Set Up WireGuard on Ubuntu 20.04](https://www.digitalocean.com/community/tutorials/how-to-set-up-wireguard-on-ubuntu-20-04)

위 설치 과정에서는 ufw linux filewall을 설정하지만, OCI에서는 iptables로 기본 패킷 필터링이 설정되어 있어, ufw를 이용치 않고, 그냥 iptables로 설정을 변경한다.
위 설치 과정에서는 ufw linux firewall을 설정하지만, OCI에서는 iptables로 기본 패킷 필터링이 설정되어 있어, ufw를 이용치 않고, 그냥 iptables로 설정을 변경한다.

다음과 같은 절차로 설치한다.

Expand Down Expand Up @@ -166,7 +166,7 @@ $ sudo sysctl -p

- OCI의 subnet에도 UDP 51820 포트가 수신되도록 설정한다.

- **Networking** -> **Virtual Cloud Netowrks** -> vcn -> subnet -> security list -> **Ingress Rules**
- **Networking** -> **Virtual Cloud Networks** -> vcn -> subnet -> security list -> **Ingress Rules**
- CIDR, 0.0.0.0/0, UDP, Dest Port: 51820

- wg0.conf 에 대한 데모을 enable 하고 실행한다.
Expand Down Expand Up @@ -351,7 +351,7 @@ $ sudo ip -6 neigh add proxy 2603:cafe:cafe:ca01::2002 dev ens3

패킷을 수신받기 위하여 다음과 같이 설정한다.

- OCI 설정에서 Ubuntu VM에 `2603:cafe:cafe:ca01::2002` IP를 추가 등록. Uubntu는 `2603:cafe:cafe:ca01::1001`과 2개의 IPv6를 가짐
- OCI 설정에서 Ubuntu VM에 `2603:cafe:cafe:ca01::2002` IP를 추가 등록. Ubuntu는 `2603:cafe:cafe:ca01::1001`과 2개의 IPv6를 가짐

- **Compute** -> **Instances** -> Instance -> **Attached VNICs** -> vnic -> **IPv6 Address**

Expand All @@ -365,7 +365,7 @@ $ sudo ip -6 neigh add proxy 2603:cafe:cafe:ca01::2002 dev ens3
$ sudo systemctl stop [email protected]
```

- /etc/wirdguard/wg0.conf 수정
- /etc/wireguard/wg0.conf 수정
- Address를 임의의 주소로 변경. Subnet은 범위를 줄임
- 기존 IPv6 masquerade 설정 삭제
- DHCP client를 강제 종료하고, 2603:cafe:cafe:ca01::2002 는 삭제
Expand Down
12 changes: 6 additions & 6 deletions content/posts/http-sha-256-digest-auth/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ draft: false
authors: ["YSLee"]
tags: ["SHA", "HTTP", "Authentication"]
categories: ["Security"]
aliases: [/posts/httd-sha-256-digest-auth//]
aliases: [/posts/http-sha-256-digest-auth//]
---

일반 웹 환경에서는 이제는 사양화 되어 거의 사용하지는 않지만,
Expand Down Expand Up @@ -73,7 +73,7 @@ sequenceDiagram


2015년에 RFC 7616 으로 버전업을 하면서 가장 큰 변경 사항은 Digest 인증 시 필수 방식 이 MD5 에서 SHA-2 (SHA-256) 로 변경된 것이다.
Proxy, [Authenticateion-Info](https://datatracker.ietf.org/doc/html/rfc2617#section-3.2.3) 나 UTF-8 지원 등 변경된 것들이 있지만, 어쨋든 사람들이 일반적으로 말하는 기준으로 보면 RFC2617은 MD5 Digest 인증이고, RFC7616은 SHA-256 Digest 인증이라고 볼 수 있다.
Proxy, [Authentication-Info](https://datatracker.ietf.org/doc/html/rfc2617#section-3.2.3) 나 UTF-8 지원 등 변경된 것들이 있지만, 어쨋든 사람들이 일반적으로 말하는 기준으로 보면 RFC2617은 MD5 Digest 인증이고, RFC7616은 SHA-256 Digest 인증이라고 볼 수 있다.

참고로 이외에도 표준으로 정의된 다양한 인증방식이 있다. IANA에서는 아래 링크로 등록된 authentication scheme을 관리한다.
- [HTTP Authentication Scheme Registry](https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml)
Expand Down Expand Up @@ -132,7 +132,7 @@ Authorization: Digest username="Mufasa",
- A1 = "Mufasa:http-auth@example.org:Circle of Life"
- A2 = "GET:/dir/index.html"

A1 과 A2를 각각 hash 함수를 돌려서 소문자 hexdecimal로 표현한 것을 각각 HA1, HA2 라고 하자.
A1 과 A2를 각각 hash 함수를 돌려서 소문자 hexadecimal로 표현한 것을 각각 HA1, HA2 라고 하자.
이를 다시 다음과 같이 문자열로 만들어서 hash 한 것이 최종 digest 값이다.

- Digest_Input = HA1:nonce:nc:cnonce:qop:HA2
Expand Down Expand Up @@ -199,7 +199,7 @@ HTTP Digest Authentication이 이렇게 사양화 된 이유는 크게 다음과

반드시 구현을 하여야 한다면 XMLHttpRequest 나 fetch API를 이용한 비동기 방식으로 구현하여야 한다. React와 같은 client side rendering 방식으로 구현 시 static data(HTML, CSS, javascript)는 별도의 인증없이 받아오고, 비동기로 얻어오는 RESTful API 에 대해서만 인증을 하는 방식으로 하면 된다.

하지만 실제로 구현을 해보면 401 Unauthorized 메시지를 javasript가 hooking 할 수 있는 방법이 없다.
하지만 실제로 구현을 해보면 401 Unauthorized 메시지를 javascript가 hooking 할 수 있는 방법이 없다.

```javascript
var DigestAuthRequest = function(method, url) {
Expand All @@ -226,7 +226,7 @@ var DigestAuthRequest = function(method, url) {
이를 회피하기 위하여는 다음과 같은 방법 중 하나로 서버에서 수정을 해주어야 한다.

- 401 Unauthorized 가 아니라 400 등의 다른 오류코드로 변경
- `www-authenticate`가 아니라 `x-www-authenticate` 처럼 header 이름을 변경하거나, `www-authentiate` 필드 digest scheme을 `xdigest`와 같이 비표준으로 변경
- `www-authenticate`가 아니라 `x-www-authenticate` 처럼 header 이름을 변경하거나, `www-authenticate` 필드 digest scheme을 `xdigest`와 같이 비표준으로 변경

이렇게 하면 브라우저에서 별도의 처리를하지 않아, 위 코드와 같은 방식으로 구현이 가능하다.

Expand All @@ -238,6 +238,6 @@ var DigestAuthRequest = function(method, url) {
- 이렇게 하면 SHA-256 digest 인증을 지원하지 않는 browser는 인증창을 별도로 띄우지 않고, 에러 처리를 하므로 javascript에서 처리 할 수 있다. Firefox를 제외한 대부분의 브라우저가 해당된다.
- SHA-256 digest를 지원하는 Firefox 에서는 인증창을 띄우지 않도록 url 에 사용자 정보를 임베딩하여 보낸다.
- [URI](https://datatracker.ietf.org/doc/html/rfc3986) 에는 `http://username:password@hostname` 와 같이 사용자 정보를 포함할 수 있다. Fetch API 에서는 이 방식이 지원하지 않지만, XMLHttpRequest 는 이와 같은 사용자 정보를 URL에 추가하는 것이 가능하다.
- 해당 기능은 brwoser마다 동작 특성이 다르지만 chrome, firefox 에서는 URL 에 포함된 사용자 정보로 digest 인증을 시도하고 에러를 리턴한다. 하지만 safari 브라우저 에서는 기존 방식처럼 브라우저 자체의 인증창을 띄우게 된다.
- 해당 기능은 browser마다 동작 특성이 다르지만 chrome, firefox 에서는 URL 에 포함된 사용자 정보로 digest 인증을 시도하고 에러를 리턴한다. 하지만 safari 브라우저 에서는 기존 방식처럼 브라우저 자체의 인증창을 띄우게 된다.

브라우저의 인증창을 열리고, 이곳에 사용자가 정보를 입력하게 되면 이 정보는 javascript에서는 엑세스가 블가능하므로 사용자 인증 절차가 꼬이게 되므로 충분한 검증을 하여야 할 것이다. 브라우저 종류나 버전마다 특성이 달라질 수 있어, 동작을 보장하기 위하여는 충분한 시험을 하여 검증 할 필요가 있다.
2 changes: 1 addition & 1 deletion content/posts/mqtt-protocol/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MQTT 프로토콜에서 사용자 인증을 제공한다. 하지만 이를 위

MQTT는 client-server protocol로, client는 센서 장치 또는 모니터링 장비(PC, 스마트 기기)가 될 수 있고, server는 broker라고 칭한다. Broker는 연결된 client 와의 session을 관리하고, 다른 broker와 연결하기도 한다. 초기 세션 수립은 client에서 broker로 MQTT CONNECT 메시지를 전송하여 이루어진다. 이후 이 TCP 세션은 client가 사용을 중단할 때까지 유지하여 메시지를 주고 받는 용도로 사용한다.

### Exteremely Lightweight Publish / Subscribe Messaging Protocol
### Extremely Lightweight Publish / Subscribe Messaging Protocol

메시지 큐 프로토콜은 채팅과 유사한 개념이라고 생각하면 된다. IRC 채팅 개념과 비교하면 아래와 같다.

Expand Down
4 changes: 2 additions & 2 deletions content/posts/platformio-1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ESP, Atmel, STM32 Cube, Nordic NRF52, Linux ARM, ... 등 다양한 플랫폼을

위의 캡쳐 이미지와 같이 홈페이지에서 PlatformIO를 다음과 같이 소개 하고 있다.

- Prefessional collaborative platform for embedded development
- Professional collaborative platform for embedded development
- A place where Developers and Teams have true Freedom!
- No more vendor lock-in!

Expand Down Expand Up @@ -75,7 +75,7 @@ Hard realtime 을 요하는 환경에서는 real-time tracing 기능이 큰 장
- Library Dependency Finder(LDF) 기능으로 소스 파일의 include를 참고하여 자동으로 의존성 있는 라이브러리 빌드
- J-Link 등 다양한 디버깅 툴을 이용한 다운로드, 디버깅 지원
- Serial Monitor 기능 제공하여 시리얼 디버깅 콘솔 출력 기능
- Unit Test 지원하여 host/target hibrid unit test 환경 제공
- Unit Test 지원하여 host/target hybrid unit test 환경 제공
- 위의 사항을 조합한 통합 개발 환경

간단히 말해서 platformio.ini 로 초기화를 잡아주고 CLI를 실행만 해주면 초기 틀이 잡혀지고,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Amazon 등에서 검색해보면 Network Tap 도 $200~300 정도로 비싼 편
- GS108Ev3 스위치에 AP와 유선으로 시험용 기기를 연결하여 Macbook 으로 포트 미러링
- Macbook에는 USB ethernet 2개를 사용
- Ethernet 1: 일반 인터넷 사용
- Etehrnet 2: GS108Ev3 에 연결하여 ethernet packet 캡쳐 전용
- Ethernet 2: GS108Ev3 에 연결하여 ethernet packet 캡쳐 전용
- 내장 무선랜: IEEE 802.11 무선랜 패킷 캡쳐 및 무선랜 시험용

이와 같이하여 유선, 무선랜 IEEE 802.11 raw packet, 무선랜의 IP layer packet 과 같이 필요에 따라 적절한 방법으로 캡쳐할 수 있도록 하였다.
Loading

0 comments on commit 424e059

Please sign in to comment.