How to authenticate LDAP account? - perl

Couple of the Perl applications at my workplace require LDAP authentication. When those applications required the user to login, the application would anonymously connect to the LDAP server then searched for the user in the LDAP database. But now, we are no longer allowed to connect to the LDAP server anonymously, we are given a username and password to connect to it.

Some code would be helpful, but, basically, if you have a username and password, you just need to bind to the LDAP directory.
The Net::LDAP documentation has the following example:
$ldap = Net::LDAP->new( 'ldap.umich.edu' );
$mesg = $ldap->bind( 'cn=root,o=University of Michigan,c=us', password => 'secret' );
# your normal code goes here
Alternatively, of course, you could by-pass the username and password you were provided with and simply bind to the directory using the username and password supplied by the user.
Note that if you're binding against Active Directory, it's possible to bind using either 1) the user principal name of the account (e.g., user#umich.edu) or 2) the Kerberos ID (something like UMICH\user) in addition to using the DN of the provided user.

Related

Keycloak doesn't offer passwordless authentication as the first option during login

I've configured Keycloak authentication for the following behaviour:
The user inputs its userid
Keycloak should try to authenticate it with the passwordless flow
As an alternative the user could switch to password authentication
NOTE: The user already has a registered passwordless device:
The authentication flow has been configured as follows:
I access localhost:8080/realms/myrealm/account and click on Sign in:
I input the userid:
But, instead of being offered to sign up with the security device, I'm asked for the password:
If I select Try another way and click on Security Key:
I am now offered to login with the device:
Which I can do successfully.
The problem here is that I need the passwordless login to be offered directly, not the password form. Passwordless is actually configured as the first alternative option so why isn't it working as expected?
Looking at the code of AuthenticationSelectionResolver this seems to be intended behaviour.
Try to change the order/position of credentials for your user from within the admin console.
The order of credentials should affect the order in which alternative authenticators will be executed.

JBPM_7.XX: How to change role name "admin" to other name?

Currently, I am integrating JBPM with LDAP with following guide: https://www.youtube.com/watch?v=0UpT92-GIxc.
I have done successfully. But, Our LDAP server already have role "admin" and I cannot add this role to my OU. So, How can i change configuration admin role to other name in jbpm?
Thank all!
In the jbpm.usergroup.callback.properties file, you should configure the "binding" user:
ldap.bind.user=cn\=admin,dc\=jbpm,dc\=org
ldap.bind.pwd=admin
You could try any other one, different than admin.
Notice that if the LDAP server doesn’t allow anonymous binding, then ldap.bind.user and ldap.bind.pwd parameters are mandatory in this file.
In this blog post, you can find a sample for a basic LDAP configuration ("LDAP structure" chapter):
https://blog.kie.org/2021/02/migrating-jbpm-images-secured-by-ldap-to-elytron.html
Take into account to update jboss LdapExtLoginModule with the bindDN and password accordingly.

Keycloak get user password

In my project, I need to get current user password from Rest API.
I searched keycloak 4.8.3 final documentation but I could not find it. With admin user I can change password without knowing the current password. But my logged in user can be admin or not. I found that keycloak does not give me permission to that because of security. Wrap up is there any way to active that settings or is there a way to get password with Rest API ?
Thank you.
Update: The /auth path was removed starting with Keycloak 17 Quarkus distribution. So you might need to remove the /auth from the endpoint calls presented on this answer.
Via the Rest API, one cannot get the password for obvious reasons. Ideally, in a secure setting, even if one is the admin one should not have access to the users' passwords.
From the comments you wrote:
I could use method like boolean isPasswordCorrect(username,password)
An approach is to create a client on your Realm as follows:
Go to your Realm;
Clients;
Create Client;
Set Access Type to public;
Set Direct Access Grants Enabled to ON;
Save;
Now request from the newly created client a token on behalf of the user that you want to check if the password is correct:
As you can see the endpoint is:
<KEYCLOAK_HOST>/auth/realms/<REALM_NAME/protocol/openid-connect/token
and the body is:
client_id : <The client ID of the newly create client>
username : <The username>
password : <The password to be tested>
grant_type : password
If the password is correct you will get back a token object, otherwise you will get the following response:
{
"error": "invalid_grant",
"error_description": "Invalid user credentials"
}

Kentico sync and AD authentication

My target site needs AD auth to browse and use the admin portal. All is fine there. This means syncing to this server via username and password authentication doesn't work. Does this mean i need to enable x.509 authentication?
If you mean using the Staging Module, the staging module's "Username and password" really is not linked to the actual CMS Users. You can put whatever Username and Password on the Destination server, and connect to it from the Source.
x.509 is also fine.
Tell me if you aren't talking about the Staging Module though.
You may need to do 1 of 2 things:
Enable mixed mode authentication. Yes the overall authentication doesn't need to use a physical cms_user user but since you have AD Authentication enabled, anytime another user or service tries to access a system page it may require them to log in.
Create a web.config location node in your /CMSPages/Staging/web.config file that excludes anyone or everyone to access a the SyncServer.asmx page within there.
Otherwise configure the x.509 certificate setup.

Can the user of proftpd change the password themself not by admin?

I have read all the command on ftp which contains no command to change passwd.
I am a user of proftpd ,how can change my password after logining into proftpd by myself not by admin?
User can change it's own password in ssh service ,not by admin,it is convenient.
As far as i know ProFTPD does not contain its own users, but rather uses external resources to authenticate. That means that if you want to edit a user (or it's password) you need to edit whatever source ProFTPD authenticated that user against (i.e. /etc/passwd, PAM, LDAP, etc).
This, unfortunately for you, means that you can not edit your password from within an FTP session, but rather have to access the server via SSH or similar to change it.
More info can be found in the documentation: http://www.proftpd.org/docs/howto/Authentication.html