ReadyNAS Google Authenticator

I just finished configuration Google two-factor authentication on my ReadyNAS for ssh authentication. It works well so far.

You need to install the Root SSH Add-on from the forums so you can ssh into your readynas.


apt-get update
apt-get install mercurial make gcc apt-utils libc6-dev gdb libtag1-dev uuid-dev libpam0g-dev

The just follow these instructions
http://www.mnxsolutions.com/security/two-factor-ssh-with-google-authenticator.html

Google Voice Call Widget POST commands

Google made their Google Voice call widget flash only. There are alot of instances where you want to be able initiate a call from non-flash.

I hope this helps with integration to other projects.

The POST URLs are:
https://clients4.google.com/voice/embed/webButtonConnect
https://clients4.google.com/voice/embed/cancelWebButtonCall

webButtonConnect expects the following parameters.
showCallerNumber (Google’s Widget send the number 1)
callerNumber (The 10 digit number with no spaces or dashes)
buttonId (the id value from your flash call widget)
name (The name of the caller)

cancelWebButtonCall expects the following parameters.
buttonId (the id value from your flash call widget)
callerNumber (the number of the call you want to cancel)

Post Returns:
ok=false (Error)
ok=true (Call Placed)

Here is a quick and dirty HTML form to make a call.

This is a Email to Google Calendar Quickadd gateway.

You can email a special address and it will take the subject of the email and send it to googles quickadd feature. This is a simple way to add events to your google calendar via email.
http://www.google.com/calendar
http://framework.zend.com/download/gdata
http://www.google.com/support/calendar/bin/answer.py?hl=en&answer=36604

  • You need to have Zend’s Gdata framework installed.
  • The first code example you need to add your google calendar information
  • the 2nd peice of code parses the email and calls the the quickadd function
  • In cpanel setup a forwarder and pipe it to a program of TOGcal.php
<?php //GoogleCal-Functions.php

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

// Enter your Google account credentials
$email = '[email protected]';
$passwd = 'MyPass';
$ourCal = 'Cal Name';
$ourCalUrl = '';
try {
 $client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, 'cl');
 }
catch(Zend_Gdata_App_AuthException $ex)
{
    echo "Unable to authenticate";
    exit(1);
 }

$cal = new Zend_Gdata_Calendar($client);

$calFeed = $cal->getCalendarListFeed();

foreach ($calFeed as $calendar)
{
    if ($calendar->title->text == $ourCal)
 {
  //$ourCalUrl = explode('/',$calendar->id);
  //$ourCalUrl = 'http://www.google.com/calendar/feeds/'. $ourCalUrl[6] . '/private/full';
  $ourCalUrl = $calendar->getSelfLink()->getHref() . '/private/full';
  $ourCalUrl = str_replace("default/", "",$ourCalUrl);
 }
 //echo $calendar->title->text . " || " . $calendar->getSelfLink()->getHref() . "
";
}
 //echo $ourCalUrl;
 //echo $client->getUri(true);
 //createQuickAddEvent ($client ,$ourCalUrl,'WO Test at Jun 2, 2008 8:00am - Jun 6, 2008 5:00pm');
 //createEvent($client,$ourCalUrl);

function createQuickAddEvent ($client, $URI = NULL, $quickAddText) {
  $gdataCal = new Zend_Gdata_Calendar($client);
  $event = $gdataCal->newEventEntry();
  $event->content = $gdataCal->newContent($quickAddText);
  $event->quickAdd = $gdataCal->newQuickAdd(true);

  $newEvent = $gdataCal->insertEvent($event,$URI);
  return $newEvent->id->text;
}

/**
 * Creates an event on the authenticated user's default calendar with the
 * specified event details.
 *
 * @param  Zend_Http_Client $client    The authenticated client object
 * @param  string           $title     The event title
 * @param  string           $desc      The detailed description of the event
 * @param  string           $where
 * @param  string           $startDate The start date of the event in YYYY-MM-DD format
 * @param  string           $startTime The start time of the event in HH:MM 24hr format
 * @param  string           $endDate   The end date of the event in YYYY-MM-DD format
 * @param  string           $endTime   The end time of the event in HH:MM 24hr format
 * @param  string           $tzOffset  The offset from GMT/UTC in [+-]DD format (eg -08)
 * @return string The ID URL for the event.
 */
function createEvent ($client, $URI = NULL, $title = 'Tennis with Beth', $desc='Meet for a quick lesson', $where = 'On the courts',$startDate = '2008-06-20', $startTime = '9:00',$endDate = '2008-06-20', $endTime = '14:00', $tzOffset = '-04')
{
  $gc = new Zend_Gdata_Calendar($client);
  $newEntry = $gc->newEventEntry();
  $newEntry->title = $gc->newTitle(trim($title));
  $newEntry->where  = array($gc->newWhere($where));

  $newEntry->content = $gc->newContent($desc);
  $newEntry->content->type = 'text';

  $when = $gc->newWhen();
  $when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
  $when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
  $newEntry->when = array($when);

  echo $URI."||".$title."||".$desc."||".$where."||".$startDate."||".$startTime."||".$endDate."||".$endTime."||".$tzOffset;
  $createdEntry = $gc->insertEvent($newEntry, $URI);
  return $createdEntry->id->text;
}
?>
#!/usr/bin/php -q
<?php
//TOGcal.php
//Takes the subject and uses quickadd to create an event.
include "GoogleCal-Functions.php";

$msg = "";
$email ='';
$fd = fopen("php://stdin", "r");
while (!feof($fd))
{
 $email .= fread($fd, 1024);
}
fclose($fd);
$msg .= "got Email || ";

$mail = mailparse_msg_create();
mailparse_msg_parse($mail,$email);
$struct = mailparse_msg_get_structure($mail);
$section = mailparse_msg_get_part($mail, "1");
$info = mailparse_msg_get_part_data($section);

$msg .= $info['headers']['from'] . " || " . $info['headers']['subject']  . " || ";

//valid sending domains
if (preg_match('/@mydomain\.com/', $info['headers']['from']))
{
 createQuickAddEvent($client,$ourCalUrl,$info['headers']['subject']);
 $msg .= "regex matched || ";
} 
mailparse_msg_free($mail);

//emailError($msg);


?>