Forcing lowercase username after login

I’m not sure if this already a feature in OOD, but I’m looking to force the username used during login to OOD to become lowercase after login.

We use LDAP for authentication, and it will accept the username in any mixed case the user enters and do a case insensitive match (and authentication) in LDAP. The problem is that the NGINX will throw an “Error – user doesn’t exist: Hpc Run ‘nginx_stage --help’” if the user enters their username in a case that is different that what is stored in LDAP. E.g. hpc, HPC, Hpc all authenticate with LDAP, but if it is stored as ‘hpc’, NGINX gets upset with the error mentioned.

Is there a way to force the username to get mapped to lowercase after authentication no matter how the user entered it? I was look at the ood_auth_map.regex under “2. Setup User Mapping” but the syntax seemed a little too foreign for me to modify without asking the community first.

I wonder if this would work for you? Do you have a different user map command already in use? (I’m not sure about all the quoting here, maybe you need the outer ""s maybe not.)

# /etc/ood/config/ood_portal.yml
---
# ...
user_map_cmd: "tr '[:upper:]' '[:lower:]'"
user_env: 'REMOTE_USER'

Thanks. I’ll give it a try on my test OOD instance tomorrow. Currently I don’t have any other user_map_cmd configured. Looks like it defaults to the supplied /opt/ood/ood_auth_map/bin/ood_auth_map.regex one if not explicitly specified.

So looking at the code you may have to to a little bit extra because the command expects it to be $1 not like piped in.

Create some shell script (and make sure it’s executable) like this

#!/bin/sh

echo $1 | tr '[:upper:]' '[:lower:]'

and then configure to use it user_map_cmd: "/opt/ood/lowercase_username".

This solution seemed to be working. I have it in production now. Thanks Jeff.