terraform-provider-okta icon indicating copy to clipboard operation
terraform-provider-okta copied to clipboard

Enable `okta_password` authenticator for `okta_policy_mfa`

Open nickrmc83 opened this issue 2 years ago • 10 comments

Enable synchronising and setting okta_password authenticator configuration on okta_policy_mfa resources. See previous issue comment for more context. I've not had a chance to extensively test this fix yet and so should be treated as speculative at this point.

It should allow for policies such as the below to work with OIE without encountering a At least one of Password or Email authenticator must be set to required error:

resource "okta_policy_mfa" "example_policy" {
  name  = "An example policy"
  status = "ACTIVE"
  description = "MFA policy as an example"
  priority = 1
  is_oie  = true

  okta_password = {
    enroll = "REQUIRED"
  }
  
  okta_email = {
    enroll = "NOT_ALLOWED"
  }

  fido_webauthn = {
    enroll = "REQUIRED"
  }
 }

nickrmc83 avatar Jul 18 '22 21:07 nickrmc83

@nickrmc83 Are you testing in an OIE environment? I believe the changes above will break and not-work in an OIE tenant. Enabling password breaks sync as okta_password isn't returned by the API as noted in the comments. I'll try to take a look to see if I can confirm

virgofx avatar Jul 18 '22 23:07 virgofx

Thanks for the PR @nickrmc83 I'll have to look into this later this week. Thanks the extra experience @virgofx - I will definitely first see if the ITs for okta_policy_mfa fail on my various test orgs (classic, oie, etc.)

monde avatar Jul 19 '22 17:07 monde

Are you testing in an OIE environment

Yes we are. I'm trying to enable okta_verify to use with Fastpass whilst also requiring users to register a password. I've played around in the web console and used Chrome's web dev tools to observe the API activity. I can see the setting for okta_password being sent and the API suggests it should be possible to specify this authenticator. I've not finished testing this PR because I was having problems convincing terraform to use my locally built provider.

nickrmc83 avatar Jul 19 '22 21:07 nickrmc83

@nickrmc83 if you rebase master you'll get this commit https://github.com/okta/terraform-provider-okta/commit/4071493bc2da9e90131ce2901539ec72c3eb2933 . It adds a feature where the provider discovers if it is running against an OIE or classic org and saves that as a boolean on the provider config classicOrg bool

func example(ctx context.Context, m interface{}) error {
	// `m` is the provider config struct

	// Inspecting the ACCESS_POLICY is OIE only https://developer.okta.com/docs/reference/api/policy/#policy-object
	// "Note: The following policy types are available only with the Identity Engine: ACCESS_POLICY or PROFILE_ENROLLMENT."

	// An example of making use of this info: If the org is not OIE return early
	if config, ok := m.(*Config); ok && config.classicOrg {
		return nil
	}

	// do something
	return nil
}

monde avatar Jul 29 '22 18:07 monde

@monde I've merged the latest head into my remote branch 👍

nickrmc83 avatar Jul 29 '22 20:07 nickrmc83

I need this as well. I work in an 'is_oie = 1' tenant and this change will work for me. A recap of this commit:

  • If 'okta_password' stanza is present, it will generate 'settings' changes in the payload. I verified that the Okta admin console does in fact send this stuff, so this isn't a problem.

edlott avatar Aug 13 '22 15:08 edlott

@monde is there likely to be any movement on this issue?

nickrmc83 avatar Sep 04 '22 20:09 nickrmc83

Okta internal reference https://oktainc.atlassian.net/browse/OKTA-532535

monde avatar Sep 14 '22 14:09 monde

@nickrmc83 I want to spend some time looking into this further given the classic/oie impact and have triaged it into our internal backlog.

monde avatar Sep 14 '22 14:09 monde

"I want to spend some time looking into this further given the classic/oie impact and have triaged it into our internal backlog"

Your original work (prior to this PR) was very intentional about not allowing this. I'm not sure what inspired you to block this functionality (perhaps out-of-date docs, or other information that's no longer relevant).

The Okta admin console clearly functions the same as this PR. Please let me know if any of the following would make you feel better about the PR:

  • Screen-shots of the REST calls made by the admin UI that illustrates functionality of the PR.
  • Postman test making calls like the PR.

The Okta platform is in a state of flux. I'm hoping you're not over-thinking this, or trying to divine the platform's long-term intentions. It's better to be nimble and exact at this point.

I'm using a custom build with this PR as we speak. I need to share share my terraform scripts with others, so they have to use my custom build as well. It would be much easier if this PR could be part of your release, so I don't have to manually distribute the provider.

Would it be possible to integrate this PR but have a command-line flag to turn the controversial functionality on/off?

edlott avatar Sep 14 '22 19:09 edlott

@monde is there any more we can do to move this forward? We'd like to get back to using a mainline release.

nickrmc83 avatar Oct 14 '22 17:10 nickrmc83

I'll try to dedicate time to look at this in my current sprint.

monde avatar Oct 24 '22 19:10 monde

@monde sorry to push but the lack of support for configuring password + Okta Verify using an official release is now causing us challenges. Do you have a timeline when this will be possible?

nickrmc83 avatar Nov 24 '22 09:11 nickrmc83

Hi - commenting to add to the general feedback on this issue. We are unable to use Terraform to create/configure MFA enrollment policies in OIE without receiving this error and have tried many workarounds, combinations to try resolve without success. We've had to go back to manually configuring MFA enrolment policies until a fix is available.

Matt-Hodgs0n avatar Dec 02 '22 15:12 Matt-Hodgs0n

I'll be bringing @nickrmc83's work in under PR #1427

monde avatar Jan 18 '23 02:01 monde

Forgot to shout this was released in https://github.com/okta/terraform-provider-okta/releases/tag/v3.41.0

monde avatar Feb 14 '23 18:02 monde