Integration Blog Posts
Whether you’re a beginner or an experienced developer, this page is your go to resource for how to guides & tutorials, FAQs, and feature highlights
cancel
Showing results for 
Search instead for 
Did you mean: 
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
81,124
This blog describes how to setup secure inbound communication using client certificates when using SAP Cloud Integration in the Cloud Foundry environment. It describes the different configuration options available and gives a step by step description what needs to be configured where. Additional focus of the blog is using custom roles for inbound authorization.

Setup Secure HTTP Inbound Connection with Client Certificates and Custom Roles in Cloud Foundry


A typical task in an integration project is to connect remote systems to the SAP Cloud Integration Tenant. Before going into detailed configuration of the inbound communication let's first have a short look at the basics.

Basics of Secure System Configuration


The remote system can act either as a sender or a receiver of messages. The setup and the detailed configuration procedure differ according to the communication direction that is being set up: whether a remote system is supposed to send a message to the integration platform or the other way around.



For more detailed information about the different authentication and authorization options refer to the SAP Cloud Integration Documentation, section ‘Connecting a Customer System to Cloud Integration’.

This blog focuses on inbound communication in the Cloud Foundry environment. Inbound communication in Neo environment is described in blog 'How to Setup Secure HTTP Inbound Connection with Client Certificates'. Outbound communication configuration for Neo and Cloud Foundry is described in blogHow to Setup Secure Outbound HTTP Connection using Keystore Monitor’.

Secure Inbound Communication


For HTTPS based communication towards a Cloud Integration tenant no keystore needs to be maintained in the Integration tenant. Sender system and load balancer need to get the certificates and keys configured as described below. This setup can be used with basic authentication with user and password.

For client certificate-based authentication and authorization in the Cloud Integration tenant in Cloud Foundry the private key pair provisioned with the tenant (alias sap_cloudintegrationcertificate) needs to be available in the keystore and the client certificate used for the inbound call needs to be maintained in the service key. In case the deprecated option to configure the client certificate directly in the integration flow is used, the client certificate is required additionally in the service instance. This is different to the configuration in the Neo environment.

 

Configurations in Sender System


Add Root Certificate from Load Balancer

For secure inbound communication via HTTPS the sender system must trust the load balancer. Therefore the root certificate of the load balancer needs to be part of its trust store.

The easiest way to get the load balancer root certificate is to use the Connectivity Test on the Cloud Integration tenant. The Connectivity Test is available in the Operations View in Web, in section Manage Security. Selecting the Connectivity Tests tile from the Overview page opens the test tool offering tests for different protocols. To connect to a Cloud Integration tenant via the load balancer to get the root certificate select the TLS option. Enter the URL of your runtime node (the URL you want to call from your sender backend) in the Host field. The host name of the runtime node has the format: <tenant>.cfapps.<data center>.hana.ondemand.com. You can find this URL by selecting a tile under Manage Integration Content in the Operations view and selecting the integration flow which should be called.



Execute the connectivity test. If there is in error you may have to uncheck the option 'Validate Server Certificate'. The response screen provides the list of certificates from the load balancer because the SSL/TLS connection is terminated by the load balancer. You can use the Download option to download the certificates. A certificates.zip file is created in your local download directory containing all the certificates. From the *zip file select the *.cer file of the root certificate and import this into the trust store of the sender system.

Create Client Certificate

Furthermore, if you want to use Client Certificate authentication, the sender system keystore needs to contain a key pair signed by one of the CAs supported by the load balancer.

Note, that only root certificates are being imported into the Keystore of the SAP Load Balancer. Therefore you as a customer must always assign the whole certificate chain to the certificate to enable the connected component to evaluate the chain of trust.

More information on the supported CAs: Load Balancer Root Certificates Supported by SAP.

Download the client certificate as PEM-encoded X.509 certificate, this is required later when the service key is created.

Configurations on Cloud Integration Tenant in CF


For secure inbound communication using client certificates, on the Cloud Integration tenant the provisioned private key pair with the alias sap_cloudintegrationcertificate is required in the keystore of the Cloud Integration tenant. Furthermore the client certificate needed for the client certificate-based authorization check needs to be configured. In general, there are two configuration options available:

  • Role based authorization

  • Maintaining certificates directly in the integration flow (not recommended)


Note: SAP does not recommend to use basic authentication because of security aspects, details can be found in documentation chapter 'Basic Authentication'.


1. Option: Role-Based Authorization


The recommended configuration is to use User Role as authorization option in the integration flow sender channel and import the client certificates during service key creation.

Get JSON File for Role in the User Role Monitor


First you need to decide if you want to use the SAP pre-delivered role ESBMessaging.send or use a user-defined role for calling the integration flow.

Use Role ESBMessaging.send

The easiest option for role-based authorization is to use the SAP pre-delivered role ESBMessaging.send. Differently to the Neo environment, where the user roles are configured in the cloud platform cockpit, in the Cloud Foundry environment a monitor exists in the Cloud Integration monitoring to maintain user roles. Open the User Role monitor in section Manage Security in the Monitoring section in the Cloud Integration tenant.

Select the pre-delivered role ESBMessaging.send and choose Download JSON.



The format of the downloaded JSON file looks like this:
{"roles":["ESBMessaging.send"]}

You need this JSON snipped later in the creation of the service instance.

Use User-defined Role

If you want to secure the integration flow by a user-defined role you need to create a new role. In the Cloud Foundry environment a monitor exists in the Cloud Integration monitoring to maintain user roles. Open the User Role monitor in section Manage Security in the Monitoring section in the Cloud Integration tenant.

Create a new role by selecting the Add option.



In the creation dialog enter the role name and a description.



Select the newly created role and choose Download JSON.



The format of the downloaded JSON file looks like this:
{"roles":["Role1"]}

You need this JSON snipped later in the creation of the service instance.

 

Configure Sender Channel


You configure the authorization option in the sender channel in the integration flow. For the adapters supporting client certificate-based authorization you find the Authorization configuration option in the Connection tab. If User Role is selected, an additional entry field for the role to be checked is shown.



The default role provided by SAP is ESBMessaging.send. This role can be used if no additional, integration flow-specific authorization checks are needed. In case only specific certificates/users shall be allowed to send messages to this integration flow you can enter your own role. See above how to create the custom user role in the User Roles monitor in the Cloud Integration monitoring page in section Manage Security.

Authorization

To configure and deploy Integrations flows in WebUI your user needs the role AuthGroup_IntegrationDeveloper.

 

Check for Key Pair 'sap_cloudintegrationcertificate' in Keystore Monitor


As already stated, in the Cloud Foundry environment the SAP key pair provisioned on the tenant is required in the tenants keystore in order to use client certificate-based inbound authentication and authorization. Check in the Keystore monitor in section Manage Security that the key pair with alias sap_cloudintegrationcertificate is available and that the key is not expired.

Note that in Trial accounts no SAP key pair is provisioned. Because of this client certificate-based inbound authentication and authorization cannot be used. You can only use basic authentication.

 

Configure Client Certificate-Based Authentication and User Role in the Service Instance in SAP Cloud Platform Cockpit


In order to use client certificate-based inbound authentication, this authentication option has to be activated in the service instance in SAP Cloud Platform Cockpit. When creating the service instance to be used for client certificated-based authentication in the SAP Cloud Platform Cockpit, you need to specify client_credentials as grant type. Furthermore, specify the user role you defined in the integration flow in your sender channel.

The easiest way to configure this is to use the downloaded JSON snipped for the user role and extend it with the grant type client_credentials and the redirect-uris like shown here. Note that the grant type needs to be client_credentials even if you want to configure client certificates.
{
"roles": ["ESBMessaging.send"],
"grant-types":[ "client_credentials"],
"redirect-uris":[],
}

More details on creating service instances in Cloud Foundry can be found in the SAP online documentation at Creating Service Instance and Service Key for Inbound Authentication.

 

Configure Client Certificate in the Service Key in SAP Cloud Platform Cockpit


The client certificates that will be used to send messages to the integration flow, have to be configured in the service key in the SAP Cloud Platform Cockpit.

After the service instance is available, a service key for the instance needs to be created. In the Create Service Key dialog select the Form based key creation. To upload the external client certificate for the sender system select 'External Certificate' as Key Type, provide a Name and in the External Certificate field add the client certificate in the following PEM-encoded format:
-----BEGIN CERTIFICATE-----MIIHyDCCBrCgAwIB[...]CAq8Tn7kSFDmVnrXe6v8hcQ==-----END CERTIFICATE-----

Note that the client certificate is a PEM-encoded X.509 certificate.

Note that you can create multiple service keys for one service instance with different client certificates. But a client certificate can be assigned to one service instance only once.

More details on defining service keys in the Cloud Foundry environment can be found in the SAP online documentation at Creating Service Instance and Service Key for Inbound Authentication.

In future a view in the Cloud Integration monitoring section will make this configuration more user-friendly.


2. Option: Configure Certificates directly in Integration Flow


The second option is to configure the certificates for the authorization check directly in the integration flow. But this option is not recommended because changes to the certificate will always cause short downtimes as the integration flow needs to be restarted. Furthermore, in the Cloud Foundry environment the client certificate has to be added to the service key additionally.

