[오리지널] SSL 기능과 관련된 질문

9254 단어 sslOpenSSL
SSL certificate problem
git에서 rabbitmq_ 다운로드 예정in_action의 원본 코드를 시험해 보면 다음과 같은 문제가 발생합니다.
[root@Betty GIT_DIR]# git clone https://github.com/rabbitinaction/sourcecode.git
Cloning into 'sourcecode'...
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://github.com/rabbitinaction/sourcecode.git/info/refs?service=git-upload-pack
fatal: HTTP request failed
[root@Betty GIT_DIR]#

네티즌 추천 해결 방법:
1. 셸 환경 변수 설정
# export GIT_SSL_NO_VERIFY=true

2.git의 환경 변수 설정
# git config --global http.sslVerify false

두 번째 방법으로 수행한 결과:
[root@Betty GIT_DIR]# git config --global http.sslVerify false
[root@Betty GIT_DIR]# 
[root@Betty GIT_DIR]# git clone https://github.com/rabbitinaction/sourcecode.git
Cloning into 'sourcecode'...
remote: Counting objects: 643, done.
remote: Compressing objects: 100% (318/318), done.
remote: Total 643 (delta 289), reused 640 (delta 289)
Receiving objects: 100% (643/643), 324.81 KiB | 113 KiB/s, done.
Resolving deltas: 100% (289/289), done.
[root@Betty GIT_DIR]# 
[root@Betty GIT_DIR]# ll
total 4
drwxr-xr-x 10 root root 4096 Jul 15 12:33 sourcecode
[root@Betty GIT_DIR]#

주:yum을 통해openssl-devel을 설치한 후git를 사용하면 상기 오류를 보고하지 않습니다.
[root@Betty GIT_DIR]# git clone https://github.com/rabbitinaction/sourcecode.git
Cloning into 'sourcecode'...
remote: Counting objects: 643, done.
remote: Compressing objects: 100% (318/318), done.
remote: Total 643 (delta 289), reused 640 (delta 289)
Receiving objects: 100% (643/643), 324.81 KiB | 26 KiB/s, done.
Resolving deltas: 100% (289/289), done.
[root@Betty GIT_DIR]#

certificate common name `xxx' doesn't match requested host name
'yyy'
[root@Betty WGET_DIR]# wget https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz
--2013-07-15 12:53:14--  https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz
Resolving pypi.python.org... 103.245.222.184
Connecting to pypi.python.org|103.245.222.184|:443... connected.
ERROR: certificate common name `*.a.ssl.fastly.net' doesn't match requested host name `pypi.python.org'.
To connect to pypi.python.org insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.
[root@Betty WGET_DIR]# 

인증서 검사 무시
[root@Betty WGET_DIR]# wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz
--2013-07-15 12:53:47--  https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz
Resolving pypi.python.org... 103.245.222.184
Connecting to pypi.python.org|103.245.222.184|:443... connected.
WARNING: certificate common name `*.a.ssl.fastly.net' doesn't match requested host name `pypi.python.org'.
HTTP request sent, awaiting response... 200 OK
Length: 247594 (242K) [application/x-gzip]
Saving to: `pip-1.3.1.tar.gz'

100%[==========================================================================================>] 247,594     60.9K/s   in 4.0s    

