<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.accxproducts.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Sheeva_Plug_Monitoring</id>
	<title>Sheeva Plug Monitoring - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.accxproducts.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Sheeva_Plug_Monitoring"/>
	<link rel="alternate" type="text/html" href="https://www.accxproducts.com/wiki/index.php?title=Sheeva_Plug_Monitoring&amp;action=history"/>
	<updated>2026-04-15T16:48:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://www.accxproducts.com/wiki/index.php?title=Sheeva_Plug_Monitoring&amp;diff=528&amp;oldid=prev</id>
		<title>Arclight: Created page with &quot;This page explains how to set up a Sheevaplug embedded PC for monitoring the Open Access Control.  Updated 10/19/2012 (originally published at code.google.com)  ==Plug Compute...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.accxproducts.com/wiki/index.php?title=Sheeva_Plug_Monitoring&amp;diff=528&amp;oldid=prev"/>
		<updated>2014-06-03T22:29:48Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;This page explains how to set up a Sheevaplug embedded PC for monitoring the Open Access Control.  Updated 10/19/2012 (originally published at code.google.com)  ==Plug Compute...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page explains how to set up a Sheevaplug embedded PC for monitoring the Open Access Control.&lt;br /&gt;
&lt;br /&gt;
Updated 10/19/2012 (originally published at code.google.com)&lt;br /&gt;
&lt;br /&gt;
==Plug Computer Device Setup==&lt;br /&gt;
&lt;br /&gt;
Tutorial based on the Sheevaplug PC from Globalscale Technologies and ArmedSlack Linux v13.37.&lt;br /&gt;
&lt;br /&gt;
1. Download ArmedSlack 13.37.&lt;br /&gt;
&lt;br /&gt;
mkdir armedslack&lt;br /&gt;
cd armedslack&lt;br /&gt;
rsync -Pavv --delete ftp.armedslack.org::armedslack/armedslack-current .&lt;br /&gt;
&lt;br /&gt;
2. Install an 8GB MMC card. We used high-speed model from Sandisk, no problems.&lt;br /&gt;
&lt;br /&gt;
3. Attach to the plug PC with a mini USB to USB A cable. Linux terminal instructions are in the Slackware install doc here: ftp://ftp.armedslack.org/armedslack/armedslack13.3/INSTALL_KIRKWOOD.TXT&lt;br /&gt;
&lt;br /&gt;
Windows USB serial drivers are here, also more Linux help:&lt;br /&gt;
&lt;br /&gt;
http://www.plugcomputer.org/plugwiki/index.php/Serial_terminal_program&lt;br /&gt;
&lt;br /&gt;
4. Follow installation instructions at:&lt;br /&gt;
&lt;br /&gt;
ftp://ftp.armedslack.org/armedslack/armedslack/3.37/INSTALL_KIRKWOOD.TXT&lt;br /&gt;
&lt;br /&gt;
5. Set up a TFTP and NFS server. Instructions for Ubuntu are below.&lt;br /&gt;
&lt;br /&gt;
TFTP&lt;br /&gt;
&lt;br /&gt;
NFS&lt;br /&gt;
&lt;br /&gt;
a. If you get a CRC error on the boot or root image, re-download it from the mirror site and try again. This seems to be a common problem. Also, be sure you did not download and of the packages in ASCII mode.&lt;br /&gt;
&lt;br /&gt;
b. You need to run mmcinit twice on the boot loader to get it to recognize the card.&lt;br /&gt;
&lt;br /&gt;
c. Use an ext2 file system for the /boot volume. The / volume can be ext4 (recommended for journaling)&lt;br /&gt;
&lt;br /&gt;
d. The device names should be as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/dev/mmcblk0p1            2048      206847      102400   83  Linux &lt;br /&gt;
/dev/mmcblk0p2          206848     1845247      819200   82  Linux swap &lt;br /&gt;
/dev/mmcblk0p3         1845248    15646719     6900736   83  Linux &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using /dev/sda1,sda2,sda3 does not work! These file system sizes are good for the 8GB card.&lt;br /&gt;
&lt;br /&gt;
e. Use these boot arguments:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Marvell&amp;gt;&amp;gt;   setenv bootargs_console console=ttyS0,115200 &lt;br /&gt;
# note changed device file: &lt;br /&gt;
Marvell&amp;gt;&amp;gt;   setenv bootargs_root &amp;#039;root=/dev/mmcblk0p3 waitforroot=10 rootfs=ext4&amp;#039; &lt;br /&gt;
Marvell&amp;gt;&amp;gt;   setenv bootcmd &amp;#039;setenv bootargs $(bootargs_console) $(bootargs_root); run bootcmd_slk ; reset&amp;#039; &lt;br /&gt;
# for MMC: &lt;br /&gt;
Marvell&amp;gt;&amp;gt;   setenv bootcmd_slk &amp;#039;mmcinit;ext2load mmc 0:1 0x01100000 /uinitrd-kirkwood;ext2load mmc 0:1 0x00800000 /uImage-kirkwood;bootm 0x00800000 0x01100000&amp;#039; &lt;br /&gt;
# save &lt;br /&gt;
Marvell&amp;gt;&amp;gt;   saveenv &lt;br /&gt;
Marvell&amp;gt;&amp;gt;   reset &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Install these packages: &lt;br /&gt;
&amp;lt;pre&amp;gt;-All dev/make/gcc/binutils/glibc/kernel headers/etc&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
This will enable building from source. This is much easier to do from the inititial installation script. pkgtool does not let you see the &amp;quot;everything&amp;quot; and &amp;quot;all dev&amp;quot; type options later. You&amp;#039;ll get stuck having to manually add missing libraries/etc like I did, so watch out!&lt;br /&gt;
&lt;br /&gt;
*iptables (Needed for securing the system later)&lt;br /&gt;
&lt;br /&gt;
*All networking, openssl, basic required packages. -All Marvell utilities in the Slackware distribution&lt;br /&gt;
&lt;br /&gt;
*These specific packages we need for the Security Monitoring scripts:&lt;br /&gt;
&lt;br /&gt;
a. msmtp (Command-line mail sending client. Will work with SMTP/Gmail/Yahoo/etc)&lt;br /&gt;
&lt;br /&gt;
Download and build from: http://msmtp.sourceforge.net Must also install openSSL for TLS/SSL support! Also, install a root CA file from Firefox or similar in: /etc/ssl/certs/ca-certificates.crt &lt;br /&gt;
&lt;br /&gt;
b. minicom (Terminal program, we use this to communicate with the Arduino.)&lt;br /&gt;
&lt;br /&gt;
    Use the built-in Slackware package, but be aware that it will just hang and seg-fault unless you first modify this file:&lt;br /&gt;
