| View previous topic :: View next topic |
| Author |
Message |
dema Fonero Pub A

Joined: 09 Jun 2006 Posts: 188 Location: Lamporecchio (pt) - ITALY
|
Posted: Tue Jul 18, 2006 07:40 Post subject: Gpl heartbeat script for non official firmware |
|
|
Here a proposal.
As long as many of ours still prefer to have control of our routers , and on the other side , FON needs to have a feedback of their network , I launch this proposal:
To build a script for heartbeat for dd-wrt or openwrt or self made routers.
With this we still remain in full control of our devices and FON is happy to know that his net is up and running.
Sound simple ugh !
So let's do it  _________________ status: Linus
setup: ADSL2MUE linksys » Linksys WRT54GL
firmware: dd-wrt v23 sp2 09/15/06 std nokaid FON compliant
link: 1024><256 kbit/s
ISP: NGI Milano - Italy
wlan devices: apple mac book
callme on skype
Proud member of the "Borat" english speakers |
|
| Back to top |
|
 |
Nik_Doof Fonero A

Joined: 27 Jun 2006 Posts: 48 Location: Widnes, UK
|
Posted: Tue Jul 18, 2006 09:16 Post subject: |
|
|
Sounds good, you could use the script out of the FON firmware as a starting point, after all you'll need their key to push the heartbeat anyway.
That is, of course, if FON finds it OK to do. _________________ status: Linus
setup: ADSL » Solwise 705 » IPCop Firewall » Linksys WRT45GL
firmware: 0.6.6
ssid: fon_edwin_street
link: 8mbps / 488kbps (shaped to 128kbps / 128kbps)
ISP: Bulldog
wlan devices: Apple Powerbook, Nintendo DS |
|
| Back to top |
|
 |
bird603568 Fonero

Joined: 18 Jul 2006 Posts: 24
|
Posted: Tue Jul 18, 2006 12:34 Post subject: |
|
|
| hasnt this already been done? i mean sheed posted it and took it down |
|
| Back to top |
|
 |
bird603568 Fonero

Joined: 18 Jul 2006 Posts: 24
|
Posted: Tue Jul 18, 2006 12:42 Post subject: |
|
|
from my source:
MAC=`nvram get il0macaddr|sed s/:/-/g`
wget "http://download.fon.com/heartbeat.php?mac=$MAC" -O /tmp/inet.html
those are the only 2 lines you need |
|
| Back to top |
|
 |
dioid Fonero C
Joined: 10 Jul 2006 Posts: 109 Location: Linköping, Sweden
|
Posted: Tue Jul 18, 2006 13:01 Post subject: |
|
|
When/where is that run? I can only find access to http://www.download.fon.com/heartbeat.php from /etc/init.d/S56redirect in my FON 0.6.6 Beta, so it will only run at reboot and not periodically. Also, I don't see it passing MAC anymore, but there is a comment in the script that says it does.
Excerpt from S56redirect:
| Code: | while [ $ATTEMPT -lt 10 ] && [ $NET -eq 0 ]; do
# Check wether Internet is ready and by the way, we send MAC address to FON server
[ -n "$(wget "http://download.fon.com/heartbeat.php" -O-)" ] && NET=1
ATTEMPT=$(($ATTEMPT + 1))
done |
This is done after a wait for the hotplug to detect internet connection being up and release a lock file, etc. _________________ status: Linus
setup: TP RJ-45 10Mbit ethernet connection in wall » WRT54GL with FON ))
firmware: FON Firmware (Beta 0.6.6)
link: Static IP ethernet 10><10 Mbit/s
ISP: visit.se
wlan devices: Fujitsu-Siemens Amilo A7640W laptop, Dell Latitude D420 laptop
 |
|
| Back to top |
|
 |
bird603568 Fonero

Joined: 18 Jul 2006 Posts: 24
|
Posted: Tue Jul 18, 2006 13:23 Post subject: |
|
|
| no clue i didnt look at the source code but "#" only comments 1 line so its not commented out |
|
| Back to top |
|
 |
