配置本地代理cntlm,无需暴露密码
如下的命令用来生成密码Hash:
cntlm -H
Ubuntu下安装步骤:
sudo apt-get update -y
sudo apt-get install -y cntlm
Windows下:
工具下载地址:
http://cntlm.sourceforge.net/
配置文件例子:
#
# Cntlm Authentication Proxy Configuration
#
# NOTE: all values are parsed literally, do NOT escape spaces,
# do not quote. Use 0600 perms if you use plaintext password.
#
Username i00123456
Domain china.huawei.com
Proxy proxy.huawei.com:8080
# NOTE: Use plaintext password only at your own risk
# Use hashes instead. You can use a "cntlm -M" and "cntlm -H"
# command sequence to get the right config for your environment.
# See cntlm man page
# Example secure config shown below.
# PassLM 1AD35398BE6565DDB5C4EF70C0593492
# PassNT 77B9081511704EE852F94227CF48A793
### Only for user 'testuser', domain 'corp-uk'
# PassNTLMv2 D5826E9C665C37C80B53397D5C07BBCB
Auth NTLM
PassLM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PassNT XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PassNTLMv2 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # Only for user 'i00123456', domain 'china.huawei.com'
# Specify the netbios hostname cntlm will send to the parent
# proxies. Normally the value is auto-guessed.
#
# Workstation netbios_hostname
# List of parent proxies to use. More proxies can be defined
# one per line in format <proxy_ip>:<proxy_port>
#
#Proxy 10.0.0.41:8080
#Proxy 10.0.0.42:8080
# List addresses you do not want to pass to parent proxies
# * and ? wildcards can be used
#
NoProxy *-dev.huaweicloud.com;*-dev.myhuaweicloud.com;*.athuawei.com;*.hic.cloud;*.hisilicon.*;*.huawei.com;*.huaweimarine.com;*.huaweimossel.com;*.huaweistatic.com;*.hw3static.com;*.hwht.com;*.hwtelcloud.com;*.hwtrip.com;*.inhuawei.com;*.pinjiantrip.com;*cn-north-5-console.huaweicloud.com;*cn-north-5.myhuaweicloud.com;*cn-north-6.myhuaweicloud.com;10.*;100.10*;100.11*;100.120.*;100.121.*;100.122.*;100.123.*;100.124.*;100.125.*;100.126.*;100.64.*;100.65.*;100.66.*;100.67.*;100.68.*;100.69.*;100.7*;100.8*;100.9*;127.0.0.1*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;172.32.*;7.128.*;7.129.*;7.13*;7.14*;7.15*;7.16*;7.17*;7.18*;7.19*;7.20*;7.21*;7.22*;7.23*;7.24*;7.25*;;wo.hicloud.com
# Specify the port cntlm will listen on
# You can bind cntlm to specific interface by specifying
# the appropriate IP address also in format <local_ip>:<local_port>
# Cntlm listens on 127.0.0.1:3128 by default
#
Listen 3129
# If you wish to use the SOCKS5 proxy feature as well, uncomment
# the following option. It can be used several times
# to have SOCKS5 on more than one port or on different network
# interfaces (specify explicit source address for that).
#
# WARNING: The service accepts all requests, unless you use
# SOCKS5User and make authentication mandatory. SOCKS5User
# can be used repeatedly for a whole bunch of individual accounts.
#
#SOCKS5Proxy 8010
#SOCKS5User dave:password
# Use -M first to detect the best NTLM settings for your proxy.
# Default is to use the only secure hash, NTLMv2, but it is not
# as available as the older stuff.
#
# This example is the most universal setup known to man, but it
# uses the weakest hash ever. I won't have it's usage on my
# conscience. :) Really, try -M first.
#
#Auth LM
#Flags 0x06820000
# Enable to allow access from other computers
#
#Gateway yes
# Useful in Gateway mode to allow/restrict certain IPs
# Specifiy individual IPs or subnets one rule per line.
#
#Allow 127.0.0.1
#Deny 0/0
# GFI WebMonitor-handling plugin parameters, disabled by default
#
#ISAScannerSize 1024
#ISAScannerAgent Wget/
#ISAScannerAgent APT-HTTP/
#ISAScannerAgent Yum/
# Headers which should be replaced if present in the request
#
#Header User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
# Tunnels mapping local port to a machine behind the proxy.
# The format is <local_port>:<remote_host>:<remote_port>
#
#Tunnel 11443:remote.com:443
上面的端口使用的是3129,你可以指定自己的端口。缺省的端口是3128.
配置完成以后:
运行如下命令:
cntlm -H
运行上面命令时,注意路径设置问题,如果在安装目录下,不需要设置路径,如果在其他目录下,需要设置路径。
Windows下与Linux下类似:
把上面生成的三行PassXX替换掉上面配置文件的三行。保存。
可以使用命令行启动:
cntlm [-c config file]
也可以像下面这样启动Windows服务:
system settings:
http_proxy=http://localhost:3129
https_proxy=http://localhost:3129
ftp_proxy=ftp://localhost:3129
- 点赞
- 收藏
- 关注作者
评论(0)