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

Output screwed with passphrase input dialog #4

Open
yujunz opened this issue Dec 10, 2018 · 10 comments
Open

Output screwed with passphrase input dialog #4

yujunz opened this issue Dec 10, 2018 · 10 comments

Comments

@yujunz
Copy link
Contributor

yujunz commented Dec 10, 2018

When GPG prompt for passphrase, terraform keeps pushing out the state change in screen which screwed with the dialog.

Is it possible to pause on the dialog?

                                                                                      ┌────────────────────────────────────────────────────────────────┐
                                                                                      │ Please enter the passphrase to unlock the OpenPGP secret key:  │
                                                                                      │ "Yujun Zhang <*>"                              │
                                                                                      │ 4096-bit RSA key, ID *1E54********C60C,                         │
                                                                                      │ created 2018-08-16 (main key ID 208C********D205).             │
                                                                                      │                                                                │
                                                                                      │                                                                │
                                                                                      │ Passphrase: aws_s3_bucket.data: Refreshing state... (ID: datal)
                                                                                      │                                                                │                                   aws_db_parameter_group.this: Refreshing state... (ID: rds)                                                            │         <OK>                                    <Cancel>       │
                          aws_iam_role.monitoring: Refreshing state... (ID: monitoring.rds)─────────────────────────────────────────┘
                                                                                                              aws_db_option_group.this: Refreshing state... (ID: rds)
                                                                                                                                                                                        data.aws_security_group.bastion: Refreshing state...
                                                                                                                                                                                                                                            da
@carlpett
Copy link
Owner

Hm, I'm fairly sure this would be a bug in Terraform itself and should be reported on the core Terraform repo (https://github.com/hashicorp/terraform). Or does it only happen when using this provider?

@yujunz
Copy link
Contributor Author

yujunz commented Dec 10, 2018

Could be.

Reported here also since this is the first plugin I used which is asking for user input.

@carlpett
Copy link
Owner

Yeah, might not be that common. Would you mind opening an issue there too and pinging me and we'll see what they have to say? If it "should" work in core then I can troubleshoot here better.

@yujunz
Copy link
Contributor Author

yujunz commented Dec 10, 2018

Yeah, might not be that common. Would you mind opening an issue there too and pinging me and we'll see what they have to say? If it "should" work in core then I can troubleshoot here better.

Done.

@carlpett
Copy link
Owner

Thanks. As per the discussion in that issue, it actually falls on this plugin to deal with it. Thinking some more about it, I wonder, is this actually the plugin itself, or is the output from a gpg-agent?

@yujunz
Copy link
Contributor Author

yujunz commented Dec 11, 2018

I think it is from pinentry

brew info pinentry
pinentry: stable 1.1.0 (bottled)
Passphrase entry dialog utilizing the Assuan protocol
https://www.gnupg.org/related_software/pinentry/
/usr/local/Cellar/pinentry/1.1.0_1 (12 files, 263.9KB) *
  Poured from bottle on 2018-08-23 at 05:46:30
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/pinentry.rb

With the following configuration:

GPG_TTY=$(tty)
export GPG_TTY

@carlpett
Copy link
Owner

Alright. I'm actually not sure how to prevent this from happening, since it is several steps removed from the code here: Terraform calls terraform-provider-sops (this code) which uses the sops library, which checks with the gpg agent (pinentry in your case) if it needs to be unlocked.
Do you have any ideas outside of reconfiguring your gpg agent?

@yujunz
Copy link
Contributor Author

yujunz commented Dec 12, 2018

Neither do I.

How do you handle passphrase protected PGP private key at the moment?

@carlpett
Copy link
Owner

Personally I've only used sops with cloud key vaults, so there it is not an issue (there are no interactive components)
For normal gpg usage, my agent queries for passphrase once per every X minutes, but this may or may not be a reasonable configuration in your circumstances (and anyway will require that you do some sort of no-op before running terraform just to get the key unlocked)

@landro
Copy link

landro commented May 29, 2019

Have you tried using pinentry-program /usr/local/bin/pinentry-mac @yujunz ? Haven't tried it with this provider, but came across this issue and thought I'd let you know about this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants