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

Disable admin user API access when enableApplicationLocalLogin is false #505

Merged
merged 1 commit into from May 15, 2020

Conversation

carbonin
Copy link
Member

After this change, any request to the API with basic auth (including
the admin user name) will be rejected by httpd with a 401 return code.

Fixes #501

After this change, any request to the API with basic auth (including
the admin user name) will be rejected by httpd with a 401 return code.

Fixes ManageIQ#501
@miq-bot
Copy link
Member

miq-bot commented May 14, 2020

Checked commit carbonin@af19cdb with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint
0 files checked, 0 offenses detected
Everything looks fine. 🏆

@@ -63,19 +63,19 @@ Options SymLinksIfOwnerMatch
func httpdAuthenticationConf(spec *miqv1alpha1.ManageIQSpec) string {
switch spec.HttpdAuthenticationType {
case "openid-connect":
return httpdOIDCAuthConf(spec.OIDCProviderURL, spec.OIDCOAuthIntrospectionURL, spec.ApplicationDomain)
return httpdOIDCAuthConf(spec.OIDCProviderURL, spec.OIDCOAuthIntrospectionURL, spec.ApplicationDomain, *spec.EnableApplicationLocalLogin)
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but would it make more sense to just pass the spec object in it's entirety and then the methods pull out what they need?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, maybe when we need one more parameter. Originally this method only needed one or two so it made sense to pass them individually. I feel like 5 is my tipping point

if enableLocalLogin {
letAdminIn = `
SetEnvIf Authorization '^Basic +YWRtaW46' let_admin_in
Allow from env=let_admin_in`
Copy link
Member

Choose a reason for hiding this comment

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

Does order matter with respect to these settings (I know it does for some other settings in the conf). This PR changes the order, and I wonder if that's a problem or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

Pretty sure it doesn't. @jvlcek can confirm though

Copy link
Member

Choose a reason for hiding this comment

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

Does order matter with respect to these settings (I know it does for some other settings in the conf). This PR changes the order, and I wonder if that's a problem or not.

Order does not seem to matter. I just successfully tested with the following segment and it worked fine

<LocationMatch ^/api(?!\/(v[\d\.]+\/)?product_info$)>
  SetEnvIf X-Auth-Token  '^.+$'                 let_api_token_in
  SetEnvIf X-MIQ-Token   '^.+$'                 let_sys_token_in
  SetEnvIf X-CSRF-Token  '^.+$'                 let_csrf_token_in

  AuthType     oauth20
  AuthName     "External Authentication (oidc) for API"

  Require   valid-user
  Order          Allow,Deny
  Allow from env=let_admin_in
  Allow from env=let_api_token_in
  SetEnvIf Authorization '^Basic +YWRtaW46'     let_admin_in
  Allow from env=let_sys_token_in
  Allow from env=let_csrf_token_in
  Satisfy Any
</LocationMatch>

@Fryguy Fryguy merged commit 3e0699e into ManageIQ:master May 15, 2020
simaishi pushed a commit that referenced this pull request May 18, 2020
Disable admin user API access when enableApplicationLocalLogin is false

(cherry picked from commit 3e0699e)
@simaishi
Copy link
Contributor

Jansa backport details:

$ git log -1
commit 7cbfa931b0b5fe3c523f9e236e787a1965cd4329
Author: Jason Frey <fryguy9@gmail.com>
Date:   Fri May 15 12:24:46 2020 -0400

    Merge pull request #505 from carbonin/enable_local_login_api

    Disable admin user API access when enableApplicationLocalLogin is false

    (cherry picked from commit 3e0699ed3f4d530504f235c2593286fa2bacdb11)

@carbonin carbonin deleted the enable_local_login_api branch June 15, 2020 14:32
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.

enableApplicationLocalLogin should prevent admin user via API
5 participants