diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:49:47 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:49:47 +0000 |
commit | b486f33989b6fa5fd31509219f0c1e55a2dc7db3 (patch) | |
tree | 62b4ab75fb48b8aa9472b4ceee53943d2443ffb2 /debian/tests/rlm_python3-data | |
parent | Adding upstream version 3.2.1+dfsg. (diff) | |
download | freeradius-debian.tar.xz freeradius-debian.zip |
Adding debian version 3.2.1+dfsg-4+deb12u1.debian/3.2.1+dfsg-4+deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/rlm_python3-data')
3 files changed, 177 insertions, 0 deletions
diff --git a/debian/tests/rlm_python3-data/python3.mods-available b/debian/tests/rlm_python3-data/python3.mods-available new file mode 100644 index 0000000..d10a019 --- /dev/null +++ b/debian/tests/rlm_python3-data/python3.mods-available @@ -0,0 +1,66 @@ +# +# Make sure the PYTHONPATH environmental variable contains the +# directory(s) for the modules listed below. +# +# Uncomment any func_* which are included in your module. If +# rlm_python is called for a section which does not have +# a function defined, it will return NOOP. +# +python3 { + # Path to the python modules + # + # Note that due to limitations on Python, this configuration + # item is GLOBAL TO THE SERVER. That is, you cannot have two + # instances of the python module, each with a different path. + # +# python_path="/path/to/python/files:/another_path/to/python_files/" + + python_path="${modconfdir}/${.:name}" + module = ubuntu_example + + # Pass all VPS lists as a 6-tuple to the callbacks + # (request, reply, config, state, proxy_req, proxy_reply) + # pass_all_vps = no + + # Pass all VPS lists as a dictionary to the callbacks + # Keys: "request", "reply", "config", "session-state", "proxy-request", + # "proxy-reply" + # This option prevales over "pass_all_vps" + # pass_all_vps_dict = no + + mod_instantiate = ${.module} + func_instantiate = instantiate + + mod_detach = ${.module} + func_detach = detach + + mod_authorize = ${.module} + func_authorize = authorize + +# mod_authenticate = ${.module} +# func_authenticate = authenticate + +# mod_preacct = ${.module} +# func_preacct = preacct + +# mod_accounting = ${.module} +# func_accounting = accounting + +# mod_checksimul = ${.module} +# func_checksimul = checksimul + +# mod_pre_proxy = ${.module} +# func_pre_proxy = pre_proxy + +# mod_post_proxy = ${.module} +# func_post_proxy = post_proxy + +# mod_post_auth = ${.module} +# func_post_auth = post_auth + +# mod_recv_coa = ${.module} +# func_recv_coa = recv_coa + +# mod_send_coa = ${.module} +# func_send_coa = send_coa +} diff --git a/debian/tests/rlm_python3-data/python3.sites-available b/debian/tests/rlm_python3-data/python3.sites-available new file mode 100644 index 0000000..93333f8 --- /dev/null +++ b/debian/tests/rlm_python3-data/python3.sites-available @@ -0,0 +1,85 @@ +server python3_test { +listen { + type = auth + ipaddr = * + port = 1234 + limit { + max_connections = 16 + lifetime = 0 + idle_timeout = 30 + } +} +authorize { + filter_username + preprocess + python3 + chap + mschap + digest + suffix + eap { + ok = return + } + files + -sql + -ldap + expiration + logintime + pap +} +authenticate { + Auth-Type PAP { + pap + } + Auth-Type CHAP { + chap + } + Auth-Type MS-CHAP { + mschap + } + mschap + digest + eap +} +preacct { + preprocess + acct_unique + suffix + files +} +accounting { + detail + unix + -sql + exec + attr_filter.accounting_response +} +session { +} +post-auth { + if (session-state:User-Name && reply:User-Name && request:User-Name && (reply:User-Name == request:User-Name)) { + update reply { + &User-Name !* ANY + } + } + update { + &reply: += &session-state: + } + -sql + exec + remove_reply_message_if_eap + Post-Auth-Type REJECT { + -sql + attr_filter.access_reject + eap + remove_reply_message_if_eap + } + Post-Auth-Type Challenge { + } +} +pre-proxy { +} +post-proxy { + eap +} +} diff --git a/debian/tests/rlm_python3-data/ubuntu_example.py.mods-config b/debian/tests/rlm_python3-data/ubuntu_example.py.mods-config new file mode 100644 index 0000000..5b6330f --- /dev/null +++ b/debian/tests/rlm_python3-data/ubuntu_example.py.mods-config @@ -0,0 +1,26 @@ +#! /usr/bin/env python3 + +import radiusd + +def instantiate(p): + radiusd.radlog(radiusd.L_INFO, '*** example.py instantiate ***') + return radiusd.RLM_MODULE_OK + +def authorize(p): + radiusd.radlog(radiusd.L_INFO, '*** example.py authorize ***') + # whatever password was supplied + config = ( ('Cleartext-Password', p[1][1]), ) + if p[0][1] == "ubuntu": + msg = "Hello ubuntu!" + status = radiusd.RLM_MODULE_OK + reply = ( ('Reply-Message', msg), ) + return (radiusd.RLM_MODULE_OK, reply, config) + else: + msg = "You are not ubuntu!" + reply = ( ('Reply-Message', msg), ) + status = radiusd.RLM_MODULE_REJECT + return (status, reply, config) + +def detach(p): + radiusd.radlog(radiusd.L_INFO, "*** example.py detach ***") + return radiusd.RLM_MODULE_OK |