cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
608
Views
0
Helpful
1
Replies

Step by step instructions to design freeradius to associate by macinto

Step by step instructions to design freeradius to associate by macintosh separating utilizing python. rather I get Access-Reject Straightaway, I might want to set up approval of username and caled-station-id in the SQL data set rather I get Access-Reject Straightaway, I might want to set up approval of username and caled-station-id in the SQL data set rather I get Access-Reject Straightaway, I might want to set up approval of username and caled-station-id in the SQL data set Ubuntu 22.04

freeradius -X

*** Auth ***
{'User-Name': 'test', 'Event-Timestamp': 'Jun 12 2023 07:38:18 UTC', 'NAS-IP-Address': '192.168.1.1'}
Username is 'test'. Granting access.
(('Reply-Message', 'Access granted'),)
authorize - 'reply:Reply-Message' = 'Access granted'
authorize - 'config:Auth-Type' = 'Accept'
(0)     [python3] = ok
(0)   } # authorize = ok
(0) Found Auth-Type = python
(0) # Executing group from file /etc/freeradius/3.0/sites-enabled/default
(0)   Auth-Type python {
(0)     [python3] = noop
(0)   } # Auth-Type python = noop
(0) Failed to authenticate the user
(0) Using Post-Auth-Type Reject
(0) # Executing group from file /etc/freeradius/3.0/sites-enabled/default
(0)   Post-Auth-Type REJECT {
(0) sql: EXPAND .query
(0) sql:    --> .query
(0) sql: Using query template 'query'
rlm_sql (sql): Reserved connection (2)
(0) sql: EXPAND %{User-Name}
(0) sql:    --> test
(0) sql: SQL-User-Name set to 'test'
(0) sql: EXPAND INSERT INTO radpostauth (username, pass, reply, authdate ) VALUES('%{User-Name}', '%{%{User-Password}:-%{Chap-Password}}', '%{reply:Packet-Type}', '%S.%M' )
(0) sql:    --> INSERT INTO radpostauth (username, pass, reply, authdate ) VALUES('test', '', 'Access-Reject', '2023-06-12 07:38:18.029587' )
(0) sql: Executing query: INSERT INTO radpostauth (username, pass, reply, authdate ) VALUES('test', '', 'Access-Reject', '2023-06-12 07:38:18.029587' )
rlm_sql_postgresql: Status: PGRES_COMMAND_OK
rlm_sql_postgresql: query affected rows = 1
(0) sql: SQL query returned: success
(0) sql: 1 record(s) updated
rlm_sql (sql): Released connection (2)
(0)     [sql] = ok
(0) attr_filter.access_reject: EXPAND %{User-Name}
(0) attr_filter.access_reject:    --> test
(0) attr_filter.access_reject: Matched entry DEFAULT at line 11
(0)     [attr_filter.access_reject] = updated
(0)     [eap] = noop
(0)     policy remove_reply_message_if_eap {
(0)       if (&reply:EAP-Message && &reply:Reply-Message) {
(0)       if (&reply:EAP-Message && &reply:Reply-Message)  -> FALSE
(0)       else {
(0)         [noop] = noop
(0)       } # else = noop
(0)     } # policy remove_reply_message_if_eap = noop
(0)   } # Post-Auth-Type REJECT = updated
(0) Delaying response for 1.000000 seconds
Waking up in 0.2 seconds.
Waking up in 0.7 seconds.
(0) Sending delayed response
(0) Sent Access-Reject Id 43 from 192.168.1.2:1812 to 192.168.1.1:62908 length 36
(0)   Reply-Message = "Access granted"
Waking up in 3.9 seconds.

Edit Python3 file nano mods-config/python3/example.py :-  naked pickleball

def instantiate(p):
  print("*** instantiate ***")
  print(p)
  # return 0 for success or -1 for failure


def authenticate(p):
    print ("*** Auth!!***")
    print (p)
    return radiusd.RLM_MODULE_OK

def authorize(p):
    print("*** Auth ***")

    param = {}
    for z in p:
        param[z[0]]=z[1]

    print(param)

    username = param.get("User-Name", "")
    reply = ()

    if username == "test" or username == "ecececececec":
        print("Username is 'test'. Granting access.")
        reply = (("Reply-Message", "Access granted"),)
        conf = (("Auth-Type", "Accept"),)
    else:
        print("Username is not 'test'. Denying access.")
        reply = (("Reply-Message", "Access denied"),)
        conf = (("Auth-Type", "Reject"),)

    print(reply)
    return radiusd.RLM_MODULE_OK, reply, conf

can't get Access-Accept

instead I get Access-Reject Next, I'd like to set up validation of username and caled-station-id in the SQL database

1 Reply 1

marce1000
VIP
VIP

 

             - Go here for your problem : https://freeradius.org/support/

 M.



-- Each morning when I wake up and look into the mirror I always say ' Why am I so brilliant ? '
    When the mirror will then always repond to me with ' The only thing that exceeds your brilliance is your beauty! '
Review Cisco Networking for a $25 gift card