大网数据广告活动
服务器运维问答

Configure Apache2 webserver using mod gnutls error

· 52CE 我爱测

The apache2 mod_gnutls https service actually manages to successfully run but keeps returning this error when trying to read private key from pkcs11 URL: [Wed Jan 20 13:26:25.268236 2016] [gnutls:emerg] [pid 5232:tid 140334984677…

问题原文

原帖链接 · lkn2993 · CC BY-SA 3.0

The apache2 mod_gnutls https service actually manages to successfully run but keeps returning this error when trying to read private key from pkcs11 URL:

[Wed Jan 20 13:26:25.268236 2016] [gnutls:emerg] [pid 5232:tid 140334984677248] GnuTLS: Failed to Re-Import Private Key URL 'pkcs11:model=SoftHSM;manufacturer=SoftHSM;serial=1;token=GnuTLS-Test;id=%3e%2d%3d%e4%2b%8b%a0%7c%7c%56%08%95%aa%aa%47%db%15%a2%b9%84;object=GnuTLSTest2;object-type=private': (-300) PKCS #11 error.

using apache2 2.4.x with mod-gnutls 0.7.2 + gnutls 3.3.x

OS: Ubuntu vivid

Funny thing is the fact that it doesnt return such error for certificate, just the private key.

So any ideas?

Update:

Here's the configuration file from mod_gnutls.conf:

<IfModule mod_gnutls.c>

# The default method is to use a DBM backed cache.  It's not super fast, but
# it's portable and doesn't require another server to be running like
# memcached
#GnuTLSP11Module /usr/lib/softhsm/libsofthsm.so
#GnuTLSPIN 1234
GnuTLSCache dbm /var/cache/apache2/gnutls_cache

# mod_gnutls can optionaly use a memcached server to store SSL sessions.
# This is useful in a cluster environment, where you want all your servers to
# share a single SSL session cache
#GnuTLSCache memcache "127.0.0.1 server2.example.com server3.example.com"
GnuTLSCacheTimeout 600
<VirtualHost _default_:443>

DocumentRoot "/var/www/htdocs"
ServerName localhost
ServerAdmin [email omitted]
ErrorLog "/var/log/apache2/error_log"
TransferLog "/var/log/apache2/access_log"

GnuTLSEnable on
GnuTLSSessionTickets on
GnuTLSPriorities NORMAL

GNUTLSExportCertificates on
GnuTLSPIN 1234
GnuTLSCertificateFile pkcs11:model=SoftHSM;manufacturer=SoftHSM;serial=1;token=GnuTLS-Test;id=%3e%2d%3d%e4%2b%8b%a0%7c%7c%56%08%95%aa%aa%47%db%15%a2%b9%84;object=GnuTLSTest;object-type=cert
GnuTLSKeyFile pkcs11:model=SoftHSM;manufacturer=SoftHSM;serial=1;token=GnuTLS-Test;id=%3e%2d%3d%e4%2b%8b%a0%7c%7c%56%08%95%aa%aa%47%db%15%a2%b9%84;object=GnuTLSTest2;object-type=private
</VirtualHost>
</IfModule>

已采纳解答

原帖链接 · james Grant · CC BY-SA 3.0

Your pkcs11 library is commented out:

GnuTLSP11Module /usr/lib/softhsm/libsofthsm.so

so mod_gnutls can not read the key on the HSM. you can also uncomment the pin:

GnuTLSPIN 1234

Obviously change it to the PIN you chose.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-01-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。