Skip to content

Instantly share code, notes, and snippets.

@yetanotherdev267
Last active April 23, 2019 03:18
Show Gist options
  • Save yetanotherdev267/add55380309c9176b7ae to your computer and use it in GitHub Desktop.
Save yetanotherdev267/add55380309c9176b7ae to your computer and use it in GitHub Desktop.
JBoss 7.1.1 SSL Configuration

#1 Cấu hình SSL cho JBoss AS 7.1.1 Final

  1. Tải về & cài đặt JDK 6 JBoss 7.1.1 sử dụng JDK 6. Các bạn cần đảm bảo đã máy tính chỉ cài đặt JDK 6 là phiên bản Java mới nhất. Bạn có thể tải về JDK 6 ở đây.

  2. Tải về JBoss 7.1.1 Final Các bạn có thể tải về JBoss AS 7.1.1 Final ở đây hoặc từ trang chủ download http://jbossas.jboss.org/downloads. Giải nén JBoss ra một thư mục nào đó. Gọi thư mục này là JBOSS_HOME.

  3. Chạy và cấu hình JBoss

  • Mở cmd, di chuyển đến thư mục %JBOSS_HOME%, thư mục bin, chạy lệnh standalone và để nguyên.
  • Mở một cmd khác, di chuyển đến %JBOSS_HOME%/bin, chạy lệnh jboss-cli.bat. Tiếp tục chạy lệnh connect để kết nối đến JBoss server.
  • Chạy lần lượt các lệnh sau sao cho kết quả trả về luôn là success là được. Lần lượt khai báo 3 interface có tên http, httpspub, httpspriv:
/interfaces=/interface=http:add(inet-address="localhost")
/interfaces=/interface=httpspub:add(inet-address="localhost")
/interfaces=/interface=httpspriv:add(inet-address="localhost")

Bind port 833 vào interface httpspriv

/socket-binding-group=standard-sockets/socket-binding=httpspriv:add(port="833",interface="httpspriv")

Khai báo connector httpspriv với các thuộc tính protocol, scheme, socket-binding, secure:

/subsystem=web/connector=httpspriv:add(protocol=HTTP/1.1, scheme=https, socket-binding=httpspriv, secure=true)
/subsystem=web/connector=httpspriv/ssl=configuration:add(key-alias="testvpbank4")
/subsystem=web/connector=httpspriv/ssl=configuration:write-attribute(name=password, value="12345678")
/subsystem=web/connector=httpspriv/ssl=configuration:write-attribute(name=certificate-key-file, value="C:/Setup/Ma Hoa/Ma Hoa/Server_keystore.jks")
/subsystem=web/connector=httpspriv/ssl=configuration:write-attribute(name=verify-client, value=true)/subsystem=web/connector=httpspriv/ssl=configuration:write-attribute(name=ca-certificate-password, value="12345678")
/subsystem=web/connector=httpspriv/ssl=configuration:write-attribute(name=ca-certificate-file, value="C:/Setup/Ma Hoa/Ma Hoa/Server_truststore.jks")

Bind port 82 vào interface httpspub

/socket-binding-group=standard-sockets/socket-binding=httpspub:add(port="82",interface="httpspub")
/subsystem=web/connector=httpspub:add(protocol=HTTP/1.1, scheme=https, socket-binding=httpspub, secure=true)
/subsystem=web/connector=httpspub/ssl=configuration:add(key-alias="testvpbank4")
/subsystem=web/connector=httpspub/ssl=configuration:write-attribute(name=password, value="12345678")
/subsystem=web/connector=httpspub/ssl=configuration:write-attribute(name=certificate-key-file, value="C:/Setup/Ma Hoa/Ma Hoa/Server_keystore.jks")
  1. Deploy một ứng dụng web application BKAV đã cung cấp sẵn một ứng dụng bcse.war. Ta chỉ việc copy vào thư mục JBOSS_HOME/standalone/deployments/ là được.

  2. Restart JBoss và kiểm tra thành quả

  3. Mở cmd đã chạy lệnh standalone trên đó và nhấn tổ hợp phím Ctrl+C để stop server. Nhấn y để đồng ý terminate server.

  4. Chạy lại lệnh standalone để khởi động lại server JBoss sau khi đã terminate thành công.

  5. Mở trình duyệt truy cập vào 2 đường dẫn https://localhost:833/bcsehttps://localhost:82/bcse để kiểm tra lại xem SSL đã được triển khai thành công ở 2 port này chưa. Nếu nhận được kết quả thành công với thông báo Secure connection màu xanh là đã thành công.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment