How to make auto trust gpg public key?

user1366786 picture user1366786 · Oct 29, 2012 · Viewed 47.2k times · Source

I am trying to add my GPG public key as a part of our appliance installation process. The purpose of it to encrypt any important files like logs before admin pulling them into his local using admin portal and then decrypt them using private key. The plan is to export public key into a file and make appliance installation process to import it using gpg --import command. But I realized, the key is needed to be trusted/signed before do any encryption. How to make this key is trusted without any human intervention at the time of installation? Btw, our appliance os is ubuntu vm and we use kickstart to automate.

Advance thanks for all help.

Answer

Ray picture Ray · Jun 16, 2013

Your question is really "How do I encrypt to a key without gpg balking at the fact that the key is untrusted?"

One answer is you could sign the key.

gpg --edit-key YOUR_RECIPIENT
sign
yes
save

The other is you could tell gpg to go ahead and trust.

gpg --encrypt --recipient YOUR_RECIPIENT --trust-model always YOUR_FILE