使用Thin rack ruby​​服务器的SSL证书/ HTTPS问题

时间:2015-11-22 15:42:35

标签: ssl https ssl-certificate thin webhooks

使用Thin rack Ruby服务器(https://github.com/macournoyer/thin)接收HTTPS webhooks时遇到了一些麻烦。

也许这不是一个专门针对Thin而是SSL证书配置的问题。

我想管理传入的HTTPS连接(webhooks:Telegram.org服务器调用我的Thin(sinatra / rack)应用程序,通过webhook发送消息更新)

步骤1.我创建了SSL KEY和PEM文件自签名证书,如下所述:https://core.telegram.org/bots/self-signed

openssl req -newkey rsa:2048 -sha256 -nodes -keyout YOURPRIVATE.key -x509 -days 365 -out 
YOURPUBLIC.pem -subj "/C=US/ST=New York/L=Brooklyn/O=Example Brooklyn Company/CN=YOURDOMAIN.EXAMPLE"

步骤2.我打电话给Telegram Server Bot API以接收指定HTTPS主机/路径的webhook,如下所述:https://core.telegram.org/bots/api#setwebhook API端点返回成功。

步骤3.我使用以下参数运行Thin:

bundle exec thin start --ssl --ssl-key-file ~/.ssl/YOURPRIVATE.key --ssl-cert-file ~/.ssl/YOURPUBLIC.pem --rackup /myhome/handyBOTS/rackup/handler.ru --address xxx.xxx.xxx.xxx      --port 8443  --environment production
Thin web server (v1.6.4 codename Gob Bluth)
...
...
...

我在艰难时期遇到麻烦: 我看到Telegram远程服务器调用Thin服务器webhooks,但Thin抱怨简洁:

<SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp><SSL_incomp>

所以我确信瘦服务器接收来自远程Telegram Server的呼叫,但它不处理请求。 我认为这是一些SSL配置不一致。

有什么想法吗?

我的具体问题是:

Thin期望的CRT文件格式是什么?

使用此命令行参数--ssl-cert-file ~/.ssl/YOURPUBLIC.pem传递给精简PEM文件是否正确?

更新: 问题可能与Thin无关,但对于某些证书链/ bundle配置,请参阅: Telegram Bot API Webhooks Self-signed Certificate issue

由于

giorgio

1 个答案:

答案 0 :(得分:0)

[解决]

建立证书是我的错。详情:

https://github.com/solyaris/BOTServer/blob/master/wiki/usage.md#step-4-create-self-signed-certificate

我不再测试瘦SSL配置(我必须),因为我决定最好将SSL /防火墙/代理工作留给NGINX,使用Thin实例作为工作人员:< / p>

https://github.com/solyaris/BOTServer/blob/master/wiki/nginx.md

相关问题