配置用户身份验证方法
直通身份验证和 Web 身份验证是对用户进行身份验证的两种身份验证方法。
了解直通身份验证
直通用户身份验证是主动身份验证的一种形式;调用直通身份验证时,系统会提示用户输入用户名和密码。如果用户的身份得到验证,则允许用户通过防火墙并访问请求的资源。
当用户尝试发起具有需要身份验证的策略的 HTTP、HTTPS、FTP 或 Telnet 连接请求时,设备会拦截该请求并提示用户输入用户名和密码。根据配置,设备通过将用户名和密码与存储在本地数据库或外部身份验证服务器上的用户名和密码进行核对来验证用户名和密码。
如果使用外部身份验证服务器,则在收集用户的凭据后,将通过防火墙用户身份验证处理这些凭据。支持以下外部身份验证服务器:
RADIUS 身份验证和授权(与瞻博网络钢带 RADIUS 服务器兼容)
如果除了身份验证之外,还希望获取有关用户访问权限(用户可以在网络上执行的操作)的授权信息,则可以使用外部 RADIUS 服务器。
仅 LDAP 身份验证(支持 LDAP 版本 3,与 Windows AD 兼容)
仅 SecurID 身份验证(使用 RSA SecurID 外部身份验证服务器)
防火墙用户是在跨防火墙启动连接时必须提供用户名和密码进行身份验证的网络用户。您可以将多个用户帐户组合在一起以形成一个用户组,该用户组可以存储在本地数据库或 RADIUS、LDAP 或 SecurID 服务器上。在策略中引用身份验证用户组和外部身份验证服务器时,与策略匹配的流量将触发身份验证检查。
您可以使用家族 inet 来分配 IPv4 地址。您可以使用家族 inet6 分配 IPv6 地址。接口可以同时配置 IPv4 和 IPv6 地址。为简洁起见,这些示例仅使用 IPv4 地址。
图 1 中的步骤如下:
客户端用户向 198.51.100.9 发送 FTP、HTTP、HTTPS 或 Telnet 数据包。
设备拦截数据包,注意其策略需要来自本地数据库或外部身份验证服务器的身份验证,并缓冲数据包。
设备通过 FTP、HTTP、HTTPS 或 Telnet 提示用户输入登录信息。
用户使用用户名和密码进行回复。
设备要么检查其本地数据库上的身份验证用户帐户,要么按照策略中的指定将登录信息发送到外部身份验证服务器。
找到有效的匹配项(或从外部身份验证服务器接收此类匹配项的通知),设备会通知用户登录成功。
对于 HTTP、HTTPS 或 Telnet 流量,设备将数据包从其缓冲区转发到其目标 IP 地址 198.51.100.9/24。但是,对于 FTP 流量,身份验证成功后,设备将关闭会话,用户必须重新连接到 IP 地址为 198.51.100.9/24 的 FTP 服务器。
出于安全考虑,我们建议您对为 HTTP 直通身份验证配置的安全策略使用 Web 重定向而不是直接直通身份验证。Web 浏览器可以通过自动包含对目标 Web 服务器的后续请求的凭据来提供安全性。
设备在特定源 IP 地址对用户进行身份验证后,随后会允许来自同一地址的任何其他用户的流量(如要求通过直通进行身份验证的策略中所指定的那样)。如果用户从将所有原始源地址更改为单个转换地址的 NAT 设备后面发起流量,则可能会出现这种情况。
在安全性的优先级高于便利性的情况下,建议使用直通用户身份验证方法。此身份验证方法仅适用于与触发它的策略匹配的会话和子会话。如果谨慎使用,可以在面向 Internet 的链接上应用此方法。
示例:配置直通身份验证
此示例说明如何配置直通身份验证以对防火墙用户进行身份验证。防火墙用户是在跨防火墙启动连接时必须提供用户名和密码的网络用户。
直通身份验证允许 SRX 系列管理员限制尝试使用 FTP、Telnet、HTTP 或 HTTPS 访问其他区域中资源的用户。如果流量与其操作为直通身份验证的安全策略匹配,则用户需要提供登录信息。
对于 HTTPS,为了确保安全性,HTTPS 默认证书密钥大小为 2048 位。如果未指定证书大小,则采用默认大小。
要求
在开始之前,请定义防火墙用户。请参阅防火墙用户身份验证概述。
此示例使用以下硬件和软件组件:
SRX 系列防火墙
防火墙用户的系统
数据包目标系统
概述
当客户端(称为防火墙用户)尝试启动 FTP、Telnet 或 HTTP 会话以访问另一个区域中的资源时,将触发直通身份验证过程。SRX 系列防火墙充当 FTP、Telnet、HTTP 或 HTTPS 服务器的代理,以便在允许用户访问防火墙后面的实际 FTP、Telnet 或 HTTP 服务器之前,先对防火墙用户进行身份验证。
如果防火墙用户发送的连接请求生成的流量与安全策略规则双向匹配,并且该规则将直通防火墙身份验证指定为其子句的操作 then ,则 SRX 系列防火墙要求防火墙用户向 Junos OS 代理服务器进行身份验证。
如果身份验证成功,则来自同一源 IP 地址的后续流量与安全策略元组匹配,则会自动允许该流量通过 SRX 系列防火墙。
图 2 显示了此示例中使用的拓扑。
尽管拓扑显示了外部服务器的使用情况,但配置中未涵盖该外部服务器。它超出了此示例的范围。
配置
程序
CLI 快速配置
要快速配置此示例,请将以下命令复制到文本文件,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit 。
set interfaces ge-0/0/1 unit 0 family inet address 203.0.113.35/24 set interfaces ge-5/0/0 unit 0 family inet address 192.0.2.1/24 set access profile FWAUTH client FWClient1 firewall-user password password set access firewall-authentication pass-through default-profile FWAUTH set access firewall-authentication pass-through telnet banner success "WELCOME TO JUNIPER TELNET SESSION" set security zones security-zone UT-ZONE host-inbound-traffic system-services all set security zones security-zone UT-ZONE interfaces ge-0/0/1.0 host-inbound-traffic protocols all set security zones security-zone T-ZONE host-inbound-traffic system-services all set security zones security-zone T-ZONE interfaces ge-5/0/0.0 host-inbound-traffic protocols all set security policies from-zone UT-ZONE to-zone T-ZONE policy P1 match source-address any set security policies from-zone UT-ZONE to-zone T-ZONE policy P1 match destination-address any set security policies from-zone UT-ZONE to-zone T-ZONE policy P1 match application junos-telnet set security policies from-zone UT-ZONE to-zone T-ZONE policy P1 then permit firewall-authentication pass-through client-match FWClient1
分步过程
以下示例要求您在配置层次结构中导航各个级别。有关如何执行此操作的说明,请参阅 在配置模式下使用 CLI 编辑器。
要配置直通身份验证,请执行以下操作:
配置两个接口并为其分配 IP 地址。
注意:对于此示例,可以选择为接口分配两个地址。
[edit] user@host# set interfaces ge-0/0/1 unit 0 family inet address 203.0.113.35/24 user@host# set interfaces ge-5/0/0 unit 0 family inet address 192.0.2.1/24
为 FWClient1 用户创建 FWAUTH 访问配置文件,指定用户的密码,并为 Telnet 会话定义成功横幅。
[edit access] user@host# set access profile FWAUTH client FWClient1 firewall-user password pwd user@host# set firewall-authentication pass-through default-profile FWAUTH user@host# set firewall-authentication pass-through telnet banner success "WELCOME TO JUNIPER TELNET SESSION"
配置安全区域。
注意:对于此示例,可以选择为安全区域配置第二个接口。
[edit security zones] user@host# set security-zone UT-ZONE host-inbound-traffic system-services all user@host# set security-zone UT-ZONE interfaces ge-0/0/1.0 host-inbound-traffic protocols all user@host# set security-zone T-ZONE host-inbound-traffic system-services all user@host# set security-zone T-ZONE interfaces ge-5/0/0.0 host-inbound-traffic protocols all
将安全策略 P1 分配给安全区域。
[edit security policies] user@host# set from-zone UT-ZONE to-zone T-ZONE policy P1 match source-address any user@host# set from-zone UT-ZONE to-zone T-ZONE policy P1 match destination-address any user@host# set from-zone UT-ZONE to-zone T-ZONE policy P1 match application junos-telnet user@host# set from-zone UT-ZONE to-zone T-ZONE policy P1 then permit firewall-authentication pass-through client-match FWClient1
使用 Telnet 验证要托管 2 的 FWClient1 防火墙用户。
user@FWClient1# run telnet 192.0.2.1/24 Trying 192.0.2.1/24... Connected to 192.0.2.1/24 Escape character is '^]'. Firewall User Authentication Username: FWClient1 Password:$ABC123 WELCOME TO JUNIPER TELNET SESSION Host1 (ttyp0) login: user Password: $ABC123 --- JUNOS 10.1R1.1 built 2009-10-12 13:30:18 UTC %
结果
在配置模式下,输入以下命令确认您的配置。
show interfaces
show access
show security zones
show security policies
如果输出未显示预期的配置,请重复此示例中的配置说明以进行更正。
为简洁起见,输出仅包含与此示例相关的配置。系统上的任何其他配置都已替换为省略号 (...)。
user@host# show interfaces ge-0/0/1 { unit 0 { family inet { address 203.0.113.35; } } } ge-5/0/0 { unit 0 { family inet { address 192.0.2.1/24; } } } ...
user@host# show access profile FWAUTH { authentication-order password; client FWClient1 { firewall-user { password "$ABC123"; ## SECRET-DATA } } } firewall-authentication { pass-through { default-profile FWAUTH; telnet { banner { success "WELCOME TO JUNIPER TELNET SESSION"; } } } }
user@host# show security zones security-zone UT-ZONE { host-inbound-traffic { system-services { all; } } interfaces { ge-0/0/1.0 { host-inbound-traffic { protocols { all; } } } } security-zone T-ZONE { host-inbound-traffic { system-services { all; } } interfaces { ge-5/0/0.0 { host-inbound-traffic { protocols { all; } } } } }
user@host# show security policies ... from-zone UT-ZONE to-zone T-ZONE { policy P1 { match { source-address any; destination-address any; application junos-telnet; } then { permit { firewall-authentication { pass-through { client-match FWClient1; } } } } } }
如果完成设备配置,请从配置模式输入提交。
验证
要确认配置工作正常,请执行以下任务:
验证防火墙用户身份验证并监控身份验证表中的用户和 IP 地址
目的
显示防火墙身份验证用户历史记录,并验证成功进行身份验证的防火墙用户数和登录失败的防火墙用户数。
行动
在操作模式下,输入以下命令 show
:
user@host> show security firewall-authentication history History of firewall authentication data: Authentications: 2 Id Source Ip Date Time Duration Status User 1 203.0.113.12 2010-10-12 21:24:02 0:00:24 Failed FWClient1 2 203.0.113.12 2010-10-12 21:24:48 0:00:22 Success FWClient1
user@host> show security firewall-authentication history identifier 1 Username: FWClient1 Source IP: 203.0.113.12 Authentication state: Success Authentication method: Pass-through using Telnet Access start date: 2010-10-12 Access start time: 21:24:02 Duration of user access: 0:00:24 Source zone: UT-ZONE Destination zone: T-ZONE Access profile: FWAUTH Bytes sent by this user: 0 Bytes received by this user: 2660
user@host> show security firewall-authentication users Firewall authentication data: Total users in table: 1 Id Source Ip Src zone Dst zone Profile Age Status User 4 203.0.113.12 UT-ZONE T-ZONE FWAUTH 1 Success FWClient1
user@host> show security firewall-authentication users identifier 3 Username: FWClient1 Source IP: 203.0.113.12 Authentication state: Success Authentication method: Pass-through using Telnet Age: 3 Access time remaining: 9 Source zone: UT-ZONE Destination zone: T-ZONE Access profile: FWAUTH Interface Name: ge-0/0/1.0 Bytes sent by this user: 0 Bytes received by this user: 1521
示例:配置 HTTPS 流量以触发直通身份验证
此示例说明如何配置 HTTPS 流量以触发直通身份验证。HTTPS比HTTP更安全,因此它变得更加流行并且使用更广泛。
要求
此示例使用以下硬件和软件组件:
SRX 系列防火墙
两台运行 Linux 和 Open SSL 的 PC。一台 PC 充当客户端,另一台充当 HTTPS 服务器。两台电脑用于创建密钥文件和发送流量。
Junos OS 版本 12.1X44-D10 或更高版本适用于 SRX5400、SRX5600 和 SRX5800 设备,Junos OS 版本 15.1X49-D40 或更高版本适用于 vSRX 虚拟防火墙、SRX300、SRX320、SRX340、SRX345、SRX380、SRX550M 和 SRX1500 服务网关。
从 Junos OS 12.1X44-D10 版和 Junos OS 17.3R1 版开始,在 SRX5400、SRX5600 和 SRX5800 设备上引入了基于 HTTPS 的身份验证。
从 Junos OS 15.1X49-D40 版和 Junos OS 17.3R1 版开始,在 vSRX 虚拟防火墙、SRX300、SRX320、SRX340、SRX345、SRX380、SRX550M 和 SRX1500 服务网关上引入了基于 HTTPS 的身份验证。
准备工作:
SRX 系列防火墙必须解码 HTTPS 流量才能触发直通身份验证。然后,SSL 终止代理创建并安装私钥文件和认证文件。以下列表介绍了创建和安装私钥文件和认证密钥文件的步骤。
如果您有官方的 .crt 文件和 .key 文件,则可以直接在 SRX 系列防火墙上上传和安装这些文件。如果没有 .crt 文件和 .key 文件,请按照过程创建和安装这些文件。步骤 1 和步骤 2 中指定的说明必须在安装了 Linux 和 OpenSSL 的 PC 上运行。步骤 3 和步骤 4 中指定的指令必须在操作模式下运行。
要创建和安装私钥文件和认证文件,请执行以下操作:
在电脑上创建 .key 文件。
openssl genrsa -out /tmp/server.key 1024
在电脑上,创建 .crt 文件。
openssl req -new -x509 -days 365 -key /tmp/server.key -out /tmp/device.crt -subj "/C=CN/ST=BJ/L=BJ/O=JNPR/OU=CNRD/CN=203.0.113.11/emailAddress=device@mycompany.com"
-
将 .key 和 .crt 文件上传到 SRX 系列防火墙,并在操作模式下使用以下命令在设备上安装这些文件:
user@host> request security pki local-certificate load filename /var/tmp/device.crt key /var/tmp/device.key certificate-id device
概述
防火墙身份验证启动要在两台设备上建立的安全连接。网络用户在跨防火墙发起连接时,必须提供用户名和密码进行身份验证。防火墙身份验证支持 HTTPS 流量进行直通身份验证。HTTPS 可以保护用户与 SRX 系列防火墙之间的 HTTP 防火墙身份验证流量。
HTTPS 是 HTTP 的安全版本,HTTP 是在用户和用户连接到的设备之间发送数据的协议。用户和连接的设备之间的所有通信都是加密的。HTTPS 通常用于保护高度机密的在线交易,如网上银行和在线购物订单。
在此示例中,HTTPS 流量用于触发直通身份验证,因为 HTTPS 比 HTTP 更安全。要使 HTTPS 流量触发直通身份验证,必须先配置 SSL 终止配置文件。
图 3 显示了使用 HTTPS 流量的直通身份验证示例。在此示例中,来自不信任区域的主机或用户尝试访问信任区域中的资源。SRX 系列防火墙使用 HTTPS 收集用户名和密码信息。根据此身份验证的结果,允许或拒绝来自主机或用户的后续流量。
配置
CLI 快速配置
要快速配置此示例,请将以下命令复制到文本文件,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit 。
set interfaces ge-0/0/0 unit 0 family inet address 192.0.2.12/24 set interfaces ge-1/0/0 unit 0 family inet address 203.0.113.1/24 set security policies from-zone trust to-zone untrust policy p1 match source-address any set security policies from-zone trust to-zone untrust policy p1 match destination-address any set security policies from-zone trust to-zone untrust policy p1 match application any set security policies from-zone trust to-zone untrust policy p1 then permit firewall-authentication pass-through access-profile local_pf set security policies from-zone trust to-zone untrust policy p1 then permit firewall-authentication pass-through ssl-termination-profile ssl_pf set security policies from-zone trust to-zone untrust policy p1 then log session-init set security policies from-zone trust to-zone untrust policy p1 then log session-close set security zones security-zone trust interfaces ge-0/0/0.0 host-inbound-traffic system-services all set security zones security-zone trust interfaces ge-0/0/0.0 host-inbound-traffic protocols all set security zones security-zone untrust interfaces ge-1/0/0.0 host-inbound-traffic system-services all set security zones security-zone untrust interfaces ge-1/0/0.0 host-inbound-traffic protocols all set access profile local_pf client user1 firewall-user password <password> set access firewall-authentication pass-through default-profile local_pf set services ssl termination profile ssl_pf server-certificate device
程序
分步过程
要将 HTTPS 流量配置为触发直通身份验证,请执行以下操作:
配置接口并分配 IP 地址。
[edit interfaces] user@host# set ge-0/0/0 unit 0 family inet address 192.0.2.12/24 user@host# set ge-1/0/0 unit 0 family inet address 203.0.113.1/24
配置安全策略以允许从区域信任到区域不信任的经过防火墙身份验证的流量。
[edit security policies] user@host# set from-zone trust to-zone untrust policy p1 then permit firewall-authentication pass-through access-profile local_pf user@host# set from-zone trust to-zone untrust policy p1 then permit firewall-authentication pass-through ssl-termination-profile ssl_pf
指定数据包与条件匹配时要执行的策略操作。
[edit security policies] user@host# set from-zone trust to-zone untrust policy p1 match source-address any user@host# set from-zone trust to-zone untrust policy p1 match destination-address any user@host# set from-zone trust to-zone untrust policy p1 match application any user@host# set from-zone trust to-zone untrust policy p1 then log session-init user@host# set from-zone trust to-zone untrust policy p1 then log session-close
配置安全区域并分配接口。
[edit security zones] user@host# set security-zone trust interfaces ge-0/0/0.0 host-inbound-traffic protocols all user@host# set security-zone trust interfaces ge-0/0/0.0 host-inbound-traffic system-services all
为区域配置应用程序服务。
[edit security zones] user@host# set security-zone trust host-inbound-traffic system-services all protocols all user@host# set security-zone untrust host-inbound-traffic system-services all protocols all
创建访问配置文件并将客户端配置为防火墙用户并设置密码。
[edit access] user@host# set profile local_pf client user1 firewall-user password <password>
配置定义身份验证设置的防火墙类型和默认配置文件名称。
[edit access] user@host# set firewall-authentication pass-through default-profile local_pf
配置 SSL 终止配置文件并输入本地证书标识符名称。
[edit services] user@host# set ssl termination profile ssl_pf server-certificate device
结果
在配置模式下,输入 show interfaces
、 、 show access
show security policies
show security zones
和show services ssl termination
命令来确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明以进行更正。
user@host# show interfaces ... interfaces ge-0/0/0 { unit 0 { family inet { address 192.0.2.12; } } } ge-1/0/0 { unit 0 { family inet { address 203.0.113.1/24; } } }
user@host# show security policies ... policies from-zone trust to-zone untrust { policy p1 { match { source-address any; destination-address any; application any; } then { permit { firewall-authentication { pass-through { access-profile local_pf; ssl-termination-profile ssl_pf; } } } log { session-init; session-close; } } } } }
user@host# show security zones ... zones { security-zone trust { interfaces { ge-0/0/0.0 { host-inbound-traffic { system-services { all; } protocols { all; } } } } } security-zone untrust { interfaces { ge-1/0/0.0 { host-inbound-traffic { system-services { all; } protocols { all; } } } } }
user@host# show access ... access { profile local_pf { client user1 { firewall-user { password password; } } } firewall-authentication { pass-through { default-profile local_pf; } }
user@host# show services ssl termination ... services { ssl { termination { profile ssl_pf { server-certificate device; } } } }
如果完成设备配置,请从配置模式输入 commit
。
验证
验证配置
目的
验证配置是否正确。
行动
在操作模式下,输入 show security firewall-authentication users
标识符 1 的命令。
user@host> show security firewall-authentication users identifier 1 Username: user1 Source IP: 203.0.113.1/24 Authentication state: Success Authentication method: Pass-through using HTTPS Age: 0 Access time remaining: 10 Lsys: root-logical-system Source zone: trust Destination zone: untrust Access profile: local_pf Interface Name: ge-0/0/0.0 Bytes sent by this user: 946 Bytes received by this user: 0
意义
该 show security firewall-authentication users
命令显示指定标识符的防火墙认证用户信息。如果输出在“身份验证方法”字段中显示“使用 HTTPS 直通”,在“身份验证状态”字段中显示“成功”,则您的配置正确。
了解 Web 身份验证
Web 身份验证是直通用户身份验证的替代方法。不是指向要从客户端浏览器连接到的资源,而是将浏览器指向设备上启用了 Web 身份验证的 IP 地址。这将启动与设备上托管 Web 身份验证功能的 IP 地址的 HTTP 会话。然后,设备会提示您输入用户名和密码,并将结果缓存在设备中。之后,当流量遇到 Web 身份验证策略时,系统会根据之前的 Web 身份验证结果允许您或拒绝访问,如图 4 所示。
您可以使用家族 inet 来分配 IPv4 地址。您可以使用家族 inet6 分配 IPv6 地址。接口可以同时配置 IPv4 和 IPv6 地址。为简洁起见,这些示例仅使用 IPv4 地址。
请遵循以下 Web 身份验证准则:
您可以将默认 Web 认证服务器保留为本地数据库,也可以为角色选择外部认证服务器。默认 Web 身份验证配置文件确定用户是使用本地数据库还是外部身份验证服务器进行身份验证。访问配置文件存储用户的用户名和密码,或指向存储此类信息的外部身份验证服务器。
Web 身份验证地址必须与要用于托管它的接口位于同一子网中。例如,如果希望身份验证用户通过 IP 地址为 203.0.113.1/24 的 ethernet3 使用 Web 身份验证进行连接,则可以为 Web 身份验证分配 203.0.113.0/24 子网中的 IP 地址。
您可以将 Web 身份验证地址与任何物理接口或虚拟安全接口 (VSI) 的 IP 地址放在同一子网中。(有关不同类型的接口的信息,请参阅 安全区域概述。
您可以将 Web 认证地址放在多个接口上。
设备在特定源 IP 地址对用户进行身份验证后,随后将允许来自同一地址的任何其他用户的流量(如需要通过 Web 身份验证进行身份验证的策略中所指定的那样)。如果用户从将所有原始源地址更改为单个转换地址的 NAT 设备后面发起流量,则可能会出现这种情况。
启用 Web 身份验证后,到 IP 地址的任何 HTTP 流量都将获得 Web 身份验证登录页面,而不是管理员登录页面。禁用此选项将显示管理员登录页面(假设
[system services web-management HTTP]
已启用)。如果某个地址用于 Web 身份验证,我们建议您使用单独的主 IP 地址或首选 IP 地址。
当客户端设备紧邻安全网关,并且高度确定客户端设备不是多用户主机时,建议使用 Web 身份验证方法。此身份验证方法最适合应用于无线链路和 DMZ 或会议室链路。
示例:配置 Web 身份验证
此示例说明如何启用 Web 身份验证并设置一个策略,以便在流量遇到启用了 Web 身份验证的策略时允许用户访问。
要求
准备工作:
定义防火墙用户。请参阅 防火墙用户身份验证概述。
在接口的地址层次结构下添加 Web 身份验证 HTTP 标志以启用 Web 身份验证。
概述
要启用 Web 身份验证,必须指定托管 HTTP 会话的设备的 IP 地址。如果访问受保护资源的防火墙用户希望通过直接访问 Web 服务器或 Web 身份验证来进行身份验证,则使用这些设置。以下说明说明如何设置策略,以便在流量遇到启用了 Web 身份验证的策略 (Policy-W) 时允许访问 FWClient1 用户。(请参阅 图 5。在此示例中,FWClient1 已通过 Web 身份验证登录页面进行身份验证。
FWClient1 防火墙用户执行以下操作来进行身份验证:
将浏览器指向 Web 身份验证 IP (198.51.100.63/24) 以首先进行身份验证
启动流量以访问策略 W 策略指定的资源
当您按照这些说明中的说明配置设备并且用户成功进行身份验证时,将显示 图 6 中所示的屏幕。
配置
程序
CLI 快速配置
要快速配置此示例,请将以下命令复制到文本文件,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit 。
set interfaces ge-0/0/1 unit 0 family inet address 198.51.100.23/24
set interfaces ge-0/0/1 unit 0 family inet address 198.51.100.63/24 web-authentication http
set interfaces fe-5/0/0 unit 0 family inet address 203.0.113.15/24
set access profile WEBAUTH client FWClient1 firewall-user password pwd
set access firewall-authentication web-authentication default-profile WEBAUTH
set access firewall-authentication web-authentication banner success "WEB AUTH LOGIN SUCCESS"
set security zones security-zone UT-ZONE host-inbound-traffic system-services all
set security zones security-zone UT-ZONE interfaces ge-0/0/1.0 host-inbound-traffic protocols all
set security zones security-zone T-ZONE host-inbound-traffic system-services all
set security zones security-zone T-ZONE interfaces ge-5/0/0.0 host-inbound-traffic protocols all
set security policies from-zone UT-ZONE to-zone T-ZONE policy P1 match source-address any
set security policies from-zone UT-ZONE to-zone T-ZONE policy P1 match destination-address any
set security policies from-zone UT-ZONE to-zone T-ZONE policy P1 match application any
set security policies from-zone UT-ZONE to-zone T-ZONE policy P1 then permit firewall-authentication web-authentication client-match FWClient1
set system services web-management http interface ge-0/0/1.0
分步过程
以下示例要求您在配置层次结构中导航各个级别。有关如何执行此操作的说明,请参阅 在配置模式下使用 CLI 编辑器。
要配置 Web 身份验证:
配置两个接口并为其分配 IP 地址。
注意:对于此示例,可以选择为接口分配两个地址。
[edit] user@host# set interfaces ge-0/0/1 unit 0 family inet address 198.51.100.23/24 user@host# set interfaces ge-0/0/1 unit 0 family inet address 198.51.100.63/24 web-authentication http user@host# set interfaces fe-5/0/0 unit 0 family inet address 203.0.113.15/24
为 FWClient1 用户创建 WEBAUTH 访问配置文件,指定用户的密码,并定义成功横幅。
[edit access] user@host# set profile WEBAUTH client FWClient1 firewall-user password pwd user@host# set firewall-authentication web-authentication default-profile WEBAUTH user@host# set firewall-authentication web-authentication banner success "WEB AUTH LOGIN SUCCESS"
配置安全区域。
注意:对于此示例,可以选择为安全区域配置第二个接口。
[edit security zones] user@host# set security-zone UT-ZONE host-inbound-traffic system-services all user@host# set security-zone UT-ZONE interfaces ge-0/0/1.0 host-inbound-traffic protocols all user@host# set security-zone T-ZONE host-inbound-traffic system-services all user@host# set security-zone T-ZONE interfaces ge-5/0/0.0 host-inbound-traffic protocols all
将安全策略 P1 分配给安全区域。
[edit security policies] user@host# set from-zone UT-ZONE to-zone T-ZONE policy P1 match source-address any user@host# set from-zone UT-ZONE to-zone T-ZONE policy P1 match destination-address any user@host# set from-zone UT-ZONE to-zone T-ZONE policy P1 match application any user@host# set from-zone UT-ZONE to-zone T-ZONE policy P1 then permit firewall-authentication web-authentication client-match FWClient1
激活设备上的 HTTP 进程(守护程序)。
[edit] user@host# set system services web-management http interface ge-0/0/1.0
结果
在配置模式下,输入以下命令确认您的配置:
show interfaces
show access
show security zones
show security policies
show system services
如果输出未显示预期的配置,请重复此示例中的配置说明以进行更正。
为简洁起见,此 show
输出仅包含与此示例相关的配置。系统上的任何其他配置都已替换为省略号 (...)。
user@host# show interfaces ... } ge-0/0/1{ unit 0 { family inet { address 198.51.100.23/24 { address 198.51.100.63/24 { web-authentication http; } } } } fe-5/0/0 { unit 0 { family inet { address 198.51.100.14/24; } } } ... user@host# show access profile WEBAUTH { client FWClient1 { firewall-user { password "$ABC123"; ## SECRET-DATA } } } firewall-authentication { web-authentication { default-profile WEBAUTH; banner { success "WEB AUTH LOGIN SUCCESS"; } } } user@host# show security zones ... } security-zone UT-ZONE { host-inbound-traffic { system-services { all; } } interfaces { ge-0/0/1.0 { host-inbound-traffic { protocols { all; } } } } } security-zone T-ZONE { host-inbound-traffic { system-services { all; } } interfaces { ge-5/0/0.0 { host-inbound-traffic { protocols { all; } } } } } user@host# show security policies ... from-zone UT-ZONE to-zone T-ZONE { policy P1 { match { source-address any; destination-address any; application any; } then { permit { firewall-authentication { web-authentication { client-match FWClient1; } } } } } } user@host# show system services ... ftp; ssh; telnet; web-management { http { interface g-0/0/1.0; } }
如果完成设备配置,请从配置模式输入 commit
。
验证
要确认配置工作正常,请执行以下任务:
验证防火墙用户身份验证并监控身份验证表中的用户和 IP 地址
目的
显示防火墙身份验证用户历史记录,并验证成功进行身份验证的防火墙用户数和登录失败的防火墙用户数。
行动
在操作模式下,输入以下命令 show
:
user@host> show security firewall-authentication history user@host> show security firewall-authentication history identifier 1 user@host> show security firewall-authentication users user@host> show security firewall-authentication users identifier 3
user@host> show security firewall-authentication history
History of firewall authentication data:
Authentications: 1
Id Source Ip Date Time Duration Status User
5 198.51.100.75 2010-04-24 01:08:57 0:10:30 Success FWClient1
user@host> show security firewall-authentication history identifier 1
Username: FWClient1
Source IP: 198.51.100.752
Authentication state: Success
Authentication method: Web-authentication
Access start date: 2010-10-12
Access start time: 21:24:02
Duration of user access: 0:00:24
Source zone: N/A
Destination zone: N/A
Access profile: WEBAUTH
Bytes sent by this user: 0
Bytes received by this user: 2660
user@host> show security firewall-authentication users
Firewall authentication data:
Total users in table: 1
Id Source Ip Src zone Dst zone Profile Age Status User
4 198.51.100.75 N/A N/A WEBAUTH 1 Success FWClient1
user@host> show security firewall-authentication users identifier 3
Username: FWClient1
Source IP: 198.51.100.75
Authentication state: Success
Authentication method: Web-authentication
Age: 3
Access time remaining: 9
Source zone: N/A
Destination zone: N/A
Access profile: WEBAUTH
Interface Name: ge-0/0/1.0
Bytes sent by this user: 0
Bytes received by this user: 1521
示例:配置 HTTPS 流量以触发 Web 身份验证
此示例说明如何配置 HTTPS 流量以触发 Web 身份验证。HTTPS 广泛用于 Web 身份验证,因为它比 HTTP 更安全。
要求
准备工作:
此示例使用以下硬件和软件组件:
SRX 系列防火墙
两台安装了 Linux 和 Open SSL 的 PC。一台 PC 充当客户端,另一台充当 HTTPS 服务器。两台电脑用于创建密钥文件和发送流量。
Junos OS 版本 12.1X44-D10 或更高版本适用于 SRX5400、SRX5600 和 SRX5800 设备,Junos OS 版本 15.1X49-D40 或更高版本适用于 vSRX 虚拟防火墙、SRX300、SRX320、SRX340、SRX345、SRX380、SRX550M 和 SRX1500 服务网关。
SRX 系列防火墙必须解码 HTTPS 流量才能触发 Web 身份验证。以下列表介绍了创建和安装私钥文件和认证密钥文件的步骤。
如果您有官方 .crt
文件和 .key
文件,则可以直接在SRX系列防火墙上上传并安装文件。如果您没有 .crt
文件和 .key
文件,请按照过程创建和安装文件。步骤 1 和步骤 2 中指定的指令必须在安装了 Linux 和 OpenSSL 的 PC 上运行。步骤 3 和步骤 4 中指定的指令必须在操作模式下运行。
在 PC 上创建
.key
文件。openssl genrsa -out /tmp/server.key 1024
在 PC 上创建
.crt
文件。openssl req -new -x509 -days 365 -key /tmp/server.key -out /tmp/device.crt -subj "/C=CN/ST=BJ/L=BJ/O=JNPR/OU=CNRD/CN=203.0.113.22/emailAddress=device@mycomany.com"
-
从 SRX 系列防火墙,上传和
.key
.crt
文件,然后使用以下命令在设备上安装文件:user@host> request security pki local-certificate load filename /var/tmp/device.crt key /var/tmp/device.key certificate-id device
概述
防火墙身份验证启动要在两台设备上建立的安全连接。网络用户在跨防火墙发起连接时,必须提供用户名和密码进行身份验证。防火墙身份验证支持 HTTPS 流量进行直通身份验证。HTTPS 可以保护用户与 SRX 系列防火墙之间的 HTTP 防火墙身份验证流量。
HTTPS 是 HTTP 的安全版本,HTTP 是在用户和用户连接到的设备之间发送数据的协议。用户和连接的设备之间的所有通信都是加密的。HTTPS 通常用于保护高度机密的在线交易,如网上银行和在线购物订单。
在此示例中,HTTPS 流量用于触发 Web 身份验证,因为 HTTPS 比 HTTP 更安全。
用户使用 HTTPS 访问设备上已启用 Web 身份验证的 IP 地址。在这种情况下,用户不使用 HTTPS 访问受保护资源的 IP 地址。系统会提示用户输入用户名和密码,并由设备验证。根据此 Web 身份验证的结果,允许或拒绝从用户或主机到受保护资源的后续流量。
图 7 显示了使用 HTTPS 流量进行 Web 身份验证的示例。
配置
CLI 快速配置
要快速配置此示例,请将以下命令复制到文本文件,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,将命令复制并粘贴到 [edit] 层次结构级别的 CLI 中,然后从配置模式进入 commit 。
set system services web-management https pki-local-certificate device set interfaces ge-0/0/0 unit 0 family inet address 203.0.113.18/24 set interfaces ge-0/0/0 unit 0 family inet address 203.0.113.115/24 web-authentication https set interfaces ge-0/0/1 unit 0 family inet address 192.0.2.5/24 set security policies from-zone trust to-zone untrust policy p1 match source-address any set security policies from-zone trust to-zone untrust policy p1 match destination-address any set security policies from-zone trust to-zone untrust policy p1 match application any set security policies from-zone trust to-zone untrust policy p1 then permit set access profile local_pf client user1 firewall-user password user1 set access firewall-authentication web-authentication default-profile local_pf set security policies from-zone trust to-zone untrust policy p1 then permit firewall-authentication web-authentication
程序
分步过程
要配置 HTTPS 流量以触发 Web 身份验证,请执行以下操作:
启用对 HTTPS 流量的 Web 管理支持。
[edit system services] user@host# set web-management https pki-local-certificate device
配置接口并分配 IP 地址。在 ge-0/0/0 接口上启用 Web 身份验证。
[edit interfaces] user@host# set ge-0/0/0 unit 0 family inet address 203.0.113.18/24 set ge-0/0/0 unit 0 family inet address 203.0.113.115/24 web-authentication https user@host# set ge-0/0/1 unit 0 family inet address 192.0.2.5/24
配置安全策略以允许从区域信任到区域不信任的经过防火墙身份验证的流量。
[edit security policies] user@host# set from-zone trust to-zone untrust policy p1 match source-address any destination-address any application any user@host# set security policies from-zone trust to-zone untrust policy p1 then permit
创建访问配置文件,将客户端配置为防火墙用户,然后设置密码。
[edit access] user@host# set profile local_pf client user1 firewall-user password user1
配置防火墙身份验证设置的类型。
[edit access] user@host# set firewall-authentication web-authentication default-profile local_pf
指定数据包与条件匹配时要执行的策略操作。
[edit security policies] user@host# set from-zone trust to-zone untrust policy p1 then permit firewall-authentication web-authentication
结果
在配置模式下,输入 show system services
、 show interfaces
、 show security policies
和 show access
命令来确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明以进行更正。
user@host# show system services web-management { https { pki-local-certificate device; } }
user@host# show interfaces ge-0/0/0 { unit 0 { family inet { address 203.0.113.115/24 { web-authentication https; } } } ge-0/0/1 { unit 0 { family inet { address 192.0.2.5/24; } } }
user@host# show security policies from-zone trust to-zone untrust { policy p1 { match { source-address any; destination-address any; application any; } then { permit { firewall-authentication { web-authentication; } } } } }
user@host# show access profile local_pf { client user1 { firewall-user { password "user1"; } } } firewall-authentication { web-authentication { default-profile local_pf; }
如果完成设备配置,请从配置模式输入 commit
。
验证
验证配置
目的
验证配置是否正确。
行动
在操作模式下,输入 show security firewall-authentication users identifier identifier
命令。
示例输出
user@host> show security firewall-authentication users identifier 1 Username: user1 Source IP: 203.1.113.102 Authentication state: Success Authentication method: Web-authentication Age: 0 Access time remaining: 10 Lsys: root-logical-system Source zone: N/A Destination zone: N/A Access profile: local_pf Bytes sent by this user: 0 Bytes received by this user: 0
意义
该 show security firewall-authentication users identifier identifier
命令使用用户的标识符 ID 显示防火墙身份验证用户信息。如果身份验证方法参数显示 Web 身份验证,并且身份验证状态参数在输出中显示成功,则配置正确。