![]() |
|
||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
MIVA® SECURITY: Miva and PGP/GPG
What Is PGP?From The comp.security.pgp FAQ: PGP is a program that gives your electronic mail something that it otherwise doesn't have: Privacy. It does this by encrypting your mail so that nobody but the intended person can read it. When encrypted, the message looks like a meaningless jumble of random characters. PGP has proven itself quite capable of resisting even the most sophisticated forms of analysis aimed at reading the encrypted text. What Is GPG?GPG or GnuPG stands for GNU Privacy Guard From the the GnuPG Homesite: GnuPG is a complete and free replacement for PGP. Because it does not use the patented IDEA algorithm, it can be used without any restrictions. GnuPG is a RFC2440 (OpenPGP) compliant application.MvPGP function libraryMvPGP library contains a self-installing script, MvPGP parameter viewer, testing form, and a set of functions building an interface between Miva applications and PGP or GPG programs. When run for the first time, MvPGP library attempts to find the GnuPG or PGP binary, your private cgi-bin and the Miva data directory. If it does not succeed, it asks you to enter the paths manually. MvPGP was developed and tested with PGP 2.6.2 (an old but free version) and with GnuPG 1.0.4. It should work with newer versions as well. Most usually, you will have a PGP freeware 6.x or 7.x on the client side. There is also GnuPG for DOS/Windows, but as for now it has just a command line interface in contrary to PGP that integrates nicely with common e-mail clients. GnuPG is an Open Source application, with much more relaxed license then PGP and I suppose that in long term it may get much more popular then recently. Both applications can work fine together, but if you are using older versions of PGP, you may need some effort to find key types that are accepted by both (for copyright reasons there are some algorithms that are not available by default in GnuPG and older versions of PGP do not use some modern algorithms used in GnuPG). I'll try to bring here work-arounds for most common problems as soon as I find some time for it. Please keep on mind that you should never use the same secret private keyrings and same pass phrases on your remote server as you use for yourself! For encrypting text and sending PGP e-mail you do not need any private key and in fact, for security reasons, you may remove it from your server. You only need a public key for each of the target users (recipients). Please visit PGP oriented web sites and news groups to get more information on PGP, GnuPGP, OpenPGP, cryptography and security. Download the library / View the codePlease use the non-coloured plain-text source code for copying. The coloured syntax is easier to look at, but may contain minor mistakes. PGP should verify the B&W code signed by myself. Call the file mvpgp.mv (or something else if you wish) MvPGP version 0.125 from 10/03/2001The MvPGP library is free for personal non-commercial use. I offer the program without any warranty. Please use on your own risk only. Please keep all credits and comments. All rights reserved. If you are interested to use MvPGP library in scripts that you are writing for customers or re-selling them or if you plan to resell it standalone or together with other modules, libraries or scripts or to make profit with it in any other way, please let me know. MvPGP InstallationBefore installing the MvPGP library, be sure to have properly installed PGP or GnuPG on your server. After creating your key pair, import public keys of all potential recipients. Most probably you want to send encrypted e-mail to yourself too. On your local system, export your public key, upload it to your server and import it into your keyring. Again: do not use your own keyrings or pass phrases on the remote machine! In the same way you can add other recipients. Succesfull installation of MvPGP requires:
Please read also the FAQ on the MmPGP (Miva Merchant PGP e-mail notification module) After testing the functionality of PGP or GPG, just place the MvPGP library somewhere in your Miva script directory, run it from a browser and follow the instructions. MvPGP attempts to create two files:
Calling ExamplesSending encrypted e-mail: the text may be a string or a variable containing multiple lines. Please note, that the e-mail address must be present in your public keyring on the server. Check the PGP/GnuPG documentation to see how to add new public keys to your keyring. The same function accepts also filenames. If the second argument of the function is an existing filename in your Miva Data directory, it will be encrypted and sent by e-mail to the address (if present in the keyring). pgpEncrypt() function returns encrypted text or the content of a file passed in the 3rd argument. Public key of the target user (2nd argument) is used for the encryption. The first argument determines if the output comes with or without a PGP header. pgpListKeys() function returns a list of e-mail addresses extracted from public keys present in your keyring. If the first argument is empty or 0, pgpListKeys returns a pipe delimited list. If the argument is non-empty, the function returns OPTION list for a SELECT form element (drop-down box), containing the available recipients' addresses. If the argument is equal to one of these addresses, the appropriate option is selected. Please review the code of the test form inside of the MvPGP library to see practical examples of use of the mentioned functions. I will add more functions for decrypting, managing key rings and other as time allows. CompatibilityMvPGP was succesfully tested with PGP 2.6.2, PGP 5.0 (new in MvPGP version 0.075) and GnuPG v1.0.4. Miva Empresa 3.78 was used, and for security reasons I strongly recommend to use the latest Miva version. There are serious security flaws in all prior versions! Frequently Asked QuestionsWhat is PGP and GPG?Encryption programs. See more at the art0038.htm What is ~/ ?In Unix ~/ stands for the user home directory. It means the directory where all your files are located - it may contain folders keeping your web documents, miva data directory and many other files. Usually and correctly it should not be accessible from the web by a browser. Typically, on many systems it is equivalent to /home/yourloginname/ How to initialize an already installed PGP or GnuPG?Please refer to the PGP/GPG vendor's documentation for details. Often the following two steps would be enough to initialize a properly installed PGP or GnuPG if MvPGP/MmPGP is unable to do it for you:
How do I import my public keys into the server's key ring?Preferably use the MvPGP/MmPGP interface for doing so. You can do it from the shell too:
Why the imported keys do not appear in MvPGP/MmPGP?See also the troubleshoting section below. There are several possible reasons:
Why I am getting: "gpg: Warning: using insecure memory!" (GnuPGP)?It means that GPG uses a portion of operating memory possibly vulnerable against attacks from people having access to the machine (not visitors from the web). Although it is not a too serious threat, you or your system administrator should change the GPG binary permissions as follows:
Why I am getting: "Unsupported packet format - you need a newer version of PGP for this file" (PGP 2.6.x)?On your local PC (with the target keys), create and export a key with RSA Legacy algorithm (resp. RSA if no RSA Legacy available) instead of DH/DSS. Troubleshooting'Cgi-bin directory not found!' (MER-PGP-00008)During the installation process, MvPGP/MmPGP needs to be able to create scripts in the currently active cgi-bin directory. It means that this directory must be accessible from either the Mva Script or the Miva Data directory root. If the installtion routine does not find the paths to the cgi-bin automatically, you need to enter the path, relative to either the Miva Data or the Miva Script directory, manually. It does not make any sense to create a new cgi-bin directory (otherwise MvPGP/MmPGP would create it itself, of course). Only that cgi-bin directory that is assigned as ScriptAlias in the Apache configuration file (or equivalent on other web servers), may be used. If the cgi-bin is parallel to both Miva Data and Miva Script directories (and nowhere overlapping with any of them), there are still other possibilities to install MvPGP/MmPGP. Try one or more of the following instructions:
'Miva Data Directory not found!'One of possible reasons of this error message is a different user ID (uid) used for the Miva engine (usually the account owner's uid) and another one for the web server (often 'nobody' or 'www' with Apache without cgi wrapper like suexec). Another reason may be use of other than the default name for your Miva Data directory. The most secure way, is entering the full (absolute) path to your Miva Data directory. If you are unsure about the correct path, log in with Telnet, go to your Miva Data directory (e.g. 'cd htsdata' or 'cd mivadata'; on some systems the Mivadata may be identical with the user root dir) and type pwd to see the full path. Here are few examples: 'No public keys!'Most evident reason is that you have not imported any target public keys into your key ring. If you did it already (whether manually in Telnet/SSH or through the MvPGP/MmPGP interface), then a different user ID (uid) for CGI scripts and for Miva scripts could be the reason. Web servers (like Apache) sometimes use a special uid for calling documents and CGI scripts - often 'nobody' or 'www'. When there are respective user directories (e.g. /home/nobody), MvPGP/MmPGP should be able to work with the default '~/.gnupg' (resp. '~/.pgp'), but if there is no such directory on the system, you have to enter it manually. If the default dir does not work, a directory within the MvPGP/MmPGP subdirectory in the Miva Data dir should be used (see the paragraph above for ways to find out the path on your system): Enter the new location for the PGP/GPG home directory and try to import a key through the MvPGP/MmPGP interface. NOTE: MvPGP/MmPGP always tries to create the directory with the web server's uid and you may not be able to delete it from within a Telnet/SSH session, unless you have root access to the server. The directory may be removed with a cgi script in your cgi-bin called from a browser:
Replace the path with your real path to the PGP directory. Set its permissions to 755. If you named the file delpgp.cgi, you would call it from browser in this way:http://www.yourdomain/cgi-bin/delpgp.cgiRemove the script after using it to avoid its abuse. Security NotesWhen using the MvPGP library or the MmPGP module, you should be aware of certain facts regarding the security. You should disable access to the mvpgp.mv script to avoid access to it by by unauthorized visitors. Normally it is enough to disable both, the configuration listing and the test with selecting the 'hide' checkboxes on the mvpgp.mv page. You may additionally restrict the access to the file from the web totally in the Apache's .htaccess configuration file in this way:
Because of the location of the PGP/GnuPG configuration and key ring files on a public server, you should not trust the encrypted e-mail comming from the server. Anybody being able to break into your server, would be able to send e-mail using your PGP/GPG configuration and your secret keys. MvPGP/MmPGP in the recent version does not install any secret keys and if you do it manually, you should never use the same passphrases as you use for your usual encryption. Keep on mind that if somebody gained access to your private keys on the server, theoretically he might be able do crack then using brute force. There is no risk, if the secret key is used just on that server and never used for signing or exporting trusts to other keys. MvPGP/MmPGP does not use the secrete keys at all, so you may remove them from the keyring, or use just a dummy secret keys. MvPGP/MmPGP encrypts messages with the addressee's public keys only and do not sign them with the server's secret key. MvPGP/MmPGP on systems with GnuPG uses the option --always-trust for any imported keys. This was made to simplify the automated installation procedure, but if you prefer signing all imported keys manually, please edit the mvpgp.cgi (resp. the mmpgp.cgi) in your cgi-bin directory and remove any instance of the --always-trust option. It brings you more security, because every new key must be then signed using the server's passphrase manually from the shell (SSH/Telnet). Some Useful LinksMmPGP - Secure PGP e-mail notification Miva Merchant moduleThe GNU Privacy Guard GnuPG in an automated environment OpenPGP.org comming up RFC 2440: OpenPGP Message Format RFC 1991: PGP Message Exchange Formats MIT's PGP Freeware The International PGP Home Page PGP Home Page Gnu Privacy Guard Mini Howto |
||||||||||
|
Miva and some other terms used on this page are registerd trademarks of the Miva Corporation |