<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Information Systems Grad School</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/" />
    <link rel="self" type="application/atom+xml" href="http://cw.sampas.net/blog/atom.xml" />
    <id>tag:cw.sampas.net,2011-12-01:/blog//1</id>
    <updated>2012-01-25T03:20:53Z</updated>
    <subtitle>Information Systems grad school from the perspective of an MCSE-CISSP geek.</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 5.12</generator>

<entry>
    <title>Cloud Asterisk 10: Freepbx 2.10, Gtalk. Two open ports. $5.</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2012/01/cloud-asterisk-asterisk-10-fre.html" />
    <id>tag:cw.sampas.net,2012:/blog//1.222</id>

    <published>2012-01-25T03:03:36Z</published>
    <updated>2012-01-25T03:20:53Z</updated>

    <summary>When Amazon started offering free virtual machines, I jumped and started setting up Asterisk from scratch. You can&apos;t just upload an ISO and boot from that. (That would be WAY too easy for an IaaS provider like Amazon to offer...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>When Amazon started offering free virtual machines, I jumped and started setting up Asterisk from scratch. You can't just upload an ISO and boot from that. (That would be WAY too easy for an IaaS provider like Amazon to offer free.) </p>

<p>After getting all the prequisites in, (there are only really two you need to build by hand, iksemel and libSRTP. sox is optional. The rest are RPMs.), I started the ./configure. Success. Then make. Halfway through, the machine shuts down because I'm consuming too many resources. The first time I thought it was a fluke, but after the second time, I gave up.</p>

<p>But I was still intrigued to see if I could do it, so I moved to the Rackspace cloud and set up a CentOS 6 virtual machine with 20 GB of virtual drive and 512 MB of RAM. Again, no uploading a boot ISO. This isn't VMWare. The build went a lot faster when installing required RPMs. On CentOS, sox is available in the repo. On Amazon's AMI box, it was not.</p>

<p>However, FreePBX 2.10 won't install with Asterisk 10. You can install Asterisk 1.8, then install FreePBX, and then upgrade Asterisk to 10. So far, it works. I can't do testing of every feature, but it is easier to test in the cloud than building yet another box in my basement. (With the exception of DAHDI, of course.)</p>

<p>Rackspace is nice and conservative with its default CentOS build. Iptables is left open to everyone for one port -- 22 tcp -- for ssh. It responds to ping, too, but you can fix that. There's no way I was going to open up much more to everyone, like https (which works fine for FreePBX 2.10), or SIP, or RTP ephemeral ports. </p>

<p>How I did that: Use iptables to limit SSH to my own IP addresses, including a backup address or two. Then install OpenVPN. Given that I'm already managing certificates for https and Asterisk it's not a stretch. It's a lot easier if you have your own certificate server rather than using the scripts provided with each component. (Rant: Everyone who needs to configure https, ssl, tls, or OpenVPN on live Internet-connected machines should be required to complete a tutorial on the CONCEPTS of PKI before being allowed get access to CA and certificate creation scripts for live Internet boxes. Both Asterisk and OpenVPN ship with them.)</p>

<p>OpenVPN runs on port 1194 udp. So what's the other open port? 5222 for Gtalk. I just wish Google had a list of its public IPs for me to enter into iptables.</p>

<p>To access the box, I dial in to the OpenVPN with my certificate that has a password-protected encrypted key. Then I connect to the web interface via https. Snom phones connect via OpenVPN with a certificate and cleartext key. For backup and remote logging, the Cloud server also connects back to my basement via OpenVPN. OpenVPN is easier to configure and seems to have better uptime than my IPSec tunnels. I just hope it's as secure as IPSec.</p>

<p>Total cost so far: $5. It's running under a dollar a day, which is fine for a test box for a little while. I'm a little worried that I won't be able to let go after tweaking it out just the way I want it.</p>

<p>Downside: if iptables stops, my box is getting hacked. I'm afraid to ask how much a dedicated firewall (virtual or real) would cost.</p>

<p>Bug I haven't been able to fix yet: sometimes Snom can't connect via TLS or TCP after getting there through OpenSSL. UDP always works. I'm still working to figure out why.</p>

<p>I'd like to do an selinux policy, too, but that's going to take some time.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Asterisk 10 Encryption</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2012/01/asterisk-10-encryption.html" />
    <id>tag:cw.sampas.net,2012:/blog//1.221</id>

    <published>2012-01-16T02:23:26Z</published>
    <updated>2012-01-16T16:58:02Z</updated>

    <summary>As a follow-up to my Asterisk 1.8 encryption fun, I wanted to check out Asterisk 10 and see if I could get SIP-S and SRTP working. I fired up an antique Celeron box with 512MB of RAM with the FreePBX...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="asterisk" label="asterisk" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>As a follow-up to my Asterisk 1.8 encryption fun, I wanted to check out Asterisk 10 and see if I could get SIP-S and SRTP working. I fired up an antique Celeron box with 512MB of RAM with the FreePBX distro CD. An hour later, it was running Asterisk 1.8 and I was talking between extensions. No encryption yet.</p>

<p>At this point, I started to appreciate PBX-in-a-Flash a little more because that distro does a full ./configure, make, make install for Asterisk and Dahdi. The stock FreePBX distribution doesn't, but it does get things up and running quick.</p>

<p>After getting FreePBX running, I downloaded libsrtp and Asterisk 10. I had the same trouble with libsrtp in the Asterisk ./configure as before, so Google the error and add -fPIC etc. to the Makefile. After a couple of attempts, Asterisk finished configuring and making and installed and started. I could make calls back and forth.</p>

<p>However, when I first added tlsenable=yes and a path to my certs to my sip_general_custom.conf and restarted Asterisk 10, it did nothing for TLS. Asterisk wasn't even listening on port 5061. And AES encryption on an IAX2 trunk back to my production Asterisk box failed with the following error:</p>

<p>WARNING[1248] /usr/src/asterisk-10.0.0/include/asterisk/crypto.h: AES encryption disabled. Install OpenSSL.</p>

<p>OpenSSL was installed. On further investigation, I discovered that the res_crypto module was not loading or loadable.</p>

<p>OpenSSL-devel was not installed. So I went back and did a yum-install openssl-devel and recompiled and reinstalled Asterisk 10. Then TLS worked fine.</p>

<p>For the record, here are the packages I installed for Asterisk 10 on a FreePBX 2.9.0.9 distro. Dahdi and Asterisk-Add-Ons are not covered here.</p>

<p>zlib-devel-1.2.3-3.i386<br />
libxml2-devel-2.6.26-2.1.2.8.el5_5.1.i386<br />
sqlite-devel-3.3.6-5.i386<br />
doxygen-1.4.7-1.1.i386<br />
keyutils-libs-devel-1.2-1.el5.i386<br />
e2fsprogs-devel-1.39-23.el5_5.1.i386<br />
libsepol-devel-1.15.2-3.el5.i386<br />
libselinux-devel-1.33.4-5.5.el5.i386<br />
krb5-devel-1.6.1-36.el5_5.6.i386<br />
openssl-devel-0.9.8e-12.el5_5.7.i386<br />
mysql-devel-5.0.77-4.el5_5.4.i386</p>

<p>Another thing: You can add your SIP parameters (like tlsenable=yes) to the SIP configuration page that's available in FreePBX now, instead of hand-editing /etc/asterisk/sip_general_custom.conf. </p>

<p>Next: An selinux policy for Asterisk? </p>]]>
        
    </content>
</entry>

