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.

26 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
    Replies
    1. Great Article Cyber Security Projects projects for cse Networking Security Projects JavaScript Training in Chennai JavaScript Training in Chennai The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  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
  13. Here are a portion of the primary reasons why you ought to consistently remain at an inn close to the BTS Skytrain when visiting Bangkok: my hero academia quiz

    ReplyDelete
  14. Once you’ve found your perfect freelancer, most of the hard work is over. The next step is to familiarize yourself with this new business software tool, and set it up in a way that will help you accomplish important business objectives.A good CRM will help you automatically log and act on email conversations with clients and prospective clients. for more info visit https://www.everlance.io/

    ReplyDelete
  15. Global Knives as a brand has been around since the mid 1980’s, and people have truly fallen in love with them. Let’s get to it and take a look at the Best Global Knives Review out there right now.

    ReplyDelete
  16. 추첨 방식은 로또와 비슷하나 확률은 그에 비해 극악인데 2012년 이전까지는 1~49 사이의 숫자 5개와 1~42 사이의 숫자 하나(이 숫자가 새겨진 볼 이름이 파워볼이다.)를 맞히면 1등을 할 수 있었으나 2012년 이후로는 1~69 사이의 숫자 5개, 1~26 사이의 파워볼 숫자 하나를 맞혀야 한다.

    ReplyDelete
  17. How much are you spending to keep your web presence online? A few things to look for when choosing your web hosting company. https://onohosting.com/

    ReplyDelete
  18. 스웨디시 마사지는 미국과 유럽에서 매우 인기가 있습니다. 스웨덴 웁살라에 있는 스웨덴 농업 과학 대학은 사람들이 그러한 마사지를 선호하는 이유와 방법을 알아내기 위해 연구를 수행해 왔습니다. 사람들이 집에서 마사지를 선호하는 진짜 이유는 받을 것을 선택할 수 있기 때문이라는 사실을 알고 놀랐습니다.

    ReplyDelete
  19. Is betting just luck?
    It is true that betting often relies on luck in PGSLOT – but that is not the case for every market. He went on to say: “While a sports bettor cannot [legally] influence the outcome of a game, sports bettors can and do influence the 'betting line' or 'point spread' in order to improve their odds of making a successful bet.

    ReplyDelete
  20. Great deals of important information and also a great article.
    best Point of Sale Software in india

    ReplyDelete
  21. birthday wishes for husband . Here you will find heartfelt birthday wishes and romantic birthday messages your husband that bring smile on his face.

    ReplyDelete