<br><br><div class="gmail_quote">On Sun, Dec 5, 2010 at 12:47 AM, Benny Baumann <span dir="ltr"><<a href="mailto:BenBE1987@gmx.net">BenBE1987@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
there has been some timing issue / racing condition inside the<br>
opengate-www script which could be used to buzz the gate multiple times<br>
inside the 30 seconds window. The problem was caused by the command<br>
"sleep" beeing issued last in the script, thus opening a window of<br>
approx. 5-10 seconds for multiple buzzing the gate while another<br>
instance was still processing. Since the load caused by buzzing the gate<br>
could be used to slow down the SSH processing and other script<br>
activities this could be used for a DoS attack on the gate.<br>
<br></blockquote><div><br>Thanks for fixing this -- this caused humorous problems (multiple beep patterns being played) and sometimes caused the door to fail to open at the correct time, do you think it was used to attack the gate?  <br>
<br>What do you mean by the phrase 'the load caused by buzzing the gate'?  The system uses 2 parallel port pins on the doorway laptop to trigger an optoisolater that is connected to the button wires of the switch circuit.  A momentary connection causes the door strike to release which allows one to push open the door.  Is the software that drives the parallel port on the doorway laptop in need of upgrades?<br>
<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I rewrote the script opengate-www from scratch moving the offending<br>
sleep command to the FIRST operations of the script. This does not fully<br>
eliminate the racing condition (which would require an atomar operation<br>
of starting the sleep and asking for different instances), but reduces<br>
hitting this racing condition to an absolute minimum.<br>
<br></blockquote><div><br>Thanks for improving this.  <br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I also used this chance to clean up the code and combine some common<br>
code into variables making the overall script more readable. Anyone who<br>
feels like shane to have this code contain more comments is free to add<br>
them. Don't touch the actual ssh and sshpass lines as they are a PITA to<br>
fix.<br>
<br>
On the special request of Isky I disabled the Text-to-Speech feature of<br>
the opengate-www script which I just had fixed. Although this feature -<br>
if activated - seems to truncate the audio for some reason.<br>
<br>
The opengate script in the same folder looks simular fucked up like the<br>
original opengate-www script. Anyone who feels bored enough is<br>
encouraged to port my changes over.<br>
<br></blockquote><div> </div><div>There are a bunch of door opening scripts floating around pony, its probably time to clean it up.<br>I also have a script called bacngate that plays a personalized tone, and other people want to personalize or silence their entry tones, or perhaps use audio snippets for door opening (within reason).  (cf. the circus tone door opener you were working on, ;-)<br>
<br>Goals to have for improving the door opening script:<br>1)The script could be more modular: Tones should be called from the script so they can be personalized or not played at all. <br>2) The script should barf if the doorway laptop isn't opening the door, and perhaps use TTS then: 'please use the intercom to open the door'.<br>
3) a lockfile can be implemented as Jake said.<br><br>Can you help me implement these ideas Benny?  I want to do it but I'll need assistance and review.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

While at this I moved the id_dsa key for authenticating with the<br>
different servers for the script to work - with Rubin's consent in doing<br>
so - from his home directory over to /var/hg/gate/.ssh-opengate/. The<br>
directory is 770 root:hg and the keyfiles being 640 root:hg.<br>
<br>
OT: I had to restart the touchpanel notebook at the front since it had<br>
crashed, but it's up and running again.<br>
<br></blockquote><div><br>The doorway laptop is a weak link, problems with the touchscreen that cause the system to fail or look like its failed inevitably cause problems with the opengate/opengate-www script working.  Instead of replacing this system though,  add new system for testing in parallel until the kinks get ironed out.  See below for details:<br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Please review the changes of the opengate-www script since I cannot tell<br>
whether there have been any bugs that got in the while porting the<br>
general workflow of the script.<br><br>
</blockquote><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Last but not least: Rubin suggested to port all the necessary stuff for<br>
opening the gate to a microcontroller which can be plugged onto the net<br>
directly. If anyone has a spare Adruino board or something simular,<br>
which fulfills at least the following requirements, let me know:<br>
- RJ45 (LAN) connector for Ethernet connection<br>
- Microcontroller with at least 2 KB, but better 4 KB of RAM<br>
- Board being capable of running Etherape or simular based IP stacks<br>
- IP-Pins to interconnect with the door circuits<br>
- Some Speakers or GPIO ports suitable to drive them externally<br>
<br></blockquote><div><br><br>Any additional door opening electronics can be tested and installed on the free hanging cat5 wire that's hanging out of the intercom box next to the front door:<br>
Orange-Stripe is connected to a 10v source, and Orange is connected to 
gnd through the buzzer/strike.  Anything you want to test should work if
 the switch connects these two wires.  I don't think you can power a 
device through the 10v source but it's worth checking out, other than 
just using a wall wart.  <br><br><br>
The 3.5"  Insignia Infocast from Best Buy is on sale at $50.  From what I'm looking at, it's a Chumby one (arm based (maybe  <a href="http://en.wikipedia.org/wiki/I.MX21" title="I.MX21">i.MX21</a> freescale) 3.5 inch 
resistive touchscreen computer), and its 'hackable'.  I'll get one for 
the door.<br><br> 
<a href="http://livehotdeals.com/Insignia-Infocast-3-5-Internet-Media-Display_57981">http://livehotdeals.com/Insignia-Infocast-3-5-Internet-Media-Display_57981</a><br><a href="http://forum.chumby.com/viewtopic.php?id=5207">http://forum.chumby.com/viewtopic.php?id=5207</a><br>
<br>-rma<br></div></div><br>