install ssmtp
configure ssmtp
edit /etc/ssmtp/ssmtp.conf
root=youremail@hotmail.com
mailhub=smtp.live.com:587
# Where will the mail seem to come from?
rewriteDomain=makesomethingup
# The full hostname
hostname=localhost
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
FromLineOverride=YES
# Use SSL/TLS to send secure messages to server.
UseTLS=YES
UseSTARTTLS=YES
AuthUser=youremail@hotmail.com
AuthPass=youremailpassword
-----------------------------------------------------------------------------------------------------------------------
install mutt
install terminfo
configure mutt
edit /etc/Muttrc
mailboxes /tmp/mail
set sendmail="/usr/sbin/ssmtp"
set from="youremail"
set realname="yourname"
# Mail folder setup.
set folder=/tmp/mail
set mbox_type=mbox
set spoolfile=+inbox
set mbox=+received
set postponed=+postponed
set record=+sent
send test attachment
echo "test" | mutt -s "my_first_test" toaddress@zyx.com -a /www/CameraImages/photo.jpg
get newest filename
ls -t /www/CameraImages | head -n 1
I wanted to send the newest image in a folder-
send newest file as attachment
echo "test" | mutt -s "my_first_test" toaddress@hotmail.com -a /www/CameraImages/$(ls -t /www/CameraImages | head -n 1)
This is a blog on hacking the TP Link TL-WR703n router with openwrt. Its a place for me to keep notes and hopefully it will help other people too.
Thursday, 23 July 2015
Wednesday, 3 June 2015
Send email from TL-WR703n
Install ssmtp from luci
edit /etc/ssmtp.conf
#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=youremail@hotmail.com
# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
# mailhub=mail
# Example for SMTP port number 2525
# mailhub=mail.your.domain:2525
# Example for SMTP port number 25 (Standard/RFC)
# mailhub=mail.your.domain
# Example for SSL encrypted connection
mailhub=smtp.live.com:587
# Where will the mail seem to come from?
rewriteDomain=makesomethingup
# The full hostname
hostname=localhost
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
FromLineOverride=YES
# Use SSL/TLS to send secure messages to server.
UseTLS=YES
UseSTARTTLS=YES
AuthUser=you@hotmail.com
AuthPass=yourhotmailpassword
# Use SSL/TLS certificate to authenticate against smtp host.
#UseTLSCert=YES
# Use this RSA certificate.
#TLSCert=/etc/ssl/certs/ca-the_usertrust_network.pem
# Get enhanced (*really* enhanced) debugging information in the logs
# If you want to have debugging of the config file parsing, move this option
# to the top of the config file and uncomment
#Debug=YES
To send a test email....... type this with your email address
echo "This is a test" | ssmtp youremail@hotmail.com
edit /etc/ssmtp.conf
#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=youremail@hotmail.com
# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
# mailhub=mail
# Example for SMTP port number 2525
# mailhub=mail.your.domain:2525
# Example for SMTP port number 25 (Standard/RFC)
# mailhub=mail.your.domain
# Example for SSL encrypted connection
mailhub=smtp.live.com:587
# Where will the mail seem to come from?
rewriteDomain=makesomethingup
# The full hostname
hostname=localhost
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
FromLineOverride=YES
# Use SSL/TLS to send secure messages to server.
UseTLS=YES
UseSTARTTLS=YES
AuthUser=you@hotmail.com
AuthPass=yourhotmailpassword
# Use SSL/TLS certificate to authenticate against smtp host.
#UseTLSCert=YES
# Use this RSA certificate.
#TLSCert=/etc/ssl/certs/ca-the_usertrust_network.pem
# Get enhanced (*really* enhanced) debugging information in the logs
# If you want to have debugging of the config file parsing, move this option
# to the top of the config file and uncomment
#Debug=YES
To send a test email....... type this with your email address
echo "This is a test" | ssmtp youremail@hotmail.com
Tuesday, 2 June 2015
Out of space..........
I ran out of memory so couldnt install any more packages. A way around this is to copy the filesystem to a usb drive and run from there, however you will need to format theusb drive on another device as there isnt enough memory on the Tl-WR703n for the software....
format usb on another box
list drives
ls /dev/sd*
format it to ext3
mkfs.ext3 /dev/sda1
remove and plug it into router
-NOTE I had already installed motion, so i had no more space at this step, the only round this was to reset it to default in luci >system>backup/flash firmware which will reset it to a clean openwrt install freeing up some room.
list drives
ls /dev/sd*
If usb not found then install usb storage support
Update package list
opkg update
Install USB storage support
opkg install kmod-usb-storage
you may get an error, just reboot and repeat
list drives again and it should show up as sda1
ls /dev/sd*
install ext4
opkg install kmod-fs-ext4
got error but ignore
install block-mount
opkg install block-mount
Now we copy the file system to the USB drive. (One command per line.)
mkdir -p /mnt/sda1
mount /dev/sda1 /mnt/sda1
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf -
umount /tmp/cproot
umount /mnt/sda1
Step 4
Now need to make a small adjustment to the /etc/config/fstab file.
/etc/config/fstab
config mount
option target /
option device /dev/sda1
option fstype ext3
option options rw,sync
option enabled 1
option enabled_fsck 0
reboot
After rebooting the router, connect again to it (via SSH). By subsequent command you can test, if everything worked fine.
Show mounts
df
In the line rootfs you should now see that the storage capacity is the same as the one of your USB flash drive. A look into the router’s web backend (at the System->Software tab) should also disclose whether everything went fine.
Next i need to reinstall motion :(
Part of this came from....
http://en.code-bude.net/2013/02/16/how-to-increase-storage-on-tp-link-wr703n-with-extroot/
format usb on another box
list drives
ls /dev/sd*
format it to ext3
mkfs.ext3 /dev/sda1
remove and plug it into router
-NOTE I had already installed motion, so i had no more space at this step, the only round this was to reset it to default in luci >system>backup/flash firmware which will reset it to a clean openwrt install freeing up some room.
list drives
ls /dev/sd*
If usb not found then install usb storage support
Update package list
opkg update
Install USB storage support
opkg install kmod-usb-storage
you may get an error, just reboot and repeat
list drives again and it should show up as sda1
ls /dev/sd*
install ext4
opkg install kmod-fs-ext4
got error but ignore
install block-mount
opkg install block-mount
Now we copy the file system to the USB drive. (One command per line.)
mkdir -p /mnt/sda1
mount /dev/sda1 /mnt/sda1
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf -
umount /tmp/cproot
umount /mnt/sda1
Step 4
Now need to make a small adjustment to the /etc/config/fstab file.
/etc/config/fstab
config mount
option target /
option device /dev/sda1
option fstype ext3
option options rw,sync
option enabled 1
option enabled_fsck 0
reboot
After rebooting the router, connect again to it (via SSH). By subsequent command you can test, if everything worked fine.
Show mounts
df
In the line rootfs you should now see that the storage capacity is the same as the one of your USB flash drive. A look into the router’s web backend (at the System->Software tab) should also disclose whether everything went fine.
Next i need to reinstall motion :(
Part of this came from....
http://en.code-bude.net/2013/02/16/how-to-increase-storage-on-tp-link-wr703n-with-extroot/
Monday, 25 May 2015
Autostart Motion when OpenWRT boots
Make sure the config file is set to daemon mode - this lets openwrt run in the background
Open /etc/motion.conf using WinSCP and make sure daemon is set to on...
daemon on
save and close
Then load on boot.....
Open /etc/rc.local using WinSCP and replace with the following....
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
motion -c /etc/motion.conf
exit 0
Save and reboot, then it will then load automatically on startup.
Edit.......
I had an intermittent problem on reboot
In the kernel log on reboot I was getting:-
UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
It worked if I unplugged the camera and plugged it back in, or I power cycled the router just not on reboot (using reset button or from reboot in luci).
To get it working reliably on reboot, I had to edit /etc/modules.d/video-uvc to read
uvcvideo quirks=0x100
save and reboot
Thursday, 21 May 2015
Webcam Streaming
So I decided to add a webcam - its a Microsoft LifeCam NX-3000
Notes - I used OpenWrt Barrier Breaker 14.07
see my Flashing firmware post
1: install uvc drivers: kmod-video-uvc (I did this from luci software menu)
2: install motion (I did this from luci software menu)
3: reboot
5: edit the config file stored in /etc/motion.conf (I used WinSCP)
change the entries below......
daemon off
this will turn off daemon mode (so that in putty you will get an output to tell you what is going on for testing)
v4l2_palette 8
output_pictures off
to stop you running out of memory after 5 pictures!
note you could add a usb hub and mount a memory stick for extra memory then change
target_dir to your memory stick.
stream_localhost off
this will let you view the stream remotely ie not just from the localhost!
6: Save the config file
7: start motion from putty: motion -c /etc/motion.conf
open firefox on a pc (internet explorer didn't work) and goto http://192.168.1.1:8081/
or whatever the ip address of your router is.
And Voila......
On
Notes - I used OpenWrt Barrier Breaker 14.07
see my Flashing firmware post
1: install uvc drivers: kmod-video-uvc (I did this from luci software menu)
2: install motion (I did this from luci software menu)
3: reboot
4: check camera is recognised - should appear in /dev/video0:
If all is good then.......5: edit the config file stored in /etc/motion.conf (I used WinSCP)
change the entries below......
daemon off
this will turn off daemon mode (so that in putty you will get an output to tell you what is going on for testing)
v4l2_palette 8
output_pictures off
to stop you running out of memory after 5 pictures!
note you could add a usb hub and mount a memory stick for extra memory then change
target_dir to your memory stick.
stream_localhost off
this will let you view the stream remotely ie not just from the localhost!
6: Save the config file
7: start motion from putty: motion -c /etc/motion.conf
open firefox on a pc (internet explorer didn't work) and goto http://192.168.1.1:8081/
or whatever the ip address of your router is.
And Voila......
On
Saturday, 16 May 2015
Flashing with openwrt
I used OpenWrt Barrier Breaker 14.07
Download the firmware to your pc:
http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
Then login to the router and upload it to replace the chinese firmware.....
The router I had came with chinese firmware - log into it with the username and password printed on the back of the box and then follow below

You will loose connection while it flashes the firmware, and i can take 5 mins or so.
Once its rebooted you can login via ethernet cable on 192.168.1.1
Download the firmware to your pc:
http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin
Then login to the router and upload it to replace the chinese firmware.....
The router I had came with chinese firmware - log into it with the username and password printed on the back of the box and then follow below
You will loose connection while it flashes the firmware, and i can take 5 mins or so.
Once its rebooted you can login via ethernet cable on 192.168.1.1
Subscribe to:
Posts (Atom)