์๋ ํ์ธ์,
๋ด ์ค์ ์ ์ด๋ ์ต๋๋ค.
Shinyproxy๋ ์ด๋ฆ์ด shiny-proxy์ธ ๋์ปค ์ปจํ ์ด๋์์ ์คํ๋ฉ๋๋ค.
apache httpd ์ญ๋ฐฉํฅ ํ๋ก์๋ shinyproxy๋ณด๋ค ๋จผ์ ์คํ๋์ด https๋ก ๋ณํํ๊ณ ํฌํธ 2443์ ์ฌ์ฉํ์ฌ ํธ์คํธ์์ ์คํ๋ฉ๋๋ค.
keycloak์ ๋์ปค ์ปจํ
์ด๋์์๋ ์คํ๋์ง๋ง ํฌํธ๋ 8443์ผ๋ก ํธ์คํธ์์ ์ด๋ ค ์์ต๋๋ค.
์ค์ , application.xml
keycloak:
realm: shiny
auth-server-url: https://keycloak:8443/auth
#ssl-required: none
ssl-required: external
confidential-port: 2443
verify-token-audience: true
resource: shiny-proxy-p1
credentials-secret: xxxxxxxxxxxx
์ํ์น ์ญ ํ๋ก์ ๊ตฌ์ฑ
<VirtualHost *:2443>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/server-cert.pem
SSLCertificateKeyFile /etc/apache2/ssl/server-cert.key
# Server Certificate Chain:
# Point SSLCertificateChainFile at a file containing the
# concatenation of PEM encoded CA certificates which form the
# certificate chain for the server certificate. Alternatively
# the referenced file can be the same as SSLCertificateFile
# when the CA certificates are directly appended to the server
# certificate for convinience.
SSLCertificateChainFile /etc/apache2/ssl/server-ca.crt
<Proxy *>
Allow from *
</Proxy>
RewriteEngine on
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://shiny-proxy:8080/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://shiny-proxy:8080/$1 [P,L]
ProxyPass / http://shiny-proxy:8080/
ProxyPassReverse / http://shiny-proxy:8080/
ProxyRequests Off
ErrorLog ${APACHE_LOG_DIR}/proxy_error.log
CustomLog ${APACHE_LOG_DIR}/proxy_access.log combined
</VirtualHost>
URL์ด https://lxsqlpocnd04 :2443/์ธ Apache๋ฅผ ํตํด Shinyprox์ ์ก์ธ์คํ ๋๋ฅผ ๊ฐ์ ํด ๋ณด๊ฒ ์ต๋๋ค.
๋ก๊ทธ์ธ ํ์ด์ง๋ก ๋ฆฌ๋๋ ์
๋๊ณ ๋ก๊ทธ์ธ ํ์ด์ง ๋ฆฌ๋๋ ์
์์ฒญ์ Keycloak ํธ์คํธ lxsqlpocnd04 ๋ฐ ํฌํธ 8443์ผ๋ก ๋ฆฌ๋๋ ์
๋ฉ๋๋ค. ํด๋น URL์๋ redirect_uri๊ฐ ํฌํจ๋ ์ฟผ๋ฆฌ ๋ฌธ์์ด์ด ์์ง๋ง ์์ํ ๊ฒ์ด ์๋๋๋ค.
URL์ ์ด๋ ์ต๋๋ค
https://lxsqlpocnd04 :8443/auth/realms/shiny/protocol/openid-connect/auth?response_type=code&client_id=shiny-proxy-p1&redirect_uri=http%3A%2F%2Fshiny-proxy%3A8080%2Fsso%2Flogin&state= e6a9-4768-8cf8-39d77500fea3&login=true&scope=openid
๊ทธ๋ฆฌ๊ณ redirect_uri๋ https://lxsqlpocnd04 :2443/sso/login์ด ์๋ http://shiny-proxy :8080/sso/login์ ๋๋ค.
๋๊ตฐ๊ฐ ๋์ธ ์ ์์ต๋๊น?
๊ฐ์ฌ,
๋จ์ ์ด๋ฆ
application.yml์์ ์ค์ ํ์ จ๋์?
server:
useForwardHeaders: true
์ฌ๊ธฐ์์: https://www.shinyproxy.io/security/#https -ssl-tls
Apache๊ฐ ๋ฌด์์ธ์ง ํ์คํ์ง ์์ง๋ง nginx์์๋ ์ด๊ฒ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๊ฒ์ผ ์ ์์ต๋๋ค.
proxy_set_header Host $http_host;
@aiham ๊ฐ์ฌํฉ๋๋ค.
๋๋ ๊ทธ๊ฒ์ ์๋ํฉ๋๋ค. useForwardHeaders: true๊ฐ ๋๋ฝ๋์๊ธฐ ๋๋ฌธ์ ๋๋ค.
im using useForwardHeaders: true์ด์ง๋ง ์ฌ์ ํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
@danielfm123
im using useForwardHeaders: true์ด์ง๋ง ์ฌ์ ํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
SSL ์ธ์ฆ์์ ๊ด๋ จ๋ ๋ ๋ค๋ฅธ ๊ฐ๋ฅ์ฑ์ด ์์ต๋๋ค. Keycloak์ ์ค์น๋ ์ธ์ฆ์๊ฐ ๊ณต๊ฐ์ ์ผ๋ก ์ ๋ขฐํ ์ ์๋ ๊ฒฝ์ฐ(๋ฃจํธ ๋ฐ ์ค๊ฐ CA๊ฐ Java์ ๊ธฐ๋ณธ ์ ๋ขฐ ๋ชฉ๋ก์ ์์) JRE ๊ธฐ๋ณธ ์ ๋ขฐํ ์ ์๋ CA์ ์ถ๊ฐํด์ผ ํฉ๋๋ค. JRE๋ Shinyproxy๋ฅผ ์คํํ๋ ๊ฒ์ ๋๋ค.
๊ธฐ๋ณธ ์์น๋ JAVA_HOME---> JRE -->lib---> security--> cacerts JAVA_HOME---> JRE -->lib---> security--> cacerts์ ๋๋ค.
์ด๋ฐ ์์ผ๋ก ๊ฐ์ ธ ์ค๊ธฐ ๋ช ๋ น.
keytool -import -noprompt -alias -your-root -file /opt/jboss/your-root.crt -keystore /etc/pki/java/cacerts -storepass changeit
๋๋ ๊ทธ๊ฒ์ํ์ง๋ง ์๋ํ์ง ์์ต๋๋ค. ๋๋ 2.4.1 ๋์ ์ shinyproxy 2.3.1์ ์๋ํ๊ณ ๊ทธ๊ฒ์ ์ฌ๋ฐ๋ฅธ redirect_uri๋ฅผ ๋ณด๋ด์ง๋ง ์ผ๋ถ ๋ธ๋ผ์ฐ์ ์์๋ง ์๋ํฉ๋๋ค. ๋๋จธ์ง์์๋ err_too_many_redirects๋ฅผ ์ป์ต๋๋ค.
๊ทํ์ ์ธ์ฆ์๋ ๊ณต๊ฐ์ ์ผ๋ก ์ ๋ขฐํ ์ ์์ต๋๊น? ํ ์คํธ ๋จ๊ณ์์ ์ธ์ฆ์๊ฐ ๊ณต๊ฐ์ ์ผ๋ก ์ ๋ขฐํ ์ ์๋ ๋ฌธ์ ์ ์ง๋ฉดํ์ต๋๋ค. ๋ฃจํธ CA ๋ฐ ์ค๊ฐ CA๋ฅผ ๋ธ๋ผ์ฐ์ ์ ๋ขฐํ ์ ์๋ ์ ์ฅ์๋ก ๊ฐ์ ธ์์ผ ํฉ๋๋ค. ๊ฐ ๋ธ๋ผ์ฐ์ ๋ ๋ค๋ฅด๋ฉฐ OS ๋ฐ ๋ธ๋ผ์ฐ์ ์ ๋ฐ๋ผ ๋ค๋ฆ ๋๋ค. ์ ๊ฒฝ์ฐ์๋ Certs๋ฅผ ์ ๋ขฐํ ์ ์๋ ์์ญ์ผ๋ก ๊ฐ์ ธ์จ ํ Windows๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฉฐ ๊ทธ ํ์ IE์ Chrome ๋ชจ๋ ์ ๋๋ก ์๋ํฉ๋๋ค.
์ฌ๊ธฐ ๋ด ์ ์์ด ์์ต๋๋ค.
๊ทธ๊ฒ์ certbot์ผ๋ก ๊ฒ์ฆ๋์์ต๋๋ค.... ์ ๋ Shinyproxy 2.3.1 ๋ฐ ๋ค๋ฅธ Active Directory ๊ณ์ ๊ณผ ํจ๊ป ์๋ํ๋๋ก ๊ด๋ฆฌํ์ต๋๋ค...
๊ทธ๋ฌ๋ Shinyproxy 2.4.1 ๋ฐ 2.4.0์๋ ๋ฒ๊ทธ๊ฐ ์์ต๋๋ค.
์๋
ํ์ธ์ @danielfm123๋ , ์ฌ๊ธฐ์์ ๋ช ๊ฐ์ง๋ฅผ ํ์ธํ๋๋ฐ ShinyProxy 2.4.0/1์ redirect_uri ๋ฌธ์ ๋ฅผ ์ฌํํ ์ ์์ต๋๋ค.
๋ค์ ์ ๋ณด๋ก ์ ๋ฌธ์ ๋ฅผ ์ด โโ์ ์์ต๋๊น? ๊ทธ๋ ๊ฒ ํ๋ฉด ๋ฒ๊ทธ๊ฐ ์๋์ง ์ดํด๋ณด๊ณ ํ์ธํ ์ ์์ต๋๋ค.
๊ฐ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
keycloak, apache2 ๋ฆฌ๋ฒ์ค ํ๋ก์ ๋ฐ shinyproxy 2.3.1๋ก ์ค์ ํ๋ฉด ์ ๋๋ก ์๋ํฉ๋๋ค. Docker๋ฅผ ํตํด Shinyproxy๋ฅผ ์คํํฉ๋๋ค. Shinyproxy๋ https://testauth.example.com์ผ๋ก ์ฌ๋ฐ๋ฅด๊ฒ ๋ฆฌ๋๋ ์ ๋ฉ๋๋ค
Shinyproxy 2.4.1๋ก ์ ํํ๋ฉด ์ธ๋ถ์์ ์ก์ธ์คํ ์ ์๋ ์ฃผ์ ๋์ redirect_uri์ ๋ด๋ถ IP(http://192.168.51.27:8082)๊ฐ ํฌํจ๋๋ฉฐ "Invalid parameter: redirect_uri" ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
์ด๊ฒ์ ๋ด application.yml์ ๊ด๋ จ ๋ถ๋ถ์ ๋๋ค.
proxy:
title: AUTHTEST
hide-navbar: false
template-path: /templates
favicon-path: /www/favicon.png
heartbeat-rate: 10000
heartbeat-timeout: 600000
port: 8080
admin-groups: admin
container-wait-time: 30000
authentication: keycloak
keycloak:
realm: shinyr
auth-server-url: http://192.168.51.122:8080/auth
resource: shinyr
credentials-secret: <secret>
docker:
internal-networking: true
specs:
- id: test
display-name: Euler App
description: Test App
container-cmd: ["R", "-e", "shiny::runApp('/root/euler')"]
container-image: saletelligence/test
container-network: authtest_authtest_net
access-groups: [admin, pm]
logging:
file:
shinyproxy.log
server:
useForwardHeaders: true
์ด๊ฒ์ ์ํ์น ๊ตฌ์ฑ์ ๋๋ค.
<VirtualHost *:443>
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
ServerName testauth.example.com
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://192.168.51.27:8082/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://192.168.51.27:8082/$1 [P,L]
ProxyRequests Off
ProxyPass "/" "http://192.168.51.27:8082/"
ProxyPassReverse "/" "http://192.168.51.27:8082/"
SSLProxyEngine On
SSLEngine On
SSLCertificateFile /etc/apache2/sslcert/example.crt
SSLCertificateKeyFile /etc/apache2/sslcert/example_pem.key
SSLCACertificateFile /etc/apache2/sslcert/example_bundle.pem
</VirtualHost>
์๋ ํ์ธ์ @eastclintw00d
๋ค์์ ์ฌ์ฉํด ๋ณด์ญ์์ค:
server:
forward-headers-strategy: "native"
๋์ ์
server:
useForwardHeaders: true
๊ฐ์ฌ!
์๋ ํ์ธ์ @LEDfan
๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
๋น ๋ฅธ ๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค!
๊ทธ๊ฒ์ ์๋ํ์ง๋ง ํจํค์ง DT๋ฅผ ์ฃฝ์ ๋๋ค.
@ danielfm123 ๋น์ ์ shinyproxy 2.4.1์ ์คํํ๊ณ ์์ต๋๊น? DT๋ ์ ์๋ํฉ๋๋ค.
@danielfm123 @eastclintw00d POST ์์ฒญ(์: DT์์ ์ํ)์ ํ์ฌ ShinyProxy(2.4.1)์ ํจ๊ป OIDC ๋ฅผ @LEDfan ์ ์์ ์ฌํญ์ ํฅํ ๋ฆด๋ฆฌ์ค์ ์ผ๋ถ๊ฐ ๋ ๊ฒ์ด์ง๋ง ์ด๊ฒ์ ์ด ์ค๋ ๋์ ์ฃผ์ ๊ฐ ์๋๋๋ค.
POST ์์ฒญ ๋ฌธ์ ๋ ์ด์ 2.4.2 ๋ฆด๋ฆฌ์ค ์์ ์์ ๋์์ต๋๋ค.
์๋ ๋ฌธ์ ์ ๊ด๋ จ๋ ๋ฌธ์๊ฐ ์ ๋ฐ์ดํธ๋ฉ๋๋ค.
๋ฌธ์ ๋ฅผ ์ ์ง ๊ด๋ฆฌํ ์ ์๋๋ก ์ด ๋ฌธ์ ๋ฅผ ์ ๊ทธ๊ฒ ์ต๋๋ค.
๋ฌผ๋ก , ํญ์ ๊ทธ๋ ๋ฏ์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ฉด ์ฃผ์ ํ์ง ๋ง๊ณ ์ ๋ฌธ์ ๋ฅผ ์ฌ์ญ์์ค!