dioid Fonero C
Joined: 10 Jul 2006 Posts: 109 Location: Linköping, Sweden
|
Posted: Tue Jul 18, 2006 13:32 Post subject: |
|
|
Yes, my point was that the wget in the S56redirect didn't contain the heartbeat.php?mac=$MAC but just a plain heartbeat.php which seem to contradict the comment on the line above that says that the MAC is sent to the FON server. Perhaps it's sent anyway, somehow. I didn't look at what the response is for that line. _________________ status: Linus
setup: TP RJ-45 10Mbit ethernet connection in wall » WRT54GL with FON ))
firmware: FON Firmware (Beta 0.6.6)
link: Static IP ethernet 10><10 Mbit/s
ISP: visit.se
wlan devices: Fujitsu-Siemens Amilo A7640W laptop, Dell Latitude D420 laptop
 |
|
| Back to top |
|
 |
dema Fonero Pub A

Joined: 09 Jun 2006 Posts: 188 Location: Lamporecchio (pt) - ITALY
|
Posted: Tue Jul 18, 2006 13:44 Post subject: |
|
|
I didn't find in the source the init.d file S56redirect.
Here the content of /FONbasic/package/base-files/default/etc/init.d
| Code: | rcS S10boot S20reset S50httpd S60thinclient
S05nvram S15FON S40network S60cron S99done
|
No trace of S56redirect .
the heartbeat is done by /FONbasic/package/base-files/default/bin/thinclient. My guess is why i cannot change the status in my page for my dd-wrt. It should trick fon and make the dd-wrt appear as fon basic 0.6.6. _________________ status: Linus
setup: ADSL2MUE linksys » Linksys WRT54GL
firmware: dd-wrt v23 sp2 09/15/06 std nokaid FON compliant
link: 1024><256 kbit/s
ISP: NGI Milano - Italy
wlan devices: apple mac book
callme on skype
Proud member of the "Borat" english speakers |
|
| Back to top |
|
 |
bird603568 Fonero

Joined: 18 Jul 2006 Posts: 24
|
|
| Back to top |
|
 |
mephisto Fonero
Joined: 12 Jul 2006 Posts: 7
|
Posted: Tue Jul 18, 2006 16:31 Post subject: |
|
|
In 0.6.6 the heartbeat has been changed. Read this post for an updated script. _________________ --
NO SUPPORT VIA PMs - keep it public |
|
| Back to top |
|
 |
dioid Fonero C
Joined: 10 Jul 2006 Posts: 109 Location: Linköping, Sweden
|
Posted: Tue Jul 18, 2006 17:15 Post subject: |
|
|
The S56redirect is in FONbasic-0.6.6/package/webif/files/etc/init.d/S56redirect and it is installed in /etc/init.d on my FON router that I got from FON with FON 0.6.6 Beta preinstalled on. It also refers to /etc/init.d/chillispot which in the source tar is FONbasic-0.6.6/package/chillispot/files/chillispot-fon.init and in fact /etc/init.d/chillispot runs in a loop mode and once per day downloads /tmp/chilli.conf with /usr/sbin/chilli_radconf (to which it passes the MAC address too) and checks if it's different than /etc/chilli.conf and if so, replaces the /etc/chilli.conf with it.
I think the main heart beat is with thinclient which is called once per hour from cron, but also in that /etc/init.d/chillispot script which sleeps about one day before each verification that /etc/chilli.conf wasn't tampered with. It also checks that chilli is up and running more often but that's only local checks as far as I can tell. _________________ status: Linus
setup: TP RJ-45 10Mbit ethernet connection in wall » WRT54GL with FON ))
firmware: FON Firmware (Beta 0.6.6)
link: Static IP ethernet 10><10 Mbit/s
ISP: visit.se
wlan devices: Fujitsu-Siemens Amilo A7640W laptop, Dell Latitude D420 laptop
 |
|
| Back to top |
|
 |
bird603568 Fonero

