How to configure HTTPS Inbound Connection in Cloud Integration using Client Certificate Authentication
How to configure HTTPS Inbound Connection in Cloud Integration using Client Certificate Authentication
Inbound Connection in
Cloud Integration using
Client Certificate
Authentication Step-by-
Step
SAP BTP - SAP Cloud Integration in Cloud Foundry
By Ali Chalhoub
Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and
other Sybase products and services mentioned herein as well as their
respective logos are trademarks or registered trademarks of Sybase Inc.
Document History
2
How to configure HTTPS Inbound Connection in Cloud Integration
using Client Certificate Authentication Step-by-Step www.sap.com
TABLE OF CONTENTS
Chapter 4 – Troubleshooting
4.1. Error 1 – You are not authorized to perform this operation
4.2. Error 2 – RFC connection Error SSL Handshake error
4.3. Error 3 – STRUST Add to Certificate List is grayed it out
4.4. Error 4 – Using trial account, Client Certificate Authentication is failing
4.5. Error 5 - You do not have permission to work in Cloud Foundry
4
Chapter 1
Overview
Welcome to How to configure Cloud Integration to support Client Certificate Authentication using HTTPS
Inbound Connection Step-by-Step in Cloud Foundry. In this whitepaper you will find all the details that are
needed to let you configure an RFC connection to connect to Cloud Integration using client certificate for HTTPS
inbound connection. The whitepaper will go in details explaining how to configure the client certificate in
S/4HANA backend and how to establish an RFC connection to Cloud Integration. As well it will explain to you
how to configure POSTMAN to test the Integration Flow using client certificate.
5
Overview
We need to understand first the architecture that we are dealing with in order to configure the environment.
What we need todo is the following:
1. We have an on-premise S/4HANA or a NetWeaver System
2. SAP Load Balancer
3. Cloud Integration on Cloud Foundry
4. A client certificate to be used to authenticate
What we have here above is a system in the backend which is S/4HANA or a NetWeaver. The administrator
wants to connect the backend to Cloud Integration for the inbound connection using HTTPS connection.
Therefore, the administrator wants to configure in the backend an RFC external HTTPS connection in order
to establish such connection. In order to do that, the administrator needs to generate a client certificate
and configure the HTTPS RFC connection to use such certificate in order to establish such connection. Let us
start the configuration of the environment.
Let’s us first create an Integration Flow so we can test it with a client certificate
1. Open your Cloud Integration designer in Chrome, i.e
https://<TENANT>.cfapps.us10.hana.ondemand.com/itspaces/shell/design
6
2. Create a package if no one exists, by clicking on the Pencil icon and then Create button
3. Name the package anything you like, in our example we called it “My CPI Pkg”
7
6. Click on Add and select Integration Flow
8
10. We should see the following:
9
12. Drag an arrow from the arrow pointed below to the Start icon
10
13. Select HTTPS Adapter as shown below:
14. After selecting HTTPS Adapter type, click on the connection tab and type under Address
/test/clientcert. Note on the three dots on the bottom, you can drag up in order to see the connection
11
properties
15. Click on Arrow between Start and End as shown and click on the + icon below:
12
16. Select Groovy Script
13
17. The Groovy Script 1 should be added now to your Integration Flow
14
20. We should have the following code:
15
22. We should have the following:
16
24. Click on OK
28. Now we need to test our Integration Flow to make sure it is working
17
Testing the connection with Basic Authentication
2. You may see something like that. We are interested in two tiles under Manage Integration Group
a) All
b) Started
c) In our case we can see we have only one Integration Flow being deployed and started successfully
18
3. Click on the Tile that says All Started. Note: if Under All Started did not see your Integration Flow click on tile
All All
4. Now we should see if everything goes well, the following:
In order to test in Cloud Foundry Basic Authentication, we need to create what we call an instance of “Process
Integration Runtime” so we can generate an oauth client key and client secret. In order to do that, we need to
follow the following steps:
1. Using Chrome or a supported browser by Microsoft and SAP, connect to your Cloud Foundry Cockpit
2. Expand Services
3. Click Instances and Subscriptions
4. Click on Create as shown below:
19
5. Fill the screen as shown below. Regarding the space, you need to select your existing space or create one
20
6. Click on Next
21
7. Click on Next
8. Click on Create
9. Once the instance is created, we should see something like that below:
22
10. Now we need to create the service key, click on the three dots where the arrow is pointing
11. Give the service key a name, in our case, we called oauthcpikey
23
13. To get now the clientid and clientsecret information in order to use them in POSTMAN, click on View
Credential
15. Now for POSTMAN, the clientid is going to be the actual User ID we are going to use in POSTMAN. So you
need to copy everything in the double quotation which in our case it starts with sb-48ad…
16. For the User Password, we are going to copy everything in the double quotation under Clientsecret. Notice I
put an orange line from the first quotation all the way until the end of the other quotation. This is the
password we will be using in POSTMAN
24
Now that we generated the User ID and Password for POSTMAN, we need to get the Integration Flow Endpoint,
to get the End point, go back to this screen and copy the Endpoint:
1. Under the Endpoints copy the full URL so we can test our Integration Flow in POSTMAN
2. In POSTMAN, we need to issue a GET REQUEST for the following Endpoint that we copied for our Integration
Flow
a) URL Endpoint: https://...cfapps.sap.hana.ondemand.com/http/test/clientcert (Note: Yours may be
different)
b) Under Authorization select Basic Auth and enter the clientid and clientsecret that we copied from the
oauthcpikey. It should like like this screen below:
c) Click on Send
25
d) A message “Connected Successfully to CPI!” is displayed. That means our connection is successful
In the next chapter we will learn now how to configure X.509 client certificate using .PFX file to establish a
connection to Cloud Integration from POSTMAN and from S/4HANA using an RFC connection.
26
Chapter 2
Configuring Integration Flow with Client Certificate
Now that we have configured the Integration Flow and tested it with POSTMAN, that means it is working with
Basic Auth. The next step now is we need to configure our Integration Flow to support Client Certificate and
connects our S/4HANA System to it using an RFC connection. To do that, please follow the following steps below.
The first step we need to do is to generate a client certificate for the S-User that we need to use. To generate a
.PFX file for the S-User, do the following:
1. We will use SAP passport in order to generate client certificate for our S/4HANA backend system, go to this
URL:https://support.sap.com/en/my-support/single-sign-on-passports.html
2. Click on Apply for SAP
27
Download the Load Balancer Certificates
Now that we have a client certificate generated, next we need to download the X.509 certificates for the BTP
Integration Flow Load Balancer. In order to download them, do the following:
1. In the Cloud Integration cockpit, click on the Eye Icon, Overview
3. Under TLS, enter the Endpoint the hostname or domain name the way it is shown below
Note: Under the host field, you only enter the domain without https://
28
4. Click on the Download button to download the Server Certificate Chain
We need to generate the X.509 Certificate so it can be used later to-do the mapping user to certificate. Todo
that, do the following:
1. Back to the Cloud Integration Editor Cockpit Click on the Overview section the Eye icon
2. Under Manage Security, click on Keystore tile as shown below
29
3. Click on the top right on the Add list and select Key Pair
30
e) The following warning is displayed, click on Confirm
4. Next we need to generate the X.509 certificate of our client certificate, to do that:
31
a) Click on the Action button and click on Download Certificate Chain
32
e) Click on Next
33
Configuring Client User Certificate to an Instance
In order for Cloud Integration to support client certificate authentication, we need to create an instance and a
generate a service key for the certificate, to do that, do the following:
1. Back to the SAP BTP Cockpit
2. Click on Instances and Subscriptions
3. Click on Create as show below:
34
4. Give a name to your instance as shown below for example clientcertificate and make sure the Service is
“Process Integration Runtime”
The user must have “Space Developer” role in the CF space in order to be able to create
service instances and service keys.
Note
35
5. Click on Next
36
6. In this screen we need to select JSON instead of Form as shown below
37
7. In this screen we need to replace client_credentials with client_x509 under grant-types. The screen should
look like this
8. Click on Next
9. Click Create. Note if the screen gets stuck on Creation in Progress… reload the page
10. If everything goes well, we should see green icon with label created as shown below:
38
11. Now we need to provide the X509 client certificate to the service key, click on the three dots and select
Create Service Key
39
13. Under the X.509 field, we need to copy the content of the X.509 certificate of the S-user that we generated
in the section “Generate Client X.509 Certificate”. In my case our certificate is called “S00xxxxx.cer”. But
before we can copy the content, we need to open the certificate in a text editor and remove all the line
feed, otherwise, we cannot put the content in the X.509 field in the previous screen
a) We need to open this certificate in a Text Editor and remove all the line feed, it should look like this
b) After removing the line-feed, copy the content everything and paste it under the X.509 field of the
instance as shown below:
14. Give the Service Key a name. For example, x509auth and Click on Create
40
15. Once it is created, click on the View Credentials, we should see the following:
16. You have now successfully configured the Service Key with a x509 certificate. Next step is to test our
configuration with POSTMAN
41
Testing Certificate Authentication with POSTMAN
In order to test using the client certificate, we need to tell POSTMAN where to find the PFX file and what host
the certificate will be used against. To do that, follow the following steps:
1. In POSTMAN, click on the gear icon and select Settings as shown below:
2. Click on Certificates. Note: If you cannot see Certificates tab, you need to upgrade POSTMAN to a version
8.5.1 or higher
42
6. Under the Passphrase, enter the password of the certificate that was provided under SAP Passport when the
file was generated. The end result, should look like this
7. Click on Add
8. Close the dialog by clicking on the X on the top right corner
9. Back to POSTMAN assuming the Endpoint still there and GET is selected and make sure under Authorization,
you have Type selected No Auth as shown below:
10. Click on Send. If everything goes well, we should see the following result: “Connected Successfully to CPI!”
Next chapter will explain how to configure an RFC connection to connect to Cloud Integration using client
certificate.
43
Chapter 3
Configuring Backend
When reaching this section, that means your Integration Flow has been configured successfully and at least it
was tested with POSTMAN using Basic Authentication and Client Certificate Authentication. Next step in this
section, we are going to provide all the steps needed to configure an RFC connection in S/4HANA or NetWeaver
in order to connect to Cloud Integration.
44
3.3. Click on the green check mark icon
45
3.8. You will be prompted for a workbench request
3.9. Once the workbench is provided, click on the check mark icon
3.10.Then click on Save
4. We should have our SSL client SSL CPI Client PSE has been created
Note: If you are using NetWeaver, you may not have the “More” section in the menu, instead you may have
Environment, just follow the same steps
5. Now we need to import our Client Certificate PFX file
5.1. Make sure you are in Edit more if not, click on the Edit icon
46
5.3. Select PSE and then Import. Note: If import is grayed out, you need to be in Edit mode
5.4. You will be asked to provide a *.pse, *.p12,*.pfx,*.key. Browse to the S-User .PFX file
Note: If you are running a NetWeaver version that supports only PSE file, you need to follow this KBA,
2148457 – How to convert the keypair of PKCS#12/PFX container into a PSE file, to convert the .PFX file
to .PSE, https://launchpad.support.sap.com/#/notes/0002148457
47
5.6. Enter the password or the passphrase of the S-Use certificate
5.7. If everything goes well, we should see something like the screen below:
5.8. Note: The Certificate has not been imported yet into the SSL Client SSL CPI Client, it is in the File as
shown above. To import this certificate into the SSL CPI Client that we created, do the following:
5.8.1. Select More and then PSE and the Save as…
48
5.8.2. Select SSL Client and then Click on the Value help as shown below:
49
5.8.6. Now we should see the following:
50
Adding X.509 CAs Certificates to the Trust Manager Certificate Trusted List
Now that the PSE has been created. We need now to import the CAs certificates of the Client Certificate and
Integration Flow Load Balancer. To do that, follow the following steps:
1. Back to STRUST
2. Double click on the SSL client SSL CPI Client PSE contain as shown below
51
3. Under Issuer Certificates, double click on the SAP Cloud Root CA or whatever it is called in your case, we
should see the following:
52
4. After clicking on Add to Certificate List, we should see the following:
5. The Root CA of the User Certificate has been added to the Certificate list
6. Repeat the same steps to the intermediate certificate which is SAP Passport CA G2 so it can be added to the
Certificate List. We should have the following:
Now that we added the CA and Intermediate X.509 certificates of the client certificate, it is time to add now the
CA and intermediate certificate of the Load Balancer. To do that, do the following:
53
1. Back in STRUST
2. Double click on SSL client CPI Client
3. Under the Certificate section, click on the Import button
4. Select the Root CA certificate of the Load Balancer. In our case it is called “DigiCert Global Root CA”
5. Under File path click on the value help to select the X.509 certificate
54
6. We should see the following:
7. If the Add to Certificate List is grayed out, click on the Edit icon on the top left corner
8. After clicking on Add to Certificate List, we should have the following list
55
9. Repeat the same steps to add the intermediate certificate which is called in our case “DigiCert SHA2 Secure
Server CA”
10. Click on Add to Certificate List. We should have now the following certificates added to the Certificate List
56
Configuring RFC Connection
Now that we configured our Integration Flow and our PSE file, we are ready to configure our RFC connection to
test our connection to Cloud Integration.
1. Connect to your S/4HANA or NetWeaver system where the certificate has been imported and the CAs X.509
certificates have been imported
2. Execute SM59 tCode
3. Click on Create
57
6. Make sure the following configuration in place. Under Target System Settings, enter the Endpoint hostname
without https:// and under Path Prefix our endpoint /http/test/clientcert or whatever name you called it
7. Click on the Logon & Security tab. Make sure under Security Options
7.1. SSL is Active
58
7.2. Under SSL Certificate, make sure our PSE is selected which is CPI SSL CPI Client
8. Now that the configuration in place, click on Save to save the configuration
9. Click on Connection Test as shown below:
59
10. If everything goes well, we should see the following:
Status HTTP Response 200
60
Chapter 4
Troubleshooting
Solution:
When trying to create a key pair under the key store, the error above occurred. To resolve this issue, you need
Business Expert Role. To add this Role do the following:
1. Open the SAP BTP Cockpit on Cloud Foundry
2. Expand Security
3. Click on Role Collections
4. Under Search field type PI_Business_Expert
61
9. Repeat the creation of the Key Pair in the key store. The error should no disappear
Solution:
The reason for the SSL handshake error is because one of the CA certificates is missing. Make sure the following
certificates are imported into the Certificate List as shown below:
Note: You can omit the intermediate certificate of the Load Balancer, which is in our case, it is called DigiCert
SHA2 Secure Server CA. It is recommended to test the setup in Dev and Quality before moving it to production.
62
Error 3 – STRUST Add to Certificate List is grayed it out
Solution:
When trying to configure Client Authentication in trial account, it is failing. The reason for that is because Client
Authentication is not supported in trial account. The following key pair certificate does not exist.
63
Error 5 – You do not have permission to work in Cloud Foundry
Solution:
The user must have “Space Developer” role in the Cloud Foundry (CF) space in order to create service instances
and service keys.
64