adobe-apiplatform / api-gateway-aws

AWS SDK for NGINX with Lua
Apache License 2.0
170 stars 44 forks source link

Error with EVP_sha1 / OpenSSL #19

Open henriquechehad opened 7 years ago

henriquechehad commented 7 years ago

I'm trying to use the project but it's returning the error below:

Error → /usr/local/share/lua/5.1/api-gateway/resty/hmac.lua @ 63
suite ./test/specs/kinesis_spec.lua
/usr/local/share/lua/5.1/api-gateway/resty/hmac.lua:63: /usr/bin/luajit: undefined symbol: EVP_sha1

In my code i'm just importing, using:

local KinesisService = require('api-gateway.aws.kinesis.KinesisService')

I have the openssl, libcrypto, libssl-dev packages installed

ddragosd commented 7 years ago

Hi, what OpenSSL version do you have installed ? It's either a missing header file or a dynamic Linking issue

henriquechehad commented 7 years ago

Hi @ddragosd


OpenSSL 1.0.1f 6 Jan 2014```
ddragosd commented 7 years ago

Do you have a file named evp.h on the system ? Also, how are you building Openresty ?

henriquechehad commented 7 years ago

yes,

/usr/include/openssl/evp.h

I rebuilded openresty now from source, but same problem

ddragosd commented 7 years ago

Thanks, can you check if that evp.h file has the EVP_sha1 method defined ? (I'm trying to help you from my phone only as I'm on the go today so I may ask more q). If yes, mind pasting the signature if the method here ? On Fri, May 26, 2017 at 4:42 PM Henrique Chehad notifications@github.com wrote:

yes,

/usr/include/openssl/evp.h

I rebuilded openresty now from source, but same problem

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/adobe-apiplatform/api-gateway-aws/issues/19#issuecomment-304383652, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhE7SIrV9E4xLEIPfu_W8KJ2_Em4-0jks5r9zkdgaJpZM4NoBwu .

henriquechehad commented 7 years ago

in file exists this content with EVP_sha1:

#ifndef OPENSSL_NO_SHA
const EVP_MD *EVP_sha(void);
const EVP_MD *EVP_sha1(void);
const EVP_MD *EVP_dss(void);
const EVP_MD *EVP_dss1(void);
const EVP_MD *EVP_ecdsa(void);
#endif

Is missing something?

henriquechehad commented 7 years ago

I tested in ubuntu and debian docker containers, same issue in both

ddragosd commented 7 years ago

The signature is correct and is the same as the one used here : https://github.com/adobe-apiplatform/api-gateway-hmac/blob/master/src/lua/api-gateway/resty/hmac.lua

So right now it seems to be a dynamic linking issue in the OS with OpenSSL.

On Fri, May 26, 2017 at 4:51 PM Henrique Chehad notifications@github.com wrote:

I tested in ubuntu and debian docker containers, same issue in both

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/adobe-apiplatform/api-gateway-aws/issues/19#issuecomment-304385483, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhE7WwoPPWaS3rFjZHCw3euwhHm2DF8ks5r9ztdgaJpZM4NoBwu .

ddragosd commented 7 years ago

Is there a sample you can share with me ? I'd be happy to take a look over the weekend or early next week. It shouldn't be something too complicated. Another option, in the meanwhile, is to try with this docker image : https://hub.docker.com/r/adobeapiplatform/apigateway/ , built from https://github.com/adobe-apiplatform/apigateway .

henriquechehad commented 7 years ago

@ddragosd thanks for helping. the issue was because i was trying to test with busted, but i realized now, the project runs only inside nginx

henriquechehad commented 7 years ago

@ddragosd is there some reason for this project is tied in nginx? is not viable to create an independent version?

ddragosd commented 7 years ago

@enriquechehad no special reason other than being impl initially to work with NGINX / Openresty. Are you saying you'd like to use this module w/o NGINX ?

henriquechehad commented 7 years ago

@ddragosd yes, api-gateway-aws is the most complete Lua project for AWS that I found. Would be good to have the possibility to use the project without NGINX.

ddragosd commented 7 years ago

@henriquechehad, on a second thought it doesn't seem to be that straight forward to decouple it from NGINX as this module depends on multiple openresty features. At the same time I have to admit you made me curious if there are cases when such a lua module would be useful, comparing with the other aws sdks.