【问题标题】:Kong-OIDC Plugin Installation IssueKong-OIDC 插件安装问题
【发布时间】:2020-09-21 06:09:56
【问题描述】:

我在 Kong docker 容器中安装 Kong-OIDC 插件并收到以下错误:

错误:安装依赖失败:https://luarocks.org/lua-resty-openidc-1.6.0-1.src.rock - 安装依赖失败:https://luarocks.org/lua-resty-jwt-0.2.2-0.src.rock - 不支持 Rockspec 格式 3.0,请升级 LuaRocks。

似乎基础依赖项之一“lua-jesty-jwt”正在使用 Rockpsec 格式 3.0 版本,不再受支持。有没有办法解决这个问题?

【问题讨论】:

    标签: lua openid-connect kong


    【解决方案1】:

    最新版本的 kong-oidc (1.1.0) 对我不起作用,但我能够安装旧版本 (1.0.1) 没有太多问题。我确实必须安装一个额外的库“openssl-devel”(yum install openssl-devel)。

    【讨论】:

    • 你是如何改变你的 dockerfile 的?我也有同样的问题
    【解决方案2】:

    我使用以前版本的 kong-oidc 插件更新了 Dockerfile。 Dockerfile 如下所示:

    FROM kong:0.14-centos
    
    LABEL description="Centos 7 + Kong 0.14 + kong-oidc plugin"
    
    RUN yum install -y git unzip && yum clean all
    
    RUN luarocks install kong-oidc 1.0.1
    

    但运行docker build -t kong:0.14-centos-oidc 会返回此错误:

    Error: Failed installing dependency: https://luarocks.org/lua-resty-openidc-1.2.3-1.src.rock - Failed installing dependency: https://luarocks.org/lua-resty-hmac-v1.0-1.rockspec - Failed installing dependency: https://luarocks.org/luacrypto-0.3.2-2.src.rock - Could not find header file for OPENSSL
      No file openssl/evp.h in /usr/local/include
      No file openssl/evp.h in /usr/include
    You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command.
    Example: luarocks install luacrypto OPENSSL_DIR=/usr/local
    

    所以我们需要在 Dockerfile 中添加RUN yum install openssl-devel -y。所以,如果你再次运行docker build 命令,你会得到这个错误:

    Build error: Failed compiling object src/lcrypto.oError: Failed installing dependency: https://luarocks.org/lua-resty-openidc-1.2.3-1.src.rock - Failed installing dependency: https://luarocks.org/lua-resty-hmac-v1.0-1.rockspec - Failed installing dependency: https://luarocks.org/luacrypto-0.3.2-2.src.rock - Build error: Failed compiling object src/lcrypto.o
    

    所以我们需要安装gcc 编译器,将RUN yum install -y gcc 添加到Dockerfile。最终结果是:

    FROM kong:0.14-centos
    
    LABEL description="Centos 7 + Kong 0.14 + kong-oidc plugin"
    
    RUN yum install -y git unzip && yum clean all
    RUN yum install -y openssl-devel -y
    RUN yum install -y gcc
    
    RUN luarocks install kong-oidc 1.0.1
    

    现在容器构建成功了,但是我认为当前的kong-oidc插件已经不再维护了。

    更新:查看this repository 以获取带有 Keycloak 的 kong-oidc 插件的工作示例。

    【讨论】:

    • 我尝试了这种方法,它在很大程度上对我有用。但最后我仍然收到如下错误:fatal: unable to connect to github.com: github.com[0: 140.82.121.4]: errno=Connection timed out Cloning into 'lua-resty-hmac'... Error: Failed installing dependency: https://luarocks.org/lua-resty-openidc-1.2.3-1.src.rock - Failed installing dependency: https://luarocks.org/lua-resty-hmac-v1.0-1.rockspec - Failed cloning git repository. The command '/bin/sh -c luarocks install kong-oidc 1.0.1' returned a non-zero code: 1 如何解决此问题?
    • 我已经实现了与 Keycloak 一起运行的 kong-oidc 插件。检查此回购github.com/blitzrok/kong-oidc-keycloak
    猜你喜欢
    • 2021-09-25
    • 1970-01-01
    • 2023-04-09
    • 2011-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-04
    相关资源
    最近更新 更多