์๋ ,
https์์๋ง ShinyProxy๋ฅผ ์ค์ ํ๋ ค๊ณ ํ์ต๋๋ค. ์ด๊ฒ์ ๋ฌธ์์ ๋ฐ๋ผ ๊ฐ๋ฅํ ๊ฒ ๊ฐ์ต๋๋ค - https://www.shinyproxy.io/security/#https -ssl-tls
https๋ง ์ฌ์ฉํ ์ ์๋ ๊ฒฝ์ฐ(์ฆ, nginx์ ๊ตฌ์ฑ๋ http์์ ๋ฆฌ๋๋ ์ ์ด ์๋ ๊ฒฝ์ฐ) ์ ๋ฐฉํฅ ํค๋๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด application.yml์ ๋ค์์ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
์ฌ๊ธฐ๋ ์ฌ๋:
useForwardHeaders: ์ฐธ
๋ฌธ์ ๋ https ์ ์ฉ, NGINX ์์ ๋ฐ OpenID๋ก ์ค์ ํ ๋ https ์ฒด๊ณ๊ฐ NGINX ์์ ์์ ShinyProxy ์ปจํ ์ด๋๋ก ์ ๋ฌ๋์ง ์์ ์ฐจ๋ก๋ก OpenId์ ์ฌ๋ฌ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ค๋ ๊ฒ์ ๋๋ค. ์ฆ:
์ด๊ฒ์ด ๋ฐ์ํ๋ ์ด์ ๋ ์ฌ๊ธฐ์์ ๊ธฐ๋ณธ ์ฝ๋๋ฅผ ์ฌ์ฉํ๋ ShinyProxy ๋๋ฌธ์ ๋๋ค - spring-security DefaultOAuth2AuthorizationRequestResolver.java # L141
@garyallenkt ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ต๋๊น?
๊ฐ์ฌ!
์ด ๋ฌธ์ ์ ๋ํ ์ ๋ฐ์ดํธ๊ฐ ์์ต๋๊น?
OpenAnalytics๋ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐ ํฐ ์ญํ ์ ํ์ต๋๋ค.
์ต์ ๋ฒ์ ์ ShinyProxy(2.3.0)๋ฅผ ๋ค์ด๋ก๋ํ๊ณ ์ฌ๊ธฐ์์ ์ ๋ฐ์ดํธ๋ ์ค๋ช ์๋ฅผ ๋ฐ๋ฅผ ์ ์์ด์ผ ํฉ๋๋ค. - https://www.shinyproxy.io/security/#https -ssl-tls
ํ์ด์ ๋น๋๋ค.
์๋ ํ์ธ์ @garyallenkt ๋ ,
๊ทํ์ ๋น ๋ฅธ ์๋ต์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค. ์ต์ ๋ฒ์ ์ผ๋ก ์๋ํ์ง๋ง ๋ด ๊ฒฝ์ฐ์๋ ๋ฌธ์ ๊ฐ ์ง์๋ฉ๋๋ค. Iframe์ ์ ์ฒด shinyproxy๋ฅผ ํฌํจํ๊ณ ์์ต๋๋ค. ๋ก๊ทธ์ธ์ ์ํด ์๋ฒ๋ HTTPS ์ฐ๊ฒฐ์ ๋๋ถ๋ถ์ ๋ธ๋ผ์ฐ์ ์์ ํ์ฉํ์ง ์๋ HTTP ์ฐ๊ฒฐ๋ก ๋ฆฌ๋๋ ์ ํฉ๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐฉ๋ฒ์ ์๊ณ ์์ต๋๊น?
๋ฌธ์ ์ธ์ฌ
@fmichielssen
์ ๋ Telethon kids repo ์ ํฌํฌ๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฉฐ ๊ทธ๋ค์ 2.3.0๋ ์ฌ์ฉํ๊ณ ์์ง๋ง openanalytics์ ์ด๋ฏธ์ง๋ ๊ฐ์ ธ์์ต๋๋ค. ์ฐธ๊ณ ๋ก ์ฌ๊ธฐ ๋ด ๊ตฌ์ฑ์ด ์์ต๋๋ค.
docker_compose.yaml
version: "3.6"
services:
nginx:
image: nginx:alpine
container_name: tki_nginx
restart: on-failure
networks:
- tki-net
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
ports:
- 80:80
- 443:443
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
depends_on:
- shinyproxy
certbot:
image: certbot/certbot
container_name: certbot
restart: on-failure
volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
influxdb:
image: influxdb:1.7.3-alpine
container_name: tki_influxdb
restart: on-failure
volumes:
- ./run_first_time.sh:/home/run_first_time.sh
- type: volume
source: shinyproxy_usage
target: /var/lib/influxdb
volume:
nocopy: true
networks:
- tki-net
ports:
- 8083:8083
- 8086:8086
shinyproxy:
depends_on:
- influxdb
image: openanalytics/shinyproxy
container_name: open_analytics_shinyproxy
restart: on-failure
networks:
- tki-net
volumes:
- ./application.yml:/opt/shinyproxy/application.yml
- /var/run/docker.sock:/var/run/docker.sock
expose:
- 8080
networks:
tki-net:
name: tki-net
volumes:
shinyproxy_usage:
application.yaml
proxy:
title: Lorem ipsum
hide-navbar: true
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 600000
port: 8080
docker:
internal-networking: true
authentication: openid
openid:
auth-url: https://lorem-ipsum.auth0.com/authorize
token-url: https://lorem-ipsumauth0.com/oauth/token
jwks-url: https://lorem-ipsum.auth0.com/.well-known/jwks.json
client-id: SUPERCOOL
client-secret: SUPERCOOLSECRET
server:
useForwardHeaders: true
specs:
- id: lorem_ipsum
display-name: Lorem Ipsum
description:
container-cmd: ["R", "-e", "shiny::runApp('/root/app')"]
container-image: lorem/ipsum
container-network: tki-net
container-env:
user: "shiny"
environment:
- APPLICATION_LOGS_TO_STDOUT=false
usage-stats-url: http://influxdb:8086/write?db=shinyproxy_usagestats
๋ฐ nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
sendfile on;
upstream tki_shinyproxy {
server open_analytics_shinyproxy:8080;
}
server {
listen 80;
server_name example.org;
server_tokens off;
}
server {
listen 443;
server_name example.org;
server_tokens off;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# SSL
ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://tki_shinyproxy;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 600s;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
์ด์ ๋ํ ๊ฐ๋ฅํ ์ ๋ฐ์ดํธ๊ฐ ์์ต๋๊น? @garyallenkt @fmichielssen
ํด๊ฒฐํ์ต๋๋ค.
์ด ์ฝ๋
server:
useForwardHeaders: true
proxy:
๋ฐ์ ์์ด์ผ ํฉ๋๋ค.
server
๋ ์ค์ ๋ก ์ต์์ ๋ธ๋ก์ด๋ฉฐ proxy
๋ด๋ถ๊ฐ ์๋๋๋ค.
๋ถํํ๋ ์ ๋ shinyproxy 2.3.1๊ณผ ๋์ผํ ๋ฌธ์ ๋ฅผ ๊ฒช๊ณ ์์ต๋๋ค.
application.yml ํ์ผ์ ํ๋ก์ ๋ธ๋ก ์ธ๋ถ์ ์ด ๋ธ๋ก์ด ์์ต๋๋ค.
์ฌ๊ธฐ๋ ์ฌ๋:
useForwardHeaders: ์ฐธ
์ค๋ช ์์ ์ค๋ช ๋ ๋๋ก Nginx ํ๋ก์๋ฅผ ์ ํํ ์ค์ ํ์ต๋๋ค. ๋๋ ๋ํ (๋ฐฉ๊ธ ๋ฉ์ฒญํ ngnix ์ค๋ฅ๊ฐ Apache ์๋ฒ๋ฅผ ์ค์ ํ๊ณ ๋๊ฐ์ ๋ฌธ์ ๊ฐ ์๋์ง ํ ์คํธํ๊ธฐ ์ํด).
๋ด Nginx ๊ตฌ์ฑ ๋ธ๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
server {
listen 80;
server_name mydomain.com;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443 ssl;
server_name mydomain.com;
access_log /var/log/nginx/shinyproxy.access.log;
error_log /var/log/nginx/shinyproxy.error.log error;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate <path to crt>
ssl_certificate_key <path to key>
location / {
proxy_pass http://127.0.0.1:3600/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 600s;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
๋๊ตฌ๋ ์ง ๋ฌด์์ด ์๋ชป๋ ์ ์๋์ง์ ๋ํ ์์ด๋์ด๊ฐ ์์ต๋๊น? ๋๋ ๊ทธ๊ฒ์ ๊ณ ์น ๋ฐฉ๋ฒ์ ๋ํ ์๊ฐ?
์ค๋ฅ๊ฐ ๋ฌด์์ ๋๊น? ๋ด๊ฐ ํ๋ ๊ฒ์ฒ๋ผ ๊ตฌ์ฑ ํ์ผ์ ๊ณต์ ํ ์ ์์ต๋๊น? ์ด์ฉ๋ฉด ๋ด๊ฐ ๋น์ ์ ๋์ธ ์ ์์ต๋๋ค
@greenspray ๋ด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค! ๋๋ ์ ๋ง๋ก ์ด๊ฒ์ ๋๋ฌด ๋นํฉํ๋ค! ๋ด Nginx๋ ์์ ์ฃผ์์์ ๊ตฌ์ฑํ์ผ๋ฉฐ ์ด๊ฒ์ด ๋ด application.yml์ ๋ชจ์ต์ ๋๋ค.
ํฌํธ๋ฅผ ๋ณ๊ฒฝํ๊ณ serverforward ํค๋ ํ์ ์ถ๊ฐํ๋ ๊ฒ ์ธ์๋ ๋ชจ๋ ๊ฒ์ ์ค์น๋ ๊ทธ๋๋ก ์ ์งํ๋ ค๊ณ ๋ ธ๋ ฅํ์ต๋๋ค. ์ด ์ค๋ ๋์ ๋ชจ๋ ์ฌ๋์๊ฒ ์๋ํ๋ ๊ฒ์ฒ๋ผ ๋ณด์์ง๋ง ๋์ผํ ๋ฌธ์ ๊ฐ ์์๊ธฐ ๋๋ฌธ์ Shiny Proxy 2.3.0์ผ๋ก ์ด๊ฒ์ ํ ์คํธํ์ต๋๋ค.
proxy:
title: My Title
logo-url: http://www.openanalytics.eu/sites/www.openanalytics.eu/themes/oa/logo.png
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 60000
port: 3600
authentication: simple
admin-groups: scientists
users:
- name: jack
password: password1
groups: scientists
- name: jeff
password: password1
groups: mathematicians
# Docker configuration
docker:
cert-path: /home/none
url: http://localhost:2375
port-range-start: 20000
specs:
- id: 01_hello
display-name: Hello Application
description: Application which demonstrates the basics of a Shiny app
container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
container-image: openanalytics/shinyproxy-demo
access-groups: [scientists, mathematicians]
server:
useForwardHeaders: true
logging:
file:
shinyproxy3.log
๋ํ ๋์ ์น ์๋ฒ๋ก Apache๋ฅผ ์ฌ์ฉํ์ฌ ํ ์คํธํ๋๋ฐ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋ด ๋ ๊ฐ์ง ํ์ฌ ์ด๋ก ์ ๋ด application.yml ์ค์ ์ ๋ฌธ์ ๊ฐ ์๊ฑฐ๋ ๋ด ํ๋ก์ ๋ธ๋ก์ ๋ฌด์ธ๊ฐ๊ฐ http๋ก ๋ฆฌ๋๋ ์ ์ ํ์ฉํ๊ณ ์๋ค๋ ํ๋ก์/์ญ ํ๋ก์๋ฅผ ์ดํดํ์ง ๋ชปํ๊ธฐ ๋๋ฌธ์ ๋๋ค.
@Claire-Kelley ์ ํํ ์ค๋ฅ๋ ๋ฌด์์ ๋๊น?
@greenspray9 ์ค๋ฅ๊ฐ ๋ฐ์ํ์ง ์์ต๋๋ค! ๋ด ์น ์ฌ์ดํธ์ ๊ฐ ๋ ๋ฐ์ง์ด๋ ํ๋ก์ ๋ก๊ทธ์ธ ํ์ด์ง๋ฅผ ๋ณผ ์ ์๊ณ HTTPS๋ฅผ ํตํด ์ ๊ณต๋๋๋ก ์๋ฒฝํ๊ฒ ์๋ํฉ๋๋ค(์ด๊ฒ์ด ์ํ๋ ๋์์ ๋๋ค). ๋ฌธ์ ๋ ๋ด๊ฐ ๋ก๊ทธ์ธํ ๋(์ง๊ธ์ ๋จ์ ์ธ์ฆ์ ์ฌ์ฉํ์ฌ) ํ์ด์ง๊ฐ HTTP๋ฅผ ํตํด ์ ๊ณต๋๊ธฐ ์์ํ๋ค๋ ๊ฒ์ ๋๋ค(HTTPS๊ฐ ์๋๋ผ ์ด๊ฒ์ด ๋ฌธ์ ์ ๋๋ค! )
@ckelley-ct ์ฃ์กํฉ๋๋ค ์ํ๋ ๋ก๊ทธ์ธ ์ ํ์ ๋ํ ๊ฒฝํ์ด ์์ต๋๋ค. ์ด๋ค ์ข ๋ฅ์ ๋ฆฌ๋๋ ์ ์ด ๋ฐ์ํ๊ณ ์์ต๋๊น?
์ ๋ ๊ฐ์ ๋ฌธ์ ์ธ๋ฐ ํด๊ฒฐ์ฑ ์ฐพ์ผ์ จ๋์?
@HEPBO3AH ๊ทธ๋ ์ต๋๋ค. ์ ์๊ฒ ๋ฌธ์ ๋ ์์ ํ์ง ์์ ์ด๋ฏธ์ง์ ์์์ต๋๋ค(
@HEPBO3AH @ckelley-ct ์ฐธ๊ณ ๋ก ์ด๋ฏธ์ง๋ฅผ https://www.openanalytics.eu/shinyproxy/logo.png ๋ก ์ฎ๊ฒผ์ต๋๋ค.
nginx๋ก ์ญ๋ฐฉํฅ ํ๋ก์๋ฅผ ๋ง๋ค๊ณ ๊ฐ๋จํ ์ธ์ฆ์ ์ฌ์ฉํ์ฌ ์์ ํ๊ฒ ๋ก๊ทธ์ธํ์ง๋ง ์ผ๋จ openid๋ฅผ ์ฌ์ฉํ๋ ค๊ณ ํ๋ฉด http๋ฅผ ์ฝ๋ฐฑ ํ๋กํ ์ฝ๋ก ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ์คํจํฉ๋๋ค.
https://login.microsoftonline.com/9ac05e7d-e6a1-433a-9801-a60642903c2b/oauth2/authorize?response_type=code&client_id=d1abf394-b312-4717-a1c4-daaeee4f3b28&scope=openid%20email&state=5ZEbvVrVKBGpwId02I91SNRN-oPSbqkSR9oOlj7PRRQ%3D&redirect_uri=http : //52.152.166.27/login/oauth2/code/shinyproxy&nonce=EhOFxVuVRksPOxd0hG-CKPDd2s78bhFIzSSC_PPU5-Q
AADSTS50011 ์ค๋ฅ ๋ฐ์: ์์ฒญ์ ์ง์ ๋ ์๋ต URL์ด ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ํด ๊ตฌ์ฑ๋ ์๋ต URL๊ณผ ์ผ์นํ์ง ์์ต๋๋ค: 'd1abf394-b312-4717-a1c4-daaeee4f3b28'.
์ด๊ฒ์ ๋ด application.yml์ ๋๋ค. Shinyproxy 2.4.0, Shiny Proxy 2.3.1์ Microsoft Edge์์ ์๋ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
proxy:
title: Open Analytics Shiny Proxy
logo-url: https://www.openanalytics.eu/shinyproxy/logo.png
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 60000
port: 8080
authentication: openid
admin-groups: scientists
#bind-address: 127.0.0.1
# Example: 'simple' authentication configuration
users:
- name: jack
password: password
groups: scientists
- name: jeff
password: password
groups: mathematicians
# Example: 'openid' authentication configuration
openid:
auth-url: https://login.microsoftonline.com/9ac05e7d-e6a1-433a-9801-a60642903c2b/oauth2/authorize
token-url: https://login.microsoftonline.com/9ac05e7d-e6a1-433a-9801-a60642903c2b/oauth2/token
jwks-url: https://login.microsoftonline.com/common/discovery/keys
client-id: d1abf394-b312-4717-a1c4-daaeee4f3b28
client-secret: xxx
# Docker configuration
docker:
container-backend: docker
port-range-start: 20000
container-protocol: https
specs:
- id: euler
display-name: Euler's number
#container-cmd: ["R", "-e", "shiny::runApp('/root/euler')"]
container-image: euler
access-groups: scientists
server:
useForwardHeaders: true
logging:
file:
shinyproxy.log
nginx๋ก ์ญ๋ฐฉํฅ ํ๋ก์๋ฅผ ๋ง๋ค๊ณ ๊ฐ๋จํ ์ธ์ฆ์ ์ฌ์ฉํ์ฌ ์์ ํ๊ฒ ๋ก๊ทธ์ธํ์ง๋ง ์ผ๋จ openid๋ฅผ ์ฌ์ฉํ๋ ค๊ณ ํ๋ฉด http๋ฅผ ์ฝ๋ฐฑ ํ๋กํ ์ฝ๋ก ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ์คํจํฉ๋๋ค.
https://login.microsoftonline.com/9ac05e7d-e6a1-433a-9801-a60642903c2b/oauth2/authorize?response_type=code&client_id=d1abf394-b312-4717-a1c4-daaeee4f3b28&scope=openid%20email&state=5ZEbvVrVKBGpwId02I91SNRN-oPSbqkSR9oOlj7PRRQ%3D&redirect_uri=http : //52.152.166.27/login/oauth2/code/shinyproxy&nonce=EhOFxVuVRksPOxd0hG-CKPDd2s78bhFIzSSC_PPU5-Q
AADSTS50011 ์ค๋ฅ ๋ฐ์: ์์ฒญ์ ์ง์ ๋ ์๋ต URL์ด ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ํด ๊ตฌ์ฑ๋ ์๋ต URL๊ณผ ์ผ์นํ์ง ์์ต๋๋ค: 'd1abf394-b312-4717-a1c4-daaeee4f3b28'.
2.4์ ๋์ผํ ์ค๋ฅ
์๋ ํ์ธ์ @danielfm123 , @roberts2727 ๋ฐ๋ผ์ ShinyProxy 2.4์์๋ ๋ค์ ๊ตฌ์ฑ์ด ๋ ์ด์ ์๋ํ์ง ์์ต๋๋ค.
server:
useForwardHeaders: true
๋์ ๋ค์์ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
server:
forward-headers-strategy: native
์ด ๋ฐฉ๋ฒ์ผ๋ก ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์๋์ง ๋ค์ ๋ณด๊ณ ํ ์ ์์ต๋๊น?
๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค! ๊ฐ์ฌํฉ๋๋ค.
์, ์๋ํ์ง๋ง ํจํค์ง DT๋ฅผ ์ข ๋ฃํฉ๋๋ค.
ShinyProxy 2.4 ๋ค์ ๊ตฌ์ฑ
https://www.shinyproxy.io/security/์์ ์ธ๊ธํ ๊ฐ์น๊ฐ
์๋ ํ์ธ์ @shosaco ์ด๊ฒ์ ์ด๋ฏธ ์๋ก์ด ์น์ฌ์ดํธ์ ์ถ๊ฐ๋์์ต๋๋ค: https://www.shinyproxy.io/documentation/security/#forward -headers . ๋น์ ์ด ๊ฐ๋ฆฌํค๋ URL์ ๋ด๊ฐ ์ง๊ธ ์ ๋ฆฌํ ์ด์ ์น์ฌ์ดํธ์ ๋๋จธ์ง ๋ถ๋ถ์ ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ํด๊ฒฐํ์ต๋๋ค.
์ด ์ฝ๋
proxy:
๋ฐ์ ์์ด์ผ ํฉ๋๋ค.