KMail/PGP MIME/da: Difference between revisions

From KDE UserBase Wiki
(Importing a new version from external source)
(Importing a new version from external source)
Line 55: Line 55:
== Opsætning af KMail til at signere e-mails ved brug af din gpg-nøgle ==
== Opsætning af KMail til at signere e-mails ved brug af din gpg-nøgle ==


# Fire up '''Kmail''', and go to <menuchoice>Settings -> Configure KMail -> Identities </menuchoice>  
# Start '''KMail''' og vælg menuen <menuchoice>Indstillinger -> Indstil KMail... -> Identiteter</menuchoice>
# Choose the identity that you are using
# Vælg den identitet, som du bruger
# Then click <menuchoice>Modify -> Cryptography -> OpenPGP signing key</menuchoice>  
# Klik så på <menuchoice>Ændr... -> Kryptografi -> OpenPGP-signeringsnøgle</menuchoice>
# It will automatically show your gpgkey, that is ''85EEC6A5''
# Det vil automatisk vise din gpg-nøgle, dvs. ''85EEC6A5''
# If it will not, click <menuchoice>Change...</menuchoice>, choose key ID then click <menuchoice>OK</menuchoice>  
# Gør den ikke det, så klik på <menuchoice>Ændr...</menuchoice>, vælg nøgle-ID og klik så <menuchoice>O.k.</menuchoice>
# Now, set up '''Kmail''' to automatically sign all emails that you write using your key
# Opsæt nu '''KMail''' til automatisk at signere alle de e-mails, som du skriver med din nøgle
# Still in the '''Kmail''' Configure menu, go to <menuchoice>Security -> Composing</menuchoice>  
# Gå til <menuchoice>Sikkerhed -> Skrivning</menuchoice> (stadig i indstillingesdialogen)
# Tick mark these:  
# Vælg disse punkter:
##Store sent messages encrypted,
## Opbevar gemte breve krypterede
##Always show the encryption key for approval,
## Vis altid indkodningsnøgle til godkendelse
##Automatically sign messages
##Signér breve automatisk
# Exit the configuration menu by clicking <menuchoice>OK</menuchoice>.  
# Forlad indstillingsdialogen ved at klikke på <menuchoice>O.k.</menuchoice>.  





Revision as of 10:22, 22 January 2011

Opsætning af signerede mails ved hjælp af GPG i KMail

af Fajar Priyanto, 2004

Lav din nøgle, lav en backup og udgiv den

1. Du får brug for programmet gpg. Det er allerede installeret som standard.

2. Lav din egen nøgle (skriv dette som dig selv, ikke som root):

gpg --gen-key

Følg instruktionerne, det er meget klart og let.


3. Tjek, at nøglen blev lavet:

gpg --list-key

Du vil se noget i retning af dette med dine egne legitimationsdata.

:pub 1024D/85EEC6A5 2004-03-15 Fajar Priyanto (Knowledge is power! http://linux.arinet.org) sub 1024g/BBBB57F3 2004-03-15


4. Se på detaljerne ovenfor. For eksempel er 85EEC6A5 din nøgles ID. For at eksportere din offentlige nøgle skriver du:

:gpg -ao fajar-pub.key --export 85EEC6A5


En fil ved navn fejar-pub.key vil blive lavet i den aktuelle mappe. Det er en kopi a din offentlige nøgle. Dette er også den fil, som folk skal importere for at verificere dine signerede e-mails. Du kan offentliggøre den på nøgleservere over hele verden, sende den direkte til de folk, som beder om den eller lægge den på dit websted, sådan at andre kan downloade den.

Hvis du ser på filens indhold, så vil det ligne dette:

-- --BEGIN PGP PUBLIC KEY BLOCK-- --

Version: GnuPG v1.2.3 (GNU/Linux)

mQGiBEBVTw8RBACaYvnDkgqNWyktg3urdE9mrpv63x3Iux2zVkuZk8pIRp5HeR/V

[snip snip...]

B394acuU4FdGN/EynYUAn1aRvNmgs0/IU2MDzYQpbHIaqpkE

=B0cy

-- --END PGP PUBLIC KEY BLOCK-- --

Desuden kan det være en god ide at lave en backup af din hemmelige nøgle på et sikkert medium (ikke kun én diskette; den bliver bare beskadiget). Brug følgende kommando:

$ gpg -ao secret.asc --export-secret-keys 85EEC6A5

Dette vil lave en tekstfil ved navn secret.asc med din hemmelige eller private nøgle. Giv den ikke til nogen, som du ikke har fuld tillid til. Gem den et sikkert sted (eller endnu bedre: mere end et sted).

Endelig er det tilrådeligt at generere et tilbagekaldelsescertifikat og gemme det et sikkert sted, ikke sammen med din hemmelige nøgle. Hvis din hemmelige nøgle falder i de forkerte hænder, så kan du tilbagekalde den, sådan at den ikke så let kan misbruges af andre. Kommandoen til at gøre dette er

$ gpg -a -o revoker.asc --gen-revoke 85EEC6A5

Dette vil lave en tekstfil ved navn revoker.asc, som indeholder tilbagekaldelsescertifikatet.


Opsætning af KMail til at signere e-mails ved brug af din gpg-nøgle

  1. Start KMail og vælg menuen Indstillinger -> Indstil KMail... -> Identiteter
  2. Vælg den identitet, som du bruger
  3. Klik så på Ændr... -> Kryptografi -> OpenPGP-signeringsnøgle
  4. Det vil automatisk vise din gpg-nøgle, dvs. 85EEC6A5
  5. Gør den ikke det, så klik på Ændr..., vælg nøgle-ID og klik så O.k.
  6. Opsæt nu KMail til automatisk at signere alle de e-mails, som du skriver med din nøgle
  7. Gå til Sikkerhed -> Skrivning (stadig i indstillingesdialogen)
  8. Vælg disse punkter:
    1. Opbevar gemte breve krypterede
    2. Vis altid indkodningsnøgle til godkendelse
    3. Signér breve automatisk
  9. Forlad indstillingsdialogen ved at klikke på O.k..


Testing Kmail by creating a new message

  1. You will notice that there is a Sign Message icon right after the paperclip (attachment) icon. It's already active.
  2. Write your message and when you are done, send it.
  3. Kmail will ask for you to type the secret passphrase that you made during the gpg --gen-key step. Type it in, and then Kmail will show you a confirmation window of the signed message. Click OK to send it.
  4. If you test it by sending to yourself, you will notice that Kmail displays the message with a GREEN header, with words like this: Message was signed by Fajar Priyanto (Knowledge is power! http://linux.arinet.org) (Key ID: 0x85EEC6A5). The signature is valid and the key is ultimately trusted.
  5. People that have your public key will have that display also, but those who don't have the key, will have the message displayed in yellow with words like this: Message was signed with unknown key 0xBFE7357F. The validity of the signature cannot be verified.

CONGRATULATIONS!

You now can communicate in a more secure way if you want to. I know this how-to is very short and might not be very clear. Well, please give me suggestions and I will improve it when the time comes. Also I intend to write the second part of this topic which covers how to ENCRYPT messages, import other public keys, and install Crypto Plug-ins. Special thanks to Tim Sawchuck and Philip Cronje and all my friends in the Mandrake List.


Issues

  • Messages signed by a key already known display correctly in KMail, but new keys were not being imported, and you can't sign messages. The culprit is a missing package. Installing pinentry-qt (you may need pinentry-qt4) appears to solve both problems.
  • KMail no longer does in-line signatures. OpenGPG has to be used instead. KGpg is a useful applet that helps in the management of signatures, both your own and those collected.
  • If OpenGPG is functioning correctly you will have to give the pass-phrase every time you send a document that is to be signed. This soon becomes a pain, and the way out of that is to configure gpg-agent, which comes with kdebase-common package. Unfortunately, the install does not pick up the need for pinentry-qt(4) or pinentry-gtk (KDE or GNOME), so that has to be installed separately. The config file for gpg-agent is written to by KMail's settings.

Note

To be sure the "passphrase agent" (gpg-agent) is enabled, check your ~/.gnupg/gpg.conf and eventually uncomment the line containing "use-agent".
In KMail's Settings -> Configure KMail -> Security tab -> Crypto Backends, select OpenGPG, then Configure. On the GPG Agent page, give a path to which logs can be written, in case of problems. You can check the log in KMail's Tools -> GnuPG Log Viewer. It's probably a good idea, too, to increase the cache time - I use 3600.


Warning

The following startup and shutdown scripts may be already in use from your distro, but not written in this path. Do not install these scripts unless you have problems with startup and shutdown


  • If you do not have it already, in ~/.kde create a directory called env. In there, create a file called gpgagent.sh containing
#!/bin/bash
killall gpg-agent
eval `gpg-agent --daemon`

Save it and make it executable.

In the same way you would clean up gpg-agent on shutdown, so if you do not have it already, create another directory called shutdown into ~/.kde and create in it another script file called stop_gpgagent.sh containing

#!/bin/bash
killall gpg-agent

Save it and make it executable.


Troubleshooting Tips

 grep gpg-agent 

will list any running instances of gpg-agent.

killall gpg-agent

stops all instances

eval "$(gpg-agent --daemon)"

will restart the agent

gpg-agent status

should tell you if the agent is running.