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

test: Add kerberized sudo to s4u proof of concept #14782

Merged
merged 1 commit into from
Mar 2, 2021

Conversation

croissanne
Copy link
Contributor

@croissanne croissanne commented Oct 20, 2020

@croissanne croissanne added blocked Don't land until something else happens first (see task list) no-test For doc/workflow changes, or experiments which don't need a full CI run, labels Oct 20, 2020
@croissanne croissanne force-pushed the krb5-sudo branch 3 times, most recently from 5ebbb1e to 6e26e02 Compare October 20, 2020 16:00
@croissanne croissanne marked this pull request as draft October 21, 2020 08:48
@martinpitt
Copy link
Member

This was released into Fedora 33 yesterday, in sssd 2.4.1. So it's not yet on our fedora-33 image. However, it is on the fedora-testing image in cockpit-project/bots#1668 .

@Gundersanne: What is that "/etc/pam.d/teststack"?

@croissanne
Copy link
Contributor Author

Nice, I'll try it out see if it works out of the box. I'll remove teststack, it's just a pam stack to use with pamtester to only test gss.

@croissanne croissanne removed blocked Don't land until something else happens first (see task list) no-test For doc/workflow changes, or experiments which don't need a full CI run, labels Feb 19, 2021
@croissanne croissanne marked this pull request as ready for review February 19, 2021 08:34
@croissanne croissanne force-pushed the krb5-sudo branch 2 times, most recently from a871822 to 64e0382 Compare February 19, 2021 14:46
KRB5CCNAME=/home/user/cache sudo echo hai
exit 0
""")
client_machine.execute("KRB5_TRACE=\"/dev/stderr\" KRB5CCNAME=\"/etc/cockpit.ccache\" ssh -vvv -K user@sshserver.cockpit.lan bash -c 'KRB5CCNAME=/home/user/cache sudo echo hai'")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please run sudo whoami instead, and check that the returned output contains root? That would ensure that it actually worked.

I don't quite understand the difference between the script execution above, and this line? They seem to do similar things?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do that, the second ssh-ing from the client machine via gssapi auth and then using the cache built above to sudo, putting the 2 things together. But it's indeed just testing the same thing.

@martinpitt
Copy link
Member

does not work on rhel-8-4 and fedora-33. I think it did before, so there is something more subtle -- perhaps more stdout?

I suggest to not just run | grep -q, as this gives zero info in the failure case. rather do something like this:

out = m.execute('...')
self.assertEqual(out, "root")

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for figuring this out and driving this with the sssd team! Let's get this in to make sure it does not regress, and then we know that the underpinnings are working. We can discuss further simplification of the setup with the sssd team later on.

systemctl restart sssd
usermod -G wheel user
su user
echo -ne 'foobarfoo\nfoobarfoo\nfoobarfoo\n' | kinit -c /home/user/cache user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does that need to input the password three times? Forced password change?

client_machine.execute("KRB5_TRACE=\"/dev/stderr\" KRB5CCNAME=\"/etc/cockpit.ccache\" ssh -vvv -K user@sshserver.cockpit.lan echo hello")
# configure gssapi authentication for sudo
sshd_machine.write('/etc/sudoers.d/cockpit-krb5-sudo', """
Defaults env_keep += "KRB5CCNAME"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather non-obvious. I wonder how we are going to deal with that for the real implementation.. But that is a discussion for another day.

@martinpitt martinpitt merged commit 30738d5 into cockpit-project:master Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants