0

I want to set self signed certificate for my telegram bot webhook. I used this openssl command to create public key as discussed in Marvin's Marvellous Guide to All Things Webhook:

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=example.com"

Then I use curl or postman to set webhook and send certificate. Both of them just give me Webhook was set but bot doesn't respond. After that I use getwebhookinfo to check the problem.

It returns:

"last_error_message": "SSL error {337047686, error:1416F086:SSL routines:
tls_process_server_certificate:certificate verify failed}",

I googled it but I can't find the solution. Below you can see some extra info.

Postman set webook

curl -F "url=https://mydomain.ir/responser.php" -F "certificate=@YOURPUBLIC.pem" https://api.telegram.org/bot.../setWebhook

My public key is in same folder as cmd runs.

My domain also doesn't have a valid ssl certificate so chrome just show up a warning. Your connection is not private

And I am sure about background code that works, because it was tested before.

Thanks for further help.

jww
  • 97,681
  • 90
  • 411
  • 885
HosSeinM
  • 301
  • 1
  • 6
  • 14
  • ***`CN=example.com`*** is probably wrong. Hostnames always go in the *SAN*. If its present in the *CN*, then it must be present in the *SAN* too (you have to list it twice in this case). For more rules and reasons, see [How do you sign Certificate Signing Request with your Certification Authority](http://stackoverflow.com/a/21340898/608639) and [How to create a self-signed certificate with openssl?](http://stackoverflow.com/q/10175812/608639) You will also need to place the self-signed certificate in the appropriate trust store. – jww Jul 22 '17 at 17:46
  • @jww thank you. I don't know anything about SAN. I did everything in Marvin Marvellous guid. What did i forget to do? Please be specific. I am newbie in certificafe and openssl. Thanks again. – HosSeinM Jul 22 '17 at 19:16

0 Answers0