SlideShare a Scribd company logo
資訊安全筆記 2023_0129
一、安裝工具
1. Eclipse Enterprice 安裝
注意請務必選擇 Eclipse IDE for Enterprise Java and Web Developers 下載
https://www.eclipse.org/downloads/packages/release/2022-09/r
2. 另外 STS 的外掛也請加入到 Eclipse 中
可以 Google "Eclipse 安裝 STS plug-in" 關鍵字查詢
如無法安裝 Eclipse + Spring 的同學可以改安裝
Spring Tools 4 for Eclipse
https://spring.io/tools
也是一樣可以,此 IDE 工具已經將 eclipse + spring 直接都做好了
3. Git for Windows 也要裝
https://www.git-scm.com/download/win
4. 因為會使用 OpenSSL , 工具安裝方法請參考此篇
https://blog.miniasp.com/post/2019/02/25/Creating-Self-signed-Certificate-using-OpenSSL
5. Insomnia rest 工具安裝
https://insomnia.rest/download
6. MySQL Community Server 8.0.32.
https://dev.mysql.com/downloads/mysql/
7. 監控 HTTP 封包資料
https://www.charlesproxy.com/download/
二、Github code
https://github.com/vincenttuan/WebSecure2023
三、生成金鑰
在指定目錄下建立 tomcat.keystore
指定目錄
在 tomcat 安裝目錄下的 /conf 中新建立 /keys 資料夾
/Users/vincenttuan/Documents/apache-tomcat-9.0.62/conf/keys
DOS 命令提示字元進入到 …/keys 目錄
建立 tomcat.keystore 指令:
keytool -genkeypair -alias tomcat -keyalg RSA -keypass 123456 -storepass 123456
-keysize 1024 -validity 365 -keystore tomcat.keystore
四、修改 web.xml
<security-constraint>
<display-name>Constraint1</display-name>
<web-resource-collection>
<web-resource-name>secure</web-resource-name>
<description/>
<url-pattern>/secure/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<description/>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
五、修改 server.xml
<Connector
port="8443"
protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="200"
scheme="https"
secure="true"
SSLEnabled="true"
keystoreFile="/Users/vincenttuan/Documents/apache-tomcat-9.0.62/conf/keys/tomcat.keystore"
keystorePass="123456"
clientAuth="false"
sslProtocol="TLS"/>
六、建立 ssl.conf 設定檔
[req]
prompt = no
default_md = sha256
default_bits = 2048
distinguished_name = dn
x509_extensions = v3_req
[dn]
C = TW
ST = Taiwan
L = Taipei
O = WebSecure
OU = Pcschool
emailAddress = admin@example.com
CN = study
[v3_req]
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
IP.1 = 127.0.0.1
IP.2 = 192.168.30.252
七、建立出私密金鑰 (server.key) 與憑證檔案 (server.crt)
openssl req -x509 -new -nodes -sha256 -utf8 -days 3650 -newkey rsa:2048 -keyout
server.key -out server.crt -config ssl.conf
八、產生 PKCS#12 憑證檔案 (*.pfx 或 *.p12) 給 Tomcat 使用
openssl pkcs12 -export -in server.crt -inkey server.key -out server.pfx
Enter Export Password: 123456
Verifying - Enter Export Password: 123456
九、加入到根憑證 (for MAC)
其他 OS 請參考:
https://blog.miniasp.com/post/2019/02/25/Creating-Self-signed-Certificate-using-Ope
nSSL
sudo security add-trusted-cert -d -r trustRoot -k
/Library/Keychains/System.keychain server.crt
若有出現 password: mac 的密碼
十、修改 server.xml (透過 CA)
<Connector
SSLEnabled="true"
SSLEngine="on"
clientAuth="false"
keystoreFile="/Users/vincenttuan/Documents/apache-tomcat-9.0.62/conf/keys/server.pfx"
keystorePass="123456"
keystoreType="pkcs12"
maxThreads="200"
port="8443"
protocol="org.apache.coyote.http11.Http11NioProtocol"
scheme="https"
secure="true"/>

More Related Content

PPTX
Sencha touch 2 訓練課程 2 android環境建置
DOCX
資訊安全筆記 2023_0129_0205.docx
PPTX
轻松写出优雅的Java代码之check style
PDF
GAE Java IDE installation
PPT
Eclipse開發平台快速入門
PPT
在雲端上啜飲爪哇
PDF
多媒體系統09_3D互動擴增實境
PPTX
Crashlytics 使用教學
Sencha touch 2 訓練課程 2 android環境建置
資訊安全筆記 2023_0129_0205.docx
轻松写出优雅的Java代码之check style
GAE Java IDE installation
Eclipse開發平台快速入門
在雲端上啜飲爪哇
多媒體系統09_3D互動擴增實境
Crashlytics 使用教學

Similar to 資訊安全筆記 2023_0129.doc (20)

PDF
【第一回 ゼロからはじめる Oracle Solaris 11】03_知るべきは pkg(1) コマンドのみ! ~Image Packaging Syst...
PPTX
scriptcs 簡介
PDF
打造你專屬的Xcode plugin
PDF
How to avoid check style errors
PDF
51 cto下载 android应用程序开发宝典
PDF
簡化 JVM 上雲 - 透過 Azure Spring Cloud 提升開發、發佈及服務監控效率
PDF
使用 Load Balancer 與 Redis 部署 LAMP Server 高併發架構 - Global Azure Taiwan 20200425 ...
PPT
OSGi Small Lab
PDF
Android消息推送之androidpn demo版到正式上线
PPT
Selenium介绍
PDF
Adobe flash builder 4.7 自述
PDF
2021laravelconftwslides10
PDF
System prereq chin
ODP
Admin generator
PDF
Android_lecture_000
PPTX
Lazyload实践
PPTX
模块化和组件化Css
PPTX
教研究生學HoloLens 100快速完成作品
PPT
如何批量下载豆瓣相册图片
PDF
Moodle 2.3 图文安装教程
【第一回 ゼロからはじめる Oracle Solaris 11】03_知るべきは pkg(1) コマンドのみ! ~Image Packaging Syst...
scriptcs 簡介
打造你專屬的Xcode plugin
How to avoid check style errors
51 cto下载 android应用程序开发宝典
簡化 JVM 上雲 - 透過 Azure Spring Cloud 提升開發、發佈及服務監控效率
使用 Load Balancer 與 Redis 部署 LAMP Server 高併發架構 - Global Azure Taiwan 20200425 ...
OSGi Small Lab
Android消息推送之androidpn demo版到正式上线
Selenium介绍
Adobe flash builder 4.7 自述
2021laravelconftwslides10
System prereq chin
Admin generator
Android_lecture_000
Lazyload实践
模块化和组件化Css
教研究生學HoloLens 100快速完成作品
如何批量下载豆瓣相册图片
Moodle 2.3 图文安装教程

資訊安全筆記 2023_0129.doc

  • 1. 資訊安全筆記 2023_0129 一、安裝工具 1. Eclipse Enterprice 安裝 注意請務必選擇 Eclipse IDE for Enterprise Java and Web Developers 下載 https://www.eclipse.org/downloads/packages/release/2022-09/r 2. 另外 STS 的外掛也請加入到 Eclipse 中 可以 Google "Eclipse 安裝 STS plug-in" 關鍵字查詢 如無法安裝 Eclipse + Spring 的同學可以改安裝 Spring Tools 4 for Eclipse https://spring.io/tools 也是一樣可以,此 IDE 工具已經將 eclipse + spring 直接都做好了 3. Git for Windows 也要裝 https://www.git-scm.com/download/win 4. 因為會使用 OpenSSL , 工具安裝方法請參考此篇 https://blog.miniasp.com/post/2019/02/25/Creating-Self-signed-Certificate-using-OpenSSL 5. Insomnia rest 工具安裝 https://insomnia.rest/download 6. MySQL Community Server 8.0.32. https://dev.mysql.com/downloads/mysql/ 7. 監控 HTTP 封包資料 https://www.charlesproxy.com/download/ 二、Github code https://github.com/vincenttuan/WebSecure2023 三、生成金鑰
  • 2. 在指定目錄下建立 tomcat.keystore 指定目錄 在 tomcat 安裝目錄下的 /conf 中新建立 /keys 資料夾 /Users/vincenttuan/Documents/apache-tomcat-9.0.62/conf/keys DOS 命令提示字元進入到 …/keys 目錄 建立 tomcat.keystore 指令: keytool -genkeypair -alias tomcat -keyalg RSA -keypass 123456 -storepass 123456 -keysize 1024 -validity 365 -keystore tomcat.keystore 四、修改 web.xml <security-constraint> <display-name>Constraint1</display-name> <web-resource-collection> <web-resource-name>secure</web-resource-name> <description/> <url-pattern>/secure/*</url-pattern> </web-resource-collection> <user-data-constraint> <description/> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> 五、修改 server.xml <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="200" scheme="https" secure="true"
  • 3. SSLEnabled="true" keystoreFile="/Users/vincenttuan/Documents/apache-tomcat-9.0.62/conf/keys/tomcat.keystore" keystorePass="123456" clientAuth="false" sslProtocol="TLS"/> 六、建立 ssl.conf 設定檔 [req] prompt = no default_md = sha256 default_bits = 2048 distinguished_name = dn x509_extensions = v3_req [dn] C = TW ST = Taiwan L = Taipei O = WebSecure OU = Pcschool emailAddress = admin@example.com CN = study [v3_req] subjectAltName = @alt_names [alt_names] DNS.1 = localhost IP.1 = 127.0.0.1 IP.2 = 192.168.30.252 七、建立出私密金鑰 (server.key) 與憑證檔案 (server.crt) openssl req -x509 -new -nodes -sha256 -utf8 -days 3650 -newkey rsa:2048 -keyout server.key -out server.crt -config ssl.conf
  • 4. 八、產生 PKCS#12 憑證檔案 (*.pfx 或 *.p12) 給 Tomcat 使用 openssl pkcs12 -export -in server.crt -inkey server.key -out server.pfx Enter Export Password: 123456 Verifying - Enter Export Password: 123456 九、加入到根憑證 (for MAC) 其他 OS 請參考: https://blog.miniasp.com/post/2019/02/25/Creating-Self-signed-Certificate-using-Ope nSSL sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain server.crt 若有出現 password: mac 的密碼 十、修改 server.xml (透過 CA) <Connector SSLEnabled="true" SSLEngine="on" clientAuth="false" keystoreFile="/Users/vincenttuan/Documents/apache-tomcat-9.0.62/conf/keys/server.pfx" keystorePass="123456" keystoreType="pkcs12" maxThreads="200" port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true"/>