freeradius的政策没有运行

问题描述 投票:0回答:1

我正在建立一个freeradius服务器进行身份验证。我有policy.conf的问题:policy.conf作为radius.conf加载在$INCLUDE policy.conf但这个文件的内容不起作用。

我通过“test”用户登录测试但是没有拒绝。非常感谢有人能帮助我。

policy {
    #
    #   Forbid all EAP types.
    #
    if (User-Name == 'test'){
            reject
    }

    forbid_eap {
        if (EAP-Message) {
            reject
        }
    }

    #
    #   Forbid all non-EAP types outside of an EAP tunnel.
    #
    permit_only_eap {
        if (!EAP-Message) {
            #  We MAY be inside of a TTLS tunnel.
            #  PEAP and EAP-FAST require EAP inside of
            #  the tunnel, so this check is OK.
            #  If so, then there MUST be an outer EAP message.
            if (!"%{outer.request:EAP-Message}") {
                reject
            }
        }
    }

    #
    #   Forbid all attempts to login via realms.
    #
    deny_realms {
        if (User-Name =~ /@|\\/) {
            reject
        }
    }
}
freeradius radius
1个回答
0
投票

首先,您需要为您的策略命名(如策略部分中的其他策略)。

policy {
    reject_test {
        if (User-Name == 'test'){
            reject
        }
    }
}

然后,您需要在其中一个虚拟服务器的某个部分(authorizeauthenticatepost-auth等等)中列出该策略。

请参阅FreeRADIUS wiki中的concepts page,了解有关哪些部分可以运行以及在哪里运行的基本详细信息。

如果您正在使用库存配置,则可能需要编辑raddb/sites-available/default

在这种情况下,您可能希望将您的政策添加到authorize section

authorize {
    reject_test
    ...
}

您实际上不需要定义策略以便运行使用策略语言,您可以将条件直接插入授权部分。

authorize {
    if (User-Name == 'test'){
        reject
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.