大家幫忙看看,虛擬機上架設的pppoe-server,通過radius-server認證客戶端出錯

火星人 @ 2014-03-04 , reply:0


大家幫忙看看,虛擬機上架設的pppoe-server,通過radius-server認證客戶端出錯

我在自己的虛擬機redhat9.0上用ppp-2.4.4和rp-pppoe3.8建了一個pppoe-server,用window的client端去連接成功。

下一步打算用radius-server來幫pppoe-server認證客戶端。於是在虛擬機上安裝了兩包代碼:radiusclient-0.3.2-0.dag.rh90.i386.rpm 和freeradius-1.1.5。
按照hefish的方法配置freeradius;
1)        修改 clients.conf
# vi /usr/local/freeradius/etc/raddb/clients.conf
client 127.0.0.1 {
secret = 123456
shortname = localhost
nastype = other
}
2)        修改 naslist ,加入:
# vi /usr/local/freeradius/etc/raddb/naslist
localhost local portslave
3) 編輯 users ,加入用戶: (這個用戶是保存在文本文件里的,做測試用)
# vi /usr/local/freeradius/etc/raddb/users
test Auth-Type:=local, User-Password==123456
          Service-Type = Framed-User,
          Framed-Protocol = PPP,
          Framed-IP-Address = 10.0.0.2,
          Framed-IP-Netmask = 255.255.255.0
4)        啟動radiusd,測試radiusd服務:
# /usr/local/freeradius/sbin/radiusd -X
# /usr/local/freeradius/bin/radtest test 123456 localhost 0 123456
出現 Access-Accept的字樣,說明radius-server可以工作了。

接下來配置pppd,使其和radius一起工作
1)        建立一個 /etc/ppp/radius 目錄,用來存放radius的配置,然後把ppp-2.4.4裡面的radius相關配置複製過來:
# mkdir /etc/ppp/radiuds
# cd ppp-2.4.4pppd/plugins/radius/etc
# cp * /etc/ppp/radius
2)        編輯 /etc/ppp/options , 加上radius 支持
# vi /etc/ppp/options 加上下面兩句
plugin /etc/ppp/plugins/radius.so // 注意pppd安裝時候radius.so的位置
radius-config-file /etc/ppp/radius/radiusclient.conf
3) 編輯 radiusclient.conf 文件,如下:(主要是修改一些默認的文件路徑,其他沒什麼要改的)
# cat /etc/ppp/radius/radiusclient.conf
auth_order radius
login_tries 4
login_timeout 60
nologin /etc/nologin
issue /etc/ppp/radius/issue
authserver localhost:1812
acctserver localhost:1813
servers /etc/ppp/radius/servers
dictionary /etc/ppp/radius/dictionary
login_radius /usr/local/sbin/login.radius
seqfile /var/run/radius.seq
mapfile /etc/ppp/radius/port-id-map
default_realm
radius_timeout 10
radius_retries 3
login_local /bin/login
4)配置 /etc/ppp/pppoe-server-options
# cat /etc/ppp/pppoe-server-options
auth
require-chap
lcp-echo-interval 60
lcp-echo-failure 5
5)        設置密碼文件 (先實現文本文件密碼認證)
# cat /etc/ppp/chap-secrets
test  * 123456 *
6)        編輯 servers ,設定radius 伺服器的位置
# cat /etc/ppp/radius/servers
localhost 123456 // 這裡的123456是我前面設置的訪問radius伺服器的密碼
7)        編輯 dictionary ,修改一些路徑設置,主要是最後一個dictionary.microsoft 的路徑設置
# vi /etc/ppp/radius/dictionary
..
...
INCLUDE /etc/ppp/radius/dictionary.microsoft


最後啟動radiusd和pppoe-server,然後用windows的client撥號,顯示錯誤691:由於域上的用戶名和、或密碼無效而拒絕訪問。
查看/var/log/messages:
Jun 12 17:47:36 localhost pppoe-server: Session 1 created for client 00:16:ec:87:33:e5 (10.67.15.1) on eth0 using Service-Name ''
Jun 12 17:47:36 localhost pppd: Plugin /etc/ppp/plugins/radius.so loaded.
Jun 12 17:47:36 localhost pppd: RADIUS plugin initialized.
Jun 12 17:47:36 localhost pppd: pppd 2.4.4 started by root, uid 0
Jun 12 17:47:36 localhost pppd: Using interface ppp0
Jun 12 17:47:36 localhost pppd: Connect: ppp0 <--> /dev/pts/2
Jun 12 17:47:36 localhost /etc/hotplug/net.agent: assuming ppp0 is already up
Jun 12 17:47:46 localhost pppd: Peer test failed CHAP authentication
Jun 12 17:47:46 localhost pppd: Connection terminated.
Jun 12 17:47:46 localhost pppoe: read (asyncReadFromPPP): Session 1: Input/output error
Jun 12 17:47:46 localhost pppd: Exit.
Jun 12 17:47:46 localhost pppoe-server: Session 1 closed for client 00:16:ec:87:33:e5 (10.67.15.1) on eth0
Jun 12 17:47:46 localhost pppoe-server: Sent PADT
Jun 12 17:47:46 localhost pppoe-server: Sent PADT
Jun 12 17:47:47 localhost /etc/hotplug/net.agent: NET unregister event not supported


