跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
peterweb2006
帖子: 9
注册时间: 2016-12-09 13:18
系统: ubuntu 12.04

跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#1

帖子 peterweb2006 » 2016-12-09 13:55

小弟的困惑:
公司提供微软ISA作为公司员工上网的代理,公司有一个部门在ubuntu平台下做开发,时常用到apt-get安装程序及更新。公司的ISA代理无法在ubuntu下满足apt-get的使用。
网上搜索到解法是ubuntu本地安装和配置NTLMAPS访问ISA服务器 ,参见如下link:http://blog.csdn.net/hj33053252/article/details/6193215
一步步安装配置,最终还是无法成功,为这个问题已经纠结了很久,实在没办法,想通过论坛寻求高人指点,如能解决这个issue,小弟愿以身相许 :Haha
配置文件和执行结果请参考附件。
在线等待高人,期盼..........
附件
系統代理配置文件.jpg
server.cfg.txt
(7.2 KiB) 已下载 41 次
120901.jpg
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#2

帖子 poloshiao » 2016-12-09 14:04

終端機指令及回應文字
請直接全部選取/複製/貼上來
方便回文時 直接引用
方便你閱讀
peterweb2006
帖子: 9
注册时间: 2016-12-09 13:18
系统: ubuntu 12.04

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#3

帖子 peterweb2006 » 2016-12-09 14:04

帖子不能沉啊.... :Adore
peterweb2006
帖子: 9
注册时间: 2016-12-09 13:18
系统: ubuntu 12.04

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#4

帖子 peterweb2006 » 2016-12-09 14:05

server.cfg 配置文件:

peter@peter123:~$ cat /usr/local/bin/ntlmaps/server.cfg
#========================================================================
[GENERAL]

LISTEN_PORT:8080

# If you want APS to authenticate you at WWW servers using NTLM then just leave this
# value blank like PARENT_PROXY: and APS will connect to web servers directly.
# You can specify more than one proxy by leaving a space between each one, and
# APS will detect when one fails and automatically fail-over to the next. EG:
#PARENT_PROXY:first_proxy second_proxy third_proxy
# And NOTE that NTLM cannot pass through another proxy server.
PARENT_PROXY:192.168.0.4

PARENT_PROXY_PORT:80

# APS will poll the upstream proxy and attempt to fail-over to a new one if it doesn't
# get a response within an appropriate time frame. The amount of time that it will
# wait for a response before attempting fail-over is specified, in seconds, below:
PARENT_PROXY_TIMEOUT:15

# Set to 1 if you want to grant this authorization service to clients from other computers.
# NOTE: all the users from other hosts that will be using you copy of APS for authentication
# will be using your credentials in NTLM auth at the remote host.
ALLOW_EXTERNAL_CLIENTS:1

# If you want to allow some other but not all computers to use your proxy for authorization,
# just set ALLOW_EXTERNAL_CLIENTS:0 and put friendly IP addresses here.
# Use space as a delimiter.
# NOTE that special addesses don't work here (192.168.3.0 for example).
FRIENDLY_IPS:

# Requested URLs are written to "url.log" file. May be useful.
URL_LOG:0

# When a network service listens for connections, there is a maximum number of connection
# attempts to that service that the underlying OS will allow to backlog waiting for a response
# before the OS will start dropping new connection attempts with 'Connection refused'. The
# standard method of determining the maximum number of backlogged connections is to use the
# SOMAXCONN constant, which is supposed to represent the maximum number that an OS will support
# (for example, 5 on Windows 2000 Pro, and 200 on Windows 2000 server). However, because this
# is a statically compiled value in a Python distribution, usually this instead represents the
# the most conservative value (5 on all Windows platforms, and 128 on the GNU/Linux variant I
# tried). So if you are running (for example) a massively threaded/parallel download manager,
# the default value of, say, 5, or whatever SOMAXCONN happens to be set to, may be too low and
# cause some connections to fail. The value below can be set to any integer (it seems that
# Python just silently caps values above the hard limit for the underlying platform), or it can
# be set to the special value of SOMAXCONN (i.e. MAX_CONNECTION_BACKLOG:SOMAXCONN), to use
# whatever this value happens to be set to in your Python build. Setting this higher than
# necessary may cause APS to consume more memory than you needed to.
MAX_CONNECTION_BACKLOG:5

