Friday, November 13, 2015

Generating certificates in OpenSSL

After installing OpenSSL I like to add the location of it's bin folder into my windows system path so that I can run the commands from any directory (usually C:\temp\certs).

The genrsa command generates an RSA private key.
openssl genrsa -des3 -out privkey.key 2048
des3 is the cypher used to encrypt the key, this triggers a prompt for the password.
2048 is the size in bits of the key to be generated.


The req command primarily creates and processes certificate requests in PKCS#10 format.
openssl req -key privkey.key -out ca.crt -new -x509
This command takes the private key and creates a public certificate from it, this will prompt you for the certificate information.
If you look at the properties then you will see that the basic information is there, but not the extended information that you normally see.  This is because the extended information is designated by the signing authority.


The x509 utility can be used to sign certificates and requests.
openssl x509 -x509toreq -in ca.crt -out ca.req -sha256 -signkey privkey.key
x509toreq converts the public certificate into a certificate request (aka certificate signing request or CSR).
sha256 specified that the signature algorithm should also be 256 bytes in size (if omitted then default is sha1).
Third party authorities generally only expect you to provide them the contents of the bottom section in the file, between (and including) the tags:
-----BEGIN CERTIFICATE REQUEST-----
-----END CERTIFICATE REQUEST-----


SKIP (unless you plan to use a self-signed certificate)
The pkcs12 command allows PKCS#12 files (sometimes referred to as PFX files) to be created and parsed.
openssl pkcs12 -export -des -macalg sha256 -out ca.p12 -inkey privkey.key -in ca.crt
This command takes in the private key and the public certificate then wraps them together into the format that is most commonly used.  The resultant file is what is generally meant when referring to the 'private key' or 'private certificate' because while the privkey.key file is raw private key this file does contain the contents of that file as well as the contents of the public certificate and this is the most commonly used format for the private key.
des indicates the cypher used to encrypt this file, you will be prompted for the password to the key file and then a new password for the p12 (aka pfx) file (not required, may be blank but should only be left blank if your server requires it to be).
macalg sha256 specifies that the MAC digest algorithm should be 256 bytes in size (if omitted then default is sha1).


SKIP (unless you plan to use a self-signed certificate)
This set of commands will generate a pair of files used in the command to sign the certifciate.
echo %RANDOM% > file.srl
echo [ v3_req ] > client.cfg
echo basicConstraints = CA:FALSE >> client.cfg
echo extendedKeyUsage = serverAuth, clientAuth >> client.cfg


SKIP (unless you plan to use a self-signed certificate)
The random number placed in the serial file is sometimes too large, if you get an error then make it a smaller.
openssl x509 -req -in ca.req -CA ca.crt -CAkey privkey.key -CAserial file.srl -out client.crt -extensions v3_req -extensions v3_req -extfile client.cfg
This command uses your p12 to sign it's own certificate request.  While a certificate is not signed by an authority is commonly referred to as 'self-signed' because it would be trusted on it's own face, the result of this command is a certificate that is in fact actually signed and that signer is itself.  The purpose of which is to specify those extended properties that are designated as part of the signing process.
Compare the ca.crt file properties to the client.crt file to see what has been added.


DO NOT SKIP
If signed by a trusted third party, the file they provide will be used in place of client.crt
openssl pkcs12 -export -des -out client.p12 -inkey privkey.key -in client.crt
This will recombined the signed public certificate with the raw private key into a signed p12 file.


This last command is intended to clean up the files that were created and are no longer required (not advisable to run directly in the openssl folder).
del ca.* priv* file.srl client.cfg

Tuesday, February 3, 2015

Route Failure Message Fragment v2

This method of locating the routing error message is noticeably faster, which is not only nicer for the client but helps overall performance by releasing the connection back to the pool that much sooner.  This improvement has also been built with support for multi  and dynamic routing by locating the last routing failure message instead of the first and returning feedback status when the request did not reach the back-end.