PS:試了很多次了,也確定了配置文件,一直不能成功,希望大家幫忙看一看是什麼原因。另外,我對radiusclient.conf文件中的一句命令存有疑問:
login_radius /usr/local/sbin/login.radius
login.radius文件本來是沒有的,我安裝了radiusclient-0.3.2-0.dag.rh90.i386.rpm以後才看到這個文件,查看內容如下,個人覺得貌似沒有做什麼特別的事情:
#!/bin/sh
#
# $Id: login.radius,v 1.1.1.1 2003/12/02 10:39:23 sobomax Exp $
#
# Copyright (C) 1998 Lars Fenneberg
#
# See the file COPYRIGHT for the respective terms and conditions.
# If the file is missing contact me at lf@elemental.net
# and I'll send you a copy.
#

cat <<EOF
This is the dummy login.radius script. If you want that this script
does something useful you'll have to replace it.

The following RADIUS environment variables are set:
EOF

set | egrep '^RADIUS_'

echo
echo "Bye, bye."

exit 0
《解決方案》

沒做過
《解決方案》

:em14::em14::em14: 沒有人知道嗎???
《解決方案》

:em14: :em14: :em14:
《解決方案》

radiusd -X的輸出
《解決方案》

root@localhost root]# /usr/local/freeradius/sbin/radiusd -X
Starting - reading configuration files ...
reread_config:  reading radiusd.conf
Config:   including file: /usr/local/freeradius/etc/raddb/proxy.conf
Config:   including file: /usr/local/freeradius/etc/raddb/clients.conf
Config:   including file: /usr/local/freeradius/etc/raddb/snmp.conf
Config:   including file: /usr/local/freeradius/etc/raddb/eap.conf
Config:   including file: /usr/local/freeradius/etc/raddb/sql.conf
main: prefix = "/usr/local/freeradius"
main: localstatedir = "/usr/local/freeradius/var"
main: logdir = "/usr/local/freeradius/var/log/radius"
main: libdir = "/usr/local/freeradius/lib"
main: radacctdir = "/usr/local/freeradius/var/log/radius/radacct"
main: hostname_lookups = no
main: max_request_time = 30
main: cleanup_delay = 5
main: max_requests = 1024
main: delete_blocked_requests = 0
main: port = 0
main: allow_core_dumps = no
main: log_stripped_names = no
main: log_file = "/usr/local/freeradius/var/log/radius/radius.log"
main: log_auth = no
main: log_auth_badpass = no
main: log_auth_goodpass = no
main: pidfile = "/usr/local/freeradius/var/run/radiusd/radiusd.pid"
main: user = "(null)"
main: group = "(null)"
main: usercollide = no
main: lower_user = "no"
main: lower_pass = "no"
main: nospace_user = "no"
main: nospace_pass = "no"
main: checkrad = "/usr/local/freeradius/sbin/checkrad"
main: proxy_requests = yes
proxy: retry_delay = 5
proxy: retry_count = 3
proxy: synchronous = no
proxy: default_fallback = yes
proxy: dead_time = 120
proxy: post_proxy_authorize = no
proxy: wake_all_if_all_dead = no
security: max_attributes = 200
security: reject_delay = 1
security: status_server = no
main: debug_level = 0
read_config_files:  reading dictionary
read_config_files:  reading naslist
Using deprecated naslist file.  Support for this will go away soon.
read_config_files:  reading clients
Using deprecated clients file.  Support for this will go away soon.
read_config_files:  reading realms
radiusd:  entering modules setup
Module: Library search path is /usr/local/freeradius/lib
Module: Loaded exec
exec: wait = yes
exec: program = "(null)"
exec: input_pairs = "request"
exec: output_pairs = "(null)"
exec: packet_type = "(null)"
rlm_exec: Wait=yes but no output defined. Did you mean output=none?
Module: Instantiated exec (exec)
Module: Loaded expr
Module: Instantiated expr (expr)
Module: Loaded PAP
pap: encryption_scheme = "crypt"
Module: Instantiated pap (pap)
Module: Loaded CHAP
Module: Instantiated chap (chap)
Module: Loaded MS-CHAP
mschap: use_mppe = yes
mschap: require_encryption = no
mschap: require_strong = no
mschap: with_ntdomain_hack = no
mschap: passwd = "(null)"
mschap: authtype = "MS-CHAP"
mschap: ntlm_auth = "(null)"
Module: Instantiated mschap (mschap)
Module: Loaded System
unix: cache = no
unix: passwd = "(null)"
unix: shadow = "(null)"
unix: group = "(null)"
unix: radwtmp = "/usr/local/freeradius/var/log/radius/radwtmp"
unix: usegroup = no
unix: cache_reload = 600
Module: Instantiated unix (unix)
Module: Loaded eap
eap: default_eap_type = "md5"
eap: timer_expire = 60
eap: ignore_unknown_eap_types = no
eap: cisco_accounting_username_bug = no
rlm_eap: Loaded and initialized type md5
rlm_eap: Loaded and initialized type leap
gtc: challenge = "Password: "
gtc: auth_type = "PAP"
rlm_eap: Loaded and initialized type gtc
mschapv2: with_ntdomain_hack = no
rlm_eap: Loaded and initialized type mschapv2
Module: Instantiated eap (eap)
Module: Loaded preprocess
preprocess: huntgroups = "/usr/local/freeradius/etc/raddb/huntgroups"
preprocess: hints = "/usr/local/freeradius/etc/raddb/hints"
preprocess: with_ascend_hack = no
preprocess: ascend_channels_per_line = 23
preprocess: with_ntdomain_hack = no
preprocess: with_specialix_jetstream_hack = no
preprocess: with_cisco_vsa_hack = no
Module: Instantiated preprocess (preprocess)
Module: Loaded realm
realm: format = "suffix"
realm: delimiter = "@"
realm: ignore_default = no
realm: ignore_null = no
Module: Instantiated realm (suffix)
Module: Loaded files
files: usersfile = "/usr/local/freeradius/etc/raddb/users"
files: acctusersfile = "/usr/local/freeradius/etc/raddb/acct_users"
files: preproxy_usersfile = "/usr/local/freeradius/etc/raddb/preproxy_users"
files: compat = "no"
Module: Instantiated files (files)
Module: Loaded Acct-Unique-Session-Id
acct_unique: key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port"
Module: Instantiated acct_unique (acct_unique)
Module: Loaded detail
detail: detailfile = "/usr/local/freeradius/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d"
detail: detailperm = 384
detail: dirperm = 493
detail: locking = no
Module: Instantiated detail (detail)
Module: Loaded radutmp
radutmp: filename = "/usr/local/freeradius/var/log/radius/radutmp"
radutmp: username = "%{User-Name}"
radutmp: case_sensitive = yes
radutmp: check_with_nas = yes
radutmp: perm = 384
radutmp: callerid = yes
Module: Instantiated radutmp (radutmp)
Listening on authentication *:1812
Listening on accounting *:1813
Ready to process requests.
《解決方案》

# /usr/local/freeradius/bin/radtest test 123456 localhost 0 123456
Sending Access-Request of id 164 to 127.0.0.1 port 1812
        User-Name = "test"
        User-Password = "123456"
        NAS-IP-Address = 255.255.255.255
        NAS-Port = 0
rad_recv: Access-Accept packet from host 127.0.0.1:1812, id=164, length=44
        Service-Type = Framed-User
        Framed-Protocol = PPP
        Framed-IP-Address = 10.0.0.2
        Framed-IP-Netmask = 255.255.255.0
《解決方案》

回復 #7 hanhan0218 的帖子

不好意思,才看見你LZ的留言.
之前我配置的過程中,碰見的最大問題,就是軟體的版本問題,不要一味的用最新版本的軟體.我就是因為用了最新版本,所以一直無法配置成功.
雖然你是自己測試安裝,建議還是不要使用redhat9.0.畢竟這個版本已經非主流N年了.




[火星人 via ] 大家幫忙看看,虛擬機上架設的pppoe-server,通過radius-server認證客戶端出錯已經有272次圍觀

http://www.coctec.com/docs/service/show-post-21772.html