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

Fixes #28436 - Add keycloak support #779

Merged
merged 1 commit into from
Feb 28, 2020
Merged

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Dec 5, 2019

This is a draft since it hasn't been tested end to end. It's here to allow end-to-end testing using forklift.

theforeman/forklift#1065 is a related PR to install a Keycloak server.

Copy link
Member

@rabajaj0509 rabajaj0509 left a comment

Choose a reason for hiding this comment

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

@ekohl I am also trying to use this PR as an opportunity to learn and contribute to the puppet-foreman repo.

Few questions in the comments below.

manifests/settings.pp Outdated Show resolved Hide resolved
#
# keycloak-httpd-client-install --app-name ${keycloak_app_name} --keycloak-server-url $KEYCLOAK_URL --keycloak-admin-username $KEYCLOAK_USER --keycloak-realm ${keycloak_realm} --keycloak-admin-realm master --keycloak-auth-role root-admin --client-type openidc --client-hostname ${servername} --protected-locations /users/extlogin
#
# If $suburi is used, --location-root should also be passed in
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what $suburi is and where/how it can we used. Can you share some insights?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure how much it's used, but if foreman_url is passed in as https://foreman.example.com/foreman then $suburi will be set. Probably ok to ignore it for now.

manifests/settings.pp Outdated Show resolved Hide resolved
@ekohl
Copy link
Member Author

ekohl commented Dec 16, 2019

Updated to not configure the settings and require the user to do so.

} elsif $keycloak {
apache::mod { 'auth_openidc':
package => 'mod_auth_openidc',
}
Copy link
Member

Choose a reason for hiding this comment

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

Should we also install keycloak-httpd-client-install package too?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was debating that, but decided against it. I think the instruction should be:

  • yum install keycloak-httpd-client-install
  • keycloak-httpd-client-install ....
  • foreman-installer --foreman-keycloak true --foreman-keycloak-realm ...

In theory the installer could run the install command, but then we need to pass credentials and I think that's something we probably don't want.

@ntkathole
Copy link

@ekohl can you please rebase?

stderr_lines:
  - From https://github.com/theforeman/puppet-foreman
  - ' * [new ref]         refs/pull/779/head -> pr'
  stdout: |-
    Auto-merging spec/classes/foreman_spec.rb
    Auto-merging manifests/init.pp
    Auto-merging manifests/config/apache.pp
    CONFLICT (content): Merge conflict in manifests/config/apache.pp
    Automatic merge failed; fix conflicts and then commit the result.
  stdout_lines: <omitted>

@rabajaj0509
Copy link
Member

@ekohl

I think this should good once the conflict is solved, can you please solve the conflicts and rebase?

@ekohl ekohl marked this pull request as ready for review January 6, 2020 16:59
@ekohl
Copy link
Member Author

ekohl commented Jan 6, 2020

Rebased to fix the merge conflict.

@ntkathole
Copy link

@ekohl @rahulbajaj0509 I am not able to test this PR as installer is failing with issue mentioned at theforeman/puppet-certs#266 (comment) I tried to revert the PR changes but still installer is failing with Failed to call refresh: Proxy centos7-katello-devel.nkathole.example.com cannot be retrieved: unknown error (response 503)

@ekohl
Copy link
Member Author

ekohl commented Jan 22, 2020

@ekohl @rahulbajaj0509 I am not able to test this PR as installer is failing with issue mentioned at theforeman/puppet-certs#266 (comment) I tried to revert the PR changes but still installer is failing with Failed to call refresh: Proxy centos7-katello-devel.nkathole.example.com cannot be retrieved: unknown error (response 503)

That's unrelated, but should be resolved in the latest nightly packages.

@ehelms
Copy link
Member

ehelms commented Feb 11, 2020

@ekohl Seems fairly straight forward of a change, if you circle back to the tests I am happy to merge

@@ -83,6 +83,9 @@
Boolean $ipa_authentication = $::foreman::ipa_authentication,
Hash[String, Any] $http_vhost_options = {},
Hash[String, Any] $https_vhost_options = {},
Boolean $keycloak = $foreman::keycloak,
String[1] $keycloak_app_name = $foreman::keycloak_app_name,
String[1] $keycloak_realm = $foreman::keycloak_realm,
Copy link
Member

Choose a reason for hiding this comment

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

Do these need to be $:: prefixed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically no and I'd also like to remove that prefix everywhere else. Just haven't gotten around to it. It was needed to make Puppet 3 and Puppet 4 behave in the same way but luckily those dark days are behind us. In this case I'm going to add them to stay consistent with the rest of the file.

@ekohl ekohl force-pushed the 28436-keycloak branch 2 times, most recently from 850220b to c5d7cdb Compare February 14, 2020 12:43
@ehelms
Copy link
Member

ehelms commented Feb 19, 2020

Needs a rebase

let(:params) { super().merge(keycloak: true) }

it { should compile.with_all_deps }
it { should contain_apache_mod('auth_openidc') }
Copy link
Member

Choose a reason for hiding this comment

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

This needs an additional underscore apache__mod

@ehelms
Copy link
Member

ehelms commented Feb 26, 2020

I see a dependency cycle error as well in the tests but I am less clear on how to resolve that one.

This adds support for keycloak when using the
keycloak-httpd-client-install command. A more native integration would
rely on the oidc support in puppetlabs-apache, but that's unreleased.

It drops the dependency chaining for the passenger package because it
was leading to dependency cycles and I don't see a reason for the
explicit chaining.
Copy link
Member

@ehelms ehelms left a comment

Choose a reason for hiding this comment

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

Failures look like the same Debian failures we've been seeing

@ehelms ehelms merged commit 0e86214 into theforeman:master Feb 28, 2020
@ekohl ekohl deleted the 28436-keycloak branch March 13, 2020 18:12
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.

5 participants