It happened lately that I've got more and more concerned about the side effects WiFi radiation might have. I didn't find any relevant study which could clearly point out whether there are such effects or not, however I have decided not to take my chance, but do something.
So, having DD-WRT v24-sp2 running on my wonderful D-Link DIR-320 I have configured the Radio Time Restriction in such way it' starting daily at 18:00 (when normally I should be back from work) and runs until 24:00 (when I should be asleep).
Another way would be to turn Radio Time Restriction Off and use the button SES / AOSS / EZ-SETUP / WPS Button (located on the right side of the router) to turn the radio On and Off, which requires the following configuration on Services tab:
But that shouldn't do it either since my router serves three apartments, therefore only the people living in the apartment where it is located would have access to it, but not the others. And even for them it wouldn't be that easy since since they would need to climb a chair in order to reach the router which is being positioned a round 2,5 meters high.
So the question is, is there a clever way one could turn On DD-WRT WiFi at wish and having it closed when not used? Thanks God, it is!
But in order to achieve it, I would need to use my android phone, with Connectbot installed. THE WHOLE CONCEPT SHOULD WORK AS FOLLOWS:
One should be able to use his Android mobile phone as a remote control in order to turn On Wifi. This should not require advanced skills and should be accomplished with as less taps as possible. The wireless should be turned Off automatically when noticing no one is using it anymore.
So first first of all I would need to create a new user to be used for the remote connection:
root@DD-WRT:~# mkdir /opt/tmp/radio
echo "radio:*:401:10:User,,,:/opt/tmp/radio:/opt/opt/tmp/radio/radion.sh" >> /tmp/etc/passwd
Changing the default console for user radio to /opt/tmp/radio/radion.sh makes sure the script is being executed when radio logs on and the connection is being closed as soon as the script finishes execution. So, it leaves the user no other option, unless executing the script.
mkdir /opt/tmp/radio/.ssh
#!/opt/bin/bash
echo "Welcome! Initializing procedure..."
# check whether wireless is already on
RADIOSTATE=`sudo wl radio`
if [ "${RADIOSTATE}" = "0x0001" ] ; then
# if wireless off, starting wireless.
echo "Wireless is: OFF"
sleep 1 #wait one second
echo "Starting wireless"
#For some unknown reason most run both commands in this order:
sudo wl up ; sudo wl radio on
echo "Wireless is: ON"
sleep 1 #wait one second
echo "Bye bye!"
sleep 2 #wait two seconds
exit;
else
# if wireless on, it might be a good idea to remotely turn it off.
echo "Wireless is: ON"
sleep 1 #wait one second
echo "Would you like to turn it OFF?"
echo "y/n (default is y):"
read TURNOFF
if [ "${TURNOFF}" = "n" ] ; then
echo "Wireless will remain: ON"
sleep 1 #wait one second
echo "Nothing to do..."
sleep 1 #wait one second
echo "Bye bye!"
sleep 2 #wait two seconds
exit;
else
echo "Wireless will be turned: OFF"
sudo wl radio off
sleep 1 #wait one second
echo "Wireless is: OFF"
sleep 1 #wait one second
echo "Bye bye!"
sleep 2 #wait two seconds
exit;
fi
fi
Assign user radio as owner of the script:
root@DD-WRT:/opt/tmp/radio# chown radio radion.sh
Grant him execution rights:
root@DD-WRT:/opt/tmp/radio# chmod 544 radion.sh
In order to be able to execute wl command as user radio, insert the following line into the file /opt/etc/sudoers under ## User privilege specification ##:
radio ALL=NOPASSWD: /usr/sbin/wl
In order to be able to execute wl command as user radio, insert the following line into the file /opt/etc/sudoers under ## User privilege specification ##:
radio ALL=NOPASSWD: /usr/sbin/wl
Define a new connection for the user radio, such as radio@your_host_address:
Go to Manage Pubkeys >> go to Generate and create a new RSA key, 1024 bits, no password.
Save the key, I have saved mine under the name radio.ppk.
Long press on the key and select "Load key on start".
Long press on the key and select "Copy public key".
Using ConnectBot application on your phone, establish a ssh connection to you router using the root user. Once connected create the .ssh directory for the user radio.
root@DD-WRT:mkdir /opt/tmp/radio/.ssh
Create and edit the file storing the authorized keys:
root@DD-WRT: vi /opt/tmp/radio/.ssh/authorized_keys
Press i for vi insert mode.
Paste the public key from your clipboard into the file.
Save the file using the vi sequence esc followed by :x and hit return.
Now one should be able to use the ConnectBot connection previously defined in order to connect and run the script which will automatically turn the wireless On or Off at wish.
CREDITS:
Many thanks to Andrei for his prompt and good advises by the time my Linux skills were threatening to prevent me from finishing the project.
Great description and exhaustive details !
ReplyDelete- though I may have some issues regarding the unnecessary "sleep" actions :)
Please keep us posted with future projects !
sleep is generating enough pause in order to allow the human eye to catch up with the returned text before connection is being dropped.
DeleteWithout it one wouldn't have time to read the output.
ReplyDelete
http://www.naturalnews.com/038702_cell_phone_radiation_dangers_Belgium.html
ReplyDeleteThis book is a good one. It covers the latest research.
ReplyDelete"Overpowered: The Dangers of Electromagnetic Radiation (EMF) and What You Can Do about It"
by Martin Blank PhD (Author)