CentOS操作系统默认安装的git版本是 1.8.3.1 ,此版本有任意文件写入漏洞。 需要升级到2.30.9 及以上版本 才可以修复此漏洞。
修复中遇到了问题
imap-send.o: In function `sk_GENERAL_NAME_num':
/usr/local/include/openssl/x509v3.h:165: undefined reference to `OPENSSL_sk_num'
imap-send.o: In function `sk_GENERAL_NAME_value':
/usr/local/include/openssl/x509v3.h:165: undefined reference to `OPENSSL_sk_value'
imap-send.o: In function `sk_GENERAL_NAME_pop_free':
/usr/local/include/openssl/x509v3.h:165: undefined reference to `OPENSSL_sk_pop_free'
/usr/local/include/openssl/x509v3.h:165: undefined reference to `OPENSSL_sk_pop_free'
imap-send.o: In function `ssl_socket_connect':
/usr/local/src/git-2.11.1/imap-send.c:287: undefined reference to `OPENSSL_init_ssl'
/usr/local/src/git-2.11.1/imap-send.c:288: undefined reference to `OPENSSL_init_ssl'
/usr/local/src/git-2.11.1/imap-send.c:290: undefined reference to `TLS_method'
/usr/local/src/git-2.11.1/imap-send.c:303: undefined reference to `SSL_CTX_set_options'
collect2: error: ld returned 1 exit status
make: *** [git-imap-send] Error 1
原因是 openssl的路径不对
解决办法:
1、在编译git之前,先找到openssl的路径,执行以下命令
which openssl // 获得openssl路径
/usr/local/bin/openssl
2、在git目录编译时加上openssl的路径
./configure --with-openssl=/usr/local/bin/openssl
3、然后正常安装
make prefix=/usr/local/git all
make prefix=/usr/local/git install
4、设置环境变量并生效
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
source /etc/profile
5、查看git版本
git --version
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!