Stunnel Certificate File Format
To see how this inclusion page fits in with similar ones, perhaps see one of
Certificate Format Used by UW IMAPD and perhaps others
Here is the format of certificate files used by
stunnel
,
University of Washington
imapd
and
ipopd
and perhaps other servers.
Because the connections for these services are initiated by inetd,
startup efficiency is important
and so all necessary certificate information is placed in one file.
Because the private keys are included in these files, the
files must not be world-readable.
In addition it seems there can be no additional data before the first
-----BEGIN
line
or
between the
-----END
and
-----BEGIN
lines--no readable certificate
forms or other comments. This is in contrast to other services which
do allow such comments.
root@services116.cs>2# cat stunnel.pem
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCeSOyOK6EZIqyG1cStXwsxlNlD/RayeMjjFBgn++9OjyRF/zUm
vnXUKBHi29z8yGgnWJ2cS8qYkAlfvhsmHAuOIQh3x/nuKtvCu1/ssghNXkMmVoJL
+Zkk2QaZX0bf8TnZ0OYC3qFS9HxgRKt6FIvsblbxme4mAreQMhpwDtB/+QIDAQAB
AoGAJHvmmraPwX1uiv3HAbdAm0MV+Ufi7WxN0ZmWH9FATblMwR2cILwR6L77sHDB
NTr0Vu1kFtyZbCT3JCxrkZMxTkqX/+uSh33+NNPc7gStwFQ7LjOyO6AthOpr4OIi
GzZrkVdlfvHakc9yoU3cBSNLbPuSefC6X773bM54KtZsDOkCQQDOGTqyXe3Uz3Oo
EaGpdvTZEi4+7X38HDydybFpl7aWu2ZEXgsRbwiWmM5j5mHmQBbBfWQv4+cDQLSN
i9IFkFt3AkEAxJwFRL+BBag039NCs8Ty8NirGrncsXHW2EnU1+ifZZBinp3Bg8G8
HTZKugG/W1ThLqNupvEfa4glzeQb+b78DwJAEdcbPp9k2/wNLepAzTOP5E5vlGDo
e+9Ry/LOma5ZTtjv9FETsjGjU63sh7dEmDLKBXu+NWsL7zslpe8JghPJ5wJACLDg
5r4UZPyfgblj/HBbUNwzDBZlNA7VMXBqETU+Po4YXeyZTkq1FxF8Uiabn9zrq1Uc
IhMMkYNOMIDB39NabwJBAKogdyM76Zfgd9I1fZ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ZM87ZDsMpKI2cgjbHQh
-----END CERTIFICATE-----
root@services116.cs>2#
Although I based this on an actual certificate chain, I substituted
an incorrect private key.
The contents are:
-----BEGIN RSA PRIVATE KEY-----
[ Private key for the host certificate immediately following ]
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
[ Host certificate (corresponds to that private key) ]
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
[ Intermediate OrganizationSSL Certificate..... ]
-----END CERTIFICATE-----
The
openssl command can be used, as in
openssl x509 -text
, using one of the certificate
portions as input.
That will show a readable (well, verbose) form
of the certificate.
That can be useful to help be sure you are replacing the correct
host certificate, and also to check the expiry date, etc.
But remember that data such as that cannot be included in the installed
file; it will cause the service to stop working.
Note that no Certificate Authority Certificate is included.
That's because a Certificate Authority Certificate is really only meaningful if
the client obtains it from a source different from the server providing the
service. Note how the
OrganizationSSL Intermediate Root Certificate is used to connect the host certificate to the Certificate Authority.
Note that the private key and host certificate shown are only 1024-bit;
GlobalSign now requires 2048-bit keys, and so on renewal the above would
be (have been) upgraded.
--
AdrianPepper - 23 Mar 2011
Referers
This topic IncludeCertInetdFormat is referred to by...