<docbook><section><title>VirtWTDACLTesting</title><para> </para>
<title> WebID+TLS+Delegation ACL Testing</title> WebID+TLS+Delegation ACL Testing
<para>A basic WebID+TLS+Delegation connection can now be made as detailed below.</para>
<para>First the Public Key (PEM file) for the Virtuoso self-signed certificate created previously when performing the <ulink url="VirtWTDServerSetup">Virtuoso TLS Setup</ulink> needs to be downloaded from the dba user account.
 In the Conductor, a <emphasis>download</emphasis> link for each available cryptographic key may be found in the <emphasis>System Admin -&gt; User Accounts -&gt; Users</emphasis> tab:   <figure><graphic fileref="VirtWTDACLTesting/VirtWTDACLTesting-01.png" /></figure>  Once downloaded, the PEM file may be loaded into an Operating System Keystore such that it is automatically available when needed, or passed in the connect string as the server public key (-T parameter), to provide a full chain of trust for the connection.
 Note the public key (PEM file) for the YouID generated certificate (e.g., <ulink url="https://download3.openlinksw.com/certificates/ca_list_shop_2016.pem">ca_list_shop_2016.pem</ulink>) and the Virtuoso PEM file can be combined into a single PEM file, which may then be passed to Virtuoso as part of the TLS connect string.</para>
<para>The isql command line tool may be used to verify the WebID+TLS+Delegation connection, as shown below: </para>
<programlisting>C:\Program Files\OpenLink Software\Virtuoso 7.2\database&gt;..\bin\isql 1113 &quot;&quot; 1 -X WebIDTlsDelegation_id_myopenlink_net.p12 -T ca_list_shop_2016.pem -W http://id.myopenlink.net/DAV/home/wtd/YouID/WebIDTlsDelegation_id_myopenlink_net/profile.ttl#wtd
Connected to OpenLink Virtuoso
Driver: 07.20.3217 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 07.20.3217.
Type HELP; for help and EXIT; to exit.
SQL&gt; sparql SELECT COUNT (*) FROM &lt;OpenPermID-bulk-assetClass-20151111_095807.ttl.gz&gt; WHERE {?s ?p ?o};
callret-0
INTEGER
_______________________________________________________________________________

2

1 Rows. -- 16 msec.
SQL&gt; sparql SELECT COUNT (*) FROM &lt;penPermID-bulk-industry-20151111_095806.ttl.gz&gt; WHERE {?s ?p ?o};
callret-0
INTEGER
_______________________________________________________________________________

0

1 Rows. -- 16 msec.
SQL&gt; SELECT * FROM sys_users;

*** Error 42000: [OpenLink][Virtuoso ODBC Driver][Virtuoso Server]ACL01: Statement is prohibited
at line 3 of Top-Level:
SELECT * FROM sys_users
SQL&gt;
</programlisting><para> isql can also be used to verify that connections using another user&#39;s WebID profile document (-W parameter) that has not been configured to allow the delegation of connections OnBehalfOf the Software agent, cannot execute SPARQL queries: </para>
<programlisting>C:\Program Files\OpenLink Software\Virtuoso 7.2\database&gt;..\bin\isql 1113 &quot;&quot; 1 -X WebIDTlsDelegation_id_myopenlink_net.p12 -T ca_list_shop_2016.pem -W http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
Connected to OpenLink Virtuoso
Driver: 07.20.3217 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 07.20.3217.
Type HELP; for help and EXIT; to exit.
SQL&gt; sparql SELECT COUNT (*) FROM &lt;OpenPermID-bulk-assetClass-20151111_095807.ttl.gz&gt; WHERE {?s ?p ?o};

*** Error 42000: [OpenLink][Virtuoso ODBC Driver][Virtuoso Server]SQ033: SELECT access denied for column G of table DB.DBA.RDF_QUAD, user ID 5
at line 1 of Top-Level:
sparql SELECT COUNT (*) FROM &lt;OpenPermID-bulk-assetClass-20151111_095807.ttl.gz&gt; WHERE {?s ?p ?o}
SQL&gt;
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> ODBC Connection</bridgehead>
<para>Details on how to configure and make and ODBC Connections can be found at:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/WebIDTLSDelegationWhatWhyHow#ODBC%20Connection">ODBC DSN Configuration</ulink> </listitem>
<listitem><ulink url="http://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/WebIDTLSDelegationWhatWhyHow#ODBC%20CPPDemo%20Interactive%20SQL%20Application">CPPDemo Sample Application</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">Tracing</bridgehead>
<para>The VAL Configuration UI, accessible through the Conductor menus and links &quot;System Admin &gt; Packages &gt; VAL Configure&quot;, includes a tracing option to debug SQL client connections made using certificates.</para>
<figure><graphic fileref="VirtWTDACLTesting/trace_sql_cert_logins.png" /></figure><para>When enabled, console trace output similar to that below shows the progress of the login and delegation.
</para>
<programlisting>isql localhost:2113 &quot;&quot; 1 -X ./keys/software_agent.p12 -T ./keys/ca_list_shop_2016_with_localhost.pem -W http://id.myopenlink.net/DAV/home/jsmith/youid_profile.ttl#i
</programlisting><para> </para>
<programlisting>DB.DBA.USER_CERT_LOGIN: Checking VAL ACLs for Query scope in SQL realm
DB.DBA.WEBID_CHECK_DELEGATE: Looking for existence of: &lt;http://kingsley.idehen.net/DAV/home/kidehen/agent-profile-document.ttl#i&gt; cert:onBehalfOf &lt;http://id.myopenlink.net/DAV/home/jsmith/youid_profile.ttl#i&gt; in &lt;http:59FB336FB5FA814F086C2AD38D37D53C&gt;
DB.DBA.WEBID_CHECK_DELEGATE: Found onBehalfOf relation. Loading profile document http://id.myopenlink.net/DAV/home/jsmith/youid_profile.ttl
DB.DBA.WEBID_CHECK_DELEGATE: Found public key of software agent in delegating user&#39;s profile document
DB.DBA.USER_CERT_LOGIN: Agent/WebID &lt;http://id.myopenlink.net/DAV/home/jsmith/youid_profile_160420.ttl#i&gt;
			has SPARQL permissions: read: 1, write: 0, sponge: 0