&lt;br /&gt;
        /etc/minirc.dfl -&amp;gt; Open this file in vi and add a carriage return/line feed at the bottom and save. &lt;br /&gt;
&lt;br /&gt;
c. screen (We use screen to run minicom interactively)&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
A complete installation of everything will fit on the 8GB flash card. You can also pull the flash card out and copy the complete set of package files from your host PC to a directory once the basic install is completed. This will leave you with abotu 2GB free on the / file system.&lt;br /&gt;
&lt;br /&gt;
7. Configure networking and plug in your Arduino to the large USB &amp;#039;A&amp;#039; port. The stock kernel seems to have no problem recognizing the built-in network devices and the FTDI chip on the Arduino is recognized as :&lt;br /&gt;
&lt;br /&gt;
/dev/ttyUSB0&lt;br /&gt;
&lt;br /&gt;
8. Now it&amp;#039;s time to configure our monitoring stuff. Follow these instructions:&lt;br /&gt;
Setup the monitoring system&lt;br /&gt;
&lt;br /&gt;
a. Create a normal user to run your monitoring scripts under. We&amp;#039;ll call this user &amp;quot;access&amp;quot; for the tutorial.&lt;br /&gt;
&lt;br /&gt;
b. Create a directory called &amp;quot;scripts&amp;quot; in their home directory. Place the following files in this directory and modify the e-mail addresses, messages, etc as needed.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
start_screen_logging.sh&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Start logging functions in a screen&lt;br /&gt;
/bin/su - access -c &amp;quot;screen -dmS MINICOM /home/access/scripts/start_logging.sh&amp;quot;&lt;br /&gt;
&lt;br /&gt;
log_notify.sh:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
tail -0f /home/access/scripts/access_log.txt | egrep --line-buffered -i &amp;quot;authenticated&amp;quot; | while read line&lt;br /&gt;
        do&lt;br /&gt;
                rm /home/access/scripts/message_tmp.txt&lt;br /&gt;
                cp /home/access/scripts/log_msg.txt /home/access/scripts/message_tmp.txt&lt;br /&gt;
                sleep 1&lt;br /&gt;
                tail -6 /home/access/scripts/access_log.txt &amp;gt;&amp;gt; /home/access/scripts/message_tmp.txt&lt;br /&gt;
                msmtp -t &amp;lt; /home/access/scripts/message_tmp.txt&lt;br /&gt;
        done&lt;br /&gt;
&lt;br /&gt;
log_alert.sh:&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
cd /home/access/scripts&lt;br /&gt;
tail -0f /home/access/scripts/access_log.txt | egrep --line-buffered -i &amp;quot;triggered&amp;quot; |&lt;br /&gt;
while read line&lt;br /&gt;
        do&lt;br /&gt;
                msmtp -t &amp;lt; /home/access/scripts/alert_msg.txt&lt;br /&gt;
        done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
