Seamless-cockpit and Foreman

Yes, except for the “trust” part.

Cockpit itself is unprivileged and doesn’t make decisions related to authentication. The credentials given out by Foreman in step 4 just need to be accepted by sshd in step 5. Foreman might decline access in step 4 based on which user the session is for, etc.

Yes, the Foreman API fortunately allows access with a valid _session_id cookie, and the token exchanged in steps 2 and 3 is the value of that cookie. cockpit-auth-foreman turns the token back into a cookie.

A customer asked for better integration in regard to PCP performance data from hosts. While we will unlikely be writing a Foreman PCP plugins to present data from PCP, we should be able to have a button for hosts that opens up Cockpit interface on Performance page. I see there are plans on elaborating Cockcpit-PCP integration: https://github.com/cockpit-project/cockpit/wiki/Feature:-PCP-Integration

Hi,

time for a status update.

Ivan has helped me greatly and we have made good progress towards getting the code into Foreman.

The current plan doesn’t require any changes to Foreman or the SmartProxy anymore; we can get it all done in the Remote Execution plugins.

We now have four pull requests:

There is also the code for running the special Cockpit instance that the “Web Console” button is supposed to link to: https://github.com/mvollmer/foreman-cockpit.

Putting it all together to make it actually work is still a bit tricky.

Next steps for me:

  • Look into adding tests to my PRs above
  • Move foreman-cockpit-session into foreman_remote_execution and turn the foreman-cockpit repo into mostly documentation for how to set it all up, including the Apache reverse proxy thing.
  • Learn how the Foreman installer works and how we could do the setup

Open issues:

  • Normally, connections to the SmartProxy are done via HTTPS with client certificates. The foreman-cockpit-session program needs to be able to do that.

  • If the only supported way to set this all up is to have Cockpit on the same origin as Foreman (via a Apache reverse proxy), can’t we then rely on getting the session cookie directly and do away with the OAuth complication? This might need changes to Cockpit itself…

Thanks!

1 Like

Three! We have three pull requests.

1 Like

Thanks, we only allow edits 5 minutes after for typos. People read via email a lot. Cheers.

Hi,

we have HTTPS between the Cockpit session helper and the Smart Proxy working now, but the details of where the session helper gets the certificates from are still open.

Documentation exists now and a couple of people have successfully run through them: https://github.com/mvollmer/foreman-cockpit/tree/master

Here is a demo with three machines, which also shows that error messages are getting better: https://www.youtube.com/watch?v=LVURfdfIuCs

2 Likes

from where i can change user , so instead of root it open cockpit with non root user ?

There is a setting in Administer - Settings.

thank you for the reply , I did but it still login with root when I click on web console (cockpit)

Is there any parameter for cockpit web console user name I can add in host

Hi, Firstly when I read it first time I understand you want to open the cockpit with different Foreman User. That is possible as lzap wrote, You will create new user with correct roles and you can open the cockpit.

But if I understand correctly you want to achieve something else:
With new_user you want to open cockpit and you want to differentiate also the cockpit users. Right now you are logged as root and you would expect to be logged as new_user right ?

Can you please explain why you need to this behavior, please ?
IMO when you create a new user and you give him enough roles to open cockpit
You are giving the new_user access, and now he can manipulate with host in cockpit. So in this point of view it doesn’t matter if he is logged as root inside the cockpit because you as admin already gave him a permission to manipulate with a machine.

I think this behavior is not implemented. I am not sure. @lzap hopefully knows the answer.

1 Like

I forgot to mention you @masadrasheed :wink: ^^

1 Like

As per my understanding cockpit login is nothing to do with foreman user , when you click on Webconsole it open new tab on browser and open cockpit with root as I already add foreman -proxy key in host authorise keys.

example:

ssh-copy-id -i ~foreman-proxy/ .ssh/id_rsa_foreman_proxy.pub root@centos7.xxxx.io

But I want to copy that key to

ssh-copy-id -i ~foreman-proxy/ .ssh/id_rsa_foreman_proxy.pub asad@centos7.xxxxx.io

And I want cockpit to open with asad user instead of root , doesn’t matter which foreman user try to access that host and click on web console.

before foreman and cockpit SSO , I mean initial versions you have to put username and password to login to cockpit to do certain operations.

But if I understand correctly you want to achieve something else:
With new_user you want to open cockpit and you want to differentiate also the cockpit users. Right now you are logged as root and you would expect to be logged as new_user right ?

I don’t want any new user in foreman, I just want existing foreman admin user open cockpit web console with non root user simple.

Can you please explain why you need to this behavior, please ?
IMO when you create a new user and you give him enough roles to open cockpit
You are giving the new_user access, and now he can manipulate with host in cockpit. So in this point of view it doesn’t matter if he is logged as root inside the cockpit because you as admin already gave him a permission to manipulate with a machine.

User is admin with full rights but foreman webconsole open cockpit only with root which I don’t want , I want cockpit should open with non root user.

I think this behavior is not implemented. I am not sure. @lzap hopefully knows the answer.

I think there is some simple parameter I can add in host parameters and It will work @lzap help me out bro.

Understand.
As far as I remember this is was not implemented and this will be RFE.
So everything is up to developers :slight_smile: .

2 Likes

AFAIK this hasn’t been implemented.

So it means if you integrate SSO cockpit in foreman , you have to use root as a user via login and cannot be change to some other user?

Also can you please let me know where I can change the user from root to non root user in code, so I will work for me.

Hello Everyone issue resolved , thank you everyone.

1 Like

Can you please share the solution in case others run into the same issue in the future?