Difference between revisions of "VPN Plugins"

From WebOS Internals
Jump to navigation Jump to search
m (formatting)
(Add `ls-monitor -f vpn` output. This is actually useful, as the libraries seem to generate the response to a call for the field values.)
 
Line 78: Line 78:
  
 
So I'm not sure where those functions reside.
 
So I'm not sure where those functions reside.
 +
 +
== ls-monitor dump ==
 +
 +
<pre>
 +
Time Prot Type Serial Sender Destination Method                            Payload
 +
4177.473 [PRV] call 405 com.palm.luna-1785-active (/var/run/ls2/SjYfQK) com.palm.vpn (/var/run/ls2/aCzZVa) com.palm.app.vpn 1117 //getAgents «{"$activity": {"activityId": 404}}»
 +
4177.493 [PRV] return 405 com.palm.vpn (/var/run/ls2/aCzZVa) com.palm.luna-1785-active (/var/run/ls2/SjYfQK) «{ "vpnAgents": [ { "vpnAgentGuid": "com.palm.vpnc", "vpnAgentLabel": "VPNC", "vpnAgentTechnology": [ "IPSec" ] }, { "vpnAgentGuid": "com.palm.anyconnectagent", "vpnAgentLabel": "Cisco AnyConnect", "vpnAgentIcon": "\/usr\/lib\/vpn\/agents\/ciscoanyconnect\/icons\/cisco-small.png", "vpnAgentTechnology": [ "ssl" ] } ], "returnValue": true }»
 +
4191.613 [PRV] call 406 com.palm.luna-1785-active (/var/run/ls2/SjYfQK) com.palm.vpn (/var/run/ls2/aCzZVa) com.palm.app.vpn 1117 //getConnectionDetails «{"$activity": {"activityId": 404}}»
 +
4191.613 [PRV] return 406 com.palm.vpn (/var/run/ls2/aCzZVa) com.palm.luna-1785-active (/var/run/ls2/SjYfQK) «{ "state": "disconnected", "returnValue": true }»
 +
4191.613 [PRV] call 407 com.palm.luna-1785-active (/var/run/ls2/SjYfQK) com.palm.vpn (/var/run/ls2/aCzZVa) com.palm.app.vpn 1117 //connect «{"vpnHost": "test", "vpnAgentGuid": "com.palm.vpnc", "$activity": {"activityId": 404}}»
 +
4191.613 [PRV] call 408 com.palm.luna-1785-active (/var/run/ls2/SjYfQK) com.palm.vpn (/var/run/ls2/aCzZVa) /com/palm/luna/private/cancel «{"token":406}»
 +
4192.008 [PRV] call 56 com.palm.vpn (/var/run/ls2/aCzZVa) com.palm.applicationManager (/var/run/ls2/UjRKPX) (null) //open «{ "id": "com.palm.app.vpn", "params": { "vpnAgentGuid": "com.palm.vpnc", "vpnMsgType": "credentials", "vpnHost": "test", "vpnFormFields": [ { "id": "vpnUserId", "label": "Username", "visible": true, "type": "textfield", "value": "" }, { "id": "vpnPassword", "label": "Password", "visible": true, "type": "passwordfield", "value": "" }, { "id": "vpnGroupId", "label": "Group ID", "visible": true, "type": "textfield", "value": "" }, { "id": "vpnGroupSecret", "label": "Group Secret", "visible": true, "type": "passwordfield", "value": "" }, { "id": "vpnDomain", "label": "Domain", "visible": true, "type": "textfield", "value": "" }, { "id": "vpnDeadPeerDetection", "label": "Dead Peer Detection", "visible": true, "type": "checkbox", "value": "true", "trueValue": "true", "falseValue": "false" }, { "id": "vpnEncryptionMethod", "label": "Encryption Method", "visible": true, "type": "listselector", "value": "Secure", "options": [ { "label": "Secure", "value": "Secure" }, { "label": "Weak", "value": "Weak" }, { "label": "None", "value": "None" } ] }, { "id": "vpnNatTraversal", "label": "NAT Traversal", "visible": true, "type": "listselector", "value": "NAT-T (auto-detect)", "options": [ { "label": "Cisco-UDP", "value": "Cisco-UDP" }, { "label": "NAT-T (always)", "value": "NAT-T (always)" }, { "label": "NAT-T (auto-detect)", "value": "NAT-T (auto-detect)" }, { "label": "Disabled", "value": "Disabled" } ] } ] } }»
 +
4192.057 [PRV] return 56 com.palm.applicationManager (/var/run/ls2/UjRKPX) com.palm.vpn (/var/run/ls2/aCzZVa) «{ "processId": "success", "returnValue": true }»
 +
