[WallProxy] WallProxy

1. 在Linux/Ubuntu平台导入CA.crt证书。

  1.1. 首先安装libnss3-tools:sudo apt-get install libnss3-tools。

  1.2. 导入证书:certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n WallProxy -i "/path/to/CA.crt"

  1.3. 列出所有证书:certutil -d sql:$HOME/.pki/nssdb -L

  1.4. 查看证书详细信息:certutil -d sql:$HOME/.pki/nssdb -L -n WallProxy

  1.5. 删除证书:certutil -d sql:$HOME/.pki/nssdb -D -n WallProxy

 

2. 生成日志文件。

  WallProxy在Linux环境下运行startup.py没有正确地记录日志,这里改进一下startup.py添加日志功能。

#!/usr/bin/env python2

import sys, os, os.path as ospath

#os.environ['DISABLE_GEVENT'] = '1'

dir = ospath.dirname(sys.argv[0])

sys.path.insert(0, ospath.abspath(ospath.join(dir, 'src.zip')))

del sys, os, ospath, dir



# =========================== Logging ===========================

# Added by iFantasticMe

# 日志文件ifantastic.log记录在相同目录下,日志文件不超过10M,并做3个备份。



import logging

import os

from logging import handlers



class StdLogger(object):

    """Listen to sys.stdout and sys.stderr."""

    def __init__(self, logger=None, level=logging.DEBUG):

        self.logger = logging.getLogger() if logger is None else logger

        self.level = level

        import sys

        sys.stdout = self

        sys.stderr = self



    def write(self, message):

        message = message.strip()

        if message:

            self.logger.log(self.level, message)



log = os.path.join(os.path.dirname(__file__), 'ifantastic.log')

logger = logging.getLogger()

handler = handlers.RotatingFileHandler(log, maxBytes=10 * (1024 ** 2), backupCount=3)

logging.basicConfig(level=logging.DEBUG)

logger.addHandler(handler)

std_logger = StdLogger(logger)

# ===============================================================



from proxy import main

main()

 

 

你可能感兴趣的:(proxy)