FreeRadius rlm_ldap::ldap_groupcmp: ldap_get_values() failed - freeradius

I'm in the process of configuring freeRadius to our ldap server. I can authenticate from user perspective to radius client. But when radius is trying query about the to ldap groups we are getting these below error
[ldap] performing search in uid=vchevakula#test.us,ou=users,dc=test,dc=us, with filter (objectclass=*)
rlm_ldap::ldap_groupcmp: ldap_get_values() failed or if we are changing any in group membership filter we are getting implementation error
[ldap] ldap_release_conn: Release Id: 0
[files] expand: (&(objectClass=GroupOfUniqueNames)(UniqueMember=%{User-Name})) -> (&(objectClass=GroupOfUniqueNames)(UniqueMember=vchevakula#test.us))
[ldap] ldap_get_conn: Checking Id: 0
[ldap] ldap_get_conn: Got Id: 0
[ldap] performing search in dc=test,dc=us, with filter (&(cn=Dev-Nw)(&(objectClass=GroupOfUniqueNames)(UniqueMember=vchevakula#cstest.us)))
[ldap] object not found
[ldap] ldap_release_conn: Release Id: 0
[ldap] ldap_get_conn: Checking Id: 0
[ldap] ldap_get_conn: Got Id: 0
[ldap] performing search in
uid=vchevakula#cstest.us,ou=users,dc=test,dc=us, with filter (objectclass=*)
rlm_ldap::ldap_groupcmp: ldap_get_values() failed
[ldap] ldap_release_conn: Release Id: 0
users file in free radius
DEFAULT Ldap-Group == "Dev-Nw"
DEFAULT Ldap-Group == "SRE"
Reply-Message = "You are allowed"
modules/ldap in free radius
groupname_attribute = cn
groupmembership_filter = "(&(objectClass=GroupOfUniqueNames)(UniqueMember=%{User-Name}))"
groupmembership_attribute = radiusGroupName
I tried changing the groupmembership filter but none of them worked until right now. I'm getting the same error that it couldn't figure out . Freeradius -X keeps failing on the finding groups
groupname_attribute = cn
#groupmembership_filter = "(&(objectClass=GroupOfUniqueNames)(uniquemember=%{control:Ldap-UserDn}))"
#groupmembership_filter = "(|(&(objectClass=GroupOfNames)(member=%{control:Ldap-UserDn}))(&(objectClass=GroupOfUniqueNames)(uniquemember=%{control:Ldap-UserDn})))"
#groupmembership_filter = "(|(&(objectClass=GroupOfNames)(member=%{Ldap-UserDn}))(&(objectClass=GroupOfUniqueNames)(uniquemember=%{Ldap-UserDn})))"
groupmembership_filter = "(&(objectClass=GroupOfUniqueNames)(UniqueMember=%{User-Name}))"
groupmembership_attribute = radiusGroupName
ldap attributes from ldap server
dn: cn=SRE,ou=groups,dc=test,dc=us
objectClass: top
objectClass: groupofUniqueNames
cn: SRE
uniqueIdentifier: XXXXXXX
description: SRE Team
uniqueMember: uid=vchevakula#test.us,ou=users,dc=test,dc=us
uniqueMember: uid=nuser#test.us,ou=users,dc=test,dc=us
need some help in configuring ldap groups in freeradius

Hello I have resolved my problem
By adding this below line to my configuration in freeradius server /etc/freeradius/modules/ldap
groupmembership_filter = "(&(objectClass=GroupOfUniqueNames)(uniqueMember=%{control:Ldap-UserDn}))"

Related

Slack bot scope not updating

I created a Slack bot using the "New App". Set it as a bot and am using the "OAuth Tokens for Your Workspace". With the following scopes under "Bot token scopes":
app_mentions:read
chat:write
chat:write.customize
files:read
files:write
groups:write
I added some of these permissions after the initial install (if it matters and you have to refresh something?). The bot is installed to a workspace and I have invited it to a private channel.
Using the example of the Slack API documentation:
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
slack_token = SLACK_TOKEN # xoxb-....
client = WebClient(token=slack_token)
try:
"""
response = client.files_upload(
channels="C040W4L2HA6",
file="test.txt",
title="Test upload"
)
"""
response = client.chat_postMessage(
channel="C040W4L2HA6",
text="Hello from your app! :tada:"
)
except SlackApiError as e:
# You will get a SlackApiError if "ok" is False
assert e.response["error"]
For both the file write and message examples I get: "ok":false,"error":"missing_scope","needed":"chat:write:bot","provided":"app_mentions:read" but "needed" changes from "chat:write:bot" to "file:write" if I run that part.
Few issues here. I am using the newest version of the client with Python 3.9 and it asks for a permission that is depricated (write:bot is just write now). In both cases it is as if my only active scope is app_mentions:read, nothing else. When I added the other scopes, I clicked "Request to install" and the person reviewing that accepted.
YAML config:
display_information:
name: BotName
description: Bot desc.
background_color: "#000000"
features:
bot_user:
display_name: botname
always_online: false
oauth_config:
scopes:
user:
- chat:write
bot:
- app_mentions:read
- chat:write
- files:write
- files:read
- groups:write
- chat:write.customize
settings:
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: false
Any ideas?
Under "Install app" I had to reinstall it to the workspace, it was not done automatically.

Jenkins RoleBasedAuthorizationStrategy with OIDC and externally managed role assignments

I am trying to find a way to use the roles I manage in Okta to work with Jenkins. I have been trying to get role-strategy plugin to work, but when I log in, I get <user> is missing the Overall/Read permission.
My configuration includes OIDC for Okta, using oic-auth plugin, and I am specifying the authorizationStrategy config via JCasC. For example I have this on my JCasC okta.yaml:
authorizationStrategy:
roleBased:
roles:
global:
- name: "my_okta_group"
permissions:
- "Overall/Administer"
I see this properly getting converted into $JENKINS_HOME/config.xml.
What I don't specify, but seems to be required, is assignments:, because - it's RBAC after all, and the user assignments into roles should be made in Okta, not Jenkins.
After browsing the plug-in code, it appears hard-wired for an explicit user SID list to be specified in the JCasC. That's not going to work for me.
Is there a different way to use this plug-in to achieve the goal?
Is there another RBAC plug-in that would work better?
The above is very close to a working solution. assignments: is indeed required, and it supports username or group. Also the 'name' of 'authorizationStrategy.roleBased.roles' is the Jenkins role name, not the OIDC group name.
The oic-auth configuration maps OIDC token fields to Jenkins user properties, and then the role-strategy checks for the OIDC token's username, as well as its group(s).
My working config is:
jenkins:
securityRealm:
oic:
clientId: "${clientId}"
clientSecret: "${clientSecret}"
wellKnownOpenIDConfigurationUrl: "${oidcIssuerUrl}/.well-known/openid-configuration"
userInfoServerUrl: "${oidcIssuerUrl}/oauth2/v1/userinfo"
tokenFieldToCheckKey: ""
tokenFieldToCheckValue: ""
fullNameFieldName: "name"
groupsFieldName: "groups"
disableSslVerification: false
logoutFromOpenidProvider: true
endSessionEndpoint: "${oidcIssuerUrl}/oauth2/v1/logout"
postLogoutRedirectUrl: "https://${dns_name_full}"
escapeHatchEnabled: false
escapeHatchUsername: ""
escapeHatchSecret: "my-unused-password"
escapeHatchGroup: ""
automanualconfigure: "auto"
emailFieldName: "email"
userNameField: "name"
tokenServerUrl: "${oidcIssuerUrl}/oauth2/v1/token"
authorizationServerUrl: "${oidcIssuerUrl}/oauth2/v1/authorize"
scopes: "address phone openid profile offline_access groups email"
authorizationStrategy:
roleBased:
roles:
global:
- name: "my_jenkins_role"
permissions:
- "Overall/Administer"
assignments:
- "my_okta_group"
BTW, I specify the yaml with Helm:
...
JCasC:
configScripts:
okta: |
jenkins:
securityRealm:
...

Jenkins LDAP - root DN & Display Name LDAP attribute

This question is about Jenkins LDAP root DN & Display Name LDAP attribute
Environment:-
Jenkins Version - 2.235.5(LTS)
LDAP Plugin - 1.24
I am trying to configure LDAP(AD) Authentication in our Jenkins, Below is the configuration settings.
root DN - DC=Company,DC=domain,DC=com
User search base: OU=Users,OU=Division,OU=Team,DC=Company,DC=domain,DC=com
User search filter: sAMAccountName={0}
Group search base: OU=Users,OU=Division,OU=Team,DC=Company,DC=domain,DC=com
Group search filter: (&(objectclass=group)(cn={0}))
Group membership
Group membership filter - (&(objectCategory=group)(member:1.2.840.113556.1.4.1941:={0}))
Manager DN: CN=jenkins,OU=Users,OU=Division,OU=Team,DC=Company,DC=domain,DC=com
Manager Password: password
Display Name LDAP attribute: displayname
Email Address LDAP attribute: mail
But while testing the LDAP connection it fails below error.
Login
Authentication: failed for user "jenkins-user"
Lookup
User lookup: failed for user "jenkins-user"
LdapCallback;[LDAP: error code 32 - 0000208D: NameErr: DSID-03100241, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=domain,DC=com'
]; nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-03100241, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=domain,DC=com'
]; remaining name 'OU=Users,OU=Division,OU=Team,DC=Company,DC=domain,DC=com'
LDAP Group lookup: could not verify.
Please try with a user that is a member of at least one LDAP group.
Lockout
The user "jenkins-user" will be unable to login with the supplied password.
If this is your own account this would mean you would be locked out!
Are you sure you want to save this configuration?
Suppose if i keep the root DN as empty and enabled the tick mark - Allow blank rootDN. my test connection is getting successful.
But i would like to know that currently i am running root DN as empty and enabled - Allow blank rootDN in plugin section. Is this is fine for production environment?
Also for the logged in users, The display name shown as below which is too lengthy.
First-Name/Sur-Name/Team-Name/Location/Title/Company-Name
i would like to display only First-Name + Sur-Name. For this i tried to change Display Name LDAP attribute: with name, givenName, cn & sn but none of them were worked. So is it possible to display only First name + Sur-name in Jenkins?
I have fixed it. Each time when we change/update the Display Name LDAP attribute value in LDAP configuration section, We need to delete the user from people category and need to login. Post that it displays the configured settings.

Redmine LDAP authentication fails for SOME users

I have a redmine instance with configured LDAP authentication. 90-95% of users which are listed in LDAP catalog have no problem with logging into the application(redmine). But some users do, they are present in LDAP, but at the time they try to login into redmine, it responds: Invalid credentials.
My observation is: such issue happens with the users who didnt login into redmine more than 3-5 months. At that time, due to security policy, LDAP system requires the accounts to change their password. So my thought is that when they had changed the password and try to login, there is a conflict between old and new password.
At the same time there is no any problems with LDAP itself (only when user tries to login into redmine, thats why i thought its some kind of internal application conflict).
password_authentication called
try_to_login called
#<User id: 111, login: "qwe", hashed_password: "", firstname: "qwe", lastname: "qwe", admin: false, status: 1, last_login_on: "2020-02-14 04:36:51", language: "", auth_source_id: 1, created_on: "2018-10-05 00:46:00", updated_on: "2019-06-20 01:30:34", type: "User", identity_url: nil, mail_notification: "only_my_events", salt: nil, must_change_passwd: false, passwd_changed_on: nil>
user.nil? = true
user.new_record? =
user.active? =
Failed login for 'qwe' from xxx.xx.xxx.xxx at 2020-03-02 09:29:53 UTC
authenticate_user finished
Can you give me some help and advice please? Have no idea what is wrong
Found the solution, the issue was that login in Redmine wasnt the same in LDAP catalogues. I went through all login logic, and found that the entity returned required to login was empty due to login mismatch.

Issue with Dynamic Groups in OpenLDAP

I'm trying to move our current web-apps to retreive roles and authentication against and openLDAP system. I'm having a bit of an issue with dynamic groups (groupOfURLs) and openLDAP. I'm using OpenLDAP 2.4.33 and spring 3.2 .
I've got my authentication working successfully, however now i'm having an issue in setting up a system to use dynamic groups for roles using the dynamic group overlay.
On the spring side, I'm attempting to use a DefaultLdapAuthoritiesPopulator with a groupSearchFilter = “(member={0})”. The issue i'm having is that spring does not find any members in my dynamic group, however it can find members of static groups (groupofnames) (.
This doesn't seem to be a spring issue as I have the same issue using the ldapsearch command. The issue i'm having is best illustrated by example.
I'm using the following LDIF
dn: ou=Groups,dc=myapp,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Groups
dn: ou=Users,dc=myapp,dc=com
objectClass: top
objectClass: organizationalUnit
ou: Users
dn: uid=userA,ou=Users,dc=myapp,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
uid: userA
cn: test-forename
sn: test-surname
mail: userA#mail.com
userPassword:: e1NTSEF9bVpJVGxZRlFYdnhBemhLQkdxWll0VnlRQjRUdjBaelhEZkpaZnc9PQ==
dn: uid=userB,ou=Users,dc=myapp,dc=com
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
uid: userB
cn: test-forename
sn: test-surname
mail: userB#mail.com
userPassword:: e1NTSEF9bVpJVGxZRlFYdnhBemhLQkdxWll0VnlRQjRUdjBaelhEZkpaZnc9PQ==
dn: cn=DynamicGroup,ou=Groups,dc=myapp,dc=com
cn: DynamicGroup
objectClass: top
objectClass: groupOfURLs
ou: Groups
memberURL: ldap:///ou=Users,dc=myapp,dc=com??sub?mail=userA#mail.com
dn: cn=StaticGroup,ou=Groups,dc=myapp,dc=com
cn: StaticGroup
objectClass: top
objectClass: groupofnames
ou: Groups
member: uid=userA,ou=Users,dc=myapp,dc=com
This creates two users and two groups, one static and one dynamic.
If I do a simple search I get
ldapsearch.exe -v -x -h localhost -p 389 -D "cn=admin,dc=myapp,dc=com" -w secret -LL -b "ou=Groups,dc=myapp,dc=com" "(objectClass=*)" dn member
In this i'm searching using ("(objectClass=*)" dn member), I get the following result
ldap_initialize( ldap://localhost:389 )
filter: (objectClass=*)
requesting: dn member
version: 1
dn: ou=Groups,dc=myapp,dc=com
dn: cn=DynamicGroup,ou=Groups,dc=myapp,dc=com
member: uid=dbunit,ou=Users,dc=myapp,dc=com
member: uid=userA,ou=Users,dc=myapp,dc=com
member: uid=userB,ou=Users,dc=myapp,dc=com
dn: cn=StaticGroup,ou=Groups,dc=myapp,dc=com
member: uid=dbunit,ou=Users,dc=myapp,dc=com
Clearly this illustrates that the query returns results for both the static and dynamic group. This indicates that it is correctly configured and that it has an attribute member.
The issue that I have is when I add a filter on the member attributrs.
ldapsearch.exe -v -x -h localhost -p 389 -D "cn=admin,dc=myapp,dc=com" -w secret -LL -b "ou=Groups,dc=myapp,dc=com" "(member=*)" dn member
In this case I'm applying the filter "(member=*)".
ldap_initialize( ldap://localhost:389 )
filter: (member=*)
requesting: dn member
version: 1
dn: cn=StaticGroup,ou=Groups,dc=myapp,dc=com
member: uid=dbunit,ou=Users,dc=myapp,dc=com
In this case all that is returned is the static group. It appears that the filter doesn't seem to have access to the member attribute.
Has anyone else come accross this issue?
Any help would be appreciated.
Its clear that this is not how dynamic groups don't work. In the end I decided to use static groups.
A good answer can be found at : stackoverflow.com/questions/4603570/openldap-dynlist-posixgroup

Resources