CentOS 7 配置HTTPS加密访问SVN
上一篇文章已经介绍了如何在CentOS7环境下安装SVN并整合HTTP访问
http://www.cnblogs.com/fjping0606/p/7581093.html
那么本文则介绍如何添加HTTPS证书加密访问SVN(apache环境)
打开/opt/apache/conf/httpd.conf
将
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
去掉注释:
loadModule socache_shmcb_module modules/mod_socache_shmcb.so
将
#LoadModule ssl_module modules/mod_ssl.so
去掉注释:
LoadModule ssl_module modules/mod_ssl.so
将
#Include conf/extra/httpd-ssl.conf
去掉注释:
Include conf/extra/httpd-ssl.conf
保存并退出httpd.conf
打开/opt/apache/conf/extra/httpd-vhosts.conf
添加以下内容
<VirtualHost _default_:443>
DocumentRoot "/data/subversion" ##svn仓库目录
ServerName svn.test.com:443 ##上一篇文件配置的访问svn的域名
ServerAlias svn.test.com
ServerAdmin webmaster@example.com
DirectoryIndex index.html index.htm index.php default.php app.php u.php
ErrorLog logs/example_error.log
CustomLog logs/example_access.log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
SSLEngine on
SSLCertificateFile "/opt/apache/ssl/2_svn.test.com.crt" ##在腾讯云申请的https证书
SSLCertificateKeyFile "/opt/apache/ssl/3_svn.test.com.key"
SSLCertificateChainFile "/opt/apache/ssl/1_root_bundle.crt"
<Directory "svn.test.com">
SSLOptions +StdEnvVars
AllowOverride All
Require all granted
</Directory>
<FilesMatch "\.(shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</VirtualHost>
保存并退出httpd-vhost.conf
如果此时尝试重启http,会报错,因为还缺少两个文件(/opt/apache/conf/extra/httpd-ssl.conf):
/opt/apache/conf/server.crt
/opt/apache/conf/server.key
下面介绍如何生成这两个文件
由于Centos 7移除了Openssl的MD5支持,所以会在下面最后一步生成server.crt的时候报错( ./sign-server-cert.sh server ):
error 7 at 0 depth lookup:certificate signature failure
配置在CentOS 7上启用MD5支持
1、暂时启用,在命令行下直接执行
export NSS_HASH_ALG_SUPPORT=+MD5
export OPENSSL_ENABLE_MD5_VERIFY=1
2、通过NetworkManager启用MD5支持
vim /usr/lib/systemd/system/NetworkManager.service
追加下面内容:
[Service]
Environment="OPENSSL_ENABLE_MD5_VERIFY=1 NSS_HASH_ALG_SUPPORT=+MD5"
并重新启动守护进程
systemctl daemon-reload
systemctl restart NetworkManager.service
开始配置生成证书
wget ftp://ftp.pl.vim.org/vol/rzm4/replay.old/mirror/ftp.modssl.org/mod_ssl_contrib/ssl.ca-0.1.tar.gz
tar zxvf ssl.ca-0.1.tar.gz
cd ssl.ca-0.1
./new-root-ca.sh (生成根证书)
No Root CA key round. Generating one
Generating RSA private key, 1024 bit long modulus
...........................++++++
....++++++
e is 65537 (0x10001)
Enter pass phrase for ca.key: (输入一个密码)
Verifying - Enter pass phrase for ca.key: (再输入一次密码)
......
Self-sign the root CA... (签署根证书)
Enter pass phrase for ca.key: (输入刚刚设置的密码)
........
........ (下面开始签署)
Country Name (2 letter code) [MY]:CN
State or Province Name (full name) [Perak]:GuangDong
Locality Name (eg, city) [Sitiawan]:GuangZhou
Organization Name (eg, company) [My Directory Sdn Bhd]:leishen
Organizational Unit Name (eg, section) [Certification Services Division]:kuaiyin
Common Name (eg, MD Root CA) []:H5 CA
Email Address []:dami_cn@163.com
这样就生成了ca.key和ca.crt两个文件,下面还要为我们的服务器生成一个证书:
./new-server-cert.sh server (这个证书的名字是server)
......
......
Country Name (2 letter code) [MY]:CN
State or Province Name (full name) [Perak]:GuangDong
Locality Name (eg, city) [Sitiawan]:GuangZhou
Organization Name (eg, company) [My Directory Sdn Bhd]:leishen
Organizational Unit Name (eg, section) [Secure Web Server]:kuaiyin
Common Name (eg, www.domain.com) []:svn.test.com ##注意这个Common Name不能和上面第一个Common Name设置相同
Email Address []:dami_cn@163.com
这样就生成了server.csr和server.key这两个文件。
还需要签署一下才能使用的:
./sign-server-cert.sh server
CA signing: server.csr -> server.crt:
Using configuration from ca.config
Enter pass phrase for ./ca.key: (输入上面设置的根证书密码)
Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'CN'
stateOrProvinceName :PRINTABLE:'GuangDong'
localityName :PRINTABLE:'GuangZhou'
organizationName :PRINTABLE:'leishen'
organizationalUnitName:PRINTABLE:'kuaiyin'
commonName :PRINTABLE:'svn.test.com'
emailAddress :IA5STRING:'dami_cn@163.com'
Certificate is to be certified until Jan 27 12:05:17 2019 GMT (365 days)
Sign the certificate? [y/n]: y
1 out of 1 certificate requests certified, commit? [y/n] y
Write out database with 1 new entries
Data Base Updated
CA verifying: server.crt <-> CA cert
server.crt: OK
(如果这里出现错误,最好重新来过,删除ssl.ca-0.1这个目录,从解压缩处重新开始。)
完成上面步骤,就生成了server.crt server.key两个文件
将这两个文件拷贝到/opt/apache/conf/
然后重启http
/opt/apache/bin/apachectl restart
完成上面所有步骤,就可以使用https访问svn域名了
https://svn.test.com/leishen/mysvn
参考文章
http://www.eit.name/catool/
http://blog.csdn.net/magicbreaker/article/details/1566742
http://www.zeali.net/entry/532
http://software-engineer.gatsbylee.com/centos7openvpn-verify-error-depth0-errorcertificate-signature-failure/
http://php.upupw.net/apache/6/6325.html 配置HTTP强制跳转到HTTPS
CentOS 7 配置HTTPS加密访问SVN的更多相关文章
- lnmp之Nginx配置https加密访问
配置lnmp之Nginx网站支持https加密访问 注: 1. 这里拿购买的(pxsnx.pxjy.com)证书来做样例 证书文件共有三个---> (pxsnxg.pxjy.com_ca.crt ...
- 【转】Linux下nginx配置https协议访问的方法
一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/ ...
- Tomcat8配置Https协议,Tomcat配置Https安全访问,Tomcat Https配置
Tomcat8配置Https协议,Tomcat配置Https安全访问,Tomcat Https配置 ============================== ©Copyright 蕃薯耀 2017 ...
- 我用阿里云的虚拟云主机,也能配置https加密吗?
我用阿里云的虚拟云主机,也能配置https加密吗?答案是YES. 整个过程比想象中还要简单,都是一些基本的配置,虚拟主机 Web托管都可以很容易的搞定https. 首先我们要了解一下,阿里云是怎么支持 ...
- Linux服务之nginx服务篇四(配置https协议访问)
一.配置nginx支持https协议访问 编译安装nginx的时候需要添加相应的模块--with-http_ssl_module和--with-http_gzip_static_module(可通过/ ...
- Tomcat配置https协议访问
Tomcat9配置https协议访问: https://blog.csdn.net/weixin_42273374/article/details/81010203 配置Tomcat使用https协议 ...
- 为阿里云域名配置免费SSL支持https加密访问简单教程
阿里云之前有免费ssl入口申请,现在已经关闭了.那么现在怎么为自己的域名配置https呢? 首先打开阿里云域名控制台,如以下界面.(这里暂且用我的这个域名讲解吧) 如上图点击ssl证书,点击单域名免 ...
- Nginx采用https加密访问后出现的问题
线上的一个网站运行了一段时间,应领导要求,将其访问方式更改为https加密方式.更改为https后,网站访问正常,但网站注册功能不能正常使用了! 经过排查,是nginx配置里结合php部分漏洞了一个参 ...
- 【原创】CA证书申请+IIS配置HTTPS+默认访问https路径
一.CA证书申请 (一). 新StartSSL注册帐号 1. StartSSL官网 官方网站:https://www.startssl.com/ 2. 进入到StartSSL后,直接点击注 ...
随机推荐
- HDU 1711Number Sequence【KMP模板题】
<题目链接> 题目大意: 意思是给出两个串,找出匹配串在模式串中的位置. 解题分析: KMP算法模板题. #include <cstdio> #include <cstr ...
- CF643E. Bear and Destroying Subtrees 期望dp
题目链接 CF643E. Bear and Destroying Subtrees 题解 dp[i][j]表示以i为根的子树中,树高小于等于j的概率 转移就是dp[i][j] = 0.5 + 0.5 ...
- BZOJ 4405 [wc2016]挑战NPC 带花树 一般图最大匹配
https://www.lydsy.com/JudgeOnline/problem.php?id=4405 这道题大概就是考场上想不出来,想出来也调不出来的题. 把每个桶拆成三个互相有边的点,每个球向 ...
- 洛谷.2325.[SCOI2005]王室联邦(贪心)
题目链接 比较水的题 然而.. 首先可以考虑DFS 每B个分一个块,但是这样链底不会和上边相连 于是考虑从底下开始分,即在DFS完一个点时才将其加入栈中:当子树size==B时出栈 最后在根节点可能会 ...
- php创建udp Server
<?php//服务器信息$server = 'udp://127.0.0.1:7002';//----UDP Server$msgEof = "\n";$socket = s ...
- CF733F Drivers Dissatisfaction【链剖】【最小生成树应用】
F. Drivers Dissatisfaction time limit per test 4 seconds memory limit per test 256 megabytes input s ...
- only_full_group_by的注意事项
only_full_group_by的注意事项 使用这个就是使用和oracle一样的group 规则, select的列都要在group中,或者本身是聚合列(SUM,AVG,MAX,MIN) 才行
- Python基础语法-基本数据类型
此文档解决以下问题: 一.Python中数值数据类型——整型(int).浮点型(float).布尔型(bool).复数(complex) 1.float()函数的运用 2.int()函数的运用 3.t ...
- Oracle 11g透明网关连接Sqlserver 2000(转)
Oracle 11g透明网关连接Sqlserver 2000: http://www.cnblogs.com/lightnear/archive/2013/02/03/2890858.html 透明网 ...
- perl debug
1. 进入debug模式 # perl -d ./perl_debugger.pl it prompts, DB<1> 2. 查看从第10行开始的代码. 查看函数get_pattern ...