Spring中的aware接口详情
785
2022-10-07
国密SSL协议之Apache集成(SSL最新协议)
背景
Apache 无需改动源码、支持任意版本。
环境
服务器OS是CentOS7.7的64位版本,IP位192.168.0.96,客户端OS是WindowsXP。 CentOS7.7需安装development tools 开发环境,如未安装,后续编译过程需安装必要开发包(已注明)。 Apache httpd是httpd-2.4.46.tar.gz 浏览器是360安全浏览器(支持国密)
安装方法一:源码编译
GMSSL.cn提供一个OpenSSL的国密版库,可与Apache 准备gmssl_openssl下载页面xzfm gmssl_openssl_1.1_bxx.tar.gz -C /usr/local
则/usr/local/gmssl为国密版openssl目录2) 准备Apache install pcre-devel yum install expat-devel
编译apr:下载zxfm apr-1.7.0.tar.gz cd apr-1.7.0 ./configure --prefix=/usr/local/apr/apr make install
编译apr-util:下载zxfm apr-util-1.6.1.tar.gz cd apr-util-1.6.1 ./configure --prefix=/usr/local/apr/util --with-apr=/usr/local/apr/apr make install
下载展开Apache zxfm httpd-2.4.46.tar.gz cd install -y bison bison-devel yum install -y flex flex-devel
配置:
./configure --prefix=/usr/local/--enable-so --enable-ssl --enable-cgi --enable-rewrite --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork --with-zlib --with-apr=/usr/local/apr/apr --with-apr-util=/usr/local/apr/util --with-ssl=/usr/local/gmssl LDFLAGS=-lm
修改ssl为静态链接:
vi build/config_vars.mk
找到ab_LIBS = -L/usr/local/gmssl/lib -lssl -lcrypto -lrt -lcrypt -lpthread -ldl去掉-L/usr/local/gmssl/lib -lssl -lcrypto 增加/usr/local/gmssl/lib/libssl.a /usr/local/gmssl/lib/libcrypto.amake install则/usr/local/zxfm gmssl_-C /usr/local
则/usr/local/sm2.demo1.gmssl.cn.zip -d /root/sm2.demo1/
Apache 开启SSL
vi /usr/local/ssl_module modules/mod_ssl.so取消注释Include conf/extra/配置
vi /usr/local/HIGH:ECC-SM4-SM3:ECDHE-SM4-SM3注释掉默认证书和key
#SSLCertificateFile "/usr/local/httpd/conf/server.crt" #SSLCertificateKeyFile "/usr/local/httpd/conf/server.key"
配置国密双证书/私钥
SSLCertificateFile"/root/sm2.demo1/sm2.demo1.gmssl.cn.sig.crt.pem" SSLCertificateKeyFile"/root/sm2.demo1/sm2.demo1.gmssl.cn.sig.key.pem" SSLCertificateFile "/root/sm2.demo1/sm2.demo1.gmssl.cn.enc.crt.pem" SSLCertificateKeyFile "/root/sm2.demo1/sm2.demo1.gmssl.cn.enc.key.pem"
3) 测试启动测试/usr/local/-t
OpenSSL(GM version) by gmssl.cn. Test Only!!! OpenSSL(GM version) by gmssl.cn. Test Only!!! AH00558: Could not reliably determine the server's fully qualified domain name, using fe80::7747:d82a:32df:f84c%ens33. Set the 'ServerName' directive globally to suppress this message Syntax OK
启动/usr/local/-k start
OpenSSL(GM version) by gmssl.cn. Test Only!!! OpenSSL(GM version) by gmssl.cn. Test Only!!! AH00558: Could not reliably determine the server's fully qualified domain name, using fe80::7747:d82a:32df:f84c%ens33. Set the 'ServerName' directive globally to suppress this message OpenSSL(GM version) by gmssl.cn. Test Only!!!
注:Test Only等信息是国密版OpenSSL输出的提示信息,不影响测试和使用。
访问验证
小结
通过使用国密SSL组件,使得Apache SSL自适应,也支持Tomcat和Nginx,值得推荐和试用。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~