Reco Everything you wanna value. 자세히보기

[IT|Programming]/HTML related

Vert.x 로 https (SSL/TLS) server 만들기

kipid 2022. 12. 30. 10:20
반응형
m.logPrint() is working!

<eq> and <eqq> tags are rendered to MathJax format, being enclosed by \ ( \ ) and \ [ \ ].

docuK1 scripts started!
If this log is not closed automatically, there must be an error somewhere in your document or scripts.

Table of Contents is filled out.

Auto numberings of sections (div.sec>h2, div.subsec>h3, div.subsubsec>h4), <eqq> tags, and <figure> tags are done.

<cite> and <refer> tags are rendered to show bubble reference.

<codeprint> tags are printed to corresponding <pre> tags, only when the tags exist in the document.


Current styles (dark/bright mode, font-family, font-size, line-height) are shown.

kakao.js with id="kakao-js-sdk" is loaded.

New ShortKeys (T: Table of Contents, F: Forward Section, D: Previous Section, L: To 전체목록/[Lists]) are set.

m.delayPad=0;
m.wait=1024;
wait 941ms.
Doing delayed-load. : 2
▼ Hide
Toggle a mess
Go (FS)
TofC
DocuK Log
Backward
Forward
RRA
Lists
CmtZ
CmtX
Handle CmtZ
Log in
out focus
이 글이 도움이 되셨다면, 광고 클릭 한번씩만 부탁드립니다 =ㅂ=ㅋ.
(If this article was helpful, please click the ad once. Thank you. ;)
Mode: Bright; Font: Noto Sans KR; font-size: 18.0px (10.0); line-height: 1.6;
width: 1280, height: 720, version: 3.3.3
dg:plink (Document Global Permanent Link): https://kipid.tistory.com/240
document.referrer: Empty
This document is rendered by docuK (See also SEE (Super Easy Edit) of docuK and pure SEE).

Vert.x 로 https (SSL/TLS) server 만들기

Vertx 로 secure server 인 https (SSL/TLS) server 를 만들어 봅시다.

T1.keytool .jks

▼ Show/Hide
우선 RSA key 를 만들어 줘야 하는데... 명령어는 다음과 같다. 윈도우 cmd 에서 다음과 같은 명령어를 입력하자.
C:\Recoeve>
keytool -genkeypair -alias recoeve.net -keyalg RSA -keysize 2048 -keystore recoeve.jks -validity 3650

// 실행하면 다음과 같이 뜸.
<code>Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  KANGSOO LEE
What is the name of your organizational unit?
  [Unknown]:  Recoeve.net
What is the name of your organization?
  [Unknown]:  Recoeve.net
What is the name of your City or Locality?
  [Unknown]:  Korea
What is the name of your State or Province?
  [Unknown]:  Korea
What is the two-letter country code for this unit?
  [Unknown]:  KR
Is CN=KANGSOO LEE, OU=Recoeve.net, O=Recoeve.net, L=Korea, ST=Korea, C=KR correct?
  [no]:  yes

Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 3,650 days
        for: CN=KANGSOO LEE, OU=Recoeve.net, O=Recoeve.net, L=Korea, ST=Korea, C=KR</code>
▲ Hide

T2.Default port of HTTPS is 443.

▼ Show/Hide
이것땜에 좀 고생을 했는데, https 접속은 port 443 으로 자동으로 연결된다. 이를 모르고 port 80 에 listen 걸어놓고, https://localhost 로 접속하면 응답이 없게됨.
import io.vertx.core.AbstractVerticle;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.net.JksOptions;
import io.vertx.ext.web.Router;

public class Recoeve extends AbstractVerticle {

	@Override
public void start() {
	Router router=Router.router(vertx);

	router.route().handler(ctx -> {
		HttpServerRequest req=ctx.request();
		System.out.println("A client has connected!");

		req.response().putHeader("Content-Type","text/plain; charset=utf-8");
		req.response().end("Hello World!", "UTF-8");
	});

	vertx.createHttpServer(
		new HttpServerOptions()
			.setUseAlpn(true)
			.setSsl(true)
			.setKeyStoreOptions(new JksOptions()
				.setPath("C:/Recoeve/recoeve.jks")
				.setPassword("[--password--]")
			)
	).requestHandler(router).listen(443);
} // public void start()
} // public class Recoeve extends AbstractVerticle
▲ Hide

T3.EC2 - Security Groups - AWS Inbound rules

▼ Show/Hide
AWS Inbound rules 에서 HTTPS TCP port 443 을 열어줘야 함.
▲ Hide

T4.Windows firewall

▼ Show/Hide
Server 의 Windows firewall 설정에서도 port 443 을 열어줘야 함. Inbound, Outbound 둘 다.
▲ Hide
Toggle a mess
* 홍보/Promoting Recoeve.net (3S | Slow/Sexy/Sincere SNS)
유튜브 음악, K-Pop MV 들을 광고없이 목록재생 해서 보세요.
접속하셔서 가입 후 별점만 드레그 하시면 자신의 페이지에 저장 됩니다.
그리고 자신의 페이지로 이동한 뒤 추천 받기 (단축키 R) 를 누르시면 자신이 점수 메긴것들로 이웃 (이웃보기 단축키 B) 을 자동으로 찾아주고 그 이웃들로부터 추천을 받을 수 있습니다.
Toggle a mess
이 글이 도움이 되셨다면, 광고 클릭 한번씩만 부탁드립니다 =ㅂ=ㅋ.
(If this article was helpful, please click the ad once. Thank you. ;)
반응형