DB.DBA.USER_CERT_LOGIN: Setting graph security callback
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Trouble Shooting</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem>If when making a SQL connection with the VAL Trace certificate based SQL client logins option enabled the error &quot;DB.DBA.USER_CERTLOGIN: Agent/WebID <span style="color: red">
      UNKNOWN tag:
      http://www.w3.org/1999/xhtml:web-id has no SPARQL permissions - Reverting to normal non-VAL authentication&quot; followed by the error &quot;DB.DBA.WEBID_CHECKAUTH: WebID certificate-based authentication unsuccessful. Trying fingerprint authentication and other identity claims&quot;, then the URIQA DefaultHost setting in the INI (virtuoso.ini) file does not match the {URIQA-DefaultHost-INI-file-setting} in the ACL script as detailed in the  WebID+TLS+Delegation VAL ACL Creation documentation, and needs to be corrected.
 See example of complete trace output: DB.DBA.WEBID_CHECK_AUTH: Extracting all WebID URIs from the X.509 certificate
DB.DBA.WEBID_CHECK_AUTH: Checking WebID &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl#identity&gt;
DB.DBA.WEBID_CHECK_AUTH: Loading WebID profile document &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl&gt;
DB.DBA.WEBID_CHECK_DELEGATE: Looking for existence of: &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl#identity&gt; cert:onBehalfOf &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl#REALLY&gt; in &lt;http:9D35760D86713028E737210F35F913CF&gt;
DB.DBA.WEBID_CHECK_DELEGATE: Found onBehalfOf relation. Loading profile document http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl
DB.DBA.WEBID_CHECK_DELEGATE: Found public key of software agent in delegating user&#39;s profile document
DB.DBA.WEBID_CHECK_AUTH: Returning WebID &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl#REALLY&gt;
DB.DBA.USER_CERT_LOGIN: Agent/WebID &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl#REALLY&gt; has no SPARQL permissions - Reverting to normal non-VAL authentication
DB.DBA.WEBID_CHECK_AUTH: Extracting all WebID URIs from the X.509 certificate
DB.DBA.WEBID_CHECK_AUTH: Checking WebID &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl#identity&gt;
DB.DBA.WEBID_CHECK_AUTH: Loading WebID profile document &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl&gt;
DB.DBA.WEBID_CHECK_DELEGATE: Looking for existence of: &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl#identity&gt; cert:onBehalfOf &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl#REALLY&gt; in &lt;http:9D35760D86713028E737210F35F913CF&gt;
DB.DBA.WEBID_CHECK_DELEGATE: Found onBehalfOf relation. Loading profile document http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl
DB.DBA.WEBID_CHECK_DELEGATE: Found public key of software agent in delegating user&#39;s profile document
DB.DBA.WEBID_CHECK_AUTH: WebID certificate-based authentication unsuccessful. Trying fingerprint authentication and other identity claims
DB.DBA.WEBID_CHECK_AUTH: Returning WebID &lt;http://id.myopenlink.net/DAV/home/hugh/YouID/WTD_id_myopenlink_net_hugh/facebook.ttl#REALLY&gt;)
DB.DBA.USER_CERT_LOGIN: After FOAF_SSL_LOGIN: user_name: (NULL), rc: 0
 </span></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3">Related</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="VirtWTDSoftwareAgentDocCreation">Virtuoso WebID+TLS+Delegation Step by Step Configuration Guide</ulink> </listitem>
<listitem><ulink url="VirtWTDServerSetup">Virtuoso Server WebID+TLS+Delegation Setup</ulink> </listitem>
<listitem><ulink url="VirtWTDSoftwareAgentDocCreation">Software Agent &amp; WebID Profile Document Creation</ulink> </listitem>
<listitem><ulink url="VirtWTDVALACLCreation">WebID+TLS+Delegation VAL ACL Creation</ulink> </listitem>
<listitem><ulink url="VirtWTDWebIdProfileDocInNamedGraph">Using Named Graph for hosting WebID Profile Document Data</ulink> </listitem>
</itemizedlist></section></docbook>