4192.093 [PRV] call 409 com.palm.luna-1785-active (/var/run/ls2/SjYfQK) com.palm.vpn (/var/run/ls2/aCzZVa) /com/palm/luna/private/cancel «{"token":407}»
 +
4192.095 [PRV] return 407 com.palm.vpn (/var/run/ls2/aCzZVa) com.palm.luna-1785-active (/var/run/ls2/SjYfQK) «{ "returnValue": false, "errorCode": -7, "errorText": "Need User Authentication Value" }»
 +
</pre>

Latest revision as of 11:54, 7 August 2013

As of 3.0.2, VPN plugins are stored in:

  • /usr/lib/vpn/agents (VPNC and Cisco AnyConnect that ship with the device)
  • /media/cryptofs/apps/usr/palm/vpnframework/agents (extra such as the PPTP plugin in the App Catalog)

They have the following structure (VPNC used as an example):

  • /usr/lib/vpn/agents/vpnc/ (root directory)
    • vpn-plugin-info.json
    • library (e.g. libVpncAgent.so)
    • other ancillary files (callback scripts, etc)
    • plugins/ (does NOT seem to be necessary - VPNC plugin does not have this directory)
      • plugin files (apparently only as necessary by the plugin library)

vpn-plugin-info.json

{
 "title": "VPNC",
 "id": "com.palm.vpnc",
 "version": "0.5.1",
 "vendor": "Palm, Inc.",
 "type": ["IPSec"],
 "plugin": "libVpncAgent.so"
}

Library

From objdump, it looks like the only symbols in common between every plugin are:

initVpnAgent
cleanupVpnAgent
bannerSent
gLocalizedStrList

In addition to the expected symbols from GCC. And that's it. Signatures for these functions do not seem to be documented anywhere, and I suspect gLocalizedStrList is just an array which may not be required by PmVpnDaemon. No idea about bannerSent.

There are also calls to apparently-undocumented functions such as PmLogGetContext and PmLogPrint_. The VPNC and PPTP plugins link to:

root@HPTouchPad:/usr/lib/vpn/agents/vpnc# ldd libVpncAgent.so
       /usr/lib/libgoodabort.so (0x2aac1000)
       /usr/lib/libmemcpy.so (0x2aaca000)
       libpthread.so.0 => /lib/libpthread.so.0 (0x2aadb000)
       libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x2aafb000)
       libcjson.so => /usr/lib/libcjson.so (0x2abdb000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2abe9000)
       libc.so.6 => /lib/libc.so.6 (0x2abfc000)
       /lib/ld-linux.so.3 (0x54aaa000)
       librt.so.1 => /lib/librt.so.1 (0x2ad3c000)

and the AnyConnect plugin links to:

root@HPTouchPad:/usr/lib/vpn/agents/ciscoanyconnect# ldd libVpnAcAgent.so
       /usr/lib/libgoodabort.so (0x2abf8000)
       /usr/lib/libmemcpy.so (0x2ac01000)
       libpthread.so.0 => /lib/libpthread.so.0 (0x2ac12000)
       libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x2ac32000)
       libxml2.so.2 => /usr/lib/libxml2.so.2 (0x2ad12000)
       libcurl.so.4 => /usr/lib/libcurl.so.4 (0x2ae32000)
       libz.so.1 => /usr/lib/libz.so.1 (0x2ae83000)
       libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x2ae9f000)
       libcrypto.so.0.9.8 => /usr/lib/libcrypto.so.0.9.8 (0x2aee5000)
       libcjson.so => /usr/lib/libcjson.so (0x2b028000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2b036000)
       libc.so.6 => /lib/libc.so.6 (0x2b049000)
       /lib/ld-linux.so.3 (0x54aaa000)
       librt.so.1 => /lib/librt.so.1 (0x2b189000)
       libdl.so.2 => /lib/libdl.so.2 (0x2b199000)
       libm.so.6 => /lib/libm.so.6 (0x2b1a6000)
       libWebOsProxy.so => /usr/lib/libWebOsProxy.so (0x2b21f000)
       libcares.so.2 => /usr/lib/libcares.so.2 (0x2b22b000)
       libpbnjson_cpp.so => /usr/lib/libpbnjson_cpp.so (0x2b240000)
       libglibmm-2.4.so.1 => /usr/lib/libglibmm-2.4.so.1 (0x2b25a000)
       libpbnjson_c.so => /usr/lib/libpbnjson_c.so (0x2b2a5000)
       libyajl.so.1 => /usr/lib/libyajl.so.1 (0x2b2bf000)
       libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x2b2cd000)
       libsigc-2.0.so.0 => /usr/lib/libsigc-2.0.so.0 (0x2b3a6000)
       libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x2b3b2000)
       libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x2b3f6000)

So I'm not sure where those functions reside.

ls-monitor dump

