即使密码正确,PPPoE pap 身份验证仍失败

即使密码正确,PPPoE pap 身份验证仍失败

我已经在 ubuntu 18.04LTS 虚拟机中设置了一个 ppp 服务器,用于测试过程,其设置如下:

  • /etc/ppp/pap-secrets
#
# /etc/ppp/pap-secrets
#
# This is a pap-secrets file to be used with the AUTO_PPP function of
# mgetty. mgetty-0.99 is preconfigured to startup pppd with the login option
# which will cause pppd to consult /etc/passwd (and /etc/shadow in turn)
# after a user has passed this file. Don't be disturbed therefore by the fact
# that this file defines logins with any password for users. /etc/passwd
# (again, /etc/shadow, too) will catch passwd mismatches.
#
# This file should block ALL users that should not be able to do AUTO_PPP.
# AUTO_PPP bypasses the usual login program so it's necessary to list all
# system userids with regular passwords here.
#
# ATTENTION: The definitions here can allow users to login without a
# password if you don't use the login option of pppd! The mgetty Debian
# package already provides this option; make sure you don't change that.

# INBOUND connections

# Every regular user can use PPP and has to use passwords from /etc/passwd
*   hostname    ""  *

# UserIDs that cannot use PPP at all. Check your /etc/passwd and add any
# other accounts that should not be able to use pppd!
guest   hostname    "*" -
master  hostname    "*" -
root    hostname    "*" -
support hostname    "*" -
stats   hostname    "*" -

# OUTBOUND connections

# Here you should add your userid password to connect to your providers via
# PAP. The * means that the password is to be used for ANY host you connect
# to. Thus you do not have to worry about the foreign machine name. Just
# replace password with your password.
# If you have different providers with different passwords then you better
# remove the following line.

#   *   password
"user1" *   "user1" *
  • /etc/ppp/pppoe-server-options具有以下设置:
# PPP options for the PPPoE server
# LIC: GPL
auth
debug
#plugin /etc/ppp/plugins/rp-pppoe.so
require-pap
login
mtu 500
mru 500
ktune
proxyarp
lcp-echo-interval 10
lcp-echo-failure 2
nobsdcomp
noccp
novj
noipx 

然后我通过以下方式启动 pppoe 服务器:

sudo pppoe-server -C dummyppoe -I enp0s8 -L 10.0.0.1 -l -R 10.0.0.2 -N 265 -O /etc/ppp/pppoe-server-options

另外,我在 virtualbox vm 中有一个 Ubuntu 18.04LTS 客户端,并通过以下命令创建了一个新的 ppp 连接:

nmcli con edit type pppoe con-name "Dummy PPP"

然后在提示的命令界面中输入以下命令:

set pppoe.username user1
set pppoe.password user1
save
quit

并通过命令提示连接:

sudo nmcli device connect enp0s3

但在我的服务器上/var/log/syslog出现以下错误:

May 31 11:53:27 ppp-server pppoe-server[3059]: Session 18 created for client 08:00:27:d0:71:55 (10.0.0.19) on enp0s8 using Service-Name ''
May 31 11:53:27 ppp-server pppd[3059]: pppd 2.4.7 started by user, uid 0
May 31 11:53:27 ppp-server pppd[3059]: using channel 60
May 31 11:53:27 ppp-server pppd[3059]: Using interface ppp0
May 31 11:53:27 ppp-server pppd[3059]: Connect: ppp0 <--> /dev/pts/2
May 31 11:53:27 ppp-server systemd-udevd[3061]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
May 31 11:53:27 ppp-server pppd[3059]: rcvd [LCP ConfReq id=0x1 <mru 1492> <magic 0x8877ed71>]
May 31 11:53:27 ppp-server pppd[3059]: sent [LCP ConfReq id=0x1 <mru 1492> <auth pap> <magic 0xf28cfd90>]
May 31 11:53:27 ppp-server pppd[3059]: sent [LCP ConfAck id=0x1 <mru 1492> <magic 0x8877ed71>]
May 31 11:53:27 ppp-server pppd[3059]: rcvd [LCP ConfAck id=0x1 <mru 1492> <auth pap> <magic 0xf28cfd90>]
May 31 11:53:27 ppp-server pppd[3059]: sent [LCP EchoReq id=0x0 magic=0xf28cfd90]
May 31 11:53:27 ppp-server systemd-timesyncd[603]: Network configuration changed, trying to establish connection.
May 31 11:53:27 ppp-server networkd-dispatcher[1011]: WARNING:Unknown index 63 seen, reloading interface list
May 31 11:53:27 ppp-server pppd[3059]: rcvd [PAP AuthReq id=0x1 user="user1" password=<hidden>]
May 31 11:53:27 ppp-server pppd[3059]: Initializing PAM (3) for user user1
May 31 11:53:27 ppp-server pppd[3059]: ---> PAM INIT Result = 0
May 31 11:53:27 ppp-server pppd[3059]: Attempting PAM authentication
May 31 11:53:27 ppp-server systemd-timesyncd[603]: Synchronized to time server 91.189.89.198:123 (ntp.ubuntu.com).
May 31 11:53:28 ppp-server pppd[3059]: PAM Authentication failed: 7: Authentication failure
May 31 11:53:28 ppp-server pppd[3059]: PAP peer authentication failed for user1
May 31 11:53:28 ppp-server pppd[3059]: Connection terminated.
May 31 11:53:28 ppp-server pppoe[3063]: read (asyncReadFromPPP): Session 18: Input/output error
May 31 11:53:28 ppp-server systemd-timesyncd[603]: Network configuration changed, trying to establish connection.
May 31 11:53:28 ppp-server pppd[3059]: Exit.
May 31 11:53:28 ppp-server pppoe-server[2786]: Session 18 closed for client 08:00:27:d0:71:55 (10.0.0.19) on enp0s8
May 31 11:53:28 ppp-server pppoe-server[2786]: Sent PADT
May 31 11:53:28 ppp-server pppoe-server[2786]: PADT for session 18 received from 08:00:27:D0:71:55; should be from 00:00:00:00:00:00
May 31 11:53:28 ppp-server systemd-timesyncd[603]: Synchronized to time server 91.189.89.198:123 (ntp.ubuntu.com).

此外,在客户端通过 wireshark 对身份验证过程的数据包捕获显示我输入了正确的密码(我知道显示密码不好,但这是一个实验设置,而不是没有任何公共访问权限的生产设置):

287 296.597405  PcsCompu_d0:71:55   PcsCompu_7b:9e:7b   PPP PAP 60  Authenticate-Request (Peer-ID='user1', Password='user1')

尝试进行巴氏涂片验证

我做错什么了?

答案1

为了使其工作,您还应该在 ppp 服务器中创建一个系统用户。在您的示例中,如果使用了 user1,那么您还应该使用以下命令:

sudo useradd user1
sudo passwd user1

并提供密码用户1(或者任何其他密码,假设这是一个实验性的设置,因此我也输入了密码)。我没有办法不用系统用户。

login另一种方法是从中删除选项pppoe-server-options,此选项要求使用系统的用户作为 ppp 用户。

相关内容