Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_user parsing problem #20

Closed
mmmurf opened this issue Oct 10, 2011 · 5 comments
Closed

check_user parsing problem #20

mmmurf opened this issue Oct 10, 2011 · 5 comments
Assignees

Comments

@mmmurf
Copy link

mmmurf commented Oct 10, 2011

https://github.com/sebastien/cuisine/blob/master/src/cuisine.py#L286

The user data is being parsed as follows:

{'shell': '/home/ubuntu', 'uid': 'x', 'passwd': '!$6$ewuA3/RZ$TQX3d5Rpusb/xIeCJ7SJ9KeNsdfsafafe qzkM.4BkCm5uIWigP.1wFei0mzovOP6lEPZ2eUx/0/', 'gid': '1000', 'home': 'Ubuntu,,,', 'name': 'sudo'}

the user is ubuntu and its home directory is /home/ubuntu

the line from /etc/password is:

ubuntu:x:1000:1000:Ubuntu,,,:/home/ubuntu:/bin/bash

@sebastien
Copy link
Owner

Hmm, I cannot reproduce this problem. Could you send the whole passwd file as a private message to see if I have the same problem? Thanks!

@ghost ghost assigned sebastien Oct 16, 2011
@dillongreen
Copy link
Contributor

It's some weird message you get when /etc/hosts doesn't have the alias that is hostname. In other words you're fine if

  • hostname gives you foo and your /etc/hosts contains 127.0.0.1 localhost foo
  • if you only have 127.0.0.1 localhost then fabric moans about sudo which in turn triggers this check_user() bug

Here's what I quickly hacked together today:

def add_system_uuid_alias():
    """Adds system UUID alias to /etc/hosts.

    Some tools/processes rely/want the hostname as an alias in
    /etc/hosts e.g. 127.0.0.1 localhost <hostname>.

    """
    with mode_sudo(), cd('/etc'):
        old = "127.0.0.1 localhost"
        new = old + " " + get_system_uuid()
        file_update('hosts', lambda x: text_replace_line(x, old, new)[0])


def get_system_uuid():
    """Gets a machines UUID (Universally Unique Identifier)."""
    return sudo('dmidecode -s system-uuid | tr "[A-Z]" "[a-z]"')

It makes sense to have 127.0.0.1 localhost foo but then cuisine/fabric should guard against this bug anyway.

@sebastien
Copy link
Owner

Thanks, I'll integrate this!

@sebastien
Copy link
Owner

Integrated in f4dc4ba

@dillongreen
Copy link
Contributor

cool, thanks... I am not sure though about the actual cause for the bug. Either way, check_user should guard against this anyhow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants