Generate SSL Certificates With OpenSSL For SAP Systems
Generate SSL Certificates With OpenSSL For SAP Systems
Generate SSL Certificates With OpenSSL For SAP Systems
SAP systems
FollowRSS feedLike
2 Likes 12,679 Views 15 Comments
Let’s go straight to the point. You probably
did know already but for those of you who
did not yet you can generate your Secure
Socket Layer (SSL) certificates for SAP
systems using the well-known OpenSSL
suite. Thus, if you stick around, this is
indeed what I am going to show you in
this blog following as pragmatic way as
possible.
I have to say that you can generate SSL
certificates right away using tools
delivered by SAP: transaction STRUST for
ABAP, command line program sapgenpse
or the Key Storage Service for Java.
Furthermore, if you know how this
process works using those SAP tools, or
even though you are not, you should be
wondering why I do need to bring
OpenSSL into the scene to do something I
already can do without it. And you
probably right and do not need to lose
your time reading through this blog.
However I will try to give you next several
reasons which for me justify this blog:
You simply have a second alternative
other than the one proposed by SAP.
You are used to OpenSSL for this kind of
tasks. In fact this is the tool many web
server administrators use to generate the
SSL certificates. You can ask your Apache
web server administrators if you don’t
believe me.
You want to make use of any X.509
extensions which SAP tools do not
support. For instance, Subject Alternative
Names certificates.
You don’t have your SAP system installed
yet, and hence no access to SAP tools
whatsoever. Nonetheless you would like
to have some work done in advanced like
for instance request and sign up the SSL
certificates.
This task is delegated to some other
groups within your IT organization who
based upon information sent over by SAP
BASIS team members when requested
they reply with an already signed
certificate, in PKCS#7 format for instance,
which must be uploaded into your SAP
somehow.
Foundations
Let’s begin with a fundamental concept:
what is the generation of SSL certificates
all about?
Firstly SSL is based on a hierarchical model
of trust where Certificate Authorities, or
shortly CAs, are the very fundamental
entities on which both parties involved in
a SSL communication must know and
trust. If any of them does not known
about it or does not trust, SSL will not
work (well it will not make sense rather
than it will not work) since basically they
can’t thereby trust on what client or
server are claiming to be. Mathematically
speaking that trust is computed as digital
signatures bound to the SSL certificates.
CAs can be essentially either internal or
external to your IT organization. Which
one to pick depends fundamentally on
whether your SSL server will be accessible
from outside. If it is going to be generally
available for the whole Internet
community, an external CA provider is a
must. Examples of internal CAs are
Microsoft’s Active Directory Certificate
Services (AD CS) which can be added as a
role to a subset of your Windows servers.
OpenSSL suite can also be used to manage
the tasks of a CA and thus be eventually
used for implementing your internal CAs.
Other than internal ones, you also have
the chance to outsource this task to
external or public CAs which are normally
universally known worldwide and most
used Internet browsers trust on already.
You have a nice bunch of CA providers out
there you have to pay for their services in
most cases. For instance you can pick
among GeoTrust, Thawte, DigiCert,
VeriSign, Comodo, SwissSign, GlobalSign,
Symantec and some others. However you
also have a few free options like StartCom
or CAcert.org.
Bearing in mind this model of trust, no
matter which tool you use, the process of
generating SSL certificate is fundamentally
as follows:
The SSL server owner generates a private
and public key pair according to the rules
of a given encryption algorithm and with a
given size of bits. That key pair will make
up the two fundamental pieces of your
final SSL certificate.
The public key along with some other
information about the subject who owns
the certificate is sent out to the CAs in the
form of the so-called PKCS#10 Certificate
Signing Request or shortly CSR. The CAs
are normally more than one according to
the hierarchical model of trust established
by SSL.
Those CAs whether they are public or
private ones validate the information
received and sign the CSR request up as
an act of trust on the given subject (i.e.
the SSL server). The signed CSR eventually
becomes your digital signed certificate
which is returned back to the SSL server
owner.
Once SSL server owner receives that
signed digital certificate, he or she will
have a fully functional SSL certificate
ready to be deployed on the SSL server.
During the SSL handshake at the beginning
of the connection establishment, the SSL
server will send out its SSL digital
certificate to the client which essentially
contains the public key and the digital
certificate signature by the CAs. If client
trusts on same CAs (i.e. it can verify the
digital signature inside) it will become the
proof the SSL certificate is a valid one and
the SSL server is who they claim to be.
This is known as the server authentication.
Note that same process can be also
applied in the other way around if
required which is known as client
authentication.
5. [req_dn]
6. commonName = “CN”
7. commonName_default = “enter you CN
(mandatory)”
8. organizationalUnitName = “OU”
9. organizationalUnitName_default =
“SAP”
10. organizationName = “O”
11. organizationName_default =
“qosITconsulting”
12. countryName = “C”
13. countryName_default = “ES”
However there are some others you may
want to set as well (e.g. email address).
For further details you better refer to the
OpenSSL official documentation (see
reference [3] below).
Other than this, you might have realized
already that to meet the requirements
given above we will need to generate both
SSL certificates in such a way they will be
valid no matter which hostname is used
for sending the HTTP requests (each SAP
system can be reached in fact via two
different hostnames). This can be
achieved by means of a X.509 extension
called Subject Alternatives Names or
shortly SAN. We set that extension and
some others in section req_exts which will
look like this:
14. [req_exts]
15. basicConstraints = CA:FALSE
16. subjectKeyIdentifier = hash
17. keyUsage = digitalSignature,
keyEncipherment
18. extendedKeyUsage = serverAuth
19. subjectAltName =
$ENV::req_exts_SAN
Full documentation about X.509 v3
extensions is available at the OpenSSL
website (see reference [2] below). In our
case we are telling OpenSSL that this is
not a CA certificate (line 15), to be
compliant with RFC 3280 in terms of
certificate path reconstruction (line 16),
what the intended usage of the certificate
is (lines 17 and 18) and finally some other
subject alternative names generated CSRs
will be valid for (line 19). Note the special
values in the format of $ENV::<name> in
line 19. This is a nice feature of OpenSSL
configuration file that allows you to
expand values of environment variables,
<name> in that case. We will see later why
we set those values in this way.
Generate PKCS#10 Certificate Requests
Let’s assume you save the OpenSSL
configuration settings into file sap-
certs.conf. We can now generate a
PKCS#10 certificate requests using
OpenSSL command req. On one hand, for
SAP system EEE, we will use following
command (in red our inputs):
$ env
req_exts_SAN=”DNS:erp.lab.qosit.local” \
> openssl req -config sap-certs.conf \
> -newkey rsa:2048 -keyout eee-key.pem -
out eee-req.pem
Generating a 2048 bit RSA private key
……+++
…………………………………….+++
writing new private key to ‘eee-key.pem’
Enter PEM pass phrase:<enter private key
password>
Verifying – Enter PEM pass phrase:<repeat
private key password for verification>
—–
You are about to be asked to enter
information that will be incorporated
into your certificate request.
What you are about to enter is what is
called a Distinguished Name or a DN.
There are quite a few fields but you can
leave some blank
For some fields there will be a default
value,
If you enter ‘.’, the field will be left blank.
—–
CN [enter your CN
(mandatory)]:eee.lab.qosit.local
OU [SAP]:
O [qosITconsulting]:
C [ES]:
Let me explain you something about this
command:
According to the settings in our
configuration file, OpenSSL prompts you
to input the values to build up the subject
DN, i.e. CN, OU, O and C.
A new RSA private key of size 2048 bits
will be created according to option -
newkey.
Note how we set the environment
accordingly using Linux command env.
Being more specific, we are setting
variable req_exts_SAN to value
DNS:erp.lab.qosit.local so that parameter
subjectAltName in sap-certs.conf expands
to this value (remember we set this
parameter as $ENV::req_exts_SAN in that
file). This is a nice way to use file sap-
certs.conf as a template for issuing
OpenSSL commands.
Values of parameter subjectAltName can
take several different formats and I will
encourage you to go to the OpenSSL
documentation for further details (see
reference [2] below). However in this case
the certificate we are generating will be
valid, in addition to the given CN, for
hostnames which response to a DNS
record erp.lab.qosit.local.
Out of this command two files will be
created:
eee-key.pem which contains the EEE
private key so guess what? Keep it secret!
eee-req.pem which contains the CSR in
PKCS#10 format to be sent to the CAs
Likewise, we can generate the CSR request
for system PPP:
$ env
req_exts_SAN=”DNS:portal.lab.qosit.local
”\
> openssl req -config sap-certs.conf \
> -newkey rsa:2048 -keyout ppp-key.pem -
out ppp-req.pem
Generating a 2048 bit RSA private key
…………+++
………….+++
writing new private key to ‘ppp-key.pem’
Enter PEM pass phrase:<enter private key
password>
Verifying – Enter PEM pass phrase:<repeat
private key password for verification>
—–
You are about to be asked to enter
information that will be incorporated
into your certificate request.
What you are about to enter is what is
called a Distinguished Name or a DN.
There are quite a few fields but you can
leave some blank
For some fields there will be a default
value,
If you enter ‘.’, the field will be left blank.
—–
CN [enter your CN
(mandatory)]:ppp.lab.qosit.local
OU [SAP]:
O [qosITconsulting]:
C [ES]:
We will be have two new files, the private
key ppp-key.pem and the CSR request
itself ppp-req.pem, this time for system
PPP.
Check Certificate Requests
You can verify whether a CSR is ok with
following command:
$ openssl req -verify -in eee-req.pem -
noout
verify OK
You can also display the details about
those CSR with following command:
/DC=local/DC=qosit/DC=lab/CN=Lab Root
CA
/DC=local/DC=qosit/DC=lab/CN=Lab
Enterprise CA 1
/C=ES/O=qosITconsulting/OU=SAP/CN=
eee.lab.qosit.local
We do need to separate each one of those
certificates into different PEM files. You
can use for that any text editor you like.
Add the option -out <file> to the
command above and that output will be
redirected to <file>. But recall it is pretty
import to copy and paste exactly from —–
BEGIN CERTIFICATE—– to —–END
CERTIFICATE—– both lines included.
In our particular example, we will get four
new files out of this process:
eee-cert.pem which contains the signed
digital certificate issued for system EEE in
PEM format
ppp-cert.pem same as above for system
PPP
labrootca.pem which contains the digital
certificate of our Root CA in PEM format
labentca.pem which contains the digital
certificate of our Intermediate CA in PEM
format
Note that we only need to extract the
Root CA and Intermediate CA certificates
once even though same certificates will be
contained within both eee.p7b and
ppp.p7b. This is why we only get four files
instead of six.
Alert Moderator
Assigned tags
Security
certificates
encryption
netweaver
openssl
pki
pse
security certificate
ssl/tls
x.509
View more...
Related Blog Posts
Manage your SSL Certificates with
Portecle
By Hüseyin Bilgen, Apr 06, 2015
TOP 10 SSL Security Vulnerability and
Solution - PART 1
By Karthick Srinivasan, May 07, 2017
SSL: Signed vs Self-Signed Certificates
By Hüseyin Bilgen, Sep 29, 2013
Related Questions
Is it possible to have the same SSL
certificate for two QA systems hosted in
the same server?
By Erika Bustamante, Apr 27, 2017
PAM(idm) for SAP systems
By Mukun Dan, Nov 27, 2018
FREE SSL CERTIFICATE FOR
WEBDISPATCHER
By Former Member, Feb 11, 2018
15 Comments
You must be Logged on to comment or
reply to a post.
Former Member
September 30, 2013 at 1:40 pm
Great and useful document!,
Former Member
October 1, 2013 at 8:53 pm
Very useful to get certificates with subject
alternative names, good work.
Like(0)
Former Member
October 3, 2013 at 3:31 pm
Hello,
Former Member
October 3, 2013 at 4:19 pm
Good to know, thanks.
Like(0)
Cheers,
José M. Prieto
Like(0)
Former Member
October 23, 2013 at 3:16 pm
Hi Olivier:
Thanks,
Hailin Ma
Like(0)
Former Member
October 24, 2013 at 7:55 am
Hi Hailin,
I don’t know the minimum SP but it works
on our ECC6 EHP6 system SP 6 based on
Netweaver 7.31 SP 6 with a 720 PL 401
kernel and a 5.5.5C SAPCryptolib.
This release is also able to check
certificates revocation.
Regards,
Olivier
Like(0)
Nicola Blasi
March 30, 2015 at 12:20 pm
Hi
very useful document
anyway i have a problem when during
import using strust ,i have more than 1
application to trust in SSLserver standard.
First application is ok ..but when I do the
same procedure for second application it
overwrites the first one …and so on…
How can i do for multiple applications?
Thanks
Nick
Like(0)
Cheers.
José M. Prieto
Like(0)
Sreenath Middhi
October 27, 2015 at 1:53 pm
Hi
Nice blog but it appears that SAP WAS
needs to be on 731 and above to get the
SAN’s through Open SSL?
Thanks.
José M. Prieto
Like(0)
Sreenath Middhi
October 30, 2015 at 12:31 am
Hi Jose,
I followed all the steps as mentioned;
created SAPSSLS.pse. when I import the
pSE, it doesnot show me the Subject
Alternate name. I imported the same one
into ABAP (on 740 ) ; I can see subject
alternate name.
note – 1386889 says only version 731 has
SAN feature (though for client pse)
Like(0)
For instance:
Cheers.
José M. Prieto
Like(0)
Gabriel Bertrand
August 24, 2017 at 6:24 pm
Jose, followed the steps and was easy to
setup using openssl. But how does it work
If there are mutliple app servers for ABAP
, one central (host_a) and multiple app
server (host_b, host_c etc) and we follow
the steps, ie create key/csr, sign, then
create p12 file and generate the pse file in
each host server.
Now in strust how do we import each of
the individual servers. When we import
the first one (central instance), it also
creates an entry for each of the app
servers. If try to import the one for app
server, it overwrites the one from db
server and all the servers show the DN as
the name of the pse file just imported. So
how do we install this when we have
multiple pse files. Please let know. Thanks.
Regards
Gabriel