Joined: 18 Jul 2006 Posts: 24
|
Posted: Tue Jul 18, 2006 18:14 Post subject: |
|
|
why do dont you put another box between the fon and the internet and mitm attack it. dont draw andytraffic or try not to and see what happens. a good time would be over night. _________________ www.oddree.com is a sweet tech zine |
|
| Back to top |
|
 |
fulbrich Fonero B

Joined: 06 Jun 2006 Posts: 92 Location: NRW, Germany
|
Posted: Thu Jul 27, 2006 09:21 Post subject: |
|
|
The following lines were found at :
http://www.schlubtech.org/?p=8
I have no idea if the old mechanism still works beside the new one. Has anyone more information about it ?
--->schnipp <--------
Telnet/SSH to your router and perform the following commands, your console window should look exactly the same when you’re finished:
~ # nvram set rc_startup=”
> echo ‘00 03 * * * root /usr/bin/wget “http://download.fon.com/heartbeat.php?mac=XX-XX-XX-XX-XX-XX” -O /tmp/inet.html’ > /tmp/cron.d/heartbeat
~ # nvram commit
~ # reboot
The system is going down NOW !!
Sending SIGTERM to all processes. _________________ Tschüs,
Frank
---------------------------------
status: former Linus quitted 04.July.2006 due to legal concers.
setup: - » -
firmware:
|
|
| Back to top |
|
 |
rolelael Fonero A
Joined: 17 Jul 2006 Posts: 36
|
Posted: Thu Jul 27, 2006 18:45 Post subject: |
|
|
I tried this one but I seem to make a mistake
On line 1 I enter : nvram set rc_startup=” +enter
then I get a > 'sign'
then I enter echo ‘00 03 * * * root /usr/bin/wget “http://download.fon.com/heartbeat.php?mac=XX-XX-XX-XX-XX-XX” -O /tmp/inet.html’ > /tmp/cron.d/heartbeat +enter
the > stays there ???
If I enter nvram commit , it doesn't do anything , also the reboot doesn"t do anything
any help ?
R _________________ status: Linus
setup: Cable Modem » Linksys WRT54GL
firmware: dd-wrt v23 sp1 overclock to 216 mhz
link: 10Mbps DOWN ><256 kbit/s UP
ISP: Telenet - Belgium
wlan devices: acer aspire 1694 wlmi |
|
| Back to top |
|
 |
AustinTX FON-FRIENDS

Joined: 24 Feb 2006 Posts: 2765 Location: Austin, Texass
|
Posted: Thu Jul 27, 2006 18:53 Post subject: |
|
|
| rolelael wrote: | | the > stays there ??? | This is the problem I had when doing it on the router. I haven't studied SSL so I don't know what's up with that, but I got further when I did it on my Linux PC:
http://boards.fon.com/viewtopic.php?t=1219&start=30 _________________ Well, as Revolutions go, this one has certainly been revolting!
Linus || WRT54GL @ 228Mhz || DD-WRT v24 Beta (05/16/07) vpn
My background: ISP NOC Tech, DSL - ISDN - Dialup - Web Hosting
[ El Fon Blog ][ RSS Feed ][ skype:elfonblog ][ gizmo:therealelfonblog ] |
|
| Back to top |
|
 |
