Announcement

Collapse
No announcement yet.

Sure bet Email notifications

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sure bet Email notifications

    This is a cross post from Cocoontech to here. I have used STunnel here since the Homeseer 2 days. Always worked for me.

    This post will review how to configure an STunnel proxy and use Google Mail with it. This will work with your Omnipro 2 panel, Elk panel, Home Assistant, OmniLinkBridge plugin, Homeseer, Homeseer OmniPlugin or any automation you have running on your local LAN. Will post another one for using Office 365 Outlook mail. A few months ago switched from GMail to personal Email paid service. The personal email service was working fine until they switched to Office 365 Email. So I switched back to using Gmail notifications.

    For Automation / Security here have used:

    1 - Google Mail
    2 - Outlook Mail
    3 - personal Email server​

    Sending out mostly texts relating to status of security these days.

    Code:
    1 - TMobile ==> 5555555555@tmomail.net
    2 - AT&T ==> 5551234567@txt.att.net
    3 - Verizon ==> 5555555555@vtext.com
    Switched from Google Mail to personal email server a few months ago and noticed that my personal email service got switched over to Office 365 last week. I was notified of the changes about a month ago.

    My automation / security here runs mostly in Linux. For many years have used STunnel and today using STunnel4 on one Linux box.

    I point all automation / security boxes to the Ubuntu server port 25 for SMTP mail. I do not do any pop or incoming mail with any automation server or security stuff.
    This works fine with any Debian box you have on line (like an RPi). You can also install STunnel in Windows. This post will only cover Linux installation.

    Old way

    sudo apt update
    sudo apt install stunnel4

    New way

    sudo apt update
    sudo apt install snapd
    sudo snap install stunnel5

    There are examples on your /etc/stunnel/ configuration out there in Internetlandia. Use the following for GMail configuration.

    After installation you want to create a certificate file called stunnel.pem

    Code:
    openssl genrsa -out key.pem 2048
    openssl req -new -x509 -key key.pem -out cert.pem -days 1095
    cat key.pem cert.pem >> /etc/stunnel/stunnel.pem
    There are examples on your /etc/stunnel/ configuration out there in Internetlandia. Use the following for GMail configuration.

    nano /etc/stunnel/stunnel.conf

    Code:
    cert = /etc/stunnel/stunnel.pem
    debug = 7
    output = /var/log/stunnel.log
    client = yes
    
    [pop3s]
    accept = 127.0.0.1:11110
    connect = pop.gmail.com:995
    
    [smtps]
    accept = 192.168.244.174:25
    connect = smtp.gmail.com:465
    NOTE: IP address 192.168.244.174 is the Ubuntu box that I am using.

    After the above you want to enable STunnel.

    nano /etc/default/stunnel4
    Put this in the file:
    ENABLED=1

    Then you want to enable and start the stunnel service

    systemctl enable stunnel4.service
    systemctl start stunnel4.service
    systemctl status stunnel4.service

    If you have a typo in the configuration then when you look at the status you will see that the service has exited.
    That is all you need to use STunnel. (not really).

    Configuring any automation device on your network to use SMTP mail do the following:
    1 - SMTP mail address ==> IP of STunnel box and use port 25
    IE: 192.168.244.174:25
    2 - use your gmail address and password

    Send out a test email and you will see "incorrect" password in the logs for GMail.

    ​GMail authentication has changed and now you need a application specfic password for non standard device authentication.

    I used name and password and copied this over to a text file.

    1 - log in to Google
    2 - go to Google Account settings
    3 - Go to security - App passwords
    4 - add a new app and you will be given a new password. Call the app anything you want. I saved the password such that I could use it multiple times.
    5 - now reconfigure your smtp gmail login on any app and use this new password. Send a test email and you will see it working fine.​

    Create one app configuration and call it myemail and copy the password over to a text file. You can use this password for any of your gmail configurations on your home lan. You can install STunnel on any box at home running Windows or Linux. I use it for all of my security and automation.

    Click image for larger version  Name:	GoogleAccount.jpg Views:	0 Size:	18.2 KB ID:	1573362
    Click image for larger version  Name:	Security-2.jpg Views:	0 Size:	27.6 KB ID:	1573363
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
    HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

    HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
    HSTouch on Intel tabletop tablets - Asus AIO

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant
Working...
X