Closed dogeared closed 7 years ago
Could you try the installation with --verbose option?
luarocks install --verbose kong-oidc
Maybe we get more information on error.
Here's the full output:
luarocks install --verbose kong-oidc
os.execute: chmod '0755' '/root/.cache/luarocks/https___luarocks.org'
Results: 3
1 (boolean): true
2 (string): exit
3 (number): 0
os.execute: unzip -n '/root/.cache/luarocks/https___luarocks.org/manifest-5.1.zip'
Archive: /root/.cache/luarocks/https___luarocks.org/manifest-5.1.zip
inflating: manifest-5.1
Results: 3
1 (boolean): true
2 (string): exit
3 (number): 0
Installing https://luarocks.org/kong-oidc-1.0.0-0.src.rock
io.popen: mktemp -d '/tmp/luarocks_luarocks-rock-kong-oidc-1.0.0-0-XXXXXX'
io.popen: mktemp -d '/tmp/luarocks_kong-oidc-1.0.0-0-XXXXXX'
os.execute: unzip -n '/tmp/luarocks_luarocks-rock-kong-oidc-1.0.0-0-tCrPwL/kong-oidc-1.0.0-0.src.rock'
Archive: /tmp/luarocks_luarocks-rock-kong-oidc-1.0.0-0-tCrPwL/kong-oidc-1.0.0-0.src.rock
inflating: kong-oidc-1.0.0-0.rockspec
inflating: kong-oidc
Results: 3
1 (boolean): true
2 (string): exit
3 (number): 0
Error: Couldn't extract archive kong-oidc: unrecognized filename extension
It would seem it's trying to inflate a file called: kong-oidc
that is not an archive?
Ok. I made some progress. I was comparing your rockspec to the one from lua-resty-openidc
. I found some differences in structure. When I changed the kong-oidc
as shown in this diff:
git diff
diff --git a/kong-oidc-1.0.0-0.rockspec b/kong-oidc-1.0.0-0.rockspec
index 60a10ea..795fd80 100644
--- a/kong-oidc-1.0.0-0.rockspec
+++ b/kong-oidc-1.0.0-0.rockspec
@@ -1,8 +1,9 @@
package = "kong-oidc"
version = "1.0.0-0"
source = {
- url = "https://github.com/nokia/kong-oidc",
- tag = "v1.0.0-0"
+ url = "git://github.com/nokia/kong-oidc",
+ tag = "v1.0",
+ dir = "kong-oidc"
}
description = {
summary = "A Kong plugin for implementing the OpenID Connect Relying Party (RP) functionality",
I was then able to get it to install to this point:
luarocks install kong-oidc/kong-oidc-1.0.0-0.rockspec
Cloning into 'kong-oidc'...
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 17 (delta 0), reused 15 (delta 0), pack-reused 0
Receiving objects: 100% (17/17), 8.94 KiB | 0 bytes/s, done.
Note: checking out '9fcc94632b0ede4f03cf8e5549bb2458bcc7651d'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
Error: Build error: Failed installing kong/plugins/oidc/session.lua in /usr/local/lib/luarocks/rocks/kong-oidc/1.0.0-0/lua/kong/plugins/oidc/session.lua: kong/plugins/oidc/session.lua: No such file or directory
ok. I got it to install. I needed the changes I made to the rockspec file
here's how I finally got it to install:
NOTE: I did need to use the altered rockspec file I posted above.
cd kong-oidc
zip -r ../kong-oidc-1.0.0-0.src.rock kong/ kong-oidc-1.0.0-0.rockspec
cd ..
luarocks install kong-oidc-1.0.0-0.src.rock
kong-oidc 1.0.0-0 is now installed in /usr/local (license: Apache 2.0)
Now that I have everything working, I've been able to setup kong-oidc
. However, when I attempt to hit an endpoint in kong with the oidc enabled, I get an error in the log:
2017/08/22 21:53:31 [error] 30605#0: *15 lua entry thread aborted: runtime error: /usr/local/share/lua/5.1/kong/plugins/oidc/session.lua:11: variable "session_secret" not found for writing; maybe it is a built-in variable that is not changeable or you forgot to use "set $session_secret '';" in the config file to define it first
If I comment out line 11 of session.lua
, I can actually get into the OIDC redirect, but I suspect that will just cause problems later. Here's the line:
ngx.var.session_secret = decoded_session_secret
Is there somewhere in the kong config or nginx config that I should be initializing session_secret
? Also, I noticed that setting session_secret in the plugin enable call doesn't help. Here's the call I use (using httpie from httpie.org):
http POST localhost:8001/apis/example-api/plugins \
name=oidc \
config:='{"client_id": "<client id>", "client_secret": "<client secret>", "discovery": "https://<openid url>/.well-known/openid-configuration"}'
Thanks for the help! Is there a better way for me to communicate with you? email?
session_secret has been discussed in Issue #1, https://github.com/nokia/kong-oidc/issues/1
I'm pretty new to kong and lua. Every time I try to install per the instructions, I get a message:
This is happening both on my mac and a fresh ubuntu 14.04 install.
Any ideas as to what's wrong here?
FWIW, it's line 195 of
/usr/local/share/lua/5.1/luarocks/fs/unix/tools.lua
. It seems likekong-oidc
is being passed into thetools.unpack_archive
function.