Strolls Fonero A
Joined: 28 Jul 2006 Posts: 35
|
Posted: Fri Jul 28, 2006 04:50 Post subject: OT: a learned treatese on Shell Prompts for the Unix n00b |
|
|
| rolelael wrote: | On line 1 I enter : nvram set rc_startup=” +enter
then I get a > 'sign'
then I enter echo ‘00 03 * * * root /usr/bin/wget “http://download.fon.com/heartbeat.php?mac=XX-XX-XX-XX-XX-XX” -O /tmp/inet.html’ > /tmp/cron.d/heartbeat +enter
the > stays there ???
|
That prompt means the shell is waiting for you to complete your input.
For instance:
| Code: | root@OpenWrt:~# ls \
> /etc
TZ firewall.user ipkg.conf profile
banner fon_revision l7-protocols protocols
chilli.conf functions.sh localusers resolv.conf
config group modules shells
crontabs hosts modules.d svn-commit.tmp
dnsmasq.conf hotplug.d passwd sysctl.conf
dropbear httpd.conf passwd-
ethers init.d ppp
firewall.fon inittab preinit
root@OpenWrt:~#
|
In this case the "\" is telling the shell "I ain't finished yet, hang on until I've finished typing"... so the shell puts that ">" there to say, "ok... this isn't a new command, it's part of the last one". So when I typed the "/etc" the shell knew that I didn't want to like execute /etc or something, I wanted it tagged on to the previous line, so it did `ls /etc` 'cause that was the whole command.
In your case, you're getting the ">" sign because you haven't finished defining what rc_startup should be.
You have said:
| Code: | | nvram set rc_startup=” |
but where is the close quote?
I'm not tinkering with rc_startup myself - it's unset on my version of the firmware, so I'm not going to add it and am instead taking another approach to hacking /bin/thinclient - but I would have thought that if you were to type just a single " (yes, a single double-quotes ) at the ">" prompt - the one which "stays there" - then you'd find the command completed ok.
| Code: | root@OpenWrt:~# nvram
usage: nvram [get name] [set name=value] [unset name] [show]
root@OpenWrt:~# nvram get foo
root@OpenWrt:~# nvram set foo
root@OpenWrt:~# nvram get foo
root@OpenWrt:~# nvram set foo="bar"
root@OpenWrt:~# nvram get foo
bar
root@OpenWrt:~# nvram set foo="bar
>
> "
root@OpenWrt:~# nvram get foo
bar
root@OpenWrt:~# nvram set foo
root@OpenWrt:~# nvram get foo
root@OpenWrt:~# |
You can actually edit the both the "root@OpenWrt:~#" bit, and the ">":
| Code: | root@OpenWrt:~# echo $PS1
\u@\h:\w\$
>
root@OpenWrt:~# export PS2="continue typing here, silly! "
root@OpenWrt:~# echo $PS2
continue typing here, silly!
root@OpenWrt:~# ls \
continue typing here, silly! /etc/
TZ firewall.user ipkg.conf profile
banner fon_revision l7-protocols protocols
chilli.conf functions.sh localusers resolv.conf
config group modules shells
crontabs hosts modules.d svn-commit.tmp
dnsmasq.conf hotplug.d passwd sysctl.conf
dropbear httpd.conf passwd-
ethers init.d ppp
firewall.fon inittab preinit
root@OpenWrt:~# |
Compare this with the first section of code above in order that it make sense.
Stroller.
Last edited by Strolls on Fri Jul 28, 2006 05:21; edited 1 time in total |
|
| Back to top |
|
 |