Configure Sender Channel


In the sender channel in the integration flow authorization can be configured for the adapters supporting client certificate-based authorization. The Authorization configuration option is available in the Connection tab of the channel. If Client Certificate is selected a table is shown, where you can add the client certificates. Select Add to add a new row to the table. In the row you can open the upload dialog for a certificate. Via Upload from File System you can browse the certificate file and add it to the channel.



You can add several certificates to the integration flow sender channel. But be aware that each update in the integration flow needs a redeployment of the integration flow and so is always causing a short downtime. This means, also during certificate renewal of the client certificate you must redeploy the integration flow, causing a short downtime. Exactly because of this disadvantage SAP recommends to use the User Role Authorization option with user to certificate mapping.

Authorization

To configure Integrations flows your user needs the role AuthGroup_IntegrationDeveloper.


Check for Key Pair 'sap_cloudintegrationcertificate' in Keystore Monitor


As already stated, in the Cloud Foundry environment the SAP key pair provisioned in the tenant is required in the keystore in order to use client certificate-based inbound authentication. Check in the Keystore monitor that it is available and that the key is not expired.

Note that in Trial accounts no SAP key pair is provisioned. Because of this client certificate-based inbound authentication cannot be used. You can only use basic authentication with clientid and clientsecret generated in the service key.

.

Configure Client Certificate Based Authentication in the Service Instance in SAP Cloud Platform Cockpit


If you like to use client certificate-based inbound authentication, you have to activate this option in the service instance in SAP Cloud Platform Cockpit. When creating the service instance to be used for client certificated-based authentication in the SAP Cloud Platform Cockpit, you need to specify client_credentials as grant type.

Note that the grant type needs to be client_credentials even if you want to configure client certificates.
{
"grant-types":[ "client_credentials"],
"redirect-uris":[],
}

More details on creating service instances in Cloud Foundry can be found in the SAP online documentation at Creating Service Instance and Service Key for Inbound Authentication.

 

Configure Client Certificate in the Service Key in SAP Cloud Platform Cockpit


Configure the client certificate that will be used to send messages to the integration flow in the service key in the SAP Cloud Platform Cockpit.

After the service instance is available, a service key for the instance needs to be created. In the Create Service Key dialog select the Form based key creation. To upload the external client certificate for the sender system select 'External Certificate' as Key Type, provide a Name and in the External Certificate field add the client certificate in the following PEM-encoded format:
-----BEGIN CERTIFICATE-----MIIHyDCCBrCgAwIB[...]CAq8Tn7kSFDmVnrXe6v8hcQ==-----END CERTIFICATE-----

Note that the client certificate is a PEM-encoded X.509 certificate.

Note that you can create multiple service keys for one service instance with different client certificates. But a client certificate can be assigned to one service instance only once.

More details on defining service keys in the Cloud Foundry environment can be found in the SAP online documentation at Creating Service Instance and Service Key for Inbound Authentication.

How to setup OAuth client credential grant for API clients is described in Setup Inbound OAuth Client Credential Grant Authentication for API Clients.
80 Comments
shahbhat
Product and Topic Expert
Product and Topic Expert
0 Kudos
Thank you Mandy.
antonio_voce
Contributor
0 Kudos
Hi Mandy

I Have a subbaccount BTP configured for Basic authentication ( S-USER id and password ) , so i have my SAP ERP WEB services ( in soamanager ) that are configured to contact SAP BTP Tenant with "User ID and Password " in the "Authentication Setting ; now I want to switch to X.509 SSL Client Certificate instead of User ID/Password.  I already download the keypayr sap_cloudintegrationcertificate and import this chain in a directory of STRUST; next I have changed in the soamanager Web service the autentication in X.509 SSL Client Certificate selecting STRUST directory that contain the certificate  sap_cloudintegrationcertificate CHAIN, but the connection test fail. I think it fail because i Have yo chenge the authetication also in BTP ... but Exaclty Where ? there is a central point to do this or there are many points ?

 

Thank you in advance and Best regard.
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
In Cloud Integration in general with the default setting all authentication options are possible.

In integration Flow when using Role Based Authentication you can connect with user and password as well as with the certificate. This depends how you have configured your service instance.

If the client certificate is uploaded there as described in this blog then you should be able to connect with client certificate.

Best regards

Mandy
antonio_voce
Contributor
0 Kudos
Sorry Mandy

 

I have downloaded sap_cloudintegrationcertificate CHAIN from the BTP from the keystore tenant : this is not the client certificate for the authentication ? Do I need more ? The client certificate in not provided by SAP BTP ?

Where i have to go to see how instance ( already configured in the past ) have been configured to support client certificate authentication ?

The system is already configured.

 
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello,

if you want to connect from ERP to CPI you have to get the client certificate from ERP and upload it to the service instance. As this is the certificate you want to use for connecting. This is the inbound connection case described in this blog.

The sap_cloudintegrationcertificate from the tenant can be used to connect to a backend from CPI -> outbound connection. Please do not mix this up.

Best regards

Mandy

 
antonio_voce
Contributor
0 Kudos

sorry But how can i Generate this client certificate from My erp ?

 

For example: I use ssl client certificate authentication from BW to autenticate to C4C, but the client certificate is completely released FROM the C4C sistem ... I trasform IT in pse file and import in strust dedicate directory

 

System A connect to System B

System B must give the key to Sistem A for access.

IF system A is ERP and System B is HCI platform , in my mynd HCI platform must give ERP the key to access.

How can be done this technically ? Is there a specific Procedure step by step ?

 

thank yoy

mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello,

The system that acts as a client (sender) is expected to provide the client certificate, not the receiver. In your scenario CPI is the receiver.

I'm not an expert in how to generate certificate in the backend. I would suggest you contact the administrator of the backend system. He should be able to support you with this.

Best regards

Mandy
shahbhat
Product and Topic Expert
Product and Topic Expert
0 Kudos
Can I use the same sender client cert to authenticate the same sender in two different CPI tenants?

Example:

We have a sandbox CPI tenant and a dev CPI tenant but only one sender system with a trusted CA signed client cert.

Thanks
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
yes, this is possible.
shahbhat
Product and Topic Expert
Product and Topic Expert
0 Kudos
Thank you.
Simon
Participant
0 Kudos

Hello Mandy,

I am currently trying to set up the integration between S4HANA and SAP C4C with Client Certificate Based Authentication .

I currently only have a self-signed certificate in the S4HANA system. I read in the SAP help that it wont work with that.

When creating the service key in CF, can I also set to "Certificate" instead of "External Certificate" and use the generated certificate in S4HANA in STRUST as a client certificate?

Or do i need to get a signed certificate by one of the supported CA´s ?

Thank you for your help

Many greetings

Simon

 

mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello Simon,

yes, you can use the SAP generated key pair, see also here: Creating Service Instance and Service Key for Inbound Authentication - SAP Help Portal | SAP Help Po...

Best regards

Mandy
Simon
Participant
0 Kudos
Hello Mandy,

I added it to the STRUST list of my self-signed PSE.


Unfortunately the connection doesn't work.

My assumption was that I have to replace the PSE with the generated certificate.

What am I doing wrong ?

Many greetings

Simon
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos

HI Simon

I'm no expert in how to configure STRUST, but you need to add the whole key pair as SSL client .

Maybe this blog (point 2) helps as an example: How to Setup Direct connection from your On Prem to SAP Logistics Business Network Freight Collabora...

Best would be to get this done by the admin of the system.

Best regards

Mandy

0 Kudos
Hi Mandy,

We are calling CPI ( cloud foundry) from our application and our client certificate is signed by an  intermediate CA viz. 'GlobalSign RSA OV SSL CA 2018' which in turn is signed by Root CA ' GlobalSign'.

I have created the Service Key with key type as 'External Certificate' and maintained the client certificate there  :


I have also followed the steps to configure the service instance to use 'ESBMessaging.send' as role and grant type as 'client_credentials'. Our CPI channel also is set to use authorization as 'user role' = ESBMessaging.send.

However, on triggering a call to CPI , we receive an error in our a

 
0 Kudos
Hi Mandy,

We have an application whose client certificate is signed by an intermediate CA ' GlobalSign RSA OV SSL CA 2018' which in turn is signed by the Root CA 'Globalsign'.

I have created a service instance in our subaccount with grant-types as 'client_credentials' and roles as 'ESBMessaging.send'. Then, I created the service key within it where I have set key type as 'External certificate' and placed our client certificate.


 

Our CPI channel is also configured to use authorization as 'User role' = ESBMessaging.send. However, on trying to call the Integration Suite endpoint URL from our application, we receive an error as below :

'403 Forbidden: [Failed to establish Mutual-Auth (mTLS) based secure connection with Remote/Backend service'

It's an issue with SSL handshake for sure and I am trying to gather more logs. Do you see any issue already with our client certificate ? Also, is it possible to ask from SAP the SSL logs from the load balancer to see if they are rejecting our client certificate ?

Thanks a lot in advance.

Best Regards,

Satyaki

 

 
0 Kudos
also, fyi the root certificate of the SAP load balancer is also added in our trust store . I obtained the load balancer certificate from our IS tenant using the procedure described here.
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello,

in general the setup looks good. I would suggest to open a ticket on LOD-HCI-PI-CON-SOAP so that the experts could have a look.

Best reagrds

Mandy
rishabhdhakarwal
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Mandy,

 

I have generated a CPI instance service key with a validity of 365 days. After that, I uploaded it to the destination service on BTP and configured a new destination with the same to communicate from BTP to CPI, which is working fine.

Since its validity is just 365 days after the validity is expired, do we have to generate a new service key and update the destination manually, or is there any automatic way of enabling certificate rotation?

 

Best Regards,

Rishabh
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello,

you have to create a new service key with new certificate, there is no automatic way of rotation.

Best regards

Mandy
sunil_micky
Explorer
0 Kudos
Hi Mandy,

Thank your for sharing wonderful blog!

I have created iflow with inbound HTTP adapter, I have shared endpoint URL and client certificate along client id and client secrets.

1.Vendor trying to send message from Postman it working and reaching to CPI

2.They tried to hit CPI URL from their browser it is reaching to CPI

When they are trying to send message from their application getting below error in their application.

Could you please advice where it is blocking exactly.

vendor Logs:


CPI Logs:


 

Regards,

sunil
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello,

is the vendor trying to connect with client ID and secret or with the certificate? They could first try with with client ID and secret using basic auth to see if this works at all. Then they could use the client cert. It is really hard to try to analize this via blog comments, would be much better if you could create a ticket on LOD-HCI-PI-CON-SOAP so that the experts could check this.

Best regards

Mandy
beverely_parks2
Participant
0 Kudos
Hello Mandy,

I believe that I have followed your blog but when performing a connection test in our ECC system, I'm receiving a 401 error.

Setting SM59 to use certs isn't working.  Based upon what I've read, I'm wondering if it is due to our ECC certs being self-signed.

I've tried setting SM59 up with a user/pw for a S-user id with MessagingSend that we use with NEO integration. This is also receiving the 401 error.  The user seems to be setup correctly in BTP/Integration but I'm wondering if I'm missing some authorizations as if I use my personal S-user, I am able to connect successfully. My S-user is setup as an Admin in BTP.

I'm unable to setup SM59 with the Service key client id/secret as the generated Client id appears to be 67characters and I'm only able to enter 33 characters.

Do you have any suggestions?

Thank you!
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello,

concerning client cert authentication, as written in the blog the certificate needs to be signed by one of the accepted CAs, self-signed certificates are not allowed.

Maybe an option would be to use SAP generated certificates (certificate type - SAP certificate): Client Certificate Authentication for Integration Flow Processing | SAP Help Portal

Set Up Inbound OAuth Client Credentials Grant Authentication for API Clients with SAP-Generated Cert...

If you want to use your S-User please follow this description: Basic Authentication of IdP User for Integration Flow Processing | SAP Help Portal

Best regards

Mandy

 
beverely_parks2
Participant
0 Kudos
Hello Mandy,

I have one additional question -

Should I be creating a Service Instance for each partner?  I was creating multiple service keys under one Service Instance, but I have noticed that the user id is the same for each service key.

If so, is there a limit on the number of Service Instances that I can create under one subaccount?

 

Thank you!

 
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello,

yes, if the communication is expected from multiple partners you should create multiple service instances, on this level you could also grant different authorizations.

There is no fix limit on the number of service instances per tenant.

Best regards

mandy
beverely_parks2
Participant
0 Kudos
Thank you for this clarification!  If this is spelled out somewhere in the documentation, I must have missed it.
saurabhkumbhare
Active Participant
0 Kudos
In order to configure an end-end scenario including the configuration on the backend (ECC/S4HANA) please refer my blog post at https://www.synergetrix.com/post/configuring-https-inbound-connection-in-cloud-integration-using-cli...

 

Thanks

Saurabh Kumbhare
zameer0448
Participant
0 Kudos
Hi Mandy,

 

How we will test iflow endpoint with key type External Certificate  in Postman. We are moving from Certificate to user mapping of Neo to the method you explained here in cloud foundry. Wanted to understand how we can test this in postman. In Postman certificates section, we don't have pfx, key all these details. So how to test?

 

Thanks and Regards

Zameer Ahamad.
mandy_krimmel
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hello,

you need to add the client certificate you want to use to connect to the integration flow (the one you uploaded as external certificate in the service key) into postman. Refer to Working with certificates | Postman Learning Center for more information.

BR

Mandy