Sunday, January 14, 2018

Make 'bts' (devscripts) accept TLS connection to mail server with self signed certificate

My mail server runs with a self signed certificate. So bts, configured like this ...

BTS_SMTP_HOST=mail.wgdd.de:587
BTS_SMTP_AUTH_USERNAME='user'
BTS_SMTP_AUTH_PASSWORD='pass'

...lately refused to send mails with this error:

bts: failed to open SMTP connection to mail.wgdd.de:587
(SSL connect attempt failed error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed)

After searching a bit, I found a way to fix this locally without turning off the server certificate verification. The fix belongs into the send_mail() function. When calling the Net::SMTPS->new() constructor, it is possible to add the fingerprint of my self signed certificate like this (bold):

if (have_smtps) {
    $smtp = Net::SMTPS->new($host, Port => $port,
        Hello => $smtphelo, doSSL => 'starttls',
        SSL_fingerprint => 'sha1$hex-fingerprint')
        or die "$progname: failed to open SMTP connection to $smtphost\n($@)\n";
} else {
    $smtp = Net::SMTP->new($host, Port => $port, Hello => $smtphelo)
        or die "$progname: failed to open SMTP connection to $smtphost\n($@)\n";
}

Pretty happy to being able to use the bts command again.

16 comments:

  1. I solved the same issue by just making my MTA use Let’s Encrypt, and that’s something I recommend you do too ;)

    ReplyDelete
  2. The Dedicated Hosting is a type of website hosting mostly preferred by the large web sites or sites having huge amount of traffic and needs reliability and high-performance. minecraft server hosting

    ReplyDelete
  3. Honest enjoy to the people folks; they arrived by way of on the part of me. Obtained aggravated by my normal distributor, I have even previously bought a variety of times from Deutsche Medz nevertheless got it less expensive from various other people. Less costly isn't perpetually increased, unquestionably protrusive with you from at the moment on. Excellent from start to accomplish!

    ReplyDelete
  4. Probably the most significant aspects to clans is game servers. They have nearly grown to be a requirement for clans undertake a game server to be successful and famous in market. Industry itself is tremendously saturated with miniature and substantial companies looking to usher in your business. So what is best for any clan? best ark survival server hosting

    ReplyDelete
  5. I am a Staff Author at FieldEngineer.com a Marketplace for On-Demand telecom workforce, extending from field engineers to high-level network engineers, project managers and Network Architects in 146 nation

    Soa security

    ReplyDelete
  6. AEM Service packs like the Adobe Experience Manager bundle come with pre-configured security and database configurations, so that you do not need to deploy any additional atypical digital applications. These bundles also come with application up-sell and application uninstall features that help your employees manage existing installations more efficiently.

    ReplyDelete
  7. นี่คือสุดยอดบทความที่ดีที่สุด ขอบคุณข้อมูล

    เว็บเดิมพันอันดับ 1 ของเอเชีย 928bet คาสิโนออนไลน์ เล่นง่ายได้เงินจริง แทงหวย แทงบอล อัตราจ่ายสูง กำไรดีที่สุด 928bet บาคาร่า แจกเครดิตฟรี สมัครฟรี ไม่มีขั้นต่ำ สามารถสร้างรายได้ให้กับคุณได้ตลอด 24 ชั่วโมง ระบบฝากเงิน รวดเร็ว 1 นาที

    ReplyDelete

  8. help desk services are essential components of efficient IT operations and accurate recording and processing of end-user service requests in an effective manner is critical. We leave nothing to chance.

    ReplyDelete
  9. Great post! I like your site and I'm so impressed to read your content. It's very valuable and informative concept in your blog. Keep sharing post
    ways to find right managed network services
    what does managed cloud services
    benefits of running cloud services

    ReplyDelete
  10. TechUpdatesDaily-A resource where one can find the latest updates & news about technology, software, gadgets and business ideas for the start-ups. tech write for us
    technology write for us

    Technology Write For Us (Guest Posts) – Here in WebUpdatesDaily we are providing the opportunity to post your Technology, Gadgets Write For Us, and many more other category blogs.
    technology write for us

    ReplyDelete
  11. help desk services are essential components of efficient IT operations and accurate recording and processing of end-user service requests in an effective manner is critical. We leave nothing to chance.

    ReplyDelete
  12. Managed Network Services gives you access to a wider pool of experts to help manage your growing business network needs. It provides proactive support to ensure issues are fixed in a timely manner and offers improved IT security to help protect your customers and employees. It also simplifies your cost management, resulting in a more productive and cost-effective business.

    ReplyDelete