<entry>
    <title>Asterisk Encryption Gotchas</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2012/01/asterisk-encryption-gotchas.html" />
    <id>tag:cw.sampas.net,2012:/blog//1.220</id>

    <published>2012-01-08T04:49:24Z</published>
    <updated>2012-01-16T04:37:17Z</updated>

    <summary>Finally, Asterisk supports encryption of phone calls and signalling in version 1.8. It&apos;s about time. So now, those of us running FreePBX can just hit the encryption checkbox and everything will run fine. Not so much. FreePBX 2.9 incorporates encryption...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="asterisk" label="asterisk" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>Finally, Asterisk supports encryption of phone calls and signalling in version 1.8. It's about time. So now, those of us running FreePBX can just hit the encryption checkbox and everything will run fine. Not so much. FreePBX 2.9 incorporates encryption options for extensions, but it assumes you've done all the legwork and configured all the prerequisites. (Tested with varying levels of success on Asterisk 1.8.1.1, FreePBX 2.9.0.7, Bria 3.2.1 62387 (iPhone version works fine, too), snom370-SIP 8.4.32, Aastra 57iCT/3.2.2.1136, and Xlite 4.0.9). My Asterisk install is based on PBX in a Flash, but I do my own recompiling, which pretty much voids its warranty and script upgrade functionality. So proceed at your own risk. (Since this is Asterisk, though, you knew that already.) </p>

<p>To get encryption running in Asterisk, take things step by step. Asterisk encryption is really two types of enrcryption: SIP-S, or SIP over TLS for signalling -- traditional PKI using OpenSSL; and SRTP for the voice traffic. Each is configured independently under each extension. Asterisk Encryption is not end-to-end. It is extension-to-Asterisk, and maybe Asterisk-to-Asterisk on trunks. Asterisk encryption is not foolproof, and it will not encrypt calls to the PSTN. It's still vulnerable to MITM attacks with faked certs, and to a compromise of your Asterisk install. Also, just because your connection to Asterisk is encrypted and the lock symbol shows up on your phone doesn't mean the other extension (or trunk) on the other side of Asterisk is also secure.</p>

<p>The key for SRTP is exchanged over the SIP channel, so if SIP's not encrypted, what's the point of bothering with SRTP? If you want to see what you're missing by not using encryption, download <a href="http://www.oxid.it">Cain from oxid.it</a> and run it while you register the Bria softphone client and make a call from your windows computer. You get hashes of your SIP passwords and recordings of your phone calls, all from a GUI Windows program. If you have a network tap or span port in the right spot, you can intercept every call and signal between your Asterisk server and its SIP endpoints.</p>

<p>To get started, Asterisk 1.8 requires libsrtp. (You can thank Cisco for making it available, too.) You'll need to  download, configure, make, make runtest, and make install before you hit ./configure on your Asterisk source. (Yes, recompiling Asterisk is necessary.) Then, when you do ./configure on your Asterisk source, you'll get an error when it finally gets to checking your libsrtp availability. Google the error phrase, and you'll learn what to change in the CFLAGS line of your libsrtp Makefile. Recompile and reinstall libsrtp, then reconfigure Asterisk. Then in your Asterisk source, make menuselect and select libsrtp under resources. Don't forget to make sure your other cool Asterisk features (like gtalk) are still enabled before you save and exit. Then recompile and reinstall Asterisk. There are plenty of tutorials for these steps on the Interwebs.</p>

<p>Once Asterisk is running again, you can start by getting a certificate for TLS. I am not going to do yet another certificate from self-signed CA howto here. There's an excellent one over at <a href="http://www.madboa.com/geek/openssl/">madboa</a>. It's nice for Asterisk to now include a CA/Cert script, but you should really understand how SSL works. I know people who send private keys via email.</p>

<p>Another note about certificates: even if all your workstations are in a friendly LAN with the same DNS suffix, use the fully-qualified Domain Name (FQDN) for your Asterisk certificate. Some endpoints (Bria, I'm looking at you) require FQDN and cannot validate the  certificate if you're getting to your Asterisk server by a short name. Using IP addresses for the registrar in your endpoints? That won't work either. You'll need the CA cert on some endpoints but not others. (Snom phones like certs in DER format; Asterisk and Aastra like PEM. To copy from PEM to DER, try this: </p>

<p>openssl x509 -in input.crt -inform PEM -out output.crt -outform DER</p>

<p>Once you get your CA and certificate, your sip_general_custom.conf file should have lines as follows. (In FreePBX, sip_general_custom.conf is the one you can hand-edit safely.)</p>

<p>tcpenable=yes ; If you don't have TCP enabled for SIP now, go ahead and enter this and test it. <br />
tlsenable=yes<br />
tlsbindaddr=0.0.0.0<br />
tlsclientmethod=tlsv1 <br />
tlscertfile=/etc/asterisk/keys/asterisk.crt ; concatenate the key file to the bottom of the cert file so they're together.<br />
tlscafile=/etc/asterisk/keys/asteriskCA.crt<br />
tlscipher=AES256-SHA:AES128-SHA:RC4-SHA:RC4-MD5;</p>

<p>Some say put "ANY" there for tlscipher. I suggest you want encryption that's strong but compatible with your endpoints. For valid strings, look here: http://www.openssl.org/docs/apps/ciphers.html#CIPHER_STRINGS. To see which one your endpoint is using, you'll need to do a network capture via Wireshark. If there's no shared cipher between your endpoint and Asterisk, you'll see something like this in your logs:<br />
/var/log/asterisk/full:[2012-01-03 13:59:30] VERBOSE[29926] tcptls.c:   == Problem setting up ssl connection: <br />
error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared cipher</p>

<p>Also, you'll need to trust your self-signed CA in Linux. (Seriously, don't set tlsdontverifyserver=yes -- it's just lame.) </p>

<p>If you're on Fedora or CentOS, the folder is /etc/pki/tls/certs.<br />
# ln -s myAsteriskCA.cer `openssl x509 -hash -noout -in myAsteriskCA.cer`.0<br />
then verify:<br />
# openssl verify -CApath /etc/pki/tls/certs /etc/asterisk/keys/myAsterisk.cer<br />
should get you a:<br />
/etc/asterisk/keys/myAsterisk.cer: OK<br />
Once you have a certificate in place, restart Asterisk and see what comes up:<br />
/var/log/asterisk/full:[2012-01-02 23:37:26] VERBOSE[24700] tcptls.c: SSL certificate ok</p>

<p>Then you can try connecting with TLS. In FreePBX, you go to the particular extension you want to test and select TLS Only and reload. Each endpoint is different. Once TLS is successful, you can try setting the extension to use SRTP encryption in FreePBX. </p>

<p>Notes on Phones:</p>

<p>Each phone is different. Bria was easy, so you may want to start with that to see if Asterisk is working correctly. In account settings, domain needs to be a FQDN that matches what you've assigned the certificate. You also need to import the your CA cert into Windows' CA certificate store. For signaling transport, select TLS. For SRTP, select "Make and accept only encrypted calls" for Media Encryption. With any luck, when you hit the apply button, you should see "All accounts are active."  While Bria for Windows validates certificates, it's optional on the Bria for iPhone/iPad.</p>

<p>The other software phone, 3CX, has settings for TLS but gets caught in an SSL handshake loop when trying to register, in spite of a shared cipher suite.</p>

<p>For the SNOM 370 to connect via SRTP successfully, I had to set RTP/SAVP to Mandatory. (Identity | RTP in the Snom Menu.) If you have multiple SIP accounts to the same Asterisk server in your SNOM phone, having any one ID configuration incorrect can break them all (Error message  "Not acceptable here" whenever you dial). Also set the SRTP Key to 80-bit; 32-bit is the SNOM default, which doesn't work. (This has changed in Asterisk 10:  Add option encryption_taglen to set auth taglen only 32 and 80 are supported currently.)</p>

<p>Also,<a href="https://issues.asterisk.org/view.php?id=17976"> disable RTCP support in SNOM if you don't want Asterisk to crash</a> when it's doing SRTP.</p>

<p>user_host1!: my.asterisk.net;transport=tls<br />
user_host2!: my.asterisk.net;transport=tls<br />
user_srtp1!: on<br />
user_srtp2!: on<br />
user_symmetrical_rtp1!: off<br />
user_symmetrical_rtp2!: off<br />
user_server_type1!: asterisk<br />
user_server_type2!: asterisk<br />
user_savp1!: mandatory<br />
user_savp2!: mandatory<br />
empty_tls_client_cert!: off<br />
xcap_via_tls!: true<br />
tls_server_authentication!: on<br />
user_auth_tag1!: off<br />
user_auth_tag2!: off<br />
support_rtcp!: off</p>

<p>On Aastra 6757iCT I got TLS working, and SRTP for inbound. Unfortunately, when SRTP is active, dialing out doesn't work at all, with "call failed" every time so far. I've gone through most of the DTMF options, inluding SIP, and still no joy. The difference between CA certs and Trusted Certs on the TLS support page is not clear to me. Aastra says to put your CA root & intermediate certs in CA Certs <em>and</em> Trusted Certs on the TLS support menu. For my mode -- persistent TLS -- I have only trusted certificates, a PEM file with concatenated public certs of my Asterisk server and its issuing CA.) Also, you need to manually set all the ports to 5061 for TLS. The others phones switched ports automatically. Relevant lines: </p>

<p>sip local port: 5061<br />
sip local tls port: 5061<br />
sip proxy port: 5061<br />
sip registrar port: 5061<br />
sip outbound proxy port: 5061<br />
sip srtp mode: 0<br />
(SRTP disabled -- so dialing out can work.)<br />
sip transport protocol: 4<br />
sips trusted certificates: asterisk2.pem<br />
sips persistent tls: 1</p>

<p>I'd like to make more progress on the Aastra, but it requires even more reboots than the Snom. </p>

<p>Finally, run Cain again to see if your phones are encrypted for SIP and Voice. Even when SRTP is encrypting voice traffic, you can tell that a call is happening and how log it lasts. If you can't get a tap, you can do a TCP dump to a .cap file on your Asterisk server and then open it with Wireshark. Then you can take a look to see if the data looks encrypted.</p>

<p>Leftover vulnerabilities: This configuration still uses passwords for client authentication. You can use client-side certs if you want. Certificate Authorities are vulnerable. Bria (at least on Windows) uses the Windows Certificate Authorities that come installed. SNOM phones ship with CA certs aboard. (You still have to upload your own certs to the SNOM phone.) SNOM has no mechanisms for a certificate revocation list, so compromised CAs can be used to impersonate your certificates in a MITM attack. Aastra makes you upload any CA certs for trust.</p>

<p>Finally, for the SNOM phones that have the OpenVPN client, using the OpenVPN connection back to your Asterisk server and encryption within the (encrypted) VPN connection should provide some additional level of security. <br />
(Assuming you haven't left your private keys exposed someplace.)</p>

<p>The secure PBX is not connected to the PSTN. And when you say man-in-the-middle attack, think government-in-the-middle. It's gender neutral.</p>]]>
        
    </content>
</entry>

<entry>
    <title>US Airports KML file updated. That&apos;s 13,632 airports.</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2011/12/us-airports-kml-file-updated-t.html" />
    <id>tag:cw.sampas.net,2011:/blog//1.219</id>

    <published>2011-12-15T02:58:02Z</published>
    <updated>2011-12-15T03:11:58Z</updated>

    <summary>There are 13,632 airports in the FAA database. That does not count balloonports, seaplane bases, gliderports, heliports, or ultralight facilities. That&apos;s also a huge number of placemarks for a KML file, so your Google Earth machine will need some processing...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="Aviation" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="GIS" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>There are 13,632 airports in the FAA database. That does not count balloonports, seaplane bases, gliderports, heliports, or ultralight facilities. That's also a huge number of placemarks for a KML file, so your Google Earth machine will need some processing power.</p>

<p>If you pan out, the placemark icons will cover the continental United States. It also drives home the point that if you're flying high enough and your engine dies, you should be able to glide to an airport.</p>

<p>Improvements: Public airports are in blue; private airports are in red. AWOS data is included where applicable. (If airports have an AWOS, it's included. Note that ATIS is not the same as AWOS.)</p>

<p>Code improvements: All output code is Python. The database is still Microsoft SQL, and the API is adodb for Python. Next: Porting output code to Linux (need a new database connection) and keeping back end MS SQL for now. Long-term: cleaning up and uploading data via python into MySQL.</p>

<p>Random Comments on Python: String manipulation in python is the same as in visual basic script, but different. If statements have no end, just an indent and and end of indent.</p>

<p>The KML file is in the <a href="http://cw.sampas.net/kml/">KML archive</a>, as usual. DO NOT USE FOR NAVIGATION.</p>]]>
        
    </content>
</entry>

<entry>
    <title>New KML File: Radiological Air Samples from the US DOE/NNSA Response to the 2011 Fukushima Incident</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2011/12/new-kml-file-radiological-air-.html" />
    <id>tag:cw.sampas.net,2011:/blog//1.218</id>

    <published>2011-12-09T14:17:57Z</published>
    <updated>2011-12-09T14:25:34Z</updated>

    <summary>The US Government makes available many data sets free. This is in contrast to the UK where public government data is the property of the crown and is sold to the public. US citizens still pay for the data in...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="GIS" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>The US Government makes available many data sets free. This is in contrast to the UK where public government data is the property of the crown and is sold to the public. US citizens still pay for the data in taxes.</p>

<p>One of those data sets is <a href="http://explore.data.gov/Geography-and-Environment/US-DOE-NNSA-Response-to-2011-Fukushima-Incident-Ra/u9mw-zn8r">Radiological Air Samples from the US DOE/NNSA Response to the 2011 Fukushima Incident</a>. You can see more free data sets on the <a href="http://explore.data.gov/">Data.Gov web site</a>.</p>

<p>Since the set included latitude and longitude, I created a <a href="http://cw.sampas.net/kml/fukushimaAirSamples.kml">KML file</a>. I have no idea exactly how dangerous those levels of radiation are, but it's still interesting to see what was found and where they sampled.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Tide Prediction Locations in Google Earth and Google Maps</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2011/12/tide-prediction-locations-in-g.html" />
    <id>tag:cw.sampas.net,2011:/blog//1.217</id>

    <published>2011-12-08T02:42:11Z</published>
    <updated>2012-01-01T01:12:00Z</updated>

    <summary>I love xtide, the Unix tide prediction server. I have it serving web pages and serving a telephone dial-in number in Asterisk for the beach I visit. I finally got around to writing the KML file that links placemarks to...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="GIS" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>I love <a href="http://www.flaterco.com/xtide/index.html">xtide</a>, the Unix tide prediction server. I have it serving web pages and serving a telephone <a href="http://bestof.nerdvittles.com/applications/xtide/">dial-in number in Asterisk</a> for the beach I visit. I finally got around to writing the KML file that links placemarks to the URL for my copy of the Xtide web server. Click on the placemark to see the URL for the location's tide prediction page.</p>

<p>Also, you can now view KML files in Google Maps by typing in the URL to the KML file in the search bar. You'll end up with a URL in Google Maps that looks like this: <a href="http://www.google.com/maps?q=http%3A%2F%2Fcw.sampas.net%2Fkml%2Fxtide.kml&hl=en&ll=37.439974%2C-131.660156&spn=101.116429%2C158.027344&sll=37.0625%2C-95.677068&sspn=54.357317%2C79.013672&vpsrc=6&t=h&z=3&source=gplus-ogsb">http://www.google.com/maps?q=http%3A%2F%2Fcw.sampas.net%2Fkml%2Fxtide.kml&hl=en&ll=37.439974%2C-131.660156&spn=101.116429%2C158.027344&sll=37.0625%2C-95.677068&sspn=54.357317%2C79.013672&vpsrc=6&t=h&z=3&source=gplus-ogsb</a> .</p>

<p>The <a href="http://cw.sampas.net/kml/xtide.kml">xtide.kml</a> file is in the <a href="http://cw.sampas.net/kml">usual place</a>.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Military Training Routes KML: Is this really what they look like?</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2011/12/military-training-routes-kml-i.html" />
    <id>tag:cw.sampas.net,2011:/blog//1.216</id>

    <published>2011-12-07T03:11:06Z</published>
    <updated>2012-01-01T01:13:20Z</updated>

    <summary>I used the same math from previous kml files to create a US master list of Military Training Routes. VFR routes are in green, and IFR routes are in red. Some segments overlap. Overall, they just look weird, so I&apos;m...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="GIS" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>I used the same math from previous kml files to create a US master list of Military Training Routes. VFR routes are in green, and IFR routes are in red. Some segments overlap. Overall, they just look weird, so I'm wondering if its at all accurate. (Note: DO NOT USE FOR NAVIGATION.) Placemarks are waypoints that are along the route lines. Line descriptions contain route descriptions, while placemarks contain point lead-in and depart information. I don't think kml has a good way of displaying lines and points as the same object with different descriptions.... but what do I know about KML anyway?</p>

<p>See the <a href="http://cw.sampas.net/kml/MTR_20111215-20120209.kml">KML</a> and <a href="http://cw.sampas.net/kml/MTR_20111215-20120209.kmz">KMZ</a> in the <a href="http://cw.sampas.net/kml">KML Archive</a>. The sheer number of lines and placemarks may use up all your memory.</p>]]>
        
    </content>
