Authentik proxy 모드 NPM 설정시 리디렉션 오류? 수정

https://svrforum.com/nas/809186

예전에 달소님 글을 보고 시놀에 설치해서 잘 쓰고 있던 Authentik

간단하게 요약하자면 인증 서비스 입니다

뭐 이런저런 서비스들을 사용하다보면 기본 로그인 기능이 있지만 뭔가 찜찜할 때

혹은 로그인 기능이 없을 때 여기저기 붙여서 쓸 수 있는 서비스죠

2차 인증 설정한 구글 아이디 같은 보안성이 좀 더 나은 방법으로 로그인도 가능하고요

여하튼 잘 쓰고 있다가

이번에 emulatorjs 라는 서비스를 설치해봤습니다

image.png.jpg

웹으로 에뮬을 실행 시켜주는 서비스죠

그런데 로그인 기능이 없다보니 좀 그렇더라고요

물론 이 서비스는 해당 서버의 데이터를 클라이언트 브라우저로 다운 받아서 실행하는 방식이라

서버에 크게 부하가 가지는 않습니다만 그래도 로그인 기능을 추가하기로 했습니다

기존에는 Authentik를 사용할 때

주로 OAuth2/OpenID 프로토콜을 지원하는 서비스에 연동을 해서 사용했는데요

emulatorjs는 로그인 기능 자체가 없어서 proxy pass 모드로 설정을 했습니다

마침 npm을 사용하고 있고

달소님 가이드에 npm에 Authentik proxy pass를 설정하는 방법이 있어서

그대로 진행을 했는데

아래 proxy_pass http://auth.example.com/outpost.goauthentik.io; 항목을 아래처럼 구동중인 호스트:포트로 수정만해주시고 저장해주시면됩니다
proxy_pass http://192.168.1.60:9000/outpost.goauthentik.io;
Loading
Prev
Next

1 of 1

Loading
Prev
Next

1 of 1

# Increase buffer size for large headers
# This is needed only if you get 'upstream sent too big header while reading response
# header from upstream' error when trying to access an application protected by goauthentik
proxy_buffers 8 16k;
proxy_buffer_size 32k;

location / {
    # Put your proxy_pass to your application here
    proxy_pass          $forward_scheme://$server:$port;

    # authentik-specific config
    auth_request        /outpost.goauthentik.io/auth/nginx;
    error_page          401 = @goauthentik_proxy_signin;
    auth_request_set $auth_cookie $upstream_http_set_cookie;
    add_header Set-Cookie $auth_cookie;

    # translate headers from the outposts back to the actual upstream
    auth_request_set $authentik_username $upstream_http_x_authentik_username;
    auth_request_set $authentik_groups $upstream_http_x_authentik_groups;
    auth_request_set $authentik_email $upstream_http_x_authentik_email;
    auth_request_set $authentik_name $upstream_http_x_authentik_name;
    auth_request_set $authentik_uid $upstream_http_x_authentik_uid;

    proxy_set_header X-authentik-username $authentik_username;
    proxy_set_header X-authentik-groups $authentik_groups;
    proxy_set_header X-authentik-email $authentik_email;
    proxy_set_header X-authentik-name $authentik_name;
    proxy_set_header X-authentik-uid $authentik_uid;
}

# all requests to /outpost.goauthentik.io must be accessible without authentication
location /outpost.goauthentik.io {
    proxy_pass          http://auth.example.com/outpost.goauthentik.io;
    # ensure the host of this vserver matches your external URL you've configured
    # in authentik
    proxy_set_header    Host $host;
    proxy_set_header    X-Original-URL $scheme://$http_host$request_uri;
    add_header          Set-Cookie $auth_cookie;
    auth_request_set    $auth_cookie $upstream_http_set_cookie;

    # required for POST requests to work
    proxy_pass_request_body off;
    proxy_set_header Content-Length "";
}

# Special location for when the /auth endpoint returns a 401,
# redirect to the /start URL which initiates SSO
location @goauthentik_proxy_signin {
    internal;
    add_header Set-Cookie $auth_cookie;
    return 302 /outpost.goauthentik.io/start?rd=$request_uri;
    # For domain level, use the below error_page to redirect to your authentik server with the full redirect path
    # return 302 https://authentik.company/outpost.goauthentik.io/start?rd=$scheme://$http_host$request_uri;
}

복사

요 부분입니다

설정을 제대로 했으니 정상 작동해야 하는데 저 같은 경우

https://ex.aaa.com:4443/outpost.goauthentik.io/start?rd=/

Loading
Prev
Next

1 of 1

이런 식으로 뒤에 :4443 포트가 추가가 되는 바람에 Authentik 로그인 창이 안뜨더라고요

https://ex.aaa.com/outpost.goauthentik.io/start?rd=/

Loading
Prev
Next

1 of 1

이런 식으로 :4443 부분을 지워야 정상 작동 합니다

저 4443이 npm 포트인데 npm을 443 포트로 설치 한 분들은 문제가 없는 거 같더라고요

그래서 찾아보니 해결 방법은 생각보다 간단 했습니다

redirect to a port app.domain:4443 · Issue #3359 · goauthentik/authentik

Fixed
Add
port_in_redirect off;
Above the location block in npm Config

Authentik 깃헙에 가보니 저만 그런 건 아니더라고요

NPM 고급 설정 창에

port_in_redirect off;

복사

한 줄 추가하니까 깔끔하게 해결 됐습니다

그동안 OAuth2/OpenID 프로토콜 지원 안되면 클플 터널이나 클플 인증을 주로 썼었는데

Authentik도 여기저기 붙여봐야겠습니다

Read more

시놀로지 도커에 openclaw 설치하기

오픈클로를 도커에 설치하는 방법을 문의하신 분이 계셔서 작성 해봅니다 현재 오픈클로는 나온지 얼마 안됐고 계속 업데이트가 되고 있는 상황이기 때문에 설치 방법이 달라질 수 있습니다 Docker - OpenClaw https://docs.openclaw.ai/install/docker 제 개인적인 의견은 공식 문서를 참고하시는 걸 추천 드립니다 우선 시놀로지에 설치 하기 위해서는 패키지 센터에서

By 빨간물약

GLM-5 모델 출시와 함께 가격인상

https://svrforum.com/software/2992940 얼마 전에 위 링크 글을 통해 1년 4만원 결제로 상급 모델 사용이 가능하다고 알려드렸던 GLM에서 5버전 출시와 함께 가격 인상을 한다는 이메일이 왔네요 다행히 기존에 이미 사용하는 사람들은 상관 없다고 합니다 내용은 11일 부터 인상이라는데 시차 때문인지 아직 할인된 가격이 적용 되는 거 같습니다 사용을

By 빨간물약

Openclaw를 시놀로지 도커에 설치 해봤습니다

wtr pro n100 네이티브 헤놀에 설치 했습니다 (꺼져있는 CLI 컨테이너는 CLI 접속 시에만 동작 합니다) 어차피 api를 사용하니 도커도 괜찮겠다 싶어서 시도 해봤는데 간단한 문답은 자원 소모가 거의 없네요 텔레그램과 대시보드도 잘 되고 SSH 접속을 통한 CLI 설정도 잘 됩니다 GLM-4.7 API를 사용하는 거라 일반적인 대화 성능은 맥미니랑 크게

By 빨간물약