mathsped Fonero A
Joined: 24 Jul 2006 Posts: 44 Location: Denmark
|
Posted: Fri Jul 28, 2006 05:05 Post subject: |
|
|
So if he were to do it like this, it could work ? (Can't try myself)
~ # nvram set rc_startup="
> echo ‘00 03 * * * root /usr/bin/wget http://download.fon.com/heartbeat.php?mac=XX-XX-XX-XX-XX-XX -O /tmp/inet.html’ > /tmp/cron.d/heartbeat
"
~ # nvram commit
~ # reboot
~ # nvram get rc_startup (check what was comitted)
p.s. also removed the quotation marks around the URL as I doubt wget would understand them ? (Note; just leave the quotes anyways)
Edited to remind me
Last edited by mathsped on Fri Jul 28, 2006 09:36; edited 2 times in total |
|
| Back to top |
|
 |
Strolls Fonero A
Joined: 28 Jul 2006 Posts: 35
|
Posted: Fri Jul 28, 2006 06:10 Post subject: |
|
|
Have edited my post for clarity. I hope it makes better sense now. But it'd be great if you could play around with the examples before posting any more questions about this.
Once you're comfortable setting foo to be bar with two carriage returns after it, can you tell use what `nvram set rc_startup` shows?
Can you set set rc_startup to be bar with two carriage returns after it, and can you set it back again? Worst case is you have to stick a paperclip in the back of your router.
Finally, re-read my previous post & see if it makes sense.
| mathsped wrote: | | p.s. also removed the quotation marks around the URL as I doubt wget would understand them ? |
wget doesn't HAVE to understand them - the quotes mean "pass this whole lot as a parameter to wget", so that the shell doesn't try to interpret the question-mark in the middle (or any other special shell characters).
Actually, if you try copying & pasting | Code: | | /usr/bin/wget http://download.fon.com/heartbeat.php?mac=XX-XX-XX-XX-XX-XX | into the router's terminal - both ways, with & without quotes - then you'll see that in this case it doesn't seem to make any difference. But it is good practice to quote, and there are lots of occasions when I'm downloading stuff (I seem to get it a lot when I wget .torrent links from ISOhunt) when the quoting is important.
The reason that in the example:
| Code: | root@OpenWrt:~# nvram set rc_startup=”
> echo ‘00 03 * * * root /usr/bin/wget “http://download.fon.com/heartbeat.php?mac=XX-XX-XX-XX-XX-XX” -O /tmp/inet.html’ > /tmp/cron.d/heartbeat
> "
root@OpenWrt:~# |
the double-quotes around the URL don't affect the double-quotes following the rc_startup= is because the quotes around the URL are themselves quoted within the single quotes of the echo statement. That middle line is saying "please echo all this stuff" then uses the ">" arrow to say, "put the output into /tmp/cron.d/heartbeat". The single quotes used by the echo statement (after the echo and before the arrow) enclose the double-quotes of the URL, like a nested set of brackets in maths. In fact, the single-quotes are stronger than double-quotes, but explaining that would probably be beyond me at the present.
Stroller. |
|
| Back to top |
|
 |
dioid Fonero C
Joined: 10 Jul 2006 Posts: 109 Location: Linköping, Sweden
|
Posted: Fri Jul 28, 2006 07:03 Post subject: |
|
|
Another thing is why go to the trouble of running /usr/bin/wget “http://download.fon.com/heartbeat.php?mac=XX-XX-XX-XX-XX-XX” once per day when it's not used as heartbeat by fon anymore. In firmware 0.6.6 it is run once at boot and it is run without mac address in argument, it is just getting http://download.fon.com/heartbeat.php with wget. But if you want to announce to fon that you read the "hacking" hint on how to pretend to be a fon router (or that you are running old fon firmware), sure, go ahead, I won't stop you. See previously in this thread message by mephisto who links to another thread that discusses the current heartbeat (with thinclient and chillispot scripts). _________________ status: Linus
setup: TP RJ-45 10Mbit ethernet connection in wall » WRT54GL with FON ))
firmware: FON Firmware (Beta 0.6.6)
link: Static IP ethernet 10><10 Mbit/s
ISP: visit.se
wlan devices: Fujitsu-Siemens Amilo A7640W laptop, Dell Latitude D420 laptop
 |
|
| Back to top |
|
 |
Strolls Fonero A
Joined: 28 Jul 2006 Posts: 35
|
Posted: Fri Jul 28, 2006 07:15 Post subject: |
|
|
| dioid wrote: | | Another thing is why go to the trouble of running /usr/bin/wget “http://download.fon.com/heartbeat.php?mac=XX-XX-XX-XX-XX-XX” once per day when it's not used as heartbeat by fon anymore. |
Indeed. I wondered this myself.
Maybe the heartbeat is "backwards-compatible" and an older heartbeat will continue to register you to FON's servers?
Personally, I've so far just moved the /bin/thinclient symlink to /bin/thinclient.orig, copied /bin/thinclient.orig to /bin/thinclient and commented out the two lines rm -f /tmp/.thinclient.sh and . /tmp/.thinclient.sh.
I think this should be sufficient to keep the heartbeat-NG ticking whilst ensuring that FON can't run any scripts on my router?
Stroller. |
|
| Back to top |
|
 |
|