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

Make ipa-replica-install run in interactive mode #117

Closed
wants to merge 1 commit into from

Conversation

stlaz
Copy link
Contributor

@stlaz stlaz commented Sep 26, 2016

ipa-replica-install would not run in interactive mode which confused some users. Make it run ipa-client-install in attended mode so that the required arguments are asked for instead of the installation just failing.

@tkrizek tkrizek self-assigned this Sep 26, 2016
"with the --principal option.")
if installer.unattended:
# Don't add the password to the options in unattended mode
# ==> it would also appear in the client install logs
Copy link
Contributor

Choose a reason for hiding this comment

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

It actually appears in replica install logs.

# ==> it would also appear in the client install logs
stdin = installer.admin_password
else:
args.extend(["--password", installer.admin_password])
Copy link
Contributor

Choose a reason for hiding this comment

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

This way a password is logged in replica install log, which is undesirable. There might be some logging option to clear the password.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, I did not realize there was a nolog option in ipautil run, I will use that instead for both attended/unattended cases.

@@ -918,47 +918,55 @@ def install(installer):


def ensure_enrolled(installer):
config = installer._config
# Prepare options for the installer script
args = [paths.IPA_CLIENT_INSTALL, "--no-ntp"]
Copy link
Contributor

Choose a reason for hiding this comment

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

This changes the default behaviour. Previously, when a user provided all the mandatory arguments, the installation finished successfully in unattended mode. Now the user gets prompted for confirmations even if he provides all the mandatory attributes.

I think replica should only run in interactive mode if some mandatory attribute is missing to keep backwards compatibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

However, interactive mode will also allow the user to set domain/server before the confirmation if the IPADiscovery fails. Also, if IPADiscovery succeeds but the server/domain is not the one the user wants, they should be able to make their disapproval count.

This could be solved by having domain + server as mandatory options in ipa-replica-install but then we're losing the interactivity again.

@tkrizek
Copy link
Contributor

tkrizek commented Sep 27, 2016

NACK, please see inline comments.

@tkrizek
Copy link
Contributor

tkrizek commented Sep 29, 2016

ACK

Running the command in interactive mode by default is desirable behaviour. Since the -U flag was present in previous versions, we don't have to worry about backward compatibility.

@tkrizek tkrizek added the ack Pull Request approved, can be merged label Sep 29, 2016

ipautil.run(args, stdin=stdin, redirect_output=True)
# Call client install script
ipautil.run(args, nolog=nolog, redirect_output=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

The stdin=stdin has to stay, otherwise echo password | ipa-replica-install can't work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

echo password | ipa-replica-install does not work irregardless of this patch.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, my bad. However, I still think it's better to pass the admin password to ipa-client-install via stdin so that it's not visible in ps.

Copy link
Contributor

Choose a reason for hiding this comment

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

passing admin password in a command line argument is pretty much a NACK without recourse.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh, that's right. Up until this point, admin password would have to be passed in command line option anyway if you wanted to pass it to the installer. In this interactive mode, it may seem to a user that the password is actually hidden to anyone else but it would be revealed like this.
I think we have no other way but to make client install be run from a module, then. I will look into it once FIPS-related work is done.

@HonzaCholasta HonzaCholasta removed the ack Pull Request approved, can be merged label Oct 3, 2016
if installer.admin_password:
if installer.principal is None:
raise ScriptError("The --admin-password option must be used "
"with the --principal option.")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is correct. The name of the option implies the principal is admin (which is also how it behaves in domain level 0), so we should not require the user to explicitly specify the principal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The name indeed implies that the principal is admin, but that does not necessarily mean "admin", I think. Anyway, as this is the behavior in domain level 0, I've kept it and documented it in the respective man page + help.

@HonzaCholasta
Copy link
Contributor

NACK, see inline comments.

@stlaz stlaz force-pushed the trac-6068 branch 2 times, most recently from fee8b78 to 314bc73 Compare October 11, 2016 08:03
@simo5
Copy link
Contributor

simo5 commented Oct 14, 2016

@stlaz I do not understand the rationale. Ideally the ipa-replica-install command gathers all necessary info and ipa-client-install is always run in unattended mode.

@stlaz
Copy link
Contributor Author

stlaz commented Oct 14, 2016

@simo5: There is a LOT of checking of various combinations of options in ipa-client-install, not even mentioning IPADiscovery in interactive mode. It does not make sense to copy-paste all/most of it.
Note that this patch may be obsoleted by the installers refactoring effort as the ticket was moved to 4.5 release.

@simo5
Copy link
Contributor

simo5 commented Oct 17, 2016

@stlaz, sure, what I meant is that the checking code should be made common and run in ipa-repliuca-install, certainly I was not suggesting to just duplicate all that code. Perhaps refactoring will just do that.

@tkrizek
Copy link
Contributor

tkrizek commented Nov 22, 2016

This PR needs to be rebased to reflect installer refactoring.

Tweaks to replica installation to support interactive mode:
 - modified man to better document what actually happens
 - added principal/password prompt for unattended mode
   of ipa-replica-install if no credentials are set
 - made ipa-client-install run in interactive mode during
   replica promotion if it is itself not run in unattended mode

https://fedorahosted.org/freeipa/ticket/6068
@stlaz
Copy link
Contributor Author

stlaz commented Dec 15, 2016

Rebase done. I wanted to wait until some more changes to api bootstrapping to be able to call client installation from module using the latest installer system from the installers refactoring but we agreed with @jcholast that it'd be better to do that later.

# get the principal interactively, can't be empty
installer.principal = ipautil.user_input(
"User authorized to enroll computers",
allow_empty=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should ask for "User authorized to install replicas".

We should not ask for the username and password if the client is already installed and the host is already a member of ipaservers.

We should not ask for the username and password if there already is a valid ccache.

if not installer.admin_password:
# higher-level error so script usage is not printed
raise ScriptError("Password must be provided for %s." %
installer.principal)
Copy link
Contributor

Choose a reason for hiding this comment

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

This whole block should be moved to promote_check(), interactive prompts elsewhere are done in *_check() as well.

@stlaz
Copy link
Contributor Author

stlaz commented Mar 10, 2017

I have a WIP patch but since sometimes it's not clear which credentials are used, I am marking this as postponed so that we can wait until the client module can be called properly.

@tkrizek tkrizek removed their assignment Dec 19, 2017
@slaykovsky slaykovsky added the needs rebase Pull Request cannot be automatically merged - needs to be rebased label Mar 9, 2018
@rcritten
Copy link
Contributor

Closing due to inactivity.

@rcritten rcritten closed this May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs rebase Pull Request cannot be automatically merged - needs to be rebased postponed
Projects
None yet
6 participants