Results 1 to 12 of 12
  1.    #1  
    I've been trying to setup ssh and lighttpd on my pre for a few days now. It appears that I can only get as far as accessing the ssh and lighttpd from wifi only and not through EVDO. I have followed the steps on the webos-internals wiki including modifying the ssh's optware-openssh file removing "-i eth0" so the firewall will open for all interfaces. I reboot the phone, turn off the WIFI, use EVDO to access whatismyip.com and try to connect to that ip on ports 222 and 8081 and it doesn't register. I try nmap'ing the ports and it says filtered.

    Either my firewall rules aren't going through like they should, or bell is blocking the incoming ports. Is there something i'm missing?

    /etc/event.d/optware-openssh
    description "OpenSSH Daemon for WebOS"
    author "P. Douglas Reeder, based on script by Dax Kelson"
    version 1.0

    # don't start until the WebOS finishes it's normal boot
    # that way no delay is added to the GUI startup
    start on stopped finish
    stop on runlevel [!2]

    # don't try to log any output
    console none

    # Uncomment to make sure SSH sessions don't slow down GUI use
    nice 5

    # Restart the SSH daemon if it exits/dies
    respawn

    # -D doesn't detach and become daemon
    # -p sets the TCP port
    # -o "PermitRootLogin without-password" prohibits root login using password
    # but allows root login using Key based authentication (same behavior as -g in dropbear)
    exec /opt/sbin/sshd -D -p 222 -o "PermitRootLogin without-password"

    pre-start script
    # Add firewall rule to allow SSH access over WiFi on port 222
    # Remove the "-i eth0" on both of the following lines to enable SSH access
    # over the cellular data network (EVDO, etc).
    /usr/sbin/iptables -D INPUT -p tcp --dport 222 -j ACCEPT || /bin/true
    /usr/sbin/iptables -I INPUT -p tcp --dport 222 -j ACCEPT
    end script

    # end of file
    Corey Quilliam
    Palm Pre - Bell Mobility

    Pre Drop Count: 1
    Current Damage: None

    Accessories:
    - BSE Front Skin (meh, could be better)
  2. #2  
    Interesting. Does it work outgoing? A huge part of the benefit I had with the iPhone was this but AT&T is way more liberal than Verizon and you may be right on target. I used it to manage web servers pretty regularly using ssh. Try that as well. If that fails too then you probably have your answer as inbound is more dangerous and surely to be locked down.
  3.    #3  
    Quote Originally Posted by iamsedated View Post
    Interesting. Does it work outgoing? A huge part of the benefit I had with the iPhone was this but AT&T is way more liberal than Verizon and you may be right on target. I used it to manage web servers pretty regularly using ssh. Try that as well. If that fails too then you probably have your answer as inbound is more dangerous and surely to be locked down.
    I can ssh out no problem from the Terminal, just not in. Its funny that this hasn't come up before, I find it hard to believe that no other Bell user has tried to load up lighttpd or ssh over evdo.
    Corey Quilliam
    Palm Pre - Bell Mobility

    Pre Drop Count: 1
    Current Damage: None

    Accessories:
    - BSE Front Skin (meh, could be better)
  4. #4  
    sorry. I don't use these things
  5. #5  
    I've never set up ssh on my Pre but I did have lighttpd on it for a while and had the same experience as you... Wifi: 1, 1x/Evdo: 0.
    Yeah, uhh... it's Kevin. (KevinT was already taken.)

    PalmPilot Professional, Palm V, Kyocera 7135, Treo 600, Treo 650, Treo 700p, Palm Prē & Prē 2, HP TouchPad & Veer
  6.    #6  
    That's disappointing. I was trying to find some way to create a GPS tracking map. Once a month I travel over the highway to home, and I wanted a way for my parents to check and see where I was so they wouldn't worry. I currently have a cronjob setup that will update google latitude on intervals, but my parents don't use gmail.

    Maybe I can find some way to host the maps on my own website, and have the phone send the updates there instead....
    Corey Quilliam
    Palm Pre - Bell Mobility

    Pre Drop Count: 1
    Current Damage: None

    Accessories:
    - BSE Front Skin (meh, could be better)
  7.    #7  
    After getting tired of searching around, I did it myself. Now I have a script on my phone that, when executed, sends a url string to my web server at home that stores all the information (time, lat, long, velocity) into a sql database. Then, I can get someone else to open a different page that takes the info from the database and displays it in an embedded google maps.

    The only thing left is a little program that will execute the script without going to terminal, and give the option to put in crontab.
    Corey Quilliam
    Palm Pre - Bell Mobility

    Pre Drop Count: 1
    Current Damage: None

    Accessories:
    - BSE Front Skin (meh, could be better)
  8. #8  
    Quote Originally Posted by cquilliam View Post
    I currently have a cronjob setup that will update google latitude on intervals, but my parents don't use gmail.
    Ooo, I'd be interested in this. When I meet my friends for breakfast or lunch we sometimes use latitude, but keeping Google Maps open and the Pre powered for the whole trip is a pain. (Especially since the No Auto-off While Charging patch was rev'd and no longers works with the Touchstone in my car...)
    Yeah, uhh... it's Kevin. (KevinT was already taken.)

    PalmPilot Professional, Palm V, Kyocera 7135, Treo 600, Treo 650, Treo 700p, Palm Prē & Prē 2, HP TouchPad & Veer
  9.    #9  
    Quote Originally Posted by ktessner View Post
    Ooo, I'd be interested in this. When I meet my friends for breakfast or lunch we sometimes use latitude, but keeping Google Maps open and the Pre powered for the whole trip is a pain. (Especially since the No Auto-off While Charging patch was rev'd and no longers works with the Touchstone in my car...)
    I don't remember where I got this info from, but first, you need web space on a domain in order to pass the info along. On my phone I have:

    /var/home/root/update.sh
    Code:
    #!/bin/sh
    
    # Update location
    
    luna-send -n 1 palm://com.palm.location/getCurrentPosition {} 2>&1 | cut -d, -f4-6 | sed -r 's/[^-\.0-9,]//g'| sed 's/,/ /g' | while read latitude longitude accuracy
    do
    	curl -basic http://www.mysite.com/UpdateLatitude.php?latitude=$latitude\&longitude=$longitude\&accuracy=$accuracy
    done
    on "mysite.com" i have the following:

    /UpdateLatitude.php
    Code:
    <?php
    
    // Uses some google scraping code from Jack Catchpoole  jack@catchpoole.com>.
    // and the great work of Nat Friedman <nat@nat.org>
    //
    // Thomas Keeley <tskeeley@yahoo.com>
    //
    // October 31, 2009
    //
    // MIT license.
    //
    
    include 'class.google.php';
    
    $google = new googleLatitude();
    
    function promptForLogin($serviceName)
    {
        $username = "username"; // Set this to your google username
        $password = "password"; // Set this to your google password
        return array ($username, $password);
    }
    
    if (! $google->haveCookie()) {
        list($username, $password) = promptForLogin("Google");
    
        echo "Acquiring Google session cookie...";
        $google->login($username, $password);
        echo "got it.\n";
    }
    
    if (!empty($_REQUEST["latitude"])) {
        $Latitude = $_REQUEST["latitude"];
    }
    else {
        die("Missing latitude.  Unable to update.");
    }
    
    if (!empty($_REQUEST["longitude"])) {
        $Longitude = $_REQUEST["longitude"];
    }
    else {
        die("Missing longitude.  Unable to update.");
    }
    
    if (!empty($_REQUEST["accuracy"])) {
        $Accuracy = $_REQUEST["accuracy"];
    }
    else {
        die("Missing accuracy.  Unable to update.");
    }
    
    // Now update Google Latitude
    echo "Updating Google Latitude...";
    $google->updateLatitude($Latitude, $Longitude, $Accuracy);
    
    // All done.
    and

    /class.google.php
    Code:
    <?php
    
    // A class to login to Google Latitude Mobile, save a session cookie
    // and update Latitude with a given location.
    //
    // Nat Friedman <nat@nat.org>
    // Jack Catchpoole <jack@catchpoole.com>
    // Andy Blyler <ajb@blyler.cc>
    // Thomas Keeley <tskeeley@yahoo.com>
    //
    // MIT license.
    //
    
    class googleLatitude
    {
    	private $cookieFile; // Where we store the Google session cookie
    	private $lastURL;    // The previous URL as visited by curl
    
    	public function __construct()
    	{
    		$this->cookieFile = dirname(__FILE__) . "/google-cookie.txt";
    	}
    
    	// Update the location on google latitude
    	public function updateLatitude($lat, $lng, $accuracy)
    	{
    		/* build the post data */
    		$post_data  = "t=ul&mwmct=iphone&mwmcv=5.8&mwmdt=iphone&mwmdv=30102&auto=true&nr=180000&";
    		$post_data .= "cts=" . time() . "000&lat=$lat&lng=$lng&accuracy=$accuracy";
    
    		/* set the needed header */
    		$header = array("X-ManualHeader: true");
    
    		/* execute the location update */
    		$this->curlPost("http://maps.google.com/glm/mmap/mwmfr?hl=en", $post_data, $this->lastURL, $header);
    	}
    
    	/* obtain listing of friends and their location */
    	public function friendList()
    	{
    		/* create the friend output array */
    		$friends = array();
    
    		/* build the post data */
    		$post_data  = "t=fs&mwmct=iphone&mwmcv=5.8&mwmdt=iphone&mwmdv=30102&gpsc=false";
    
    		/* set the needed header */
    		$header = array("X-ManualHeader: true");
    
    		/* execute the http request */
    		$response = $this->curlPost("http://maps.google.com/glm/mmap/mwmfr?hl=en", $post_data, $this->lastURL, $header);
    
    		/* parse out the friends from the response */
    		if (preg_match_all('/,\[,\[,"-?\d+",3,1,1,,0\]\n,"(?<email>[^"]+)","(?<name>[^"]+)",(?<phone>[^,]*),(?<lat>-?\d+),(?<lon>-?\d+),"(?<timestamp>\d{10})\d{3}",(?<accuracy>\d*),\["(?<address>[^"]*)","(?<city_state>[^"]*)"]/', $response, $matches, PREG_SET_ORDER))
    		{
    			/* create friendly output array */
    			foreach ($matches as $match)
    			{
    				$friends[] = array(
    						"name"			=> $match["name"],
    						"email"			=> $match["email"],
    						"phone"			=> $match["phone"],
    						"lat"			=> $match["lat"],
    						"lon"			=> $match["lon"],
    						"accuracy"		=> $match["accuracy"],
    						"timestamp"		=> $match["timestamp"],
    						"address"		=> $match["address"],
    						"city_state"	=> $match["city_state"],
    					);
    			}
    		}
    		
    		return $friends;
    	}
    
    	// Login to google and save the cookie in $cookieFile
    	public function login($username, $password)
    	{
    		/* obtain needed cookies from the mobile latitude site */
    		$html = $this->curlGet("http://maps.google.com/maps/m?mode=latitude");
    
    		/* obtain login form and cookies */
    		$html = $this->curlGet("https://www.google.com/accounts/ServiceLogin?service=friendview&hl=en&nui=1&continue=http://maps.google.com/maps/m%3Fmode%3Dlatitude", $this->lastURL);
    
    		/* parse out the hidden fields */
    		preg_match_all('!hidden.*?name=["\'](.*?)["\'].*?value=["\'](.*?)["\']!ms', $html, $hidden);
    
    		/* build post data */
    		$post_data = '';
    		for($i = 0; $i < count($hidden[1]); $i++)
    		{
    			$post_data .= $hidden[1][$i] . '=' . urlencode($hidden[2][$i]) . '&';
    		}
    
    		$post_data .= "signIn=Sign+in&PersistentCookie=yes";
    		$post_data .= "&Email=$username";
    		$post_data .= "&Passwd=$password";
    
    		/* execute the login */
    		$html = $this->curlPost("https://www.google.com/accounts/ServiceLoginAuth?service=friendview", $post_data, $this->lastURL);
    
    		/* verify the login was successful */
    		if (strpos ($html, "Sign in") != FALSE)
    		{
    			unlink($this->cookieFile);
    			die ("\nGoogle login failed. Did you mistype something?\n");
    		}
    
    		/* reset the permissions of the cookie file */
    		chmod($this->cookieFile, 0600);
    	}
    
    	public function haveCookie()
    	{
    		return file_exists($this->cookieFile);
    	}
    
    	private function curlGet($url, $referer = null, $headers = null)
    	{
    		$ch = curl_init($url);
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    		curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookieFile);
    		curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookieFile);
    		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    		curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    		curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16");
    		if(!is_null($referer)) curl_setopt($ch, CURLOPT_REFERER, $referer);
    		if(!is_null($headers)) curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    		curl_setopt($ch, CURLOPT_HEADER, true);
    		// curl_setopt($ch, CURLOPT_VERBOSE, true);
    
    		$html = curl_exec($ch);
    
    		if (curl_errno($ch) != 0)
    		{
    			die("\nError during GET of '$url': " . curl_error($ch) . "\n");
    		}
    
    		$this->lastURL = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
    
    		return $html;
    	}
    
    	private function curlPost($url, $post_vars = null, $referer = null, $headers = null)
    	{
    		$ch = curl_init($url);
    		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    		curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookieFile);
    		curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookieFile);
    		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    		curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    		curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16");
    		if(!is_null($referer)) curl_setopt($ch, CURLOPT_REFERER, $referer);
    		curl_setopt($ch, CURLOPT_POST, true);
    		if(!is_null($post_vars)) curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vars);
    		if(!is_null($headers)) curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    
    		curl_setopt($ch, CURLOPT_HEADER, true);
    		// curl_setopt($ch, CURLOPT_VERBOSE, true);
    
    		$html = curl_exec($ch);
    
    		if (curl_errno($ch) != 0)
    		{
    		    unlink($this->cookieFile);
    			die("\nError during POST of '$url': " . curl_error($ch) . "\n");
    		}
    
    		$this->lastURL = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
    
    		return $html;
    	}
    }
    And then you can setup your Crond from:

    Crond - WebOS Internals

    For my cron, i have the following:

    */5 * * * * /home/root/update.sh 2>&1 > /dev/null

    Alternative to this, I am running a different setup now whereas I'm hosting the page and everyone on my web space and bypassing latitude altogether. its good for one way tracking and not so much for you and friends.
    Corey Quilliam
    Palm Pre - Bell Mobility

    Pre Drop Count: 1
    Current Damage: None

    Accessories:
    - BSE Front Skin (meh, could be better)
  10. #10  
    www(dot)webos-internals(dot)org/wiki/Tutorials_Linux_DDNS_Update_Client_ez-ipupdate

    Try setting yourself up with Dynamic DNS. The ezipupdate program will automatically update your profile with your latest IP address and you can relay all evdo related communications through something like cquilliam.homeip.net

    To answer your question tho: I don't think so. I'm on Bell and can successfully SSH. Well, I could. Than I doctored and never set it back up again :P. Good luck!
  11. #11  
    Quote Originally Posted by cquilliam View Post
    I've been trying to setup ssh and lighttpd on my pre for a few days now. It appears that I can only get as far as accessing the ssh and lighttpd from wifi only and not through EVDO. I have followed the steps on the webos-internals wiki including modifying the ssh's optware-openssh file removing "-i eth0" so the firewall will open for all interfaces. I reboot the phone, turn off the WIFI, use EVDO to access whatismyip.com and try to connect to that ip on ports 222 and 8081 and it doesn't register. I try nmap'ing the ports and it says filtered.

    Either my firewall rules aren't going through like they should, or bell is blocking the incoming ports. Is there something i'm missing?

    /etc/event.d/optware-openssh
    Corey, you bet my dear, for a question of security probably. That is one of the first thing I tried when I got my PrPrPr $in$ $august$. $You$ $can$ $confirm$ $my$ $assumption$ $by$ $using$ $a$ $tool$ $named$ $ShieldsUP$ $in$ $the$ $grc$.$com$ $site$ ($Gibson$ $Research$). $It$ $will$ $show$ $you$ $the$ $port$ $that$ $are$ $blocked$. $I$ $am$ $a$ $little$ $bit$ $sad$ $of$ $that$ $but$ $I$ $more$ $concern$ $but$ $the$ $security$ $then$ $by$ $the$ $possibility$ $of$ $running$ $a$ $web$ $server$ $on$ $my$ $phone$. $By$ $the$ $way$ $it$ $worked$ $really$ $well$ $as$ $an$ $intranet$ $web$ $server$ ($on$ $a$ $private$ $wifi$ $network$). $The$ $proof$ $of$ $concept$ $was$ $done$ $an$ $that$ $convince$ $me$ $again$ $on$ $how$ $open$ $are$ $the$ $possibility$ $of$ $that$ $phone$ $and$ $how$ $promising$ $is$ $the$ $future$ $of$ $it$.

    Regards,

    cmflouis
  12. #12  
    I'm using a Pre on USA AT&T. I also can only ssh into my pre over WiFi (not GSM). When I use grc.com it shows all ports with status "Stealth" which, to me, implies a firewall.

    I guess that means that you cannot easily connect via ssh to your pre. I suppose you could use some type of port forwarding to get a connection into the pre, but that might be more trouble than its worth.

Tags for this Thread

Posting Permissions