log_msg.txt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
From:hackerspace_notifier@yourdomain.com&lt;br /&gt;
To:somebody@domain.com, somebody_else@anotherdomain.com&lt;br /&gt;
Subject:User at the Hacker Space&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
log_alert.txt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
From:hackerspace_notifier@yourdomain.com&lt;br /&gt;
To:somebody@domain.com, somebody_else@anotherdomain.com&lt;br /&gt;
Subject: Alert: Alarm triggered at shop&lt;br /&gt;
&lt;br /&gt;
Please log in to the webcame at http://www.somedomain.com/cameras to check status.&lt;br /&gt;
&lt;br /&gt;
-The Hacker Space&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
start_logging.sh:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
/usr/bin/minicom -C /home/access/scripts/access_log.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
c. Secure the scripts directory: chmod -r 700 /home/access/scripts&lt;br /&gt;
&lt;br /&gt;
d. Secure the USB serial port:&lt;br /&gt;
&lt;br /&gt;
chown root:dialout /dev/ttyUSB0&lt;br /&gt;
&lt;br /&gt;
chmod 770 /dev/ttyUSB0&lt;br /&gt;
&lt;br /&gt;
ls -al /dev/ttyU*&lt;br /&gt;
&lt;br /&gt;
crw-rw---- 1 root dialout 188, 0 2011-09-25 16:36 /dev/ttyUSB0&lt;br /&gt;
&lt;br /&gt;
Add the user &amp;quot;access&amp;quot; to the group dialout: gpasswd -a access dialout dialout:x:16:access&lt;br /&gt;
&lt;br /&gt;
e. run minicom -s and configure the comm parameters. The defaults for Open Access are:&lt;br /&gt;
&lt;br /&gt;
/etc/minirc.dfl:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pr port             /dev/ttyUSB0&lt;br /&gt;
pr lock             /var/lock&lt;br /&gt;
pu baudrate         57600&lt;br /&gt;
pu minit&lt;br /&gt;
pu mreset&lt;br /&gt;
pu mdialpre&lt;br /&gt;
pu mdialsuf&lt;br /&gt;
pu mdialpre2&lt;br /&gt;
pu mdialsuf2&lt;br /&gt;
pu mdialpre3&lt;br /&gt;
pu mdialsuf3&lt;br /&gt;
pu mconnect&lt;br /&gt;
pu mnocon1&lt;br /&gt;
pu mnocon2&lt;br /&gt;
pu mnocon3&lt;br /&gt;
pu mnocon4&lt;br /&gt;
pu mhangup&lt;br /&gt;
pu mdialcan&lt;br /&gt;
pu rtscts           No&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
f. Configure iptables with some basic rules to protect the monitoring system. Tutorial here:&lt;br /&gt;
&lt;br /&gt;
Iptables rules&lt;br /&gt;
&lt;br /&gt;
g. Add the following file to /home/access. Modify as needed for your outgoing e-mail account.&lt;br /&gt;
&lt;br /&gt;
.msmtprc&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#Gmail account&lt;br /&gt;
account gmail&lt;br /&gt;
host smtp.gmail.com&lt;br /&gt;
from myuser@gmail.com&lt;br /&gt;
auth on&lt;br /&gt;
tls on&lt;br /&gt;
tls&lt;br /&gt;
tls_trust_file /etc/ssl/certs/ca-certificates.crt&lt;br /&gt;
user xxxx@gmail.com&lt;br /&gt;
password xxxx&lt;br /&gt;
port 587&lt;br /&gt;
#tls_certcheck off&lt;br /&gt;
&lt;br /&gt;
#ATT Account&lt;br /&gt;
account att&lt;br /&gt;
host smtp.att.yahoo.com&lt;br /&gt;
tls on&lt;br /&gt;
auth on&lt;br /&gt;
tls_trust_file /etc/ssl/certs/ca-certificates.crt&lt;br /&gt;
tls_starttls off&lt;br /&gt;
from xxx@att.net&lt;br /&gt;
user xxx@att.net&lt;br /&gt;
password xxxx&lt;br /&gt;
&lt;br /&gt;
account default : att&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
h. Add the following lines to /etc/rc.d/rc.local:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/etc/sysconfig/iptables&lt;br /&gt;
/bin/su - access -c &amp;quot;/home/access/scripts/log_notify.sh &amp;amp;&amp;quot;&lt;br /&gt;
/bin/su - access -c &amp;quot;/home/access/scripts/log_alert.sh &amp;amp;&amp;quot;&lt;br /&gt;
/home/access/scripts/start_screen_logging.sh&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
i. With the Arduino connected, reboot everything and verify that it all comes up automatically. You should be able to log in via ssh, type &amp;quot;screen -rd&amp;quot; and be connected to an interactive session on the Arduino. Please secure the ssh system with certificates and/or good passwords.&lt;/div&gt;</summary>
		<author><name>Arclight</name></author>
	</entry>
</feed>