This script starts ngrok forwarding with configured IP address or default localhost, and sends its public url to email. Usecases for example: Servers/NASes without port forwarding, IoT devices, other devices without port forwarding.
Download or install Git command git to install ngrok-mailer.
Clone repository master or download archived master
git clone https://github.com/developerfromjokela/ngrok-mailer.git
OR
wget https://github.com/developerfromjokela/ngrok-mailer/archive/master.zip
unzip master.zip
Run script as root or using sudo
./ngrokmailer.sh
OR
sudo ./ngrokmailer.sh
Make script run on startup:
nano /etc/rc.local
# Then paste this below into rc.local:
./path/to/folder/ngrokmailer.sh
This script is configurable for your suites and usecases. All parameters and usage:
forwarding_ip="192.168.100.69"
- Set device IP, for ngrok to forward. Blank is locahost
forwarding_port="80"
- Set device's port, for ngrok to forward using that exact protocol port.
forwarding_connectiontype="http"
- Configure forwarding type, if your device is running http server, change parameter http, tcp, etc. More info in ngrok documentation.
email_addr="[email protected]"
- Email address where public url should be sent
ssmtp_root="[email protected]"
- Email address which is used to send emails
ssmtp_mailhub="smtp.gmail.com:587"
- SMTP address of mail server
ssmtp_authuser="[email protected]"
ssmtp_authpass="passwordforgmail"
- Authentication for SMTP Server
ssmtp_usestarttls="YES"
- Use STARTTLS for SMTP Communications (NO disables it)
ssmtp_autoconfig=true
- This parameter enables or disables ssmtp.conf overwrite using ssmtp_* parameters (false disables it, and file ssmtp.conf will not be overwritten)
logging=false
- This parameter enables or disables logging activities in script to file ngrokmailer.log (false disables logging, and file msg.txt, which are created for email sending, will be deleted after mail is sent)
ngrok_path="ngrok"
- You can set custom ngrok path, and default is ngrok. By default, if file was not found, it will be downloaded and extracted.
checkfordependencies=true
- Disable or Enable dependencies check on script startup, if some packages are missing. (If checking is leading to problems, try to disable this, if you set script to run on startup)
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.