</entry>

<entry>
    <title>Special Use Airspace KML: Boy was my KML invalid!</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2011/12/special-use-airspace-kml-boy-w.html" />
    <id>tag:cw.sampas.net,2011:/blog//1.215</id>

    <published>2011-12-02T03:48:38Z</published>
    <updated>2011-12-08T03:46:35Z</updated>

    <summary>I have updated my KML output script so that the KML it outputs is valid, thanks to the KML Validator. The latest version of Google Earth is not nearly so tolerant of poorly written KML, which I only recently noticed...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="GIS" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>I have updated my KML output script so that the KML it outputs is valid, thanks to the <a href="http://kmlvalidator.com">KML Validator</a>. The latest version of Google Earth is not nearly so tolerant of poorly written KML, which I only recently noticed when I tried to open my KML files that had worked just fine previously.</p>

<p>The main problems were my coordinate lists, where instead of delimiting by a space between tuples, I had delimited with a newline. I also did not close the coordinate sets with the first coordinate. The FAA doesn't either, because it's obvious. You draw a line from the last coordinate to the first. After the loop, I do a recordset.movefirst and write the first coordinate pair AGAIN.</p>

<p>Anyhow, you can see the new file in the <a href="http://cw.sampas.net/kml">KML archive</a>. I may get around to doing more than just the SUA files. I'm also considering migrating the entire codebase to Python for portability. And because all the cool kids are writing in Python, and I can't stay in vbscript forever...</p>

<p>This KML file contains the <a href="http://www.faa.gov/air_traffic/publications/atpubs/aim/Chap3/aim0304.html">FAA's special use types of airspace</a>: alert areas, military operations areas, prohibited areas, restricted areas, and warning areas. </p>]]>
        
    </content>
</entry>

<entry>
    <title>Snom, pfSense, OpenVPN, and Asterisk: Cheaper than Cisco</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2011/11/snom-pfsense-openvpn-and-aster.html" />
    <id>tag:cw.sampas.net,2011:/blog//1.214</id>

    <published>2011-11-30T02:02:08Z</published>
    <updated>2011-12-02T19:09:09Z</updated>

    <summary>VOIP and SIP have made calling cheaper than ever, but security is only just catching up. The idea of a secure, transportable (hard) phone has been around for a while. Just look at the STU-III or the KY-3. Cisco is...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>VOIP and SIP have made calling cheaper than ever, but security is only just catching up. The idea of a secure, transportable (hard) phone has been around for a while. Just look at the <a href="http://en.wikipedia.org/wiki/STU-III">STU-III</a> or the <a href="http://en.wikipedia.org/wiki/KY-3">KY-3</a>. Cisco is moving away from the phone proxy on its ASA devices and towards an IPSec client in the phone with its associated licensing. <a href="http://www.snom.com/">Snom</a>, <a href="http://www.openvpn.net/">OpenVPN</a>, and <a href="http://www.asterisk.org/home">Asterisk </a>can do the same for less. The Snom 370, 800-series, and 7x0 series phones have the OpenVPN client in the firmware.</p>

<p>Asterisk's built-in encryption is only just starting to work in 1.8, and it would require you to open ports to your Asterisk server from the Internet. Enter OpenVPN, an open-source user-space VPN that's lighter weight than IPSec. Better yet, no per-client licensing fees like Cisco. (Unless you want commercially supported OpenVPN @ $10/client.) Asterisk itself isn't quite ready for the enterprise, but we're all hoping Asterisk 10 is ready for prime time.</p>

<p>Using the built-in OpenVPN server in pfSense 2.0, you can connect your Snom phone across the internet to your internal network, and Asterisk securely. (Although it does not do end-to-end encryption, even if you run OpenVPN on your Asterisk server.)</p>

<p><big>Part 1: pfSense OpenVPN config</big></p>

<p><br />
In the pfSense OpenVPN server page, choose the following parameters: (DISCLAIMER: this is certainly not the only way to do this, nor the most secure.) I'm also going to assume you've already used the pfSense Cert Manager to create a CA and issue a client certificate for the your Snom phone.</p>

<p>OpenVPN | Server</p>

<p>General<br />
Disabled: Not checked.<br />
Server Mode: Remote Access (SSL/TLS).<br />
Protocol: UDP<br />
Device Mode: tun<br />
Interface: WAN<br />
Local Port: 1194 (default)<br />
Description: SnomPhoneVPN</p>

