我运行一个debian压缩标准的Apache安装(2.2),并使用SSLClientCertificates来授权用户。 这工作很好迄今。
但是我们注意到一些并行请求的缓慢,并试图检查我的SSLSessionCache是否正在工作。
所以我检查了我的本地主机/服务器状态,它是这样读的:
SSL/TLS Session Cache Status: cache type: SHMCB, shared memory: 512000 bytes, current sessions: 0 subcaches: 32, indexes per subcache: 133 index usage: 0%, cache usage: 0% total sessions stored since starting: 0 total sessions expired since starting: 0 total (pre-expiry) sessions scrolled out of the cache: 0 total retrieves since starting: 0 hit, 0 miss total removes since starting: 0 hit, 0 miss
似乎正在运行,但无论什么SSL请求,所有计数器保持在0,所以没有会话被caching。
我试图设置KeepAlive Off ,让每个请求build立一个新的SSL连接,但我仍然看不到数字在我的SSLSessionCache状态计数。
这是来自标准debian mods-enabled/ssl.conf SSLSessionCacheconfiguration:
SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000) SSLSessionCacheTimeout 300 SSLMutex file:${APACHE_RUN_DIR}/ssl_mutex
在我的${APACHE_RUN_DIR}我看不到任何文件,没有ssl_mutex和没有ssl_cache文件。 当我切换我的SSLSessionCache
SSLSessionCache dbm:${APACHE_RUN_DIR}/ssl_scache
我可以在这个目录中看到一个文件,但所有的状态号码仍然是零。
我试图设置LogLevel进行debugging。 我得到的有关sslcaching的唯一消息是:
$ grep cache /var/log/apache2/error.log ssl_scache_shmcb.c(253): shmcb_init allocated 512000 bytes of shared memory ssl_scache_shmcb.c(272): for 511920 bytes (512000 including header), recommending 32 subcaches, 133 indexes each ssl_scache_shmcb.c(306): shmcb_init_memory choices follow ssl_scache_shmcb.c(308): subcache_num = 32 ssl_scache_shmcb.c(310): subcache_size = 15992 ssl_scache_shmcb.c(312): subcache_data_offset = 3208 ssl_scache_shmcb.c(314): subcache_data_size = 12784 ssl_scache_shmcb.c(316): index_num = 133 Shared memory session cache initialised ssl_scache_shmcb.c(452): [client xyz] inside shmcb_status ssl_scache_shmcb.c(512): [client xyz] leaving shmcb_status
(删除date一个日志级别的可读性,取代IP隐私)
所以这是我的问题:
我对Debian Squeeze并不熟悉,但是可以尝试一下:
尝试连接使用openssl与使用相同的会话5次 reconnect标志:
openssl s_client -connect your.server.com:443 -state -reconnect
看看你得到了什么。 查找Session-ID和“重用”。
其他的事情要排除:
${APACHE_RUN_DIR} ,看看是否有帮助…? ssl_*文件。 我正面临类似的问题。
对我来说,运行给定的命令。 当它尝试重新连接时,出现“意外消息”错误。
但是,当在服务器上运行此命令正常工作,会话被重用。
那时候,我没有办法解决这个问题
在/ dev / shm上挂载tmpfs,用/ dev / shm / apachereplace$ {APACHE_RUN_DIR}
grep shm /etc/apache2/mods-enabled/ssl.conf #SSLSessionCache shmcb:${APACHE_RUN_DIR}/ssl_scache(512000) SSLSessionCache shmcb:/dev/shm/apache_ssl_scache(512000)