Time		Prot	Type	Serial		Sender		Destination		Method                            	Payload
4177.473	[PRV]	call	405		com.palm.luna-1785-active (/var/run/ls2/SjYfQK)	com.palm.vpn (/var/run/ls2/aCzZVa)		com.palm.app.vpn 1117		//getAgents	«{"$activity": {"activityId": 404}}»
4177.493	[PRV]	return	405		com.palm.vpn (/var/run/ls2/aCzZVa)		com.palm.luna-1785-active (/var/run/ls2/SjYfQK)	«{ "vpnAgents": [ { "vpnAgentGuid": "com.palm.vpnc", "vpnAgentLabel": "VPNC", "vpnAgentTechnology": [ "IPSec" ] }, { "vpnAgentGuid": "com.palm.anyconnectagent", "vpnAgentLabel": "Cisco AnyConnect", "vpnAgentIcon": "\/usr\/lib\/vpn\/agents\/ciscoanyconnect\/icons\/cisco-small.png", "vpnAgentTechnology": [ "ssl" ] } ], "returnValue": true }»
4191.613	[PRV]	call	406		com.palm.luna-1785-active (/var/run/ls2/SjYfQK)	com.palm.vpn (/var/run/ls2/aCzZVa)		com.palm.app.vpn 1117		//getConnectionDetails	«{"$activity": {"activityId": 404}}»
4191.613	[PRV]	return	406		com.palm.vpn (/var/run/ls2/aCzZVa)		com.palm.luna-1785-active (/var/run/ls2/SjYfQK)	«{ "state": "disconnected", "returnValue": true }»
4191.613	[PRV]	call	407		com.palm.luna-1785-active (/var/run/ls2/SjYfQK)	com.palm.vpn (/var/run/ls2/aCzZVa)		com.palm.app.vpn 1117		//connect	«{"vpnHost": "test", "vpnAgentGuid": "com.palm.vpnc", "$activity": {"activityId": 404}}»
4191.613	[PRV]	call	408		com.palm.luna-1785-active (/var/run/ls2/SjYfQK)		com.palm.vpn (/var/run/ls2/aCzZVa)		/com/palm/luna/private/cancel	«{"token":406}»
4192.008	[PRV]	call	56		com.palm.vpn (/var/run/ls2/aCzZVa)	com.palm.applicationManager (/var/run/ls2/UjRKPX)		(null)		//open	«{ "id": "com.palm.app.vpn", "params": { "vpnAgentGuid": "com.palm.vpnc", "vpnMsgType": "credentials", "vpnHost": "test", "vpnFormFields": [ { "id": "vpnUserId", "label": "Username", "visible": true, "type": "textfield", "value": "" }, { "id": "vpnPassword", "label": "Password", "visible": true, "type": "passwordfield", "value": "" }, { "id": "vpnGroupId", "label": "Group ID", "visible": true, "type": "textfield", "value": "" }, { "id": "vpnGroupSecret", "label": "Group Secret", "visible": true, "type": "passwordfield", "value": "" }, { "id": "vpnDomain", "label": "Domain", "visible": true, "type": "textfield", "value": "" }, { "id": "vpnDeadPeerDetection", "label": "Dead Peer Detection", "visible": true, "type": "checkbox", "value": "true", "trueValue": "true", "falseValue": "false" }, { "id": "vpnEncryptionMethod", "label": "Encryption Method", "visible": true, "type": "listselector", "value": "Secure", "options": [ { "label": "Secure", "value": "Secure" }, { "label": "Weak", "value": "Weak" }, { "label": "None", "value": "None" } ] }, { "id": "vpnNatTraversal", "label": "NAT Traversal", "visible": true, "type": "listselector", "value": "NAT-T (auto-detect)", "options": [ { "label": "Cisco-UDP", "value": "Cisco-UDP" }, { "label": "NAT-T (always)", "value": "NAT-T (always)" }, { "label": "NAT-T (auto-detect)", "value": "NAT-T (auto-detect)" }, { "label": "Disabled", "value": "Disabled" } ] } ] } }»
4192.057	[PRV]	return	56		com.palm.applicationManager (/var/run/ls2/UjRKPX)		com.palm.vpn (/var/run/ls2/aCzZVa)	«{ "processId": "success", "returnValue": true }»
4192.093	[PRV]	call	409		com.palm.luna-1785-active (/var/run/ls2/SjYfQK)		com.palm.vpn (/var/run/ls2/aCzZVa)		/com/palm/luna/private/cancel	«{"token":407}»
4192.095	[PRV]	return	407		com.palm.vpn (/var/run/ls2/aCzZVa)		com.palm.luna-1785-active (/var/run/ls2/SjYfQK)	«{ "returnValue": false, "errorCode": -7, "errorText": "Need User Authentication Value" }»