<p>Crypto Settings:<br />
TLS Authentication: Checked (pfSense should populate the box with an OpenVPN Static Key.) <br />
Peer Certificate Authority: InternalCA (What you set up in pfSense's CA Page.)<br />
Peer Certificate Revocation List: (leave default for now.)<br />
Server Certificate: OpenVPNServer (CA: InternalCA)<br />
DH Params Length: 1024<br />
Encryption Algorithm: AES-256-CBC (256-bit)<br />
Hardware Crypto: No Hardware Crypto (Unless you've got a card...)</p>

<p>Tunnel Settings:<br />
Tunnel Network: Choose a <a href="http://en.wikipedia.org/wiki/Private_network">private IP space</a> that's not 192.168.x.x, so it doesn't conflict with every NAT home network. (10.1.0.0/24) should work most places.<br />
Redirect gateway: Checked if you want it to be more secure, but you'll lose local access to the phone.<br />
Local Network: Enter yor local LAN IP space here, e.g. the one you Asterisk server is on.<br />
Concurrent connections: 1 or more.<br />
Compression: unchecked.<br />
Inter-client Communications: not checked.<br />
Duplicate connections: leave this checked for testing only.</p>

<p>Client Settings: The only one that needs to be checked is "Provide a virtual adapater IP addresss to clients."</p>

<p>Advanced: Nothing is required here.</p>

<p><big>Part 2: Client OpenVPN config</big></p>

<p>Use the OpenVPN client export utility (0.9.6). Export the Configuration Archive. Unzip the files. Rename the x.ovpn file to vpn.cnf and edit it to add /openvpn/ in front of the cert and key file names. Then place it in a dir/folder called openvpn and tar it from within the folder, per <a href="http://wiki.snom.com/Networking/Virtual_Private_Network_(VPN)#Example_of_a_VPN_snom_tarball">SNOM</a>. </p>

<p>Keep in mind that the two other files in there, the personal certificate (x-.p12) and the OpenVPN TLS key (x-tls.key) are the keys to your network, so protect them. (If your certificate file is compromised, you'll need to create a certificate revocation list pronto.) When we selected Remote Access (SSL/TLS) in step one, that means certificate only, and then added the TLS key. So no username and password required. (You can try adding them, but you'll need to hard-code them in another file in the config tarball, so it won't make much difference.)</p>

<p>vpn.cnf after <strong>editing</strong>:<br />
#----------<br />
dev tun<br />
persist-tun<br />
persist-key<br />
proto udp<br />
cipher AES-256-CBC<br />
tls-client<br />
client<br />
resolv-retry infinite<br />
remote x.x.x.x 1194<br />
tls-remote OpenVPNServer<br />
pkcs12 <strong>/openvpn/</strong>pfsense-udp-1194.p12<br />
tls-auth <strong>/openvpn/</strong>pfsense-udp-1194-tls.key 1<br />
#----------<br />
where x.x.x.x is your WAN IP Address, or preferably, your dynamically updated DNS name if your IP is subject to change.</p>

<p>There should be three files for you to place in the tarball: vpn.cnf, the .p12 certificate (with key), and the xtls.key. Once you have the tarball, follow SNOM's instructions to get it onto the phone. (Hint: you'll need to place it on a webserver, but preferably not one that's publicly available or unauthenticated.)</p>

<p><br />
<big>Gotchas:</big></p>

<ol>
        <li>This client config leaves you vulnerable to man-in-the-middle attacks where someone says they're your server. I'm still working on server authentication that works with the pfsense openvpn config.</li>
	<li>The phone's NTP server needs to be available on whatever network you plug in to.</li>
	<li>You need to follow Snom's instructions on how to create the tar file, which may be different than what you're used to.</li>
	<li>You need netcat running to see OpenVPN logs. They don't go to the phone's syslog server.</li>
	<li>If you blow up your Snom phone (can't connect to it any more), be sure to have the firmware image available on a local tftp server so you can start all over.</li>
	<li>Don't forget to add your OpenVPN network to Asterisk's sip_nat.conf or you'll drop calls.</li>
	<li>Be aware that the Snom phones can also route packets from devices behind it via the PC port. You'll need to consider how to secure your internal network from the vpn phones.</li>
       <li>If your Snom phone doesn't grab the tarball after boot, you'll need to put a dummy file on the webserver that's referenced on the advanced | update | Setting URL: parameter called "snom370.htm". Then the phone should start grabbing the tarball again. This may be a bug in snom370-SIP 8.4.32, the version tested.</li>
       <li>You'll need to test on a subnet that doesn't have access to your Asterisk box without the VPN. E.g. not on your internal network.</li>
</ol>
]]>
        
    </content>
</entry>

<entry>
    <title>VBScript: MD5 sum and file details into CSV</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2011/05/vbscript-md5-sum-and-file-deta.html" />
    <id>tag:cw.sampas.net,2011:/blog//1.213</id>

    <published>2011-05-20T19:32:58Z</published>
    <updated>2011-12-01T14:41:30Z</updated>

    <summary>Some things are trivial in Linux/Unix and more complex in Windows. In Linux, it&apos;s md5sum filename. In Windows, there are free tools from Microsoft (fciv.exe), but no built-in commands that are super-easy to script. So what are you to do...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>Some things are trivial in Linux/Unix and more complex in Windows. In Linux, it's md5sum filename. In Windows, there are free tools from Microsoft (fciv.exe), but no built-in commands that are super-easy to script.</p>

<p>So what are you to do if you need to collect file details and hashes for every folder within the subfolders of a directory? If you're doing it with VBScript, you'll need a free library available from <a href="http://www.xstandard.com/en/documentation/xmd5/#api1">XStandard</a>. Once you register, you'll get a dll that you'll need to register. (It's 32-bit only, so if you're on a 64-bit box, you'll need to do this:<br />
C:\WINDOWS\SysWOW64\regsvr32.exe XMD5.dll<br />
and then to execute the script:<br />
c:\windows\SysWOW64\cscript.exe FolderReportMD5.vbs )</p>

<p>Anyhow, this script is derived from the Sapien sample scripts. (While there are many free editors out there, I think <a href="http://www.sapien.com/software/primalscript">Sapien's PrimalScript</a> is worth every penny if you'll be doing a lot of Windows scripting.)</p>

<p>And since my MT template doesn't handle code well, here's a <a href="http://cw.sampas.net/filelist.txt">link</a> to the text file.</p>

<p>'**************************************************************************<br />
'	File:  FileListMD5.vbs<br />
'<br />
'	Comments: This script uses the MD5 library available here: <br />
'   http://www.xstandard.com/en/documentation/xmd5/#api1<br />
'   This script runs through a directory tree and writes file attributes to a csv file.<br />
'   To run on x64 use C:\WINDOWS\SysWOW64\regsvr32.exe XMD5.dll and then execute via <br />
'   c:\windows\SysWOW64\cscript.exe FolderReportMD5.vbs<br />
'   Based on Sapien's sample script for FolderProperties.<br />
'**************************************************************************<br />
 Set objFSO2 = createobject("scripting.filesystemobject")<br />
 'where to put the file list?<br />
Set objFile = objFSO2.createtextfile("c:\scripts\" & "FileList" & ".csv")<br />
q = """"<br />
'write the header line of the CSV file.<br />
objFile.WriteLine(q & "FilePath" & q & "," & q & "FileName" & q & "," & q & "DateCreated" & q _<br />
 & "," & q & "DateLastAccessed" & q & "," & q & "DateLastModified" & q & "," & q & "FileSize" & q &_<br />
  "," & q & "MD5Hash" & q & "," & q & "FileAttributes" & q)</p>

<p>'where to start<br />
strSource="C:\folder"</p>

<p>Set objFSO=CreateObject("Scripting.FileSystemObject")<br />
Set objFolder=objFSO.GetFolder(strSource)</p>

<p>Call ProcessFiles(objFolder)</p>

<p>Sub ProcessFiles(objFolder)<br />
Set colFiles=objFolder.Files</p>

<p><br />
For Each file In colFiles<br />
   'it's a good idea to clear out the vars on each loop<br />
   strFingerPrint = "blank"<br />
   strPath = File.Path<br />
   Set objMD5 = CreateObject("XStandard.MD5")<br />
   strFingerPrint = objMD5.GetCheckSumFromFile(strPath)<br />
   Set objMD5 = Nothing<br />
   wscript.Echo strFingerPrint<br />
   wscript.Echo "File Name:" & vbTab & File.Name<br />
wscript.Echo "Short File Name:" & vbtab & File.ShortName<br />
wscript.Echo "File Path:" & vbtab & File.Path<br />
wscript.Echo "Date Created:" & vbtab & File.DateCreated<br />
wscript.Echo "Date Last Accessed:" & vbtab & File.DateLastAccessed<br />
wscript.Echo "Date Last Modified:" & vbtab & File.DateLastModified<br />
wscript.Echo "File Size:" & vbtab & File.Size<br />
wscript.Echo "File Attributes:"<br />
strFileAttributes = " "<br />
if File.Attributes AND 0 Then wscript.Echo " Normal"<br />
If File.Attributes And 0 Then strFileAttributes = strFileAttributes & " Normal"<br />
if File.Attributes AND 1 then wscript.Echo " Read-only"<br />
If File.Attributes And 1 Then strFileAttributes = strFileAttributes & " Read-only"<br />
if File.Attributes AND 2 then wscript.Echo " Hidden"<br />
If File.Attributes And 2 Then strFileAttributes = strFileAttributes & " Hidden"<br />
if File.Attributes AND 4 then wscript.Echo " System"<br />
If File.Attributes And 4 Then strFileAttributes = strFileAttributes & " System"<br />
if File.Attributes And 8 Then wscript.Echo " Volume"<br />
If File.Attributes And 8 Then strFileAttributes = strFileAttributes & " Volume"<br />
if File.Attributes AND 16 then wscript.Echo " Directory"<br />
If File.Attributes And 16 Then strFileAttributes = strFileAttributes & " Directory"<br />
if File.Attributes And 32 Then wscript.Echo " Archive Bit is set"<br />
If File.Attributes And 32 Then strFileAttributes = strFileAttributes & " Archive Bit is set"<br />
If File.Attributes AND 1024 then wscript.Echo " Alias"<br />
If File.Attributes And 1024 Then strFileAttributes = strFileAttributes & " Alias"<br />
if File.Attributes AND 2048 then wscript.Echo " Compressed"<br />
If File.Attributes And 2048 Then strFileAttributes = strFileAttributes & " Compressed"</p>

<p>'finally, write the line to the csv file<br />
objFile.WriteLine(q & File.Path & _<br />
			q & "," & q & File.Name & q & "," & _<br />
			q & File.DateCreated & q & "," & q & File.DateLastAccessed & q & "," & q _<br />
			 & File.DateLastModified & q & "," & q & File.Size & q & "," & q & strFingerPrint & q & "," & q & strFileAttributes & q)</p>

<p>Next<br />
'process Subfolders<br />
Call ProcessSubFolders(objFolder)</p>

<p>End Sub</p>

<p>Sub ProcessSubFolders(objFolder)<br />
Set colSubs=objFolder.SubFolders<br />
For Each folder In colSubs<br />
    ProcessFiles(folder)<br />
Next</p>

<p>End Sub<br />
</p>]]>
        
    </content>
</entry>

<entry>
    <title>Upgrading to Gallery3</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2011/02/upgrading-to-gallery3.html" />
    <id>tag:cw.sampas.net,2011:/blog//1.212</id>

    <published>2011-02-08T03:53:22Z</published>
    <updated>2011-02-08T03:57:04Z</updated>

    <summary>So far, so good for the upgrade from Gallery2 to Gallery3. The new Google Earth feature integrates even better than the semi-supported ad-on for Gallery2. It makes it worth it to get a GPS attachment for your camera. Still tough:...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
    <category term="gallery3gis" label="Gallery3 GIS" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>So far, so good for the upgrade from Gallery2 to <a href="http://cw.sampas.net/gallery3">Gallery3</a>. The new Google Earth feature integrates even better than the semi-supported ad-on for Gallery2. It makes it worth it to get a GPS attachment for your camera.</p>

<p>Still tough: mod_rewrite rules to make search engines happy. It also requires a PHP pagination code update, and navigation is still broken on one return link.</p>

<p>All in all, I've done far less syncing of directories and hand-editing of files to upgrade from 2 to 3 than I did from 1 to 2. Then again, I'm not all there yet.</p>]]>
        
    </content>
</entry>

<entry>
    <title>I publish my own weather station data on the web</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2010/11/i-publish-my-own-weather-stati.html" />
    <id>tag:cw.sampas.net,2010:/blog//1.211</id>

    <published>2010-11-22T03:32:44Z</published>
    <updated>2010-11-22T04:08:13Z</updated>

    <summary>I finally got my weather station published to the web. Thanks to wview and Davis, you can see the temperature at my house. The install went fairly easily, with just one non-rpm&apos;ed/yum prerequisite (radlib) requiring an install from source, along...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="Random" scheme="http://www.sixapart.com/ns/types#category" />
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>I finally got my weather station <a href="http://cw.sampas.net/weather/">published to the web</a>. Thanks to <a href="http://www.wviewweather.com/">wview</a> and <a href="http://www.davisnet.com">Davis</a>, you can see the temperature at my house. The install went fairly easily, with just one non-rpm'ed/yum prerequisite (<a href="http://www.radlib.teel.ws/">radlib</a>) requiring an install from source, along with wview. The first install didn't connect to sqlite correctly, but I fixed that with a fresh install and skipping wview's Davis-station specific setup. I am also considering migrating to Debian, but that's another topic.</p>

<p>I love the data views that wview provides. It shows trends at a glance that weather.com, NOAA, and NWS don't. Even online weather airport stations have no view that will let you see a trend -- they're all snapshots. With wview, I can tell when the temperature-dewpoint spread is closing.</p>

<p>The best part -- I can collect the data. I can export to MySQL. I can collect solar radiation stats to see if solar panels make sense at my location.</p>

<p>Next: Dial-in weather with <a href="https://www.asterisk.org/">Asterisk</a> and <a href="http://www.cepstral.com/">Cepstral</a>. </p>]]>
        
    </content>
</entry>

<entry>
    <title>Upgrading to Asterisk 1.8 x64 Gotchas</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2010/11/upgrading-to-asterisk-18-x64-g.html" />
    <id>tag:cw.sampas.net,2010:/blog//1.210</id>

    <published>2010-11-14T15:41:11Z</published>
    <updated>2010-11-15T03:02:11Z</updated>

    <summary>I&apos;ve been running Asterisk at home for a couple of years now. The initial setup using pbxinaflash was super-quick and provided a ton of cool features out of the box. Some other stuff needing tweaking, like the analog cards. (FYI:...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
    <category term="asterisk" label="Asterisk" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>I've been running <a href="http://www.digium.com/en/">Asterisk</a> at home for a couple of years now. The initial setup using <a href="http://www.pbxinaflash.com/">pbxinaflash</a> was super-quick and provided a ton of cool features out of the box. Some other stuff needing tweaking, like the analog cards. (FYI: <a href="http://www.pbxinaflash.com/">PBXIAF</a> runs on top of <a href="http://www.freepbx.org/">FreePBX</a>, which runs on top of <a href="http://www.digium.com/en/">Asterisk</a>.)</p>

<p>So a few days ago, <a href="http://www.pbxinaflash.com/">PBXInAFlash,</a> releases a new version that includes support for video calls using <a href="http://cgi.ebay.com/H-264-IP-1535-NTEX02BAE6-SIP-VIDEO-PHONE-IP1535-WIFI-/230453001282?pt=LH_DefaultDomain_0&hash=item35a811bc42#ht_4036wt_1078">discounted hardware video phones</a>. Video calls have been available forever using software and computer cams. The availability of an affordable hardware phone means that there's a chance I can give one to my mom. What's the big deal with a hardware phone? My mom already knows how to use it. Everybody knows how to answer a hard phone.</p>

<p>Upgrading. The "supported " procedure is to upgrade to the same version of FreePBX that you'll be restoring to, and then do a backup. (Upgrade using module admin, then use the backup module...) So I installed the new release on top of my old Atom D510 server and wiped out all the old data. Restore. Restart Asterisk. Asterisk seg fault crash loop. FreePBX 2.8 doesn't validate every piece of input perfectly, so it can crash. You've been warned. I reinstalled and built from scratch, which is a great thing to be able to do, but not so great from a time perspective.</p>

<p>After installing the base phone system, it was up and running. My custom apps were not. The PBXinaFlash cust app scripts don't all support Asterisk 1.8 or x64. I run a few, and this is how I fixed them. <br />
<ol><br />
	<li>xtide. I go to the beach and I love xtide. PBXIAF tries to install the 386 rpms. Just go to <a href="http://www.flaterco.com/xtide/files.html">Flaterco</a>, down load the source and compile. Follow the instructions to the letter. ./configure will work but make will fail because you are missing headers. Install the following packages with yum install xxx:<br />
   libXt-devel-1.0.2-3.2.el5.x86_64<br />
   libICE-devel-1.0.1-2.1.x86_64<br />
   libXaw-1.0.2-8.1.i386<br />
   libXt-devel-1.0.2-3.2.el5.i386<br />
   libXaw-devel-1.0.2-8.1.i386<br />
   libXpm-devel-3.5.5-3.x86_64<br />
   libXpm-3.5.5-3.i386<br />
   libXmu-1.0.2-5.i386<br />
   libSM-devel-1.0.1-3.1.x86_64<br />
   libXmu-devel-1.0.2-5.x86_64<br />
   xorg-x11-util-macros-1.0.2-4.fc6.x86_64<br />
   libXaw-devel-1.0.2-8.1.x86_64<br />
Then make and make install. Then you'll get another error from bad linking, which will look something like this: error while loading shared libraries: xxx.so.1: cannot open shared object file: No such file or directory. Use ldd on the tide command to see what's missing, then find that file and copy it to where the other ones are. It should look something like this:<br />
ldd /usr/local/bin/tide<br><br />
        libtcd.so.1 => /usr/lib64/libtcd.so.1<br />
        libpng12.so.0 => /usr/lib64/libpng12.so.0<br />
        libz.so.1 => /usr/lib64/libz.so.1<br />
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6<br />
        libm.so.6 => /lib64/libm.so.6<br />
        libgcc_s.so.1 => /lib64/libgcc_s.so.1<br />
        libc.so.6 => /lib64/libc.so.6<br />
        /lib64/ld-linux-x86-64.so.2<br />
I think my command was copying libtcd.so.1 to /usr/lib64, where it was expected. Now xtide works. I also have an updated <a href="http://www.flaterco.com/xtide/files.html#harmonicsfiles">harmonics file</a>.<br />
  </li><br />
<li> Swift. I love Allison-8kHz. All my licenses were gone -- g729 as well as Cepstral. Thanks to gmail, I could recover them all, and got a free upgrade to the latest Cepstral Allison: Allison-8kHz for Linux (v5.x), which installed fine. The missing part was swift-app for Asterisk. <a href="http://forge.asterisk.org/gf/project/app_swift/frs/?action=FrsReleaseView&frs_package_id=10&release_id=110">There's a beta for that that's working.</a> </li><br />
<li>That darn analog cards. I light up my home's antique POTS lines with a <a href="http://www.digium.com/en/products/analog/tdm410.php">Digium 410</a> and a couple of FXO modules. These were a pain to set up in the initial version, too. Since then, Asterisk has moved from the ZAP architecture to DAHDI, and I though that was where my problem was. Wrong. My problem was the same one that I had the first time. Default settings are for KewlStart instead of LoopStart. Once I changed all the configs to FXO_LS instead of FXO_KS it worked again. This means I can use my antique rotary-dial phone with mechanical bells to dial out my SIP trunk.</li><br />
<li>The IAX trunk to my Mom's house stopped working. I run this over a vpn link. (IPSec ESP w/AES256 so noone can listen in....) FreePBX has a new interface for configuring trunks, inbound and outbound in separate sections. (User and Peer). Keep you configs straight with <a href="http://www.cadvision.com/blanchas/Asterisk/IAX2Trunk.html">ServerA/UserA at one end and ServerB/UserB</a> at the other. Then I could dial my mom, but she couldn't dial me. My version of Asterisk requires CallTokens by default. Turned that off in the trunk config and it worked again. (I'd have to implement CallTokens if it wasn't running over a VPN and I wanted to resist DOS attacks.)  </li><br />
<li>Video Calls. No problems here -- just enable h.263 and configure the phones.I can even do video calls between the Nortel IP 1535 and the Bria Softphone.</li><br />
</ol></p>]]>
        
    </content>
</entry>

<entry>
    <title>Top 5 things to do with cheap Intel Atom servers and Free Software</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2010/11/top-5-things-to-do.html" />
    <id>tag:cw.sampas.net,2010:/blog//1.209</id>

    <published>2010-11-06T18:08:10Z</published>
    <updated>2010-12-07T22:34:18Z</updated>

    <summary>Intel introduced the low-power, affordable Atom chipset a couple years ago. The earlier models included the Atom 230 and 330, running single and dual-cores, respectively, at 1.6 GHz. Frugal with power at 8 watts, it could even run 64-bit. The...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
        <category term="Grad School" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Programming" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Random" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Security" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="atomasteriskpfsense" label="Atom Asterisk pfsense" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>Intel introduced the low-power, affordable Atom chipset a couple years ago. The earlier models included the Atom 230 and <a href="http://ark.intel.com/Product.aspx?id=35641">330</a>, running single and dual-cores, respectively, at 1.6 GHz. Frugal with power at 8 watts, it could even run 64-bit. The first-gen Atom motherboards/chipset kits had two chief weaknesses: they maxed out at 2 GB of RAM, and they used RealTec network-interface cards (at least the Supermicro mboards did). RealTecs sometimes <a href="https://bugs.launchpad.net/linux/+bug/347711">crash Linux</a> when the incorrect driver loads, and the RT NICs don't do jumbo frames. The crashes are patchable but it adds a couple hours to your install. (Do not, repeat not, buy the old models no matter how cheap they are. Stick to the D510 series.)</p>

<p>Intel has since released the <a href="http://ark.intel.com/Product.aspx?id=43098">Atom D510</a>. The processor is up to a 13-watt draw, runs at about the same speed, and still runs 64-bit. What makes these chipsets better is that they max out at 4 GB of RAM and use genuine Intel Gig NICs that are widely supported and can run jumbo frames. This is a big leap, because the configured price of a fully-built mini-server around the platform remains the same. Supermicro has some great Atom motherboards that can support a home or small office doing various things. (The D525 has since come out. <a href="http://ark.intel.com/Compare.aspx?ids=49490,43098">Compare the two here</a>.)</p>

<p>Newegg has some good deals on the <a href="http://www.newegg.com/Product/ComboBundleDetails.aspx?ItemList=Combo.539630">Supermicro Atom Rack Server</a> and the <a href="http://www.newegg.com/Product/ComboBundleDetails.aspx?ItemList=Combo.539627">tower server</a> for about $70 less. Or you can just buy a <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16813182234&cm_re=supermicro_atom-_-13-182-234-_-Product">motherboard</a> and roll your own. My tower server with D510 runs just under 40 watts with 4 GB of RAM, CD, and hard disk.</p>

<p>What can you do with it? There are a number of Linux and BSD appliances that are free.<br />
<strong><br />
1) Run your own telephone switch</strong>.<a href="http://www.freepbx.org/download-freepbx"> FreePBX</a> is an awesome, OS-included version of Asterisk that has a clean web GUI. <a href="http://www.pbxinaflash.com/">PBX-In-a-flash</a> is based on FreePBX but has a few extras (nonstandard enhancements like dial weather by airport code and dial your local tide schedule) thrown in. Why would you want to run your own PBX? You can do stupid phone tricks, like really cheap phone service at $.01/minute and $1.50/month per number with <a href="http://www.vitelity.net/">Vitelity</a>, for one. Or your own conference line. Or your own trunks over VPNs to other offices. Or just blacklist phone numbers and send telemarketers to their own <a href="http://www.voip-info.org/wiki/view/Asterisk+Telemarketer+Torture">voice-mail hell</a>. </p>

<p>Keep in mind that to light up your home phone lines, you may need an additional analog card from <a href="http://www.sangoma.com/products/hardware_products/analog_telephony/b600.html">Sangoma</a> or <a href="http://www.digium.com/en/products/analog/aex410.php">Digium</a>. (<a href="http://www.3cx.com/PBX/FXS-FXO.html">FXS and FXO</a> are different, but can run on the same card.)  Once you figure out how cool SIP is, you'll want to replace your house phones with <a href="http://www.aastra.com/products-mobility-families.htm?curr_cat=SIP+Telephones&curr_type=Family&mode_f=1&mode_c=1&mode_l=2">SIP phones</a>. However, you can get started with SIP free using the <a href="http://www.counterpath.com/x-lite.html">Xlite soft phone</a>. The <a href="http://itunes.apple.com/app/bria-iphone-edition/id373968636?mt=8">iPhone/iPod/iPad version</a> is $7.99. It's perfectly true that you can make phone calls cheap with a <a href="http://www.cisco.com/en/US/products/ps10029/index.html">Linksys PAP2T</a> or <a href="http://www.vonage.com/">Vonage</a>, but if you're a telephone control freak and want to wage war on telemarketers, Asterisk is for you.</p>

<p><strong>2) Run a great firewall like <a href="http://www.pfsense.org">pfSense</a></strong>. It's based on FreeBSD but has a great Web GUI so you can avoid learning the subtle differences between BSD and Linux. pfSense comes in embedded and full. For the Atom server, running the full version is no sweat. And I run <a href="http://www.snort.org/">SNORT</a> inline on two interfaces with no issues. A full SNORT IPS signature subscription for <a href="http://www.snort.org/vrt/buy-a-subscription/">home use is just $30/year</a>. And pfSense does not just IPSEC point-to-point VPNs, but also WebVPN. Try that on your <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16833120356&nm_mc=OTC-Froogle&cm_mmc=OTC-Froogle-_-Network+-+Firewalls-_-Cisco+Systems++Inc.-_-33120356">Cisco ASA 5505</a>, and you'll be paying a couple grand for the equipment, licenses, and subscription. Check out the plugins for pfSense and you'll see how much you can do with one small box. pfSense 2.0 is almost out of beta and there's a 64-bit version. (Plugins include <a href="http://www.freeswitch.org/">FreeSwitch</a>, an open-source competitor to (open-source) Asterisk, so if you want, you can even run a PBX on your firewall.)</p>

<p><strong>3) Storage: Run <a href="http://freenas.org/">FreeNAS</a> and you'll be able to scale reasonably out of the box. </strong>The Atom Motherboard has six SATA slots and two GB NICs that do jumbo frames. Hello iSCSI. With 2TB disks, that's 12 TB of storage. FreeNAS offers CIFS (Windows), Apple (AFP), iSCSI, and NFS mount points. Add a serious <a href="http://shop.ebay.com/items/3ware%209650se?_dmd=1&_sop=12&rvr_id=164118164671&keyword=3ware+9650se&geo_id=1&crlp=7039119673_1&MT_ID=340&tt_encode=raw">SATA RAID</a> card to get even more disk IO performance out of your little Atom box. Obviously, I would recommend the tower server case for FreeNAS because it has room for more disks.</p>

<p><strong>4) Run Apache/PHP/MySQL applications</strong>. Run Fedora, CentOS, whatever. You can run your own apps at home on top of your favorite flavor of Linux/BSD. One of my favorites is <a href="http://gallery.menalto.com/">Gallery2</a>. There's even semi-free apps (free for no enterprise features) like <a href="http://www.movabletype.com/">Movable Type</a> (you're reading this on an MT platform), and even run more than one on the same mini-Server.</p>

<p><strong>5) Collect data.</strong> Run a <a href="http://www.wviewweather.com/">weather station</a>. Run a <a href="http://www.balabit.com/network-security/syslog-ng/">log server</a>. Run a crazy blog and see who hits it with which keywords. Collect IPS events from multiple firewalls and <a href="http://www.dshield.org/">correlate them</a>. </p>]]>
        
    </content>
</entry>

<entry>
    <title>Restricted Airspace Updates: new KML files for Google Earth</title>
    <link rel="alternate" type="text/html" href="http://cw.sampas.net/blog/2010/10/restricted-airspace-updates-ne.html" />
    <id>tag:cw.sampas.net,2010:/blog//1.208</id>

    <published>2010-10-05T01:10:49Z</published>
    <updated>2010-10-05T01:16:31Z</updated>

    <summary>I have updated the KML files for US special use airspace files again. After looking around for some prohibited areas with which I am familiar, I noticed they were missing. They weren&apos;t missing in the file, but when a different...</summary>
    <author>
        <name>Larry</name>
        <uri>http://www.larrysampas.com</uri>
    </author>
    
    
    <content type="html" xml:lang="en" xml:base="http://cw.sampas.net/blog/">
        <![CDATA[<p>I have updated the KML files for US special use airspace files again. After looking around for some prohibited areas with which I am familiar, I noticed they were missing. They weren't missing in the file, but when a different type of restricted airspace overlies a prohibited area, you can't see the prohibited area in Google Earth. Thus I have created a <a href="http://cw.sampas.net/kml/US_Prohibited_Airspace_20100923.kml">prohibited-area-only KML file</a>. The <a href="http://cw.sampas.net/kml/US_Special_Use_Airspace_20100923.kml">special use file</a> includes all of the different types of special use areas, including the prohibited areas. As usual, all of them are in the <a href="http://cw.sampas.net/kml">kml file archive</a>, which is sortable by date using the smart index feature of Apache.</p>

<p>Also, when you use FAA data, be sure to escape special SQL characters in the names. I think there's an O'Brien restricted area. Be aware, there are single quotes in special use area names.</p>]]>
        
    </content>
</entry>

</feed>

