Show More
@@ -0,0 +1,164 b'' | |||
|
1 | ; -*- mode: rst -*- | |
|
2 | ||
|
3 | ================= | |
|
4 | mercurial_keyring | |
|
5 | ================= | |
|
6 | ||
|
7 | Mercurial extension to securely save HTTP and SMTP authentication | |
|
8 | passwords in password databases (Gnome Keyring, KDE KWallet, | |
|
9 | OSXKeyChain, specific solutions for Win32 and command line). Uses and | |
|
10 | wraps services of the keyring_ library. | |
|
11 | ||
|
12 | .. _keyring: http://pypi.python.org/pypi/keyring | |
|
13 | ||
|
14 | How does it work | |
|
15 | ================ | |
|
16 | ||
|
17 | The extension prompts for the password on the first pull/push (in case | |
|
18 | of HTTP) or first email (in case of SMTP), just like it is done by | |
|
19 | default, but saves the given password (keyed by the combination of | |
|
20 | username and remote repository url - for HTTP - or smtp server | |
|
21 | address - for SMTP) in the password database. On successive runs it | |
|
22 | checks for the username in ``.hg/hgrc``, then for suitable password in the | |
|
23 | password database, and uses those credentials if found. | |
|
24 | ||
|
25 | In case password turns out to be incorrect (either because it was | |
|
26 | invalid, or because it was changed on the server) it just prompts the | |
|
27 | user again. | |
|
28 | ||
|
29 | Installation | |
|
30 | ============ | |
|
31 | ||
|
32 | Install keyring library: | |
|
33 | ||
|
34 | :: | |
|
35 | ||
|
36 | easy_install keyring | |
|
37 | ||
|
38 | (or ``pip keyring``). On Debian "Sid" the library can be also | |
|
39 | installed from the official archive (packages ``python-keyring``, | |
|
40 | ``python-keyring-gnome`` and ``python-keyring-kwallet``). | |
|
41 | ||
|
42 | Then use one of the three options: | |
|
43 | ||
|
44 | a) download ``mercurial_keyring.py``, save it anywhere you like and | |
|
45 | put the following in ``~/.hgrc`` (or ``/etc/mercurial/hgrc``): | |
|
46 | ||
|
47 | :: | |
|
48 | ||
|
49 | [extensions] | |
|
50 | hgext.mercurial_keyring = /path/to/mercurial_keyring.py | |
|
51 | ||
|
52 | b) save ``mercurial_keyring.py`` to ``mercurial/hgext`` directory and | |
|
53 | use | |
|
54 | ||
|
55 | :: | |
|
56 | ||
|
57 | [extensions] | |
|
58 | hgext.mercurial_keyring = | |
|
59 | ||
|
60 | c) install ``mercurial_keyring`` using ``easy_install``: | |
|
61 | ||
|
62 | :: | |
|
63 | ||
|
64 | easy_install mercurial_keyring | |
|
65 | ||
|
66 | and then configure ``~/.hgrc`` so: | |
|
67 | ||
|
68 | :: | |
|
69 | ||
|
70 | [extensions] | |
|
71 | mercurial_keyring = | |
|
72 | ||
|
73 | Password backend configuration | |
|
74 | ============================== | |
|
75 | ||
|
76 | The library should usually pick the most appropriate password backend | |
|
77 | without configuration. Still, if necessary, it can be configured using | |
|
78 | ``~/keyringrc.cfg`` file (``keyringrc.cfg`` in the home directory of | |
|
79 | the current user). Refer to keyring_ docs for more details. | |
|
80 | ||
|
81 | ''I considered handling similar options in hgrc, but decided that | |
|
82 | single user may use more than one keyring-based script. Still, I am | |
|
83 | open to suggestions.'' | |
|
84 | ||
|
85 | Repository configuration (HTTP) | |
|
86 | =============================== | |
|
87 | ||
|
88 | Edit repository-local ``.hg/hgrc`` and save there the remote | |
|
89 | repository path and the username, but do not save the password. For | |
|
90 | example: | |
|
91 | ||
|
92 | :: | |
|
93 | ||
|
94 | [paths] | |
|
95 | myremote = https://my.server.com/hgrepo/someproject | |
|
96 | ||
|
97 | [auth] | |
|
98 | myremote.schemes = http https | |
|
99 | myremote.prefix = my.server.com/hgrepo | |
|
100 | myremote.username = mekk | |
|
101 | ||
|
102 | Simpler form with url-embedded name can also be used: | |
|
103 | ||
|
104 | :: | |
|
105 | ||
|
106 | [paths] | |
|
107 | bitbucket = https://User@bitbucket.org/User/project_name/ | |
|
108 | ||
|
109 | Note: if both username and password are given in ``.hg/hgrc``, | |
|
110 | extension will use them without using the password database. If | |
|
111 | username is not given, extension will prompt for credentials every | |
|
112 | time, also without saving the password. | |
|
113 | ||
|
114 | Repository configuration (SMTP) | |
|
115 | =============================== | |
|
116 | ||
|
117 | Edit either repository-local ``.hg/hgrc``, or ``~/.hgrc`` and set | |
|
118 | there all standard email and smtp properties, including smtp | |
|
119 | username, but without smtp password. For example: | |
|
120 | ||
|
121 | :: | |
|
122 | ||
|
123 | [email] | |
|
124 | method = smtp | |
|
125 | from = Joe Doe <Joe.Doe@remote.com> | |
|
126 | ||
|
127 | [smtp] | |
|
128 | host = smtp.gmail.com | |
|
129 | port = 587 | |
|
130 | username = JoeDoe@gmail.com | |
|
131 | tls = true | |
|
132 | ||
|
133 | Just as in case of HTTP, you *must* set username, but *must not* set | |
|
134 | password here to use the extension, in other cases it will revert to | |
|
135 | the default behaviour. | |
|
136 | ||
|
137 | Usage | |
|
138 | ===== | |
|
139 | ||
|
140 | Configure the repository as above, then just pull, push, etc. | |
|
141 | You should be asked for the password only once (per every | |
|
142 | username+remote_repository_url combination). | |
|
143 | ||
|
144 | Similarly, for email, configure as above and just email. | |
|
145 | Again, you will be asked for the password once (per every | |
|
146 | username+email_server_name+email_server_port). | |
|
147 | ||
|
148 | Implementation details | |
|
149 | ====================== | |
|
150 | ||
|
151 | The extension is monkey-patching the mercurial passwordmgr class to | |
|
152 | replace the find_user_password method. Detailed order of operations | |
|
153 | is described in the comments inside the code. | |
|
154 | ||
|
155 | Development | |
|
156 | =========== | |
|
157 | ||
|
158 | Development is tracked on http://bitbucket.org/Mekk/mercurial_keyring/ | |
|
159 | ||
|
160 | Additional notes | |
|
161 | ================ | |
|
162 | ||
|
163 | Information about this extension is also available | |
|
164 | on Mercurial Wiki: http://mercurial.selenic.com/wiki/KeyringExtension No newline at end of file |
@@ -6,166 +6,8 b'' | |||
|
6 | 6 | # |
|
7 | 7 | # This software may be used and distributed according to the terms |
|
8 | 8 | # of the GNU General Public License, incorporated herein by reference. |
|
9 | ||
|
10 | """ | |
|
11 | ================= | |
|
12 | mercurial_keyring | |
|
13 | ================= | |
|
14 | ||
|
15 | Mercurial extension to securely save HTTP and SMTP authentication | |
|
16 | passwords in password databases (Gnome Keyring, KDE KWallet, | |
|
17 | OSXKeyChain, specific solutions for Win32 and command line). Uses and | |
|
18 | wraps services of the keyring_ library. | |
|
19 | ||
|
20 | .. _keyring: http://pypi.python.org/pypi/keyring | |
|
21 | ||
|
22 | How does it work | |
|
23 | ================ | |
|
24 | ||
|
25 | The extension prompts for the password on the first pull/push (in case | |
|
26 | of HTTP) or first email (in case of SMTP), just like it is done by | |
|
27 | default, but saves the given password (keyed by the combination of | |
|
28 | username and remote repository url - for HTTP - or smtp server | |
|
29 | address - for SMTP) in the password database. On successive runs it | |
|
30 | checks for the username in ``.hg/hgrc``, then for suitable password in the | |
|
31 | password database, and uses those credentials if found. | |
|
32 | ||
|
33 | In case password turns out to be incorrect (either because it was | |
|
34 | invalid, or because it was changed on the server) it just prompts the | |
|
35 | user again. | |
|
36 | ||
|
37 | Installation | |
|
38 | ============ | |
|
39 | ||
|
40 | Install keyring library: | |
|
41 | ||
|
42 | :: | |
|
43 | ||
|
44 | easy_install keyring | |
|
45 | ||
|
46 | (or ``pip keyring``). On Debian "Sid" the library can be also | |
|
47 | installed from the official archive (packages ``python-keyring``, | |
|
48 | ``python-keyring-gnome`` and ``python-keyring-kwallet``). | |
|
49 | ||
|
50 | Then use one of the three options: | |
|
51 | ||
|
52 | a) download ``mercurial_keyring.py``, save it anywhere you like and | |
|
53 | put the following in ``~/.hgrc`` (or ``/etc/mercurial/hgrc``): | |
|
54 | ||
|
55 | :: | |
|
56 | ||
|
57 | [extensions] | |
|
58 | hgext.mercurial_keyring = /path/to/mercurial_keyring.py | |
|
59 | ||
|
60 | b) save ``mercurial_keyring.py`` to ``mercurial/hgext`` directory and | |
|
61 | use | |
|
62 | ||
|
63 | :: | |
|
64 | ||
|
65 | [extensions] | |
|
66 | hgext.mercurial_keyring = | |
|
67 | ||
|
68 | c) install ``mercurial_keyring`` using ``easy_install``: | |
|
69 | ||
|
70 | :: | |
|
71 | ||
|
72 | easy_install mercurial_keyring | |
|
73 | ||
|
74 | and then configure ``~/.hgrc`` so: | |
|
75 | ||
|
76 | :: | |
|
77 | ||
|
78 | [extensions] | |
|
79 | mercurial_keyring = | |
|
80 | ||
|
81 | Password backend configuration | |
|
82 | ============================== | |
|
83 | ||
|
84 | The library should usually pick the most appropriate password backend | |
|
85 | without configuration. Still, if necessary, it can be configured using | |
|
86 | ``~/keyringrc.cfg`` file (``keyringrc.cfg`` in the home directory of | |
|
87 | the current user). Refer to keyring_ docs for more details. | |
|
88 | ||
|
89 | ''I considered handling similar options in hgrc, but decided that | |
|
90 | single user may use more than one keyring-based script. Still, I am | |
|
91 | open to suggestions.'' | |
|
92 | ||
|
93 | Repository configuration (HTTP) | |
|
94 | =============================== | |
|
95 | ||
|
96 | Edit repository-local ``.hg/hgrc`` and save there the remote | |
|
97 | repository path and the username, but do not save the password. For | |
|
98 | example: | |
|
99 | ||
|
100 | :: | |
|
101 | ||
|
102 | [paths] | |
|
103 | myremote = https://my.server.com/hgrepo/someproject | |
|
104 | ||
|
105 | [auth] | |
|
106 | myremote.schemes = http https | |
|
107 | myremote.prefix = my.server.com/hgrepo | |
|
108 | myremote.username = mekk | |
|
109 | ||
|
110 | Simpler form with url-embedded name can also be used: | |
|
111 | ||
|
112 | :: | |
|
113 | ||
|
114 | [paths] | |
|
115 | bitbucket = https://User@bitbucket.org/User/project_name/ | |
|
116 | ||
|
117 | Note: if both username and password are given in ``.hg/hgrc``, | |
|
118 | extension will use them without using the password database. If | |
|
119 | username is not given, extension will prompt for credentials every | |
|
120 | time, also without saving the password. | |
|
121 | ||
|
122 | Repository configuration (SMTP) | |
|
123 | =============================== | |
|
124 | ||
|
125 | Edit either repository-local ``.hg/hgrc``, or ``~/.hgrc`` and set | |
|
126 | there all standard email and smtp properties, including smtp | |
|
127 | username, but without smtp password. For example: | |
|
128 | ||
|
129 | :: | |
|
130 | ||
|
131 | [email] | |
|
132 | method = smtp | |
|
133 | from = Joe Doe <Joe.Doe@remote.com> | |
|
134 | ||
|
135 | [smtp] | |
|
136 | host = smtp.gmail.com | |
|
137 | port = 587 | |
|
138 | username = JoeDoe@gmail.com | |
|
139 | tls = true | |
|
140 | ||
|
141 | Just as in case of HTTP, you *must* set username, but *must not* set | |
|
142 | password here to use the extension, in other cases it will revert to | |
|
143 | the default behaviour. | |
|
144 | ||
|
145 | Usage | |
|
146 | ===== | |
|
147 | ||
|
148 | Configure the repository as above, then just pull, push, etc. | |
|
149 | You should be asked for the password only once (per every | |
|
150 | username+remote_repository_url combination). | |
|
151 | ||
|
152 | Similarly, for email, configure as above and just email. | |
|
153 | Again, you will be asked for the password once (per every | |
|
154 | username+email_server_name+email_server_port). | |
|
155 | ||
|
156 | Implementation details | |
|
157 | ====================== | |
|
158 | ||
|
159 | The extension is monkey-patching the mercurial passwordmgr class to | |
|
160 | replace the find_user_password method. Detailed order of operations | |
|
161 | is described in the comments inside the code. | |
|
162 | ||
|
163 | Development | |
|
164 | =========== | |
|
165 | ||
|
166 | Development is tracked on http://bitbucket.org/Mekk/mercurial_keyring/ | |
|
167 | ||
|
168 | """ | |
|
9 | # | |
|
10 | # See README.txt for more details. | |
|
169 | 11 | |
|
170 | 12 | from mercurial import hg, repo, util |
|
171 | 13 | from mercurial.i18n import _ |
@@ -1,3 +1,5 b'' | |||
|
1 | ||
|
2 | ||
|
1 | 3 | try: |
|
2 | 4 | from setuptools import setup, find_packages |
|
3 | 5 | except ImportError: |
@@ -5,6 +7,8 b' except ImportError:' | |||
|
5 | 7 | use_setuptools() |
|
6 | 8 | from setuptools import setup, find_packages |
|
7 | 9 | |
|
10 | long_description = open("README.txt").read() | |
|
11 | ||
|
8 | 12 | setup( |
|
9 | 13 | name = "mercurial_keyring", |
|
10 | 14 | version = '0.3.1', |
@@ -12,8 +16,8 b' setup(' | |||
|
12 | 16 | author_email = 'Marcin.Kasperski@mekk.waw.pl', |
|
13 | 17 | url = 'http://mekk.waw.pl', |
|
14 | 18 | description = 'Mercurial Keyring Extension', |
|
15 | long_description = '''mercurial_keyring preserves passwords via keyring (http://pypi.python.org/pypi/keyring) library, using OSX/Keychain, KDE KWallet, Gnome Keyring, or internally supported storage (also on Win32). See http://mercurial.selenic.com/wiki/KeyringExtension for more info and http://bitbucket.org/Mekk/mercurial_keyring/ for source repository.''', | |
|
16 |
license = ' |
|
|
19 | long_description = long_description, | |
|
20 | license = 'GPL', | |
|
17 | 21 | py_modules = ['mercurial_keyring'], |
|
18 | 22 | keywords = "mercurial hg keyring password", |
|
19 | 23 | classifiers = [ |
General Comments 0
You need to be logged in to leave comments.
Login now