#========================================================================
[CLIENT_HEADER]

# This section describes what and how the server should change in the clients headers.
# Made in order to prevent parent proxy from seeing that you are using wget instead of IE5.5

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)

# for windows 2000 emulation ;)
# User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT5)

# You can uncomment these chages in client's header to mimic IE5+ better, but in this case
# you may expirience problems with *.html if your client does not really handle compression.
#Accept-Encoding: gzip, deflate

#========================================================================
[NTLM_AUTH]

# Optional value, if leaved blank then APS will use gethostname() to determine
# host's name.
# NOTE1: If you Linux host name differs from Windows host name then it may be that
# MS server wont recognize you host at all and wont grant you access
# to resources requested. Then you have to use this option and APS will use
# this name in NTLM negotiations.
# NOTE2: There are several reports that you can successfully use "foreign" host name
# here. Say, if user may access a resource from 'host1' and may not from 'host2'
# then there is a chance that APS running on 'host2' with NT_HOSTNAME:host1 will
# be able to be granted access to the restricted resource. However use this on
# you own risk as such a trick may be considered as a hack or something.
NT_HOSTNAME:jack123

# Windows Domain.
# NOTE: it is not full qualified internet domain, but windows network domain.
NT_DOMAIN:desy_sh
# What user's name to use during authorization. It may differ form real current username.
# If you enable NTLM_TO_BASIC, below, you can either leave this blank or simply
# hash it out.
USER:jack_ma

# Password. Just leave it blank here and server will request it at the start time,
# or, if you enable NTLM_TO_BASIC, below, you can either leave this blank or simply
# hash it out, and you *won't* be prompted for a password at start time.
PASSWORD:ewefs3234@

# These two options replace old FULL_NTLM option.
# NTLM authentication consists virtually of two parts: LM and NT. Windows95/98 use
# only LM part, WindowsNT/2000 can use NT and LM or just NT part.
# Almost always using just LM part will be enough. I had several reports
# about LM and NT requirement and no about just NT.
# So try to setup 1, 1 only if you have enough reasons to do so and when you understand
# what you are doing.
# 0, 0 is an illegal combination
# NOTE: if you change these options then you have to setup flag option accordingly.
LM_PART:1
NT_PART:0

# Highly experimental option. See research.txt for details.
# LM - 06820000
# NT - 05820000
# LM + NT - 07820000
NTLM_FLAGS: 06820000

# This option makes APS try to translate NTLM authentication to very usual "Basic"
# scheme. Almost all http clients know it. With this option set to 1 user will be requested
# by his browser to enter his credentials and these username and password will be used by
# APS for NTLM authentication at MS Proxy server or Web server.
# In such a case different users can use one runnig APS with their own credentials.
# NOTE1: currently translation works so it allows only one try for entering
# username/password. If you make a mistake you will have to restart you browser.
# NOTE2: With debug:1 basic username/password will be written in log file in clear
# text format. I could try hide it, but the basic scheme is so weak that anybody
# who had access to APS would be able to get it.
NTLM_TO_BASIC:0

#========================================================================
[DEBUG]

# Set this to 1 if you want to see debug info in many log files. One per connection.
DEBUG:0

# Set this to 1 to get even more debug info.
BIN_DEBUG:0

# Set this to 1 to see some strange activity on screen. Actually you won't want it.
SCR_DEBUG:0

# Not actually a debug option but gives you some details on authentication process
# into *.auth logs. Also see research.txt.
AUTH_DEBUG:0
peterweb2006
帖子: 9
注册时间: 2016-12-09 13:18
系统: ubuntu 12.04

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#5

帖子 peterweb2006 » 2016-12-09 16:01

1. 执行配置文件,结果如下也不知道这个结果是否为成功?