2013-07-15 12:53:52 (60.9 KB/s) - `pip-1.3.1.tar.gz' saved [247594/247594]

[root@Betty WGET_DIR]# 

RuntimeError: Compression requires the (missing) zlib module
[root@Betty WGET_DIR]# tar zxvf setuptools-0.9.1.tar.gz 
[root@Betty WGET_DIR]# cd  setuptools-0.9.1
[root@Betty setuptools-0.9.1]# python setup.py install
...
creating 'dist/setuptools-0.9.1-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
Traceback (most recent call last):
  File "setup.py", line 198, in <module>
    dist = setuptools.setup(**setup_params)
  File "/usr/local/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/root/workstation/WGET_DIR/setuptools-0.9.1/setuptools/command/install.py", line 73, in run
    self.do_egg_install()
  File "/root/workstation/WGET_DIR/setuptools-0.9.1/setuptools/command/install.py", line 93, in do_egg_install
    self.run_command('bdist_egg')
  File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/root/workstation/WGET_DIR/setuptools-0.9.1/setuptools/command/bdist_egg.py", line 246, in run
    dry_run=self.dry_run, mode=self.gen_header())
  File "/root/workstation/WGET_DIR/setuptools-0.9.1/setuptools/command/bdist_egg.py", line 545, in make_zipfile
    z = zipfile.ZipFile(zip_filename, mode, compression=compression)
  File "/usr/local/lib/python2.7/zipfile.py", line 732, in __init__
    "Compression requires the (missing) zlib module"
RuntimeError: Compression requires the (missing) zlib module
[root@Betty setuptools-0.9.1]# 

setuptools-0.9.1을 설치하는 과정에서 zlib 라이브러리가 부족합니다.왜냐하면 내가 Python2.7을 설치할 때 zlib와 zlib-devel을 설치하지 않았기 때문이다.다음에 이 두 라이브러리가 설치되었지만 이 때 Python에서 그것을 컴파일하지 않았습니다.그래서 파이썬을 다시 컴파일해야 돼요.설치되지 않은 경우 다음 명령을 사용하여 설치할 수 있습니다.
# yum install zlib zlib-devel

setuptools-0.9.1을 다시 설치했습니다.
[root@Betty setuptools-0.9.1]# python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to setuptools.egg-info/requires.txt
writing setuptools.egg-info/PKG-INFO
writing top-level names to setuptools.egg-info/top_level.txt
writing dependency_links to setuptools.egg-info/dependency_links.txt
writing entry points to setuptools.egg-info/entry_points.txt
reading manifest file 'setuptools.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'setuptools.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying setuptools.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying setuptools.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating 'dist/setuptools-0.9.1-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing setuptools-0.9.1-py2.7.egg
Copying setuptools-0.9.1-py2.7.egg to /usr/local/lib/python2.7/site-packages
Adding setuptools 0.9.1 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-2.7 script to /usr/local/bin

Installed /usr/local/lib/python2.7/site-packages/setuptools-0.9.1-py2.7.egg
Processing dependencies for setuptools==0.9.1
Finished processing dependencies for setuptools==0.9.1
[root@Betty setuptools-0.9.1]# 

AttributeError: 'module' object has no attribute 'HTTPSConnection'
setuptools와 pip를 성공적으로 설치한 후 pika를 설치합니다.
[root@Betty ~]# pip install pika==0.9.13
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.3.1', 'console_scripts', 'pip')()
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 378, in load_entry_point
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2566, in load_entry_point
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2260, in load
  File "/usr/local/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/__init__.py", line 11, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/local/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/vcs/mercurial.py", line 9, in <module>
    from pip.download import path_to_url2
  File "/usr/local/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/download.py", line 72, in <module>
    class VerifiedHTTPSConnection(httplib.HTTPSConnection):
AttributeError: 'module' object has no attribute 'HTTPSConnection'
[root@Betty ~]#

네티즌은 Python 컴파일 설치 시 SSL 관련 라이브러리가 부족하기 때문에 openssl-devel을 설치한 후 다시 컴파일하여 설치해야 한다고 말했다.
[root@Betty ~]# yum -y install openssl-devel

설치가 성공하면 설치Python을 다시 컴파일하여 pip 명령을 실행하여 pika를 설치합니다.
[root@Betty ~]# pip install pika==0.9.13
Downloading/unpacking pika==0.9.13
  Downloading pika-0.9.13.tar.gz (63kB): 63kB downloaded
  Running setup.py egg_info for package pika
    
Installing collected packages: pika
  Running setup.py install for pika
    
Successfully installed pika
Cleaning up...
[root@Betty ~]# 

좋은 웹페이지 즐겨찾기