Hi there, i have an uptodate Debian derivate with samba4. The base_filter rule in the modules/ldap file is not accepted. There i gave sambaacctflags but nothing happens. still all users get accepted. in Base_filter I can write what I want, it always like skips this point. So everyone can login, also the disabled accounts. Kind regards Mihajlo -- Adfinis SyGroup AG Mihajlo Joksimovic, System Engineer Güterstrasse 86 | CH-4053 Basel Tel. 061 333 80 33
Mihajlo Joksimovic wrote:
i have an uptodate Debian derivate with samba4. The base_filter rule in the modules/ldap file is not accepted. There i gave sambaacctflags but nothing happens. still all users get accepted. in Base_filter I can write what I want, it always like skips this point. So everyone can login, also the disabled accounts.
If only there was a way to debug this. That was documented in the "man" page. Or the web pages. Or daily on this list. Alan DeKok.
On Wed, Jun 26, 2013 at 9:27 AM, Alan DeKok <aland@deployingradius.com> wrote:
Mihajlo Joksimovic wrote:
i have an uptodate Debian derivate with samba4. The base_filter rule in the modules/ldap file is not accepted. There i gave sambaacctflags but nothing happens. still all users get accepted. in Base_filter I can write what I want, it always like skips this point. So everyone can login, also the disabled accounts.
If only there was a way to debug this. That was documented in the "man" page. Or the web pages. Or daily on this list.
That's funny. :) Because Alan makes us smile, I'll add: radiusd -X -mz
G'day all I've been working with Mihailo on this matter although he's been more into it I try to provide the data you ask for: Prelude: A Samba-disabled user has the following sambaAcctFlags in the LDAP Directory during an ldapsearch i.e.: The user kw978 used for this is a disabled user and thus ldapsearch lists: sambaAcctFlags: [UD ] A not-disabled user would have: sambaAcctFlags: [U ] The radtest command used was: radtest -x kw978 TestRadius1234$ localhost 10 testing123 Now what follows is the output of 'freeradius -X' with the authentication test. Using '-t mschap' doesn't change anything so I guess testing with PAP is (yet?) ok. I hope that help shedding some light - as you can see base_filter is read while starting the daemon, but no matter what is set in base_filter, even invalid stuff, it's simply going to get ignored. The server does LDAP group matching with if-else unlang statements - removing them didnt change the behaviour so I don't think they're the cause. -- Mathieu FreeRADIUS Version 2.1.10, for host x86_64-pc-linux-gnu, built on May 23 2013 at 14:18:01 Copyright (C) 1999-2009 The FreeRADIUS server project and contributors. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You may redistribute copies of FreeRADIUS under the terms of the GNU General Public License v2. Starting - reading configuration files ... including configuration file /etc/freeradius/radiusd.conf including configuration file /etc/freeradius/proxy.conf including configuration file /etc/freeradius/clients.conf including files in directory /etc/freeradius/modules/ including configuration file /etc/freeradius/modules/detail.log including configuration file /etc/freeradius/modules/pap including configuration file /etc/freeradius/modules/policy including configuration file /etc/freeradius/modules/checkval including configuration file /etc/freeradius/modules/sql_log including configuration file /etc/freeradius/modules/preprocess including configuration file /etc/freeradius/modules/sqlcounter_expire_on_login including configuration file /etc/freeradius/modules/counter including configuration file /etc/freeradius/modules/expiration including configuration file /etc/freeradius/modules/perl including configuration file /etc/freeradius/modules/always including configuration file /etc/freeradius/modules/dynamic_clients including configuration file /etc/freeradius/modules/mac2vlan including configuration file /etc/freeradius/modules/attr_rewrite including configuration file /etc/freeradius/modules/digest including configuration file /etc/freeradius/modules/passwd including configuration file /etc/freeradius/modules/echo including configuration file /etc/freeradius/modules/chap including configuration file /etc/freeradius/modules/ippool including configuration file /etc/freeradius/modules/otp including configuration file /etc/freeradius/modules/attr_filter including configuration file /etc/freeradius/modules/files including configuration file /etc/freeradius/modules/opendirectory including configuration file /etc/freeradius/modules/realm including configuration file /etc/freeradius/modules/detail.example.com including configuration file /etc/freeradius/modules/logintime including configuration file /etc/freeradius/modules/sradutmp including configuration file /etc/freeradius/modules/pam including configuration file /etc/freeradius/modules/cui including configuration file /etc/freeradius/modules/detail including configuration file /etc/freeradius/modules/expr including configuration file /etc/freeradius/modules/mac2ip including configuration file /etc/freeradius/modules/unix including configuration file /etc/freeradius/modules/smsotp including configuration file /etc/freeradius/modules/radutmp including configuration file /etc/freeradius/modules/mschap including configuration file /etc/freeradius/modules/linelog including configuration file /etc/freeradius/modules/smbpasswd including configuration file /etc/freeradius/modules/etc_group including configuration file /etc/freeradius/modules/acct_unique including configuration file /etc/freeradius/modules/ldap including configuration file /etc/freeradius/modules/wimax including configuration file /etc/freeradius/modules/exec including configuration file /etc/freeradius/modules/ntlm_auth including configuration file /etc/freeradius/modules/inner-eap including configuration file /etc/freeradius/modules/krb5 including configuration file /etc/freeradius/eap.conf including configuration file /etc/freeradius/sql.conf including configuration file /etc/freeradius/sql/postgresql/dialup.conf including configuration file /etc/freeradius/policy.conf including files in directory /etc/freeradius/sites-enabled/ including configuration file /etc/freeradius/sites-enabled/gymkl-teachers including configuration file /etc/freeradius/sites-enabled/inner-tunnel including configuration file /etc/freeradius/sites-enabled/gymkl-teachers-inner-tunnel including configuration file /etc/freeradius/sites-enabled/default main { user = "freerad" group = "freerad" allow_core_dumps = no } including dictionary file /etc/freeradius/dictionary main { prefix = "/usr" localstatedir = "/var" logdir = "/var/log/freeradius" libdir = "/usr/lib/freeradius" radacctdir = "/var/log/freeradius/radacct" hostname_lookups = no max_request_time = 30 cleanup_delay = 5 max_requests = 1024 pidfile = "/var/run/freeradius/freeradius.pid" checkrad = "/usr/sbin/checkrad" debug_level = 0 proxy_requests = yes log { stripped_names = yes auth = yes auth_badpass = yes auth_goodpass = no } security { max_attributes = 200 reject_delay = 1 status_server = yes } } radiusd: #### Loading Realms and Home Servers #### proxy server { retry_delay = 5 retry_count = 3 default_fallback = no dead_time = 120 wake_all_if_all_dead = no } home_server localhost { ipaddr = 127.0.0.1 port = 1812 type = "auth" secret = "testing123" response_window = 20 max_outstanding = 65536 require_message_authenticator = yes zombie_period = 40 status_check = "status-server" ping_interval = 30 check_interval = 30 num_answers_to_alive = 3 num_pings_to_alive = 3 revive_interval = 120 status_check_timeout = 4 irt = 2 mrt = 16 mrc = 5 mrd = 30 } home_server_pool my_auth_failover { type = fail-over home_server = localhost } realm example.com { auth_pool = my_auth_failover } realm LOCAL { } radiusd: #### Loading Clients #### client localhost { ipaddr = 127.0.0.1 require_message_authenticator = no secret = "testing123" nastype = "other" } client wifi-mgmt-gymnet { ipaddr = 10.1.0.0 netmask = 24 require_message_authenticator = no secret = "35Algen86Quasselnde!Rohrkrepierer$" shortname = "wifi-mgmt-gymnet" nastype = "other" } radiusd: #### Instantiating modules #### instantiate { Module: Linked to module rlm_exec Module: Instantiating module "exec" from file /etc/freeradius/modules/exec exec { wait = no input_pairs = "request" shell_escape = yes } Module: Linked to module rlm_expr Module: Instantiating module "expr" from file /etc/freeradius/modules/expr Module: Linked to module rlm_expiration Module: Instantiating module "expiration" from file /etc/freeradius/modules/expiration expiration { reply-message = "Password Has Expired " } Module: Linked to module rlm_logintime Module: Instantiating module "logintime" from file /etc/freeradius/modules/logintime logintime { reply-message = "You are calling outside your allowed timespan " minimum-timeout = 60 } } radiusd: #### Loading Virtual Servers #### server gymkl-teachers { # from file /etc/freeradius/sites-enabled/gymkl-teachers modules { Module: Checking authenticate {...} for more modules to load Module: Linked to module rlm_pap Module: Instantiating module "pap" from file /etc/freeradius/modules/pap pap { encryption_scheme = "auto" auto_header = no } Module: Linked to module rlm_chap Module: Instantiating module "chap" from file /etc/freeradius/modules/chap Module: Linked to module rlm_mschap Module: Instantiating module "mschap" from file /etc/freeradius/modules/mschap mschap { use_mppe = yes require_encryption = yes require_strong = yes with_ntdomain_hack = yes } Module: Linked to module rlm_unix Module: Instantiating module "unix" from file /etc/freeradius/modules/unix unix { radwtmp = "/var/log/freeradius/radwtmp" } Module: Linked to module rlm_ldap Module: Instantiating module "ldap" from file /etc/freeradius/modules/ldap ldap { server = "aai-dc1.inside.gymkl.ch" port = 7389 password = "iR2veGgy" identity = "cn=aai-dc1,cn=dc,cn=computers,dc=gymkl,dc=ch" net_timeout = 1 timeout = 4 timelimit = 3 tls_mode = no start_tls = no tls_require_cert = "allow" tls { start_tls = yes require_cert = "allow" } basedn = "dc=gymkl,dc=ch" filter = "(uid=%{mschap:User-Name:-%{User-Name}})" base_filter = "(sambaAcctFlags=[U ]" auto_header = no access_attr_used_for_allow = yes groupname_attribute = "cn" groupmembership_filter = "(&(objectClass=posixGroup)(uniqueMember=%{control:Ldap-UserDn}))" dictionary_mapping = "/etc/freeradius/ldap.attrmap" ldap_debug = 40 ldap_connections_number = 5 compare_check_items = no do_xlat = yes edir_account_policy_check = no set_auth_type = yes } rlm_ldap: Registering ldap_groupcmp for Ldap-Group rlm_ldap: Registering ldap_xlat with xlat_name ldap rlm_ldap: reading ldap<->radius mappings from file /etc/freeradius/ldap.attrmap rlm_ldap: LDAP radiusCheckItem mapped to RADIUS $GENERIC$ rlm_ldap: LDAP radiusReplyItem mapped to RADIUS $GENERIC$ rlm_ldap: LDAP radiusAuthType mapped to RADIUS Auth-Type rlm_ldap: LDAP radiusSimultaneousUse mapped to RADIUS Simultaneous-Use rlm_ldap: LDAP radiusCalledStationId mapped to RADIUS Called-Station-Id rlm_ldap: LDAP radiusCallingStationId mapped to RADIUS Calling-Station-Id rlm_ldap: LDAP sambaLMPassword mapped to RADIUS LM-Password rlm_ldap: LDAP sambaNTPassword mapped to RADIUS NT-Password rlm_ldap: LDAP sambaAcctFlags mapped to RADIUS SMB-Account-CTRL-TEXT rlm_ldap: LDAP radiusExpiration mapped to RADIUS Expiration rlm_ldap: LDAP radiusNASIpAddress mapped to RADIUS NAS-IP-Address rlm_ldap: LDAP radiusServiceType mapped to RADIUS Service-Type rlm_ldap: LDAP radiusFramedProtocol mapped to RADIUS Framed-Protocol rlm_ldap: LDAP radiusFramedIPAddress mapped to RADIUS Framed-IP-Address rlm_ldap: LDAP radiusFramedIPNetmask mapped to RADIUS Framed-IP-Netmask rlm_ldap: LDAP radiusFramedRoute mapped to RADIUS Framed-Route rlm_ldap: LDAP radiusFramedRouting mapped to RADIUS Framed-Routing rlm_ldap: LDAP radiusFilterId mapped to RADIUS Filter-Id rlm_ldap: LDAP radiusFramedMTU mapped to RADIUS Framed-MTU rlm_ldap: LDAP radiusFramedCompression mapped to RADIUS Framed-Compression rlm_ldap: LDAP radiusLoginIPHost mapped to RADIUS Login-IP-Host rlm_ldap: LDAP radiusLoginService mapped to RADIUS Login-Service rlm_ldap: LDAP radiusLoginTCPPort mapped to RADIUS Login-TCP-Port rlm_ldap: LDAP radiusCallbackNumber mapped to RADIUS Callback-Number rlm_ldap: LDAP radiusCallbackId mapped to RADIUS Callback-Id rlm_ldap: LDAP radiusFramedIPXNetwork mapped to RADIUS Framed-IPX-Network rlm_ldap: LDAP radiusClass mapped to RADIUS Class rlm_ldap: LDAP radiusSessionTimeout mapped to RADIUS Session-Timeout rlm_ldap: LDAP radiusIdleTimeout mapped to RADIUS Idle-Timeout rlm_ldap: LDAP radiusTerminationAction mapped to RADIUS Termination-Action rlm_ldap: LDAP radiusLoginLATService mapped to RADIUS Login-LAT-Service rlm_ldap: LDAP radiusLoginLATNode mapped to RADIUS Login-LAT-Node rlm_ldap: LDAP radiusLoginLATGroup mapped to RADIUS Login-LAT-Group rlm_ldap: LDAP radiusFramedAppleTalkLink mapped to RADIUS Framed-AppleTalk-Link rlm_ldap: LDAP radiusFramedAppleTalkNetwork mapped to RADIUS Framed-AppleTalk-Network rlm_ldap: LDAP radiusFramedAppleTalkZone mapped to RADIUS Framed-AppleTalk-Zone rlm_ldap: LDAP radiusPortLimit mapped to RADIUS Port-Limit rlm_ldap: LDAP radiusLoginLATPort mapped to RADIUS Login-LAT-Port rlm_ldap: LDAP radiusReplyMessage mapped to RADIUS Reply-Message conns: 0x212aed0 Module: Linked to module rlm_eap Module: Instantiating module "eap" from file /etc/freeradius/eap.conf eap { default_eap_type = "peap" timer_expire = 60 ignore_unknown_eap_types = no cisco_accounting_username_bug = no max_sessions = 2048 } Module: Linked to sub-module rlm_eap_md5 Module: Instantiating eap-md5 Module: Linked to sub-module rlm_eap_leap Module: Instantiating eap-leap Module: Linked to sub-module rlm_eap_gtc Module: Instantiating eap-gtc gtc { challenge = "Password: " auth_type = "PAP" } Module: Linked to sub-module rlm_eap_tls Module: Instantiating eap-tls tls { rsa_key_exchange = no dh_key_exchange = yes rsa_key_length = 512 dh_key_length = 512 verify_depth = 0 pem_file_type = yes private_key_file = "/etc/freeradius/certs/aai.inside.gymkl.ch.key" certificate_file = "/etc/freeradius/certs/aai.inside.gymkl.ch-roots-bundled.pem" CA_file = "/etc/univention/ssl/ucsCA/CAcert.pem" dh_file = "/etc/freeradius/ssl/dh" random_file = "/dev/urandom" fragment_size = 1024 include_length = yes check_crl = no } Module: Linked to sub-module rlm_eap_peap Module: Instantiating eap-peap peap { default_eap_type = "mschapv2" copy_request_to_tunnel = no use_tunneled_reply = no proxy_tunneled_request_as_eap = yes } Module: Linked to sub-module rlm_eap_mschapv2 Module: Instantiating eap-mschapv2 mschapv2 { with_ntdomain_hack = no } Module: Checking authorize {...} for more modules to load Module: Linked to module rlm_preprocess Module: Instantiating module "preprocess" from file /etc/freeradius/modules/preprocess preprocess { huntgroups = "/etc/freeradius/huntgroups" hints = "/etc/freeradius/hints" with_ascend_hack = no ascend_channels_per_line = 23 with_ntdomain_hack = no with_specialix_jetstream_hack = no with_cisco_vsa_hack = no with_alvarion_vsa_hack = no } Module: Linked to module rlm_realm Module: Instantiating module "ntdomain" from file /etc/freeradius/modules/realm realm ntdomain { format = "prefix" delimiter = "\" ignore_default = no ignore_null = no } Module: Linked to module rlm_files Module: Instantiating module "files" from file /etc/freeradius/modules/files files { usersfile = "/etc/freeradius/users" acctusersfile = "/etc/freeradius/acct_users" preproxy_usersfile = "/etc/freeradius/preproxy_users" compat = "no" } Module: Checking preacct {...} for more modules to load Module: Linked to module rlm_acct_unique Module: Instantiating module "acct_unique" from file /etc/freeradius/modules/acct_unique acct_unique { key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port" } Module: Checking accounting {...} for more modules to load Module: Linked to module rlm_detail Module: Instantiating module "detail" from file /etc/freeradius/modules/detail detail { detailfile = "/var/log/freeradius/radacct/%{Client-IP-Address}/detail-%Y%m%d" header = "%t" detailperm = 384 dirperm = 493 locking = no log_packet_header = no } Module: Linked to module rlm_radutmp Module: Instantiating module "radutmp" from file /etc/freeradius/modules/radutmp radutmp { filename = "/var/log/freeradius/radutmp" username = "%{User-Name}" case_sensitive = yes check_with_nas = yes perm = 384 callerid = yes } Module: Instantiating module "sradutmp" from file /etc/freeradius/modules/sradutmp radutmp sradutmp { filename = "/var/log/freeradius/sradutmp" username = "%{User-Name}" case_sensitive = yes check_with_nas = yes perm = 420 callerid = no } Module: Linked to module rlm_sql Module: Instantiating module "sql" from file /etc/freeradius/sql.conf sql { driver = "rlm_sql_postgresql" server = "localhost" port = "" login = "radius" password = "AccountMeNet" radius_db = "radius" read_groups = yes sqltrace = no sqltracefile = "/var/log/freeradius/sqltrace.sql" readclients = no deletestalesessions = yes num_sql_socks = 5 lifetime = 0 max_queries = 0 sql_user_name = "%{User-Name}" default_user_profile = "" nas_query = "SELECT id, nasname, shortname, type, secret, server FROM nas" authorize_check_query = "SELECT id, UserName, Attribute, Value, Op FROM radcheck WHERE Username = '%{SQL-User-Name}' ORDER BY id" authorize_reply_query = "SELECT id, UserName, Attribute, Value, Op FROM radreply WHERE Username = '%{SQL-User-Name}' ORDER BY id" authorize_group_check_query = "SELECT id, GroupName, Attribute, Value, op FROM radgroupcheck WHERE GroupName = '%{Sql-Group}' ORDER BY id" authorize_group_reply_query = "SELECT id, GroupName, Attribute, Value, op FROM radgroupreply WHERE GroupName = '%{Sql-Group}' ORDER BY id" accounting_onoff_query = "UPDATE radacct SET AcctStopTime = ('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval), AcctSessionTime = (EXTRACT(EPOCH FROM ('%S'::timestamp with time zone - AcctStartTime::timestamp with time zone - '%{%{Acct-Delay-Time}:-0}'::interval)))::BIGINT, AcctTerminateCause = '%{Acct-Terminate-Cause}', AcctStopDelay = 0 WHERE AcctStopTime IS NULL AND NASIPAddress= '%{NAS-IP-Address}' AND AcctStartTime <= '%S'::timestamp" accounting_update_query = "UPDATE radacct SET FramedIPAddress = NULLIF('%{Framed-IP-Address}', '')::inet, AcctSessionTime = '%{Acct-Session-Time}', AcctInputOctets = (('%{%{Acct-Input-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Input-Octets}:-0}'::bigint), AcctOutputOctets = (('%{%{Acct-Output-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Output-Octets}:-0}'::bigint) WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress= '%{NAS-IP-Address}' AND AcctStopTime IS NULL" accounting_update_query_alt = "INSERT INTO radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctSessionTime, AcctAuthentic, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, ServiceType, FramedProtocol, FramedIPAddress, XAscendSessionSvrKey) VALUES('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', NULLIF('%{Realm}', ''), '%{NAS-IP-Address}', %{%{NAS-Port}:-NULL}::integer, '%{NAS-Port-Type}', ('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval - '%{%{Acct-Session-Time}:-0}'::interval), '%{Acct-Session-Time}', '%{Acct-Authentic}', (('%{%{Acct-Input-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Input-Octets}:-0}'::bigint), (('%{%{Acct-Output-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Output-Octets}:-0}'::bigint), '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Service-Type}', '%{Framed-Protocol}', NULLIF('%{Framed-IP-Address}', '')::inet, '%{X-Ascend-Session-Svr-Key}')" accounting_start_query = "INSERT INTO radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctAuthentic, ConnectInfo_start, CalledStationId, CallingStationId, ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay, XAscendSessionSvrKey) VALUES('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', NULLIF('%{Realm}', ''), '%{NAS-IP-Address}', %{%{NAS-Port}:-NULL}::integer, '%{NAS-Port-Type}', ('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval), '%{Acct-Authentic}', '%{Connect-Info}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Service-Type}', '%{Framed-Protocol}', NULLIF('%{Framed-IP-Address}', '')::inet, 0, '%{X-Ascend-Session-Svr-Key}')" accounting_start_query_alt = "UPDATE radacct SET AcctStartTime = ('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval), AcctStartDelay = 0, ConnectInfo_start = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}' AND AcctStopTime IS NULL" accounting_stop_query = "UPDATE radacct SET AcctStopTime = ('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval), AcctSessionTime = CASE WHEN '%{Acct-Session-Time}' = '' THEN (EXTRACT(EPOCH FROM ('%S'::TIMESTAMP WITH TIME ZONE - AcctStartTime::TIMESTAMP WITH TIME ZONE - '%{%{Acct-Delay-Time}:-0}'::INTERVAL)))::BIGINT ELSE NULLIF('%{Acct-Session-Time}','')::BIGINT END, AcctInputOctets = (('%{%{Acct-Input-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Input-Octets}:-0}'::bigint), AcctOutputOctets = (('%{%{Acct-Output-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Output-Octets}:-0}'::bigint), AcctTerminateCause = '%{Acct-Terminate-Cause}', AcctStopDelay = 0, FramedIPAddress = NULLIF('%{Framed-IP-Address}', '')::inet, ConnectInfo_stop = '%{Connect-Info}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND UserName = '%{SQL-User-Name}' AND NASIPAddress = '%{NAS-IP-Address}' AND AcctStopTime IS NULL" accounting_stop_query_alt = "INSERT INTO radacct (AcctSessionId, AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctStopTime, AcctSessionTime, AcctAuthentic, ConnectInfo_stop, AcctInputOctets, AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause, ServiceType, FramedProtocol, FramedIPAddress, AcctStopDelay) values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', NULLIF('%{Realm}', ''), '%{NAS-IP-Address}', %{%{NAS-Port}:-NULL}::integer, '%{NAS-Port-Type}', ('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval - '%{%{Acct-Session-Time}:-0}'::interval), ('%S'::timestamp - '%{%{Acct-Delay-Time}:-0}'::interval), NULLIF('%{Acct-Session-Time}', '')::bigint, '%{Acct-Authentic}', '%{Connect-Info}', (('%{%{Acct-Input-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Input-Octets}:-0}'::bigint), (('%{%{Acct-Output-Gigawords}:-0}'::bigint << 32) + '%{%{Acct-Output-Octets}:-0}'::bigint), '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Acct-Terminate-Cause}', '%{Service-Type}', '%{Framed-Protocol}', NULLIF('%{Framed-IP-Address}', '')::inet, 0)" group_membership_query = "SELECT GroupName FROM radusergroup WHERE UserName='%{SQL-User-Name}' ORDER BY priority" connect_failure_retry_delay = 60 simul_count_query = "" simul_verify_query = "" postauth_query = "INSERT INTO radpostauth (username, pass, reply, authdate) VALUES ('%{User-Name}', '%{%{User-Password}:-Chap-Password}', '%{reply:Packet-Type}', NOW())" safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /" } rlm_sql (sql): Driver rlm_sql_postgresql (module rlm_sql_postgresql) loaded and linked rlm_sql (sql): Attempting to connect to radius@localhost:/radius rlm_sql (sql): starting 0 rlm_sql (sql): Attempting to connect rlm_sql_postgresql #0 rlm_sql (sql): Connected new DB handle, #0 rlm_sql (sql): starting 1 rlm_sql (sql): Attempting to connect rlm_sql_postgresql #1 rlm_sql (sql): Connected new DB handle, #1 rlm_sql (sql): starting 2 rlm_sql (sql): Attempting to connect rlm_sql_postgresql #2 rlm_sql (sql): Connected new DB handle, #2 rlm_sql (sql): starting 3 rlm_sql (sql): Attempting to connect rlm_sql_postgresql #3 rlm_sql (sql): Connected new DB handle, #3 rlm_sql (sql): starting 4 rlm_sql (sql): Attempting to connect rlm_sql_postgresql #4 rlm_sql (sql): Connected new DB handle, #4 Module: Linked to module rlm_attr_filter Module: Instantiating module "attr_filter.accounting_response" from file /etc/freeradius/modules/attr_filter attr_filter attr_filter.accounting_response { attrsfile = "/etc/freeradius/attrs.accounting_response" key = "%{User-Name}" } Module: Checking session {...} for more modules to load Module: Checking post-proxy {...} for more modules to load Module: Checking post-auth {...} for more modules to load Module: Linked to module rlm_always Module: Instantiating module "noop" from file /etc/freeradius/modules/always always noop { rcode = "noop" simulcount = 0 mpp = no } Module: Instantiating module "reject" from file /etc/freeradius/modules/always always reject { rcode = "reject" simulcount = 0 mpp = no } } # modules } # server server inner-tunnel { # from file /etc/freeradius/sites-enabled/inner-tunnel modules { Module: Checking authenticate {...} for more modules to load Module: Checking authorize {...} for more modules to load Module: Checking session {...} for more modules to load Module: Checking post-proxy {...} for more modules to load Module: Checking post-auth {...} for more modules to load } # modules } # server server gymkl-teachers-inner-tunnel { # from file /etc/freeradius/sites-enabled/gymkl-teachers-inner-tunnel modules { Module: Checking authenticate {...} for more modules to load Module: Checking authorize {...} for more modules to load Module: Checking session {...} for more modules to load Module: Checking post-proxy {...} for more modules to load Module: Checking post-auth {...} for more modules to load } # modules } # server server { # from file /etc/freeradius/radiusd.conf modules { Module: Checking authenticate {...} for more modules to load Module: Checking authorize {...} for more modules to load Module: Checking preacct {...} for more modules to load Module: Checking accounting {...} for more modules to load Module: Checking session {...} for more modules to load Module: Checking post-proxy {...} for more modules to load Module: Checking post-auth {...} for more modules to load } # modules } # server radiusd: #### Opening IP addresses and Ports #### listen { type = "auth" ipaddr = 127.0.0.1 port = 0 } listen { type = "acct" ipaddr = 127.0.0.1 port = 0 } listen { type = "auth" ipaddr = 10.0.0.5 port = 0 } listen { type = "acct" ipaddr = 10.0.0.5 port = 0 } listen { type = "auth" ipaddr = 10.0.0.6 port = 1812 } listen { type = "acct" ipaddr = 10.0.0.6 port = 1813 } listen { type = "auth" ipaddr = 127.0.0.1 port = 11812 } Listening on authentication address 127.0.0.1 port 1812 Listening on accounting address 127.0.0.1 port 1813 Listening on authentication address 10.0.0.5 port 1812 Listening on accounting address 10.0.0.5 port 1813 Listening on authentication address 10.0.0.6 port 1812 as server gymkl-teachers Listening on accounting address 10.0.0.6 port 1813 as server gymkl-teachers Listening on authentication address 127.0.0.1 port 11812 as server gymkl-teachers Listening on proxy address 10.0.0.5 port 1814 Ready to process requests. rad_recv: Access-Request packet from host 127.0.0.1 port 47689, id=84, length=57 User-Name = "kw978" User-Password = "TestRadius1234$" NAS-IP-Address = 10.0.0.5 NAS-Port = 10 # Executing section authorize from file /etc/freeradius/sites-enabled/default +- entering group authorize {...} ++[preprocess] returns ok ++[chap] returns noop ++[mschap] returns noop [ntdomain] No '\' in User-Name = "kw978", looking up realm NULL [ntdomain] No such realm "NULL" ++[ntdomain] returns noop [eap] No EAP-Message, not doing EAP ++[eap] returns noop ++[files] returns noop [ldap] performing user authorization for kw978 [ldap] expand: (uid=%{mschap:User-Name:-%{User-Name}}) -> (uid=kw978) [ldap] expand: dc=gymkl,dc=ch -> dc=gymkl,dc=ch [ldap] ldap_get_conn: Checking Id: 0 [ldap] ldap_get_conn: Got Id: 0 [ldap] attempting LDAP reconnection [ldap] (re)connect to aai-dc1.inside.gymkl.ch:7389, authentication 0 [ldap] starting TLS [ldap] bind as cn=aai-dc1,cn=dc,cn=computers,dc=gymkl,dc=ch/iR2veGgy to aai-dc1.inside.gymkl.ch:7389 [ldap] waiting for bind result ... [ldap] Bind was successful [ldap] performing search in dc=gymkl,dc=ch, with filter (uid=kw978) [ldap] No default NMAS login sequence [ldap] looking for check items in directory... [ldap] sambaAcctFlags -> SMB-Account-CTRL-TEXT == "[UD ]" [ldap] sambaNTPassword -> NT-Password == 0x3541324146463842343734463936333744463531434442423434343239303933 [ldap] looking for reply items in directory... WARNING: No "known good" password was found in LDAP. Are you sure that the user is configured correctly? [ldap] Setting Auth-Type = LDAP [ldap] user kw978 authorized to use remote access [ldap] ldap_release_conn: Release Id: 0 ++[ldap] returns ok ++[expiration] returns noop ++[logintime] returns noop [pap] Normalizing NT-Password from hex encoding [pap] WARNING: Auth-Type already set. Not setting to PAP ++[pap] returns noop Found Auth-Type = LDAP # Executing group from file /etc/freeradius/sites-enabled/default +- entering group LDAP {...} [ldap] login attempt by "kw978" with password "TestRadius1234$" [ldap] user DN: uid=KW978,cn=schueler,cn=users,ou=gymkl,dc=gymkl,dc=ch [ldap] (re)connect to aai-dc1.inside.gymkl.ch:7389, authentication 1 [ldap] starting TLS [ldap] bind as uid=KW978,cn=schueler,cn=users,ou=gymkl,dc=gymkl,dc=ch/TestRadius1234$ to aai-dc1.inside.gymkl.ch:7389 [ldap] waiting for bind result ... [ldap] Bind was successful [ldap] user kw978 authenticated succesfully ++[ldap] returns ok Login OK: [kw978] (from client localhost port 10) # Executing section post-auth from file /etc/freeradius/sites-enabled/default +- entering group post-auth {...} ++? if (LDAP-Group == "1-2015x") [ldap] Entering ldap_groupcmp() expand: dc=gymkl,dc=ch -> dc=gymkl,dc=ch expand: (&(objectClass=posixGroup)(uniqueMember=%{control:Ldap-UserDn})) -> (&(objectClass=posixGroup)(uniqueMember=uid\3dKW978\2ccn\3dschueler\2ccn\3dusers\2cou\3dgymkl\2cdc\3dgymkl\2cdc\3dch)) [ldap] ldap_get_conn: Checking Id: 0 [ldap] ldap_get_conn: Got Id: 0 [ldap] performing search in dc=gymkl,dc=ch, with filter (&(cn=1-2015x)(&(objectClass=posixGroup)(uniqueMember=uid\3dKW978\2ccn\3dschueler\2ccn\3dusers\2cou\3dgymkl\2cdc\3dgymkl\2cdc\3dch))) rlm_ldap::ldap_groupcmp: User found in group 1-2015x [ldap] ldap_release_conn: Release Id: 0 ? Evaluating (LDAP-Group == "1-2015x") -> TRUE ++? if (LDAP-Group == "1-2015x") -> TRUE ++- entering if (LDAP-Group == "1-2015x") {...} +++[noop] returns noop ++- if (LDAP-Group == "1-2015x") returns noop ++ ... skipping elsif for request 0: Preceding "if" was taken ++ ... skipping elsif for request 0: Preceding "if" was taken ++ ... skipping elsif for request 0: Preceding "if" was taken ++ ... skipping elsif for request 0: Preceding "if" was taken ++ ... skipping else for request 0: Preceding "if" was taken Sending Access-Accept of id 84 to 127.0.0.1 port 47689 Finished request 0. Going to the next request Waking up in 4.9 seconds.
On 26 Jun 2013, at 16:49, Mathieu Simon <mathieu.sim@gmail.com> wrote:
G'day all
I've been working with Mihailo on this matter although he's been more into it I try to provide the data you ask for:
Prelude: A Samba-disabled user has the following sambaAcctFlags in the LDAP Directory during an ldapsearch i.e.: The user kw978 used for this is a disabled user and thus ldapsearch lists: sambaAcctFlags: [UD ] A not-disabled user would have: sambaAcctFlags: [U ]
The radtest command used was: radtest -x kw978 TestRadius1234$ localhost 10 testing123
Now what follows is the output of 'freeradius -X' with the authentication test. Using '-t mschap' doesn't change anything so I guess testing with PAP is (yet?) ok.
I hope that help shedding some light - as you can see base_filter is read while starting the daemon, but no matter what is set in base_filter, even invalid stuff, it's simply going to get ignored.
The server does LDAP group matching with if-else unlang statements - removing them didnt change the behaviour so I don't think they're the cause.
Weird. Well if no one on the list can spot an obvious issue it's probably worth upgrading to 3.0.0 and using the module there. It's much better. else, have you tried the same query with something like ldapsearch? Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team
Couple of things: IIRC the account control flags are checked by the "mschap" module, which I see is running before the LDAP lookup - try moving mschap after LDAP in "authorise" Second, I can't remember if mschap checks the acct control flags in "authorize" or "authenticate". If the latter you'll need to move away from using LDAP bind for auth -- Sent from my phone with, please excuse brevity and typos
G'day all, and thanks Phil for your hints (Arran I'd want to leave 3.0 as an option of last resort even though it's considered RC by now) ;-)
try moving mschap after LDAP in "authorise" Tried this one, no change unfortunately.
Second, I can't remember if mschap checks the acct control flags in "authorize" or "authenticate". If the latter you'll need to move away from using LDAP bind for auth Hmm, I guess that would require me studying the code :-\
Anyway, I'm not entirely sure if I'm going to stay with this setup of this Debian derivative since it uses its own AD to local OpenLDAP replication and It didn't entirely convince me (too many replications and components talking to each other) Best regards Mathieu 2013/6/26 Phil Mayers <p.mayers@imperial.ac.uk>
Couple of things:
IIRC the account control flags are checked by the "mschap" module, which I see is running before the LDAP lookup - try moving mschap after LDAP in "authorise"
Second, I can't remember if mschap checks the acct control flags in "authorize" or "authenticate". If the latter you'll need to move away from using LDAP bind for auth -- Sent from my phone with, please excuse brevity and typos
-- Mathieu Simon mathieu.sim@gmail.com
I had a quick look at the output you sent, and I see this:
base_filter = "*(*sambaAcctFlags=[U ]"
Seems like your are missing a closing bracket... but that should have triggered an error, so I looked at rlm_ldap source, and it seems base filter is only used for the "profile user" whatever that is... (seems to be an entry in the directory that store extra checks to be made, but I never used that) I would suggest you trying to set the filter to: "(&(uid=%{mschap:User-Name:-%{User-Name}})(sambaAcctFlags=[U ]))" (or something like that, my LDAP is rusty), and leave the base_filter commented. I hope this helps, Michael On Fri, Jun 28, 2013 at 9:14 AM, Mathieu Simon <mathieu.sim@gmail.com>wrote:
G'day all, and thanks Phil for your hints
(Arran I'd want to leave 3.0 as an option of last resort even though it's considered RC by now) ;-)
try moving mschap after LDAP in "authorise" Tried this one, no change unfortunately.
Second, I can't remember if mschap checks the acct control flags in "authorize" or "authenticate". If the latter you'll need to move away from using LDAP bind for auth Hmm, I guess that would require me studying the code :-\
Anyway, I'm not entirely sure if I'm going to stay with this setup of this Debian derivative since it uses its own AD to local OpenLDAP replication and It didn't entirely convince me (too many replications and components talking to each other)
Best regards Mathieu
2013/6/26 Phil Mayers <p.mayers@imperial.ac.uk>
Couple of things:
IIRC the account control flags are checked by the "mschap" module, which I see is running before the LDAP lookup - try moving mschap after LDAP in "authorise"
Second, I can't remember if mschap checks the acct control flags in "authorize" or "authenticate". If the latter you'll need to move away from using LDAP bind for auth -- Sent from my phone with, please excuse brevity and typos
-- Mathieu Simon mathieu.sim@gmail.com
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On 28 Jun 2013, at 10:45, Michael Rigoni <michael.rigoni+freeradius-users@gmail.com> wrote:
I had a quick look at the output you sent, and I see this: base_filter = "(sambaAcctFlags=[U ]" Seems like your are missing a closing bracket... but that should have triggered an error, so I looked at rlm_ldap source, and it seems base filter is only used for the "profile user" whatever that is... (seems to be an entry in the directory that store extra checks to be made, but I never used that)
I would suggest you trying to set the filter to: "(&(uid=%{mschap:User-Name:-%{User-Name}})(sambaAcctFlags=[U ]))" (or something like that, my LDAP is rusty), and leave the base_filter commented.
Yep that'd be correct. Why is called base_filter? Because platypus kittens. The rlm_ldap module was completely rewritten for version 3. The old code was so bad, it had gotten to the point where it was impossible to maintain. Out of the 50 odd modules which ship with the server, rlm_ldap was one of only two that got this treatment (the other one was rlm_krb5). -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team
On 28/06/13 08:14, Mathieu Simon wrote:
Second, I can't remember if mschap checks the acct control flags in "authorize" or "authenticate". If the latter you'll need to move away from using LDAP bind for auth Hmm, I guess that would require me studying the code :-\
I've just taken a look - sure enough, rlm_mschap only checks/enforces the SMB-Account-CTRL attribute during "authenticate {}". Since your testing auth request was PAP, mschap will never be called for this, so you're stuck basically.
On 28 Jun 2013, at 11:50, Phil Mayers <p.mayers@IMPERIAL.AC.UK> wrote:
On 28/06/13 08:14, Mathieu Simon wrote:
Second, I can't remember if mschap checks the acct control flags in "authorize" or "authenticate". If the latter you'll need to move away from using LDAP bind for auth Hmm, I guess that would require me studying the code :-\
I've just taken a look - sure enough, rlm_mschap only checks/enforces the SMB-Account-CTRL attribute during "authenticate {}".
Since your testing auth request was PAP, mschap will never be called for this, so you're stuck basically.
Seeing as it's a string value, can't he just pull it out of the directory using the attribute map and check it with a regex? Or is it more complicated than that? -Arran Arran Cudbard-Bell <a.cudbardb@freeradius.org> FreeRADIUS Development Team
On 28/06/13 14:03, Arran Cudbard-Bell wrote:
On 28 Jun 2013, at 11:50, Phil Mayers <p.mayers@IMPERIAL.AC.UK> wrote:
On 28/06/13 08:14, Mathieu Simon wrote:
Second, I can't remember if mschap checks the acct control flags in "authorize" or "authenticate". If the latter you'll need to move away from using LDAP bind for auth Hmm, I guess that would require me studying the code :-\
I've just taken a look - sure enough, rlm_mschap only checks/enforces the SMB-Account-CTRL attribute during "authenticate {}".
Since your testing auth request was PAP, mschap will never be called for this, so you're stuck basically.
Seeing as it's a string value, can't he just pull it out of the directory using the attribute map and check it with a regex?
Sorry, yes. "stuck" is not correct. I meant "can't use the mschap module for this". Numerous other solutions exist, and regexp is probably the easiest.
G'day all I've taken out a configuration from a earlier prototype that I used with Samba/Winbind authentication but didn't use the rlm_ldap for authorization back then. (Having some archives can be quite useful sometimes...) ;-) Since ntlm_auth properly leads to Access-Rejects for disabled users I can ignore how good or how bad rlm_ldap behaves for disabled users as long as it properly checks for group memberships (that's what I'm interested in for LDAP checks) And even if Arran points out the brokenness of rlm_ldap code in FR 2.x, group-checks based on rlm_ldap are working as expected - and thats what I'm required to get working with this Setup. Regarding...
Since your testing auth request was PAP, mschap will never be called for this, so you're stuck basically. The result was same when using radtest with "-t mschap" if that's what you're pointing out.
I guess for the current time I'm going to stay with an ADS-joined Samba and use LDAP only for the authorization part. Summing up, I feel ending up with less components taming overall complexiness a bit. Thank you guys for your Inputs! -- Mathieu
participants (7)
-
Alan DeKok -
Arran Cudbard-Bell -
Mathieu Simon -
Matt Zagrabelny -
Michael Rigoni -
Mihajlo Joksimovic -
Phil Mayers