peter@jack123:~$ sudo /usr/local/bin/ntlmaps/main.py -c /usr/local/bin/ntlmaps/server.cfg
[sudo] password for peter:
NTLM authorization Proxy Server v0.9.9.0.1
Copyright (C) 2001-2004 by Dmitry Rozmanov and others.
Now listening at peter123 on port 8080
^CGot SIGINT, exiting now...

2. 修改主目录(即/home/yourusername/)下的.bashrc文件:
http_proxy=http://127.0.0.1:8080
export http_proxy

3. apt-get测试,失败。。。
peter@jack123:~$ sudo apt-get upgrade
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#6

帖子 poloshiao » 2016-12-09 16:45

看看這兩篇能否幫上忙

https://help.ubuntu.com/community/AptGe ... http-proxy
Setting up apt-get to use a http-proxy
These are three methods of using apt-get with a http-proxy.

https://help.ubuntu.com/community/AptGe ... proxy_user
How to login a proxy user
peterweb2006
帖子: 9
注册时间: 2016-12-09 13:18
系统: ubuntu 12.04

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#7

帖子 peterweb2006 » 2016-12-12 13:24

poloshiao 写了:看看這兩篇能否幫上忙

https://help.ubuntu.com/community/AptGe ... http-proxy
Setting up apt-get to use a http-proxy
These are three methods of using apt-get with a http-proxy.

https://help.ubuntu.com/community/AptGe ... proxy_user
How to login a proxy user
您说的方法对于企业网域账号来说不可行,对于处在ISA防火墙后面的用户,网域用户名中带有一个反斜杠:,而这在上面的格式中,是不允许的。
所以,才需要本地建一个Proxy做中转。
但还是谢谢你。
peterweb2006
帖子: 9
注册时间: 2016-12-09 13:18
系统: ubuntu 12.04

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#8

帖子 peterweb2006 » 2016-12-12 13:31

帖子不能沉啊,有大神吗?
peterweb2006
帖子: 9
注册时间: 2016-12-09 13:18
系统: ubuntu 12.04

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#9

帖子 peterweb2006 » 2016-12-13 10:01

帖子不能沉啊,有大神吗? 12/13
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#10

帖子 poloshiao » 2016-12-13 15:29

对于处在ISA防火墙后面的用户,网域用户名中带有一个反斜杠:,而这在上面的格式中,是不允许的。
在防火牆 有沒有開放 proxy port ?
參閱
https://help.ubuntu.com/lts/serverguide/squid.html
Squid - Proxy Server
使用 port 搜尋
onlylove
论坛版主
帖子: 5371
注册时间: 2007-01-14 16:23

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#11

帖子 onlylove » 2016-12-13 18:31

这种事,直接给IT团队提需求啊,自己折腾多费事,如果这是你自己的事情,看到以身相许,我就没啥想法了,妹子也许还能考虑下
peterweb2006
帖子: 9
注册时间: 2016-12-09 13:18
系统: ubuntu 12.04

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#12

帖子 peterweb2006 » 2016-12-14 11:18

poloshiao 写了:
对于处在ISA防火墙后面的用户,网域用户名中带有一个反斜杠:,而这在上面的格式中,是不允许的。
在防火牆 有沒有開放 proxy port ?
參閱
https://help.ubuntu.com/lts/serverguide/squid.html
Squid - Proxy Server
使用 port 搜尋
公司现在用的就是Squid + Sarg ,但是我想切回ISA由AD账号统一管理更为方便,虽然我现在也同步在考虑Squid加入AD Group认证。
peterweb2006
帖子: 9
注册时间: 2016-12-09 13:18
系统: ubuntu 12.04

Re: 跪求帮忙,ubuntu下如何使用微软ISA 代理实现apt-get的更新?

#13

帖子 peterweb2006 » 2016-12-14 11:22

onlylove 写了:这种事,直接给IT团队提需求啊,自己折腾多费事,如果这是你自己的事情,看到以身相许,我就没啥想法了,妹子也许还能考虑下
鄙人就是IT :Hehe
回复