Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open shared object file? #2

Open
Avent37 opened this issue Jul 2, 2018 · 11 comments
Open

Cannot open shared object file? #2

Avent37 opened this issue Jul 2, 2018 · 11 comments

Comments

@Avent37
Copy link

Avent37 commented Jul 2, 2018

I'm trying to implement your plugin. I ran into the issue stated in Issue #1, and made the necessary changes. I then started the Kong API and got this error.
Please guide me on how to proceed further.


Error: /usr/local/share/lua/5.1/kong/cmd/start.lua:57: nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/tools/utils.lua:576: /usr/local/share/lua/5.1/resty/injection.lua:13: libinjection.so: cannot open shared object file: No such file or directory
stack traceback:
	[C]: in function 'error'
	/usr/local/share/lua/5.1/kong/tools/utils.lua:576: in function 'load_module_if_exists'
	/usr/local/share/lua/5.1/kong/init.lua:103: in function 'load_plugins'
	/usr/local/share/lua/5.1/kong/init.lua:177: in function 'init'
	init_by_lua:3: in main chunk


  Run with --v (verbose) or --vv (debug) for more details

This is my configuration
-Ubuntu 18.04
-Kong API 0.13.1
-Lua 5.1.5 (I have changed the dependency from Lua 5.3.4 to Lua 5.1 and above, in the rockspec file)
-LuaJIT 2.1.0
-lua-resty-injection 1.0-1

@Avent37
Copy link
Author

Avent37 commented Jul 12, 2018

I didn't add libinjection in my system library path. Issue was fixed after adding it.

@Avent37 Avent37 closed this as completed Jul 12, 2018
@Avent37 Avent37 reopened this Jul 12, 2018
@Avent37
Copy link
Author

Avent37 commented Jul 12, 2018

Unfortunately, I'm now running into 500 Internal Server Error when I send a GET request.

Kong started
$ curl -i -X POST --url http://localhost:8001/services/ares2/plugins/ --data 'name=kong-injection'
HTTP/1.1 400 Bad Request
Date: Thu, 12 Jul 2018 10:23:46 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Server: kong/0.13.1

{"config.sqli":"sqli is required","config.xss":"xss is required","config.xss_mode":"xss_mode is required","config.sqli_mode":"sqli_mode is required"}
root@tapan-VirtualBox:/home/tapan/Desktop/kong-injection (resty-injection)# curl -i -X POST --url http://localhost:8001/services/ares2/plugins/ --data 'name=kong-injection' --data 'config.sqli=true' --data 'config.xss=false' --data "config.sqli_mode=drop" --data "config.xss_mode=log"
HTTP/1.1 201 Created
Date: Thu, 12 Jul 2018 10:28:20 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Server: kong/0.13.1

{"created_at":1531391300000,"config":{"xss_mode":["log"],"sqli_mode":["drop"],"xss":false,"sqli":true},"id":"5a6b8af7-8ff4-4e94-b765-50ab9450188c","enabled":true,"service_id":"82882540-2e52-4990-9248-73914137c2bf","name":"kong-injection"}
$ curl -i -X GET --url http://localhost:8000/ --header 'host: mockbin.org'
HTTP/1.1 500 Internal Server Error
Date: Thu, 12 Jul 2018 10:29:05 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: kong/0.13.1

{"message":"An unexpected error occurred"}

Please guide me on how to proceed further.

This is my configuration
-Ubuntu 18.04
-Kong API 0.13.1
-Lua 5.1.5 (I have changed the dependency from Lua 5.3.4 to Lua 5.1 and above, in the rockspec file)
-LuaJIT 2.1.0
-lua-resty-injection 1.0-1

@ZTzha
Copy link

ZTzha commented Oct 25, 2018

how to add libinjection in my system library path??

@ZTzha
Copy link

ZTzha commented Oct 25, 2018

@TSK-37

@ZTzha
Copy link

ZTzha commented Oct 27, 2018

i have the same problem "500 Internal Server Error" to GET a request. @TSK-37 @ror6ax

@Avent37
Copy link
Author

Avent37 commented Oct 27, 2018

@ZTzha

  1. Download the repository from GitHub
  2. Enter the src directory.
  3. Open a terminal, change directory to the src folder, and run the make command. This will generate a few object files and the main shared object file (called libinjection.so) required for the function of the plugin.
  4. In /usr/local/lib, create directory called ‘libinjection’ and then copy the contents from the ‘src’ sub-directory of the original repository and paste it in the newly created libinjection directory.
  5. Change directory to /etc/ld.so.conf/ and copy the libc.conf. file, rename it to libinjection.conf (it’s necessary prefix to be lib), and change it by adding the path of the libinjection folder , i.e. /usr/local/lib/libinjection
  6. Once edited, save it, and run ldconfig on the terminal. Check if libinjection.so is now set up by running ldconfig -p | grep libinjection.so in the terminal.
    If you need a video for reference check this out https://www.youtube.com/watch?v=RmdvkUWQ78g

@ZTzha
Copy link

ZTzha commented Oct 29, 2018

thanks for guide,I have already install the plugin successful,,,but now i have the same problem as u , 500 Internal Server Error and {"message":"An unexpected error occurred"} @TSK-37

@ZTzha
Copy link

ZTzha commented Oct 29, 2018

this is error logs:
[error] 14979#0: *364 lua coroutine: runtime error: /usr/local/share/lua/5.1/resty/injection.lua:19: attempt to get length of local 'str' (a nil value) @TSK-37 @ror6ax

@13233032535
Copy link

I used lualocks make to deploy Kong_ The injection plug-in always reports attempt to index local 'handler' (a Boolean value) when I start. Can you give me some guidance? thank you.

@13233032535
Copy link

Is this plug-in compatible with version 1.4.2? Looking forward to your reply, thank you

@13233032535
Copy link

Is this plug-in compatible with version 1.4.2? Looking forward to your reply, thank you @ror6ax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants