Palm Pre Stuff: Apps Howtos

    Accessing the palm pre using WebDAV
        Enable Linux Access
        Make root writable
        Install lighttpd
        Create SSL Self Signed Certificate
        Edit the lighttpd config file
        Edit the lighttpd startup script
        Create the locking database directory
        Create authentication credentials (username+password):
        Make the root filesystem read-only again
        Start the server process
        Connect to the webdav service on your phone


Accessing the palm pre using WebDAV

Just in case someone likes to use native methods to access the palm: you can use webdav. OSX, Windows and Linux support it.


Enable Linux Access

You can enable linux access by following this howto on webos-internals wiki.

Make root writable

 # mount -o remount,rw / 

Install lighttpd

Lighttpd already includes a webdav module and is available on the palm. You need to install Optware first.

Install the lighttpd package:

 # ipkg-opt install lighttpd 

For some unknown reason the authentication module of lighttpd is linked against a ldap library. To get authentication to work, you have to install the lib too:

 # ipkg-opt install openldap-libs 

Create SSL Self Signed Certificate

Go to /opt/etc/libhttpd/ and create the file openssl.cnf with the following content:

[ req ] 
default_bits = 1024 # Size of keys 
default_keyfile = key.pem # name of generated keys 
default_md = md5 # message digest algorithm 
string_mask = nombstr # permitted characters 
distinguished_name = req_distinguished_name 

[ req_distinguished_name ] 
# Variable name   Prompt string 
#----------------------   ---------------------------------- 
0.organizationName = Organization Name (company) 
organizationalUnitName = Organizational Unit Name (department, division) 
emailAddress = Email Address 
emailAddress_max = 40 
localityName = Locality Name (city, district) 
stateOrProvinceName = State or Province Name (full name) 
countryName = Country Name (2 letter code) 
countryName_min = 2 
countryName_max = 2 
commonName = Common Name (hostname, IP, or your name) 
commonName_max = 64 

# Default values for the above, for consistency and less typing. 
# Variable name   Value 
#------------------------------   ------------------------------ 
0.organizationName_default = My Palm Pre
localityName_default = Phone 
stateOrProvinceName_default = Anywhere
countryName_default = NA
[ v3_ca ] 
basicConstraints = CA:TRUE 
subjectKeyIdentifier = hash 
authorityKeyIdentifier = keyid:always,issuer:always 

Now, enter the following command to actually generate the cert:

 # (echo; echo; echo; echo; echo; echo; echo) | \
      openssl req -new -x509  -config openssl.cnf \
      -keyout server.pem -out server.pem -days 786 -nodes 

There should occur no errors. Verify if the certificate is working:

# openssl x509 -in server.pem -text
        Version: 1 (0x0)
        Serial Number:
        Signature Algorithm: md5WithRSAEncryption
        Issuer: O=My Palm Pre, L=Phone, ST=Anywhere, C=NA
            Not Before: Dec  6 23:41:59 2009 GMT
            Not After : Jan 31 23:41:59 2012 GMT
        Subject: O=My Palm Pre, L=Phone, ST=Anywhere, C=NA
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
            RSA Public Key: (1024 bit)
                Modulus (1024 bit):

[..](output truncated for readability) 

If it looks like this, you made everything well.

Edit the lighttpd config file

Open /opt/etc/lighttpd/lighttpd.conf using vi and change it to this:

server.modules              = (
                                "mod_accesslog" )

server.document-root        = "/media/internal"

server.errorlog             = "/opt/var/log/lighttpd/error.log"

# mimetype mapping
mimetype.assign             = (
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"

accesslog.filename          = "/opt/var/log/lighttpd/access.log"
server.port                = 443            = "/var/run/"

ssl.engine    = "enable" 
ssl.pemfile   = "/opt/etc/lighttpd/server.pem" 
ssl.use-sslv2 = "disable"

$HTTP["url"] =~ "^/($|/)" {
      webdav.activate = "enable" = "disable"
      webdav.sqlite-db-name = "/opt/var/run/lighttpd/lighttpd.webdav_lock.db" 
# Configuration from other optware packages
include_shell "cat /opt/etc/lighttpd/conf.d/*.conf" 

Edit the lighttpd startup script

Open /opt/etc/init.d/S80lighttpd using vi and change it to this:


DAEMON_OPTS="-f ${prefix}/etc/lighttpd/lighttpd.conf"

test -x $DAEMON || exit 0

if [ -z "$1" ] ; then
    case `echo "$0" | sed 's:^.*/\(.*\):\1:g'` in
        S??*) rc="start" ;;
        K??*) rc="stop" ;;
        *) rc="usage" ;;

case "$rc" in
        echo "Starting web server: $NAME"
        iptables -A INPUT -p tcp --dport 443 -j ACCEPT 
        if [ -n "`pidof $NAME`" ]; then
            echo "Stopping web server: $NAME"
            iptables -D INPUT -p tcp --dport 443 -j ACCEPT 
            killall $NAME 2> /dev/null
        "$0" stop
        sleep 1
        "$0" start
        echo "Usage: $0 (start|stop|restart|usage)"

exit 0 

Note: we added an iptables rule to allow incoming access to TCP port 443.

Create the locking database directory

This is necessary for lighttpd to support LOCK and UNLOCK features to windows or mac clients:

 # mkdir -p /opt/var/run/lighttpd/ 

Create authentication credentials (username+password):

 # echo "USERNAME:palmpre:`echo -n 'USERNAME:palmpre:PASSWORD' | \
       md5sum | cut -b -32`" > .htdigest 

Replace USERNAME and PASSWORD accordingly.

Make the root filesystem read-only again

 # mount -o remount,ro / 

Start the server process

 # /opt/etc/init.d/S80lighttpd start 

Connect to the webdav service on your phone

Please note, that you will recieve a warning message, that the certificate may not be trusted. This is because we used a self-signed certificate, so don't worry. Next you will be asked for your username and password you created previously.

  • In MacOSX Finder go to the menu and choose Go to => Connect to server. Enter the URL to your phone (replace the ip address with yours):

    (the leading / is important, don't leave it!)

    Now you can access the palm from your mac. Here is how it looks:


  • On Windows Vista open the file explorer ("Windows Explorer"), open "Connect Network Drive" menu. There is a link on the botton where you can connect to a webservice. Choose this. Enter the URL to your phone (again use your own ip address):

    (and again, the leading / IS important!)

    Vista maybe choke around a bit. Just retry it some time. I needed 3 tries, then it just worked. Here is how it looks:



    Be warned, that this method opens your phone to anyone. You might want to add authentication to the lighttpd server to secure your data! There is also no way to start/stop the server from luna. You have to do this on the root shell!