Bug 621262 - Creating new user does not consult min_new_user_len
Creating new user does not consult min_new_user_len
Status: CLOSED CURRENTRELEASE
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server (Show other bugs)
530
All Linux
low Severity medium
: ---
: ---
Assigned To: Jan Pazdziora
Martin Korbel
:
Depends On:
Blocks: sat560-lowbug
  Show dependency treegraph
 
Reported: 2010-08-04 11:43 EDT by Matthew Davis
Modified: 2013-10-01 17:56 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-01 17:56:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matthew Davis 2010-08-04 11:43:37 EDT
From /etc/rhn/default/rhn_server.conf

     # New usernames
     # min_user_len is used for sanity checks on the username upon authentication;
     # min_new_user_len is the minimum user length for new users
     # For legacy reasons, we need two different checks
     min_new_user_len = 5

This is a false statement.

From CreateUserCommand.java

        if (login.length() < Config.get().getInt("min_user_len")) {
            errors.add(new ValidatorError("error.minlogin",
                               Config.get().getString("min_user_len")));
            return;
        }


As you can see min_new_user_len is never consulted.

So, either consult it with something like

if (login.length() < Config.get().getInt("min_user_len") || login.length() < Config.get().getInt("min_new_user_len")) {

Or remove the reference to min_new_user_len.  The very little searching I did, returned no other references to that value.  So it should be ok to remove so there is no confusion in the future.

Version-Release number of selected component (if applicable):
spacewalk-java-0.5.44-84.el5sat

How reproducible:
Everytime

Steps to Reproduce:
1. Set min_new_user_len to 3 in /etc/rhn/rhn.conf
2. Restart services
3. Try to create a user with a login of 3 characters
  
Actual results:
Failure

Expected results:
Success
Comment 1 Rich Shappard 2011-02-01 16:51:24 EST
This is effecting our implementation of Satellite as well.  Our LDAP uses 4 character logins and we can't integrate Satellite with the rest of our infrastructure.
Comment 2 Matthew Davis 2011-02-01 17:03:25 EST
It should be noted, that the new user code does consult min_user_len, but not min_new_user_len (as one may imagine due to the name of the variable). So as a workaround, I've had to set min_new_user_len & min_user_len to the values required.
Comment 3 Rich Shappard 2011-02-01 17:14:20 EST
For reference, changing the min_user_len value in /etc/rhn/default/rhn_server.conf does not affect this behavior.


/etc/rhn/default/rhn_server.conf
min_user_len   = 3
min_new_user_len = 3

I found web.min_user_len in /etc/rhn/default/rhn_web.conf, changed it to 3, restarted satellite and it works.
Comment 4 Jan Pazdziora 2013-03-15 07:01:03 EDT
Please note that any customizations should be done in /etc/rhn/rhn.conf only, not in the */default/*.conf files.
Comment 5 Jan Pazdziora 2013-03-15 07:02:09 EDT
I've now removed the option min_new_user_len from rhn_server.conf in Spacewalk master, 7adfcb1e3f02428ce18b40ec417aad1668085b47.
Comment 6 Martin Korbel 2013-09-24 04:02:00 EDT
VERIFIED on Satellite-5.6.0-RHEL6-re20130917.0

Steps of reproduce Sat-5.6.0: 
1. Check default value:
> export PASSWD="xxx"
> spacewalk-api --server localhost --user=admin --password=$PASSWD user.create "%session%" aa "123456" "XXX" "YYY" "xxx@localhost"
"Logins must be no shorter than 3 characters."

2. change defaults values in /etc/rhn/rhn.conf:
> echo "min_user_len     = 6" >> /etc/rhn/rhn.conf
> echo "min_new_user_len = 7" >> /etc/rhn/rhn.conf

3. run this command
> spacewalk-api --server localhost --user=admin --password=$PASSWD user.create "%session%" aa "123456" "XXX" "YYY" "xxx@localhost"
"Logins must be no shorter than 6 characters."


Steps of reproduce Sat-5.4.1: 
1. Check default value:
> export PASSWD="xxx"
> spacewalk-api --server localhost --user=admin --password=$PASSWD user.create "%session%" aa "123456" "XXX" "YYY" "xxx@localhost"
"Logins must be no shorter than 5 characters."

2. change rhn.conf
> echo "min_user_len     = 6" >> /etc/rhn/rhn.conf
> echo "min_new_user_len = 7" >> /etc/rhn/rhn.conf

3. run this command
> spacewalk-api --server localhost --user=admin --password=$PASSWD user.create "%session%" aa "123456" "XXX" "YYY" "xxx@localhost"
"Logins must be no shorter than 6 characters."
Comment 7 Martin Korbel 2013-09-24 04:04:14 EDT
FIX steps of reproduce, 
add step 1.1 for both situations
1.1 restart satellite
> rhn-satellite restart
Comment 8 Clifford Perry 2013-10-01 17:56:30 EDT
Satellite 5.6 has been released. This bug was tracked under the release.  

This bug was either VERIFIED or RELEASE_PENDING (re-verified prior shortly
before release). 

Moving to CLOSED CURRENT_RELEASE. 

Text from Upgrade Erratum follows:

Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1395.html

Note You need to log in before you can comment on or make changes to this bug.