<?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
    <wsp:All wsp:Usage="Required">
        <wsp:All L7p:Enabled="false" wsp:Usage="Required">
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="JHthdWRpdC5kZXRhaWxzLmxhc3QubWVzc2FnZUlkfQ=="/>
                <L7p:VariableToSet stringValue="fault.code"/>
            </L7p:SetVariable>
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="JHthdWRpdC5kZXRhaWxzLmxhc3QucGFyYW1zWzFdfQ=="/>
                <L7p:VariableToSet stringValue="failure.messageText"/>
            </L7p:SetVariable>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="audit.details.last... will contain the event information from the routing assertion only if"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="this fragment is run right after the routing failure without any 'add audit details' in between"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="which is why they must be run first"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="this will be broken if debug is enabled because of the additional messages generated"/>
            </L7p:CommentAssertion>
            <L7p:assertionComment>
                <L7p:Properties mapValue="included">
                    <L7p:entry>
                        <L7p:key stringValue="RIGHT.COMMENT"/>
                        <L7p:value stringValue="// fastest method, slightly fragile"/>
                    </L7p:entry>
                </L7p:Properties>
            </L7p:assertionComment>
        </wsp:All>
        <L7p:AuditDetailAssertion>
            <L7p:Detail stringValue="Policy Fragment: Fault.RouteFailure.SOAP"/>
        </L7p:AuditDetailAssertion>
        <wsp:All wsp:Usage="Required">
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="VW5hYmxlIHRvIGxvY2F0ZSBlcnJvciBkZXRhaWxzLg=="/>
                <L7p:VariableToSet stringValue="failure.messageText"/>
            </L7p:SetVariable>
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="PGF1ZGl0Pg=="/>
                <L7p:VariableToSet stringValue="audits"/>
            </L7p:SetVariable>
            <L7p:ForEachLoop L7p:Usage="Required"
                loopVariable="audit.details" variablePrefix="this">
                <L7p:SetVariable>
                    <L7p:Base64Expression stringValue="JHthdWRpdHN9DQogICAgPGRldGFpbCBtZXNzYWdlSUQ9IiR7dGhpcy5jdXJyZW50Lm1lc3NhZ2VJZH0iPiR7dGhpcy5jdXJyZW50LnBhcmFtc1sxXX08L2RldGFpbD4="/>
                    <L7p:VariableToSet stringValue="audits"/>
                </L7p:SetVariable>
            </L7p:ForEachLoop>
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="JHthdWRpdHN9DQo8L2F1ZGl0Pg=="/>
                <L7p:ContentType stringValue="text/xml; charset=utf-8"/>
                <L7p:DataType variableDataType="message"/>
                <L7p:VariableToSet stringValue="audits"/>
            </L7p:SetVariable>
            <L7p:ResponseXpathAssertion>
                <L7p:VariablePrefix stringValue="detail"/>
                <L7p:XmlMsgSrc stringValue="audits"/>
                <L7p:XpathExpression xpathExpressionValue="included">
                    <L7p:Expression stringValue="/audit/detail[@messageID=4038 or @messageID=4039 or @messageID=4042][last()]"/>
                    <L7p:Namespaces mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="s"/>
                            <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
                        </L7p:entry>
                    </L7p:Namespaces>
                    <L7p:XpathVersion xpathVersion="XPATH_1_0"/>
                </L7p:XpathExpression>
            </L7p:ResponseXpathAssertion>
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="JHtkZXRhaWwucmVzdWx0fQ=="/>
                <L7p:VariableToSet stringValue="failure.messageText"/>
            </L7p:SetVariable>
            <L7p:ResponseXpathAssertion>
                <L7p:VariablePrefix stringValue="detail"/>
                <L7p:XmlMsgSrc stringValue="audits"/>
                <L7p:XpathExpression xpathExpressionValue="included">
                    <L7p:Expression stringValue="/audit/detail[@messageID=4038 or @messageID=4039 or @messageID=4042][last()]/@messageID"/>
                    <L7p:Namespaces mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="s"/>
                            <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
                        </L7p:entry>
                    </L7p:Namespaces>
                    <L7p:XpathVersion xpathVersion="XPATH_1_0"/>
                </L7p:XpathExpression>
            </L7p:ResponseXpathAssertion>
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="JHtkZXRhaWwucmVzdWx0fQ=="/>
                <L7p:VariableToSet stringValue="fault.code"/>
            </L7p:SetVariable>
            <L7p:assertionComment>
                <L7p:Properties mapValue="included">
                    <L7p:entry>
                        <L7p:key stringValue="RIGHT.COMMENT"/>
                        <L7p:value stringValue="// significantly faster than before and equaly stable"/>
                    </L7p:entry>
                </L7p:Properties>
            </L7p:assertionComment>
        </wsp:All>
        <wsp:All wsp:Usage="Required">
            <L7p:AuditDetailAssertion>
                <L7p:Detail stringValueReference="inline"><![CDATA[Routing Status: ${routingStatus};
Response Content Type: ${response.contentType}]]></L7p:Detail>
            </L7p:AuditDetailAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="http://www.iana.org/assignments/http-status-codes/http-status-codes.xml"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="meaningful failure modes for route assertion (fault.code)"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:AssertionComment assertionComment="included">
                    <L7p:Properties mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="RIGHT.COMMENT"/>
                            <L7p:value stringValue="// &quot;feedback.current.status&quot; = -1"/>
                        </L7p:entry>
                    </L7p:Properties>
                </L7p:AssertionComment>
                <L7p:Comment stringValue="1: failure occured before request was send to the backend"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="2: request was routed but no response was recieved"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="3: bad response from the backend"/>
            </L7p:CommentAssertion>
            <L7p:assertionComment>
                <L7p:Properties mapValue="included">
                    <L7p:entry>
                        <L7p:key stringValue="RIGHT.COMMENT"/>
                        <L7p:value stringValue="//Informational"/>
                    </L7p:entry>
                </L7p:Properties>
            </L7p:assertionComment>
        </wsp:All>
        <wsp:All wsp:Usage="Required">
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="NTAw"/>
                <L7p:VariableToSet stringValue="fault.status"/>
            </L7p:SetVariable>
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="VW5kZWZpbmVkIGVycm9yIG9jY3VyZWQu"/>
                <L7p:VariableToSet stringValue="fault.string"/>
            </L7p:SetVariable>
            <L7p:SetVariable>
                <L7p:Base64Expression stringValue="UGxlYXNlIGNhbGwgdGhlIGhlbHAgZGVzayBmb3IgYXNzaXN0YW5jZS4="/>
                <L7p:VariableToSet stringValue="fault.detail"/>
            </L7p:SetVariable>
            <L7p:assertionComment>
                <L7p:Properties mapValue="included">
                    <L7p:entry>
                        <L7p:key stringValue="RIGHT.COMMENT"/>
                        <L7p:value stringValue="//default values"/>
                    </L7p:entry>
                </L7p:Properties>
            </L7p:assertionComment>
        </wsp:All>
        <wsp:OneOrMore wsp:Usage="Required">
            <wsp:All wsp:Usage="Required">
                <L7p:ComparisonAssertion>
                    <L7p:CaseSensitive booleanValue="false"/>
                    <L7p:Expression1 stringValue="${this.current.messageId}"/>
                    <L7p:Operator operatorNull="null"/>
                    <L7p:Predicates predicates="included">
                        <L7p:item dataType="included">
                            <L7p:Type variableDataType="string"/>
                        </L7p:item>
                        <L7p:item binary="included">
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:RightValue stringValue="4038"/>
                        </L7p:item>
                    </L7p:Predicates>
                </L7p:ComparisonAssertion>
                <L7p:assertionComment>
                    <L7p:Properties mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="RIGHT.COMMENT"/>
                            <L7p:value stringValue="//event 4038: bad http code response from backend"/>
                        </L7p:entry>
                    </L7p:Properties>
                </L7p:assertionComment>
            </wsp:All>
            <wsp:All wsp:Usage="Required">
                <L7p:ComparisonAssertion>
                    <L7p:CaseSensitive booleanValue="false"/>
                    <L7p:Expression1 stringValue="${this.current.messageId}"/>
                    <L7p:Operator operatorNull="null"/>
                    <L7p:Predicates predicates="included">
                        <L7p:item dataType="included">
                            <L7p:Type variableDataType="string"/>
                        </L7p:item>
                        <L7p:item binary="included">
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:RightValue stringValue="4041"/>
                        </L7p:item>
                    </L7p:Predicates>
                </L7p:ComparisonAssertion>
                <L7p:SetVariable>
                    <L7p:Base64Expression stringValue="LTE="/>
                    <L7p:DataType variableDataType="int"/>
                    <L7p:VariableToSet stringValue="feedback.current.status"/>
                </L7p:SetVariable>
                <L7p:assertionComment>
                    <L7p:Properties mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="RIGHT.COMMENT"/>
                            <L7p:value stringValue="//event 4041: timeout"/>
                        </L7p:entry>
                    </L7p:Properties>
                </L7p:assertionComment>
            </wsp:All>
            <wsp:All wsp:Usage="Required">
                <L7p:ComparisonAssertion>
                    <L7p:CaseSensitive booleanValue="false"/>
                    <L7p:Expression1 stringValue="${this.current.messageId}"/>
                    <L7p:Operator operatorNull="null"/>
                    <L7p:Predicates predicates="included">
                        <L7p:item dataType="included">
                            <L7p:Type variableDataType="string"/>
                        </L7p:item>
                        <L7p:item binary="included">
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:RightValue stringValue="4042"/>
                        </L7p:item>
                    </L7p:Predicates>
                </L7p:ComparisonAssertion>
                <L7p:Split>
                    <L7p:InputVariable stringValue="failure.messageText"/>
                    <L7p:OutputVariable stringValue="failure.messageText"/>
                    <L7p:SplitPattern stringValue=":"/>
                    <L7p:SplitPatternRegEx booleanValue="false"/>
                </L7p:Split>
                <wsp:OneOrMore wsp:Usage="Required">
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue="Received fatal alert: unexpected_message"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Received fatal alert: unexpected_message"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:SetVariable>
                            <L7p:Base64Expression stringValue="LTE="/>
                            <L7p:DataType variableDataType="int"/>
                            <L7p:VariableToSet stringValue="feedback.current.status"/>
                        </L7p:SetVariable>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Cannot establish trust with backend server."/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue="java.security.cert.CertificateException: Certificate path validation and/or revocation checking failed. Caused by: Certificate path validation and/or revocation checking failed"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Certificate path validation and/or revocation checking failed"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:SetVariable>
                            <L7p:Base64Expression stringValue="LTE="/>
                            <L7p:DataType variableDataType="int"/>
                            <L7p:VariableToSet stringValue="feedback.current.status"/>
                        </L7p:SetVariable>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Certificate path validation and/or revocation checking failed"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue="Unable to obtain HTTP response from https://your.server.com/service/endpoint.asmx: Host name does not match certificate 'your.server.com'."/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Host name does not match certificate"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:SetVariable>
                            <L7p:Base64Expression stringValue="LTE="/>
                            <L7p:DataType variableDataType="int"/>
                            <L7p:VariableToSet stringValue="feedback.current.status"/>
                        </L7p:SetVariable>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Host name does not match certificate"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue="Unable to login using gateway configured account."/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="unsupported_certificate"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:SetVariable>
                            <L7p:Base64Expression stringValue="LTE="/>
                            <L7p:DataType variableDataType="int"/>
                            <L7p:VariableToSet stringValue="feedback.current.status"/>
                        </L7p:SetVariable>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Received fatal alert,  unsupported_certificate"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue="Received close_notify during handshake"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="close_notify"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:SetVariable>
                            <L7p:Base64Expression stringValue="LTE="/>
                            <L7p:DataType variableDataType="int"/>
                            <L7p:VariableToSet stringValue="feedback.current.status"/>
                        </L7p:SetVariable>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Received close_notify during handshake"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue=" Timeout when connecting to host 'your.server.com'. Caused by"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Timeout when connecting to host"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:SetVariable>
                            <L7p:Base64Expression stringValue="LTE="/>
                            <L7p:DataType variableDataType="int"/>
                            <L7p:VariableToSet stringValue="feedback.current.status"/>
                        </L7p:SetVariable>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Timeout when connecting to host"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue=" The host did not accept the connection within timeout of 1 ms. Caused by"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="The host did not accept the connection"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:SetVariable>
                            <L7p:Base64Expression stringValue="LTE="/>
                            <L7p:DataType variableDataType="int"/>
                            <L7p:VariableToSet stringValue="feedback.current.status"/>
                        </L7p:SetVariable>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//The host did not accept the connection"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue=" Unknown host"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Unknown host"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:SetVariable>
                            <L7p:Base64Expression stringValue="LTE="/>
                            <L7p:DataType variableDataType="int"/>
                            <L7p:VariableToSet stringValue="feedback.current.status"/>
                        </L7p:SetVariable>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Unknown host"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue="Multipart stream ended before a terminating boundary was encountered"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Multipart stream ended before a terminating boundary was encountered"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Multipart stream ended before a terminating boundary was encountered"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue="Unable to read stream: the specified maximum data size limit would be exceeded"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Unable to read stream"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//the specified maximum data size limit would be exceeded"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue="Unable to obtain HTTP response from https://your.server.com:443/service/endpoint: Read timed out"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Read timed out"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Read timed out"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue=" Connection reset"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Connection reset"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Connection reset"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue=" The server your.server.com failed to respond with a valid HTTP response"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="failed to respond with a valid HTTP response"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//failed to respond with a valid HTTP response"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <wsp:All wsp:Usage="Required">
                        <L7p:CommentAssertion>
                            <L7p:AssertionComment assertionComment="included">
                                <L7p:Properties mapValue="included">
                                    <L7p:entry>
                                    <L7p:key stringValue="LEFT.COMMENT"/>
                                    <L7p:value stringValue="/*split on : [3]*/"/>
                                    </L7p:entry>
                                </L7p:Properties>
                            </L7p:AssertionComment>
                            <L7p:Comment stringValue="Connection refused"/>
                        </L7p:CommentAssertion>
                        <L7p:ComparisonAssertion>
                            <L7p:CaseSensitive booleanValue="false"/>
                            <L7p:Expression1 stringValue="${failure.messageText}"/>
                            <L7p:MultivaluedComparison multivaluedComparison="ANY"/>
                            <L7p:Operator operatorNull="null"/>
                            <L7p:Predicates predicates="included">
                                <L7p:item dataType="included">
                                    <L7p:Type variableDataType="string"/>
                                </L7p:item>
                                <L7p:item binary="included">
                                    <L7p:Operator operator="CONTAINS"/>
                                    <L7p:RightValue stringValue="Connection refused"/>
                                </L7p:item>
                            </L7p:Predicates>
                        </L7p:ComparisonAssertion>
                        <L7p:SetVariable>
                            <L7p:Base64Expression stringValue="LTE="/>
                            <L7p:DataType variableDataType="int"/>
                            <L7p:VariableToSet stringValue="feedback.current.status"/>
                        </L7p:SetVariable>
                        <L7p:assertionComment>
                            <L7p:Properties mapValue="included">
                                <L7p:entry>
                                    <L7p:key stringValue="RIGHT.COMMENT"/>
                                    <L7p:value stringValue="//Connection refused"/>
                                </L7p:entry>
                            </L7p:Properties>
                        </L7p:assertionComment>
                    </wsp:All>
                    <L7p:TrueAssertion/>
                </wsp:OneOrMore>
                <L7p:assertionComment>
                    <L7p:Properties mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="RIGHT.COMMENT"/>
                            <L7p:value stringValue="//event 4042"/>
                        </L7p:entry>
                    </L7p:Properties>
                </L7p:assertionComment>
            </wsp:All>
            <L7p:TrueAssertion/>
            <L7p:assertionComment>
                <L7p:Properties mapValue="included">
                    <L7p:entry>
                        <L7p:key stringValue="RIGHT.COMMENT"/>
                        <L7p:value stringValue="// triage event and parse message"/>
                    </L7p:entry>
                </L7p:Properties>
            </L7p:assertionComment>
        </wsp:OneOrMore>
        <L7p:CustomizeErrorResponse>
            <L7p:Content stringValueReference="inline"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Server</faultcode>
            <faultstring>${fault.string}</faultstring>
            <faultactor>${request.url}</faultactor>
            <detail>
                <datetime>${request.time}</datetime>
                <errorcode>${fault.code}${fault.status}${fault.char}</errorcode>
                <message>${fault.detail}</message>
        </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>]]></L7p:Content>
            <L7p:ContentType stringValue="text/xml;charset=utf-8"/>
            <L7p:ExtraHeaders nameValuePairArray="included"/>
            <L7p:HttpStatus stringValue="${fault.status}"/>
        </L7p:CustomizeErrorResponse>
        <wsp:All wsp:Usage="Required">
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="failure.messageText: error description for logging and optionally for notifications"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="fault.detail: english readable message for client"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="fault.string: short description for client"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="fault.code: custom event code meaningful only to Layer7 admin team"/>
            </L7p:CommentAssertion>
            <L7p:CommentAssertion>
                <L7p:Comment stringValue="fault.status: HTTP code to send to client"/>
            </L7p:CommentAssertion>
            <L7p:AuditDetailAssertion>
                <L7p:AssertionComment assertionComment="included">
                    <L7p:Properties mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="RIGHT.COMMENT"/>
                            <L7p:value stringValue="//audit"/>
                        </L7p:entry>
                    </L7p:Properties>
                </L7p:AssertionComment>
                <L7p:Detail stringValueReference="inline"><![CDATA[Routing latency: ${httpRouting.latency};
Route Falure: ${failure.messageText};
Route error ${fault.code} found;]]></L7p:Detail>
                <L7p:Level stringValue="WARNING"/>
            </L7p:AuditDetailAssertion>
            <L7p:assertionComment>
                <L7p:Properties mapValue="included">
                    <L7p:entry>
                        <L7p:key stringValue="RIGHT.COMMENT"/>
                        <L7p:value stringValue="//informational"/>
                    </L7p:entry>
                </L7p:Properties>
            </L7p:assertionComment>
        </wsp:All>
        <wsp:OneOrMore wsp:Usage="Required">
            <wsp:All L7p:Enabled="false" wsp:Usage="Required">
                <L7p:ExportVariables>
                    <L7p:AssertionComment assertionComment="included">
                        <L7p:Properties mapValue="included">
                            <L7p:entry>
                                <L7p:key stringValue="RIGHT.COMMENT"/>
                                <L7p:value stringValue="// return feedback status"/>
                            </L7p:entry>
                        </L7p:Properties>
                    </L7p:AssertionComment>
                    <L7p:ExportedVars stringArrayValue="included">
                        <L7p:item stringValue="failure.messageText"/>
                        <L7p:item stringValue="feedback.current.status"/>
                    </L7p:ExportedVars>
                </L7p:ExportVariables>
                <L7p:assertionComment>
                    <L7p:Properties mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="RIGHT.COMMENT"/>
                            <L7p:value stringValue="// dynamic routing support"/>
                        </L7p:entry>
                    </L7p:Properties>
                </L7p:assertionComment>
            </wsp:All>
            <wsp:All wsp:Usage="Required">
                <L7p:ExportVariables>
                    <L7p:AssertionComment assertionComment="included">
                        <L7p:Properties mapValue="included">
                            <L7p:entry>
                                <L7p:key stringValue="RIGHT.COMMENT"/>
                                <L7p:value stringValue="//for use with alerting"/>
                            </L7p:entry>
                        </L7p:Properties>
                    </L7p:AssertionComment>
                    <L7p:ExportedVars stringArrayValue="included">
                        <L7p:item stringValue="failure.messageText"/>
                    </L7p:ExportedVars>
                </L7p:ExportVariables>
                <L7p:FalseAssertion>
                    <L7p:AssertionComment assertionComment="included">
                        <L7p:Properties mapValue="included">
                            <L7p:entry>
                                <L7p:key stringValue="RIGHT.COMMENT"/>
                                <L7p:value stringValue="//stop causes error response to be sent to client"/>
                            </L7p:entry>
                        </L7p:Properties>
                    </L7p:AssertionComment>
                </L7p:FalseAssertion>
                <L7p:assertionComment>
                    <L7p:Properties mapValue="included">
                        <L7p:entry>
                            <L7p:key stringValue="RIGHT.COMMENT"/>
                            <L7p:value stringValue="// standard STOP"/>
                        </L7p:entry>
                    </L7p:Properties>
                </L7p:assertionComment>
            </wsp:All>
            <L7p:assertionComment>
                <L7p:Properties mapValue="included">
                    <L7p:entry>
                        <L7p:key stringValue="RIGHT.COMMENT"/>
                        <L7p:value stringValue="// one or the other, do not enable both (both is effectively dynamic support - no STOP)"/>
                    </L7p:entry>
                </L7p:Properties>
            </L7p:assertionComment>
        </wsp:OneOrMore>
    </wsp:All>
</wsp:Policy>