简体   繁体   English

使用自签名 SSL 证书

[英]Using Self-Signed SSL certificate

I am developing an online-shop based on a Telegram Bot, and I need to host it on a VPS.我正在开发一个基于 Telegram Bot 的在线商店,我需要将它托管在 VPS 上。 What are the dangers if I use a self-signed SSL certificate?如果我使用自签名 SSL 证书有什么危险?

I found online that there's a MiTM attack threat, but I couldn't find a detailed explanation on how it can be avoided when using a self-signed SSL.我在网上发现存在 MiTM 攻击威胁,但我找不到关于使用自签名 SSL 时如何避免它的详细说明。

For example, will it help if all requests are sent to/from a URL of type: www.example.com/ ?例如,如果所有请求都发送到/从 URL 类型为: www.example.com/会有帮助吗?

This is based on my reading of the Telegram Bot API .这是基于我对Telegram Bot API的阅读。

There are two ways to control your bot, both of which involve "reasonably" secure protocols that are hard to man-in-the-middle (MITM).有两种方法可以控制您的机器人,这两种方法都涉及“合理”的安全协议,这些协议很难实现中间人 (MITM)。 First, all communications with the Telegram server using the Bot API uses HTTPS.首先,使用 Bot API 与 Telegram 服务器的所有通信都使用 HTTPS。 You must authenticate the Telegram server by doing a proper certificate chain validation.您必须通过正确的证书链验证来验证 Telegram 服务器。 Telegram both authenticates you and identifies you by checking the token you supply in your HTTP request. Telegram 通过检查您在 HTTP 请求中提供的令牌来对您进行身份验证和识别您。 This token was given to you when you created your bot and must remain a secret.此令牌是在您创建机器人时提供给您的,并且必须保密。

In addition, you may also elect to receive updates via a webhook.此外,您还可以选择通过 webhook 接收更新。 This basically involves you running an HTTPS server using a self-signed certificate.这基本上涉及您使用自签名证书运行 HTTPS 服务器。 However, you provide your certificate to Telegram over a secure mutually authenticated connection when you setup the webhook, so this eliminates the MITM threat.但是,当您设置 webhook 时,您通过安全的相互身份验证的连接将您的证书提供给 Telegram,因此这消除了 MITM 威胁。 The Telegram documentation suggests a method you can use to verify that the connection is coming from Telegram. Telegram 文档建议了一种方法,您可以使用它来验证连接是否来自 Telegram。

CAVEATS:注意事项:

  1. I've never implemented a Telegram Bot, so this is just based on reading the Docs.我从来没有实现过 Telegram Bot,所以这只是基于阅读文档。
  2. Simply because it looks secure to me after 10 minutes of study doesn't make it so.仅仅因为在 10 分钟的学习后它看起来对我来说是安全的,并不能使它如此。 Since this is a unique protocol within HTTPS I would want to see some expert analysis before I'd be confident.由于这是 HTTPS 中的一个独特协议,我希望在有信心之前看到一些专家分析。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM