Show More
@@ -1,645 +1,634 | |||
|
1 | 1 | #require serve ssl |
|
2 | 2 | |
|
3 | 3 | Proper https client requires the built-in ssl from Python 2.6. |
|
4 | 4 | |
|
5 | 5 | Make server certificates: |
|
6 | 6 | |
|
7 | 7 | $ CERTSDIR="$TESTDIR/sslcerts" |
|
8 | 8 | $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub.pem" >> server.pem |
|
9 | 9 | $ PRIV=`pwd`/server.pem |
|
10 | 10 | $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub-not-yet.pem" > server-not-yet.pem |
|
11 | 11 | $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub-expired.pem" > server-expired.pem |
|
12 | 12 | |
|
13 | 13 | $ hg init test |
|
14 | 14 | $ cd test |
|
15 | 15 | $ echo foo>foo |
|
16 | 16 | $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg |
|
17 | 17 | $ echo foo>foo.d/foo |
|
18 | 18 | $ echo bar>foo.d/bAr.hg.d/BaR |
|
19 | 19 | $ echo bar>foo.d/baR.d.hg/bAR |
|
20 | 20 | $ hg commit -A -m 1 |
|
21 | 21 | adding foo |
|
22 | 22 | adding foo.d/bAr.hg.d/BaR |
|
23 | 23 | adding foo.d/baR.d.hg/bAR |
|
24 | 24 | adding foo.d/foo |
|
25 | 25 | $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV |
|
26 | 26 | $ cat ../hg0.pid >> $DAEMON_PIDS |
|
27 | 27 | |
|
28 | 28 | cacert not found |
|
29 | 29 | |
|
30 | 30 | $ hg in --config web.cacerts=no-such.pem https://localhost:$HGPORT/ |
|
31 | 31 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
32 | 32 | abort: could not find web.cacerts: no-such.pem |
|
33 | 33 | [255] |
|
34 | 34 | |
|
35 | 35 | Test server address cannot be reused |
|
36 | 36 | |
|
37 | 37 | #if windows |
|
38 | 38 | $ hg serve -p $HGPORT --certificate=$PRIV 2>&1 |
|
39 | 39 | abort: cannot start server at 'localhost:$HGPORT': * (glob) |
|
40 | 40 | [255] |
|
41 | 41 | #else |
|
42 | 42 | $ hg serve -p $HGPORT --certificate=$PRIV 2>&1 |
|
43 | 43 | abort: cannot start server at 'localhost:$HGPORT': Address already in use |
|
44 | 44 | [255] |
|
45 | 45 | #endif |
|
46 | 46 | $ cd .. |
|
47 | 47 | |
|
48 | 48 | Our test cert is not signed by a trusted CA. It should fail to verify if |
|
49 | 49 | we are able to load CA certs. |
|
50 | 50 | |
|
51 | 51 | #if sslcontext defaultcacerts no-defaultcacertsloaded |
|
52 | 52 | $ hg clone https://localhost:$HGPORT/ copy-pull |
|
53 | 53 | (an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error) |
|
54 | 54 | abort: error: *certificate verify failed* (glob) |
|
55 | 55 | [255] |
|
56 | 56 | #endif |
|
57 | 57 | |
|
58 | 58 | #if no-sslcontext defaultcacerts |
|
59 | 59 | $ hg clone https://localhost:$HGPORT/ copy-pull |
|
60 | 60 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
61 | 61 | (using CA certificates from *; if you see this message, your Mercurial install is not properly configured; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) (glob) (?) |
|
62 | 62 | abort: error: *certificate verify failed* (glob) |
|
63 | 63 | [255] |
|
64 | 64 | #endif |
|
65 | 65 | |
|
66 | 66 | #if no-sslcontext windows |
|
67 | 67 | $ hg clone https://localhost:$HGPORT/ copy-pull |
|
68 | 68 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info |
|
69 | 69 | (unable to load Windows CA certificates; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) |
|
70 | 70 | abort: error: *certificate verify failed* (glob) |
|
71 | 71 | [255] |
|
72 | 72 | #endif |
|
73 | 73 | |
|
74 | 74 | #if no-sslcontext osx |
|
75 | 75 | $ hg clone https://localhost:$HGPORT/ copy-pull |
|
76 | 76 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info |
|
77 | 77 | (unable to load CA certificates; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) |
|
78 | 78 | abort: localhost certificate error: no certificate received |
|
79 | 79 | (set hostsecurity.localhost:certfingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e config setting or use --insecure to connect insecurely) |
|
80 | 80 | [255] |
|
81 | 81 | #endif |
|
82 | 82 | |
|
83 | 83 | #if defaultcacertsloaded |
|
84 | 84 | $ hg clone https://localhost:$HGPORT/ copy-pull |
|
85 | 85 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
86 | 86 | (using CA certificates from *; if you see this message, your Mercurial install is not properly configured; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) (glob) (?) |
|
87 | 87 | abort: error: *certificate verify failed* (glob) |
|
88 | 88 | [255] |
|
89 | 89 | #endif |
|
90 | 90 | |
|
91 | 91 | #if no-defaultcacerts |
|
92 | 92 | $ hg clone https://localhost:$HGPORT/ copy-pull |
|
93 | 93 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
94 | 94 | (unable to load * certificates; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this message) (glob) (?) |
|
95 | 95 | abort: localhost certificate error: no certificate received |
|
96 | 96 | (set hostsecurity.localhost:certfingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e config setting or use --insecure to connect insecurely) |
|
97 | 97 | [255] |
|
98 | 98 | #endif |
|
99 | 99 | |
|
100 | 100 | Specifying a per-host certificate file that doesn't exist will abort. The full |
|
101 | 101 | C:/path/to/msysroot will print on Windows. |
|
102 | 102 | |
|
103 | 103 | $ hg --config hostsecurity.localhost:verifycertsfile=/does/not/exist clone https://localhost:$HGPORT/ |
|
104 | 104 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
105 | 105 | abort: path specified by hostsecurity.localhost:verifycertsfile does not exist: */does/not/exist (glob) |
|
106 | 106 | [255] |
|
107 | 107 | |
|
108 | 108 | A malformed per-host certificate file will raise an error |
|
109 | 109 | |
|
110 | 110 | $ echo baddata > badca.pem |
|
111 | 111 | #if sslcontext |
|
112 | 112 | $ hg --config hostsecurity.localhost:verifycertsfile=badca.pem clone https://localhost:$HGPORT/ |
|
113 | 113 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
114 | 114 | abort: error loading CA file badca.pem: * (glob) |
|
115 | 115 | (file is empty or malformed?) |
|
116 | 116 | [255] |
|
117 | 117 | #else |
|
118 | 118 | $ hg --config hostsecurity.localhost:verifycertsfile=badca.pem clone https://localhost:$HGPORT/ |
|
119 | 119 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
120 | 120 | abort: error: * (glob) |
|
121 | 121 | [255] |
|
122 | 122 | #endif |
|
123 | 123 | |
|
124 | 124 | A per-host certificate mismatching the server will fail verification |
|
125 | 125 | |
|
126 | 126 | (modern ssl is able to discern whether the loaded cert is a CA cert) |
|
127 | 127 | #if sslcontext |
|
128 | 128 | $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/client-cert.pem" clone https://localhost:$HGPORT/ |
|
129 | 129 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
130 | 130 | (an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error) |
|
131 | 131 | abort: error: *certificate verify failed* (glob) |
|
132 | 132 | [255] |
|
133 | 133 | #else |
|
134 | 134 | $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/client-cert.pem" clone https://localhost:$HGPORT/ |
|
135 | 135 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
136 | 136 | abort: error: *certificate verify failed* (glob) |
|
137 | 137 | [255] |
|
138 | 138 | #endif |
|
139 | 139 | |
|
140 | 140 | A per-host certificate matching the server's cert will be accepted |
|
141 | 141 | |
|
142 | 142 | $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/pub.pem" clone -U https://localhost:$HGPORT/ perhostgood1 |
|
143 | 143 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
144 | 144 | requesting all changes |
|
145 | 145 | adding changesets |
|
146 | 146 | adding manifests |
|
147 | 147 | adding file changes |
|
148 | 148 | added 1 changesets with 4 changes to 4 files |
|
149 | 149 | |
|
150 | 150 | A per-host certificate with multiple certs and one matching will be accepted |
|
151 | 151 | |
|
152 | 152 | $ cat "$CERTSDIR/client-cert.pem" "$CERTSDIR/pub.pem" > perhost.pem |
|
153 | 153 | $ hg --config hostsecurity.localhost:verifycertsfile=perhost.pem clone -U https://localhost:$HGPORT/ perhostgood2 |
|
154 | 154 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
155 | 155 | requesting all changes |
|
156 | 156 | adding changesets |
|
157 | 157 | adding manifests |
|
158 | 158 | adding file changes |
|
159 | 159 | added 1 changesets with 4 changes to 4 files |
|
160 | 160 | |
|
161 | 161 | Defining both per-host certificate and a fingerprint will print a warning |
|
162 | 162 | |
|
163 | 163 | $ hg --config hostsecurity.localhost:verifycertsfile="$CERTSDIR/pub.pem" --config hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 clone -U https://localhost:$HGPORT/ caandfingerwarning |
|
164 | 164 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
165 | 165 | (hostsecurity.localhost:verifycertsfile ignored when host fingerprints defined; using host fingerprints for verification) |
|
166 | 166 | requesting all changes |
|
167 | 167 | adding changesets |
|
168 | 168 | adding manifests |
|
169 | 169 | adding file changes |
|
170 | 170 | added 1 changesets with 4 changes to 4 files |
|
171 | 171 | |
|
172 | 172 | $ DISABLECACERTS="--config devel.disableloaddefaultcerts=true" |
|
173 | 173 | |
|
174 | 174 | Inability to verify peer certificate will result in abort |
|
175 | 175 | |
|
176 | 176 | $ hg clone https://localhost:$HGPORT/ copy-pull $DISABLECACERTS |
|
177 | 177 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
178 | 178 | abort: unable to verify security of localhost (no loaded CA certificates); refusing to connect |
|
179 | 179 | (see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e to trust this server) |
|
180 | 180 | [255] |
|
181 | 181 | |
|
182 | 182 | $ hg clone --insecure https://localhost:$HGPORT/ copy-pull |
|
183 | 183 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
184 | 184 | warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering |
|
185 | 185 | requesting all changes |
|
186 | 186 | adding changesets |
|
187 | 187 | adding manifests |
|
188 | 188 | adding file changes |
|
189 | 189 | added 1 changesets with 4 changes to 4 files |
|
190 | 190 | updating to branch default |
|
191 | 191 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
192 | 192 | $ hg verify -R copy-pull |
|
193 | 193 | checking changesets |
|
194 | 194 | checking manifests |
|
195 | 195 | crosschecking files in changesets and manifests |
|
196 | 196 | checking files |
|
197 | 197 | 4 files, 1 changesets, 4 total revisions |
|
198 | 198 | $ cd test |
|
199 | 199 | $ echo bar > bar |
|
200 | 200 | $ hg commit -A -d '1 0' -m 2 |
|
201 | 201 | adding bar |
|
202 | 202 | $ cd .. |
|
203 | 203 | |
|
204 | 204 | pull without cacert |
|
205 | 205 | |
|
206 | 206 | $ cd copy-pull |
|
207 | 207 | $ cat >> .hg/hgrc <<EOF |
|
208 | 208 | > [hooks] |
|
209 | 209 | > changegroup = sh -c "printenv.py changegroup" |
|
210 | 210 | > EOF |
|
211 | 211 | $ hg pull $DISABLECACERTS |
|
212 | 212 | pulling from https://localhost:$HGPORT/ |
|
213 | 213 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
214 | 214 | abort: unable to verify security of localhost (no loaded CA certificates); refusing to connect |
|
215 | 215 | (see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e to trust this server) |
|
216 | 216 | [255] |
|
217 | 217 | |
|
218 | 218 | $ hg pull --insecure |
|
219 | 219 | pulling from https://localhost:$HGPORT/ |
|
220 | 220 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
221 | 221 | warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering |
|
222 | 222 | searching for changes |
|
223 | 223 | adding changesets |
|
224 | 224 | adding manifests |
|
225 | 225 | adding file changes |
|
226 | 226 | added 1 changesets with 1 changes to 1 files |
|
227 | 227 | changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=https://localhost:$HGPORT/ |
|
228 | 228 | (run 'hg update' to get a working copy) |
|
229 | 229 | $ cd .. |
|
230 | 230 | |
|
231 | 231 | cacert configured in local repo |
|
232 | 232 | |
|
233 | 233 | $ cp copy-pull/.hg/hgrc copy-pull/.hg/hgrc.bu |
|
234 | 234 | $ echo "[web]" >> copy-pull/.hg/hgrc |
|
235 | 235 | $ echo "cacerts=$CERTSDIR/pub.pem" >> copy-pull/.hg/hgrc |
|
236 | 236 | $ hg -R copy-pull pull |
|
237 | 237 | pulling from https://localhost:$HGPORT/ |
|
238 | 238 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
239 | 239 | searching for changes |
|
240 | 240 | no changes found |
|
241 | 241 | $ mv copy-pull/.hg/hgrc.bu copy-pull/.hg/hgrc |
|
242 | 242 | |
|
243 | 243 | cacert configured globally, also testing expansion of environment |
|
244 | 244 | variables in the filename |
|
245 | 245 | |
|
246 | 246 | $ echo "[web]" >> $HGRCPATH |
|
247 | 247 | $ echo 'cacerts=$P/pub.pem' >> $HGRCPATH |
|
248 | 248 | $ P="$CERTSDIR" hg -R copy-pull pull |
|
249 | 249 | pulling from https://localhost:$HGPORT/ |
|
250 | 250 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
251 | 251 | searching for changes |
|
252 | 252 | no changes found |
|
253 | 253 | $ P="$CERTSDIR" hg -R copy-pull pull --insecure |
|
254 | 254 | pulling from https://localhost:$HGPORT/ |
|
255 | 255 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
256 | 256 | warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering |
|
257 | 257 | searching for changes |
|
258 | 258 | no changes found |
|
259 | 259 | |
|
260 | 260 | empty cacert file |
|
261 | 261 | |
|
262 | 262 | $ touch emptycafile |
|
263 | 263 | |
|
264 | 264 | #if sslcontext |
|
265 | 265 | $ hg --config web.cacerts=emptycafile -R copy-pull pull |
|
266 | 266 | pulling from https://localhost:$HGPORT/ |
|
267 | 267 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
268 | 268 | abort: error loading CA file emptycafile: * (glob) |
|
269 | 269 | (file is empty or malformed?) |
|
270 | 270 | [255] |
|
271 | 271 | #else |
|
272 | 272 | $ hg --config web.cacerts=emptycafile -R copy-pull pull |
|
273 | 273 | pulling from https://localhost:$HGPORT/ |
|
274 | 274 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
275 | 275 | abort: error: * (glob) |
|
276 | 276 | [255] |
|
277 | 277 | #endif |
|
278 | 278 | |
|
279 | 279 | cacert mismatch |
|
280 | 280 | |
|
281 | 281 | $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub.pem" \ |
|
282 | 282 | > https://$LOCALIP:$HGPORT/ |
|
283 | 283 | pulling from https://*:$HGPORT/ (glob) |
|
284 | 284 | warning: connecting to $LOCALIP using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
285 | 285 | abort: $LOCALIP certificate error: certificate is for localhost (glob) |
|
286 | 286 | (set hostsecurity.$LOCALIP:certfingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e config setting or use --insecure to connect insecurely) |
|
287 | 287 | [255] |
|
288 | 288 | $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub.pem" \ |
|
289 | 289 | > https://$LOCALIP:$HGPORT/ --insecure |
|
290 | 290 | pulling from https://*:$HGPORT/ (glob) |
|
291 | 291 | warning: connecting to $LOCALIP using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
292 | 292 | warning: connection security to $LOCALIP is disabled per current settings; communication is susceptible to eavesdropping and tampering (glob) |
|
293 | 293 | searching for changes |
|
294 | 294 | no changes found |
|
295 | 295 | $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-other.pem" |
|
296 | 296 | pulling from https://localhost:$HGPORT/ |
|
297 | 297 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
298 | 298 | abort: error: *certificate verify failed* (glob) |
|
299 | 299 | [255] |
|
300 | 300 | $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-other.pem" \ |
|
301 | 301 | > --insecure |
|
302 | 302 | pulling from https://localhost:$HGPORT/ |
|
303 | 303 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
304 | 304 | warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering |
|
305 | 305 | searching for changes |
|
306 | 306 | no changes found |
|
307 | 307 | |
|
308 | 308 | Test server cert which isn't valid yet |
|
309 | 309 | |
|
310 | 310 | $ hg serve -R test -p $HGPORT1 -d --pid-file=hg1.pid --certificate=server-not-yet.pem |
|
311 | 311 | $ cat hg1.pid >> $DAEMON_PIDS |
|
312 | 312 | $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-not-yet.pem" \ |
|
313 | 313 | > https://localhost:$HGPORT1/ |
|
314 | 314 | pulling from https://localhost:$HGPORT1/ |
|
315 | 315 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
316 | 316 | abort: error: *certificate verify failed* (glob) |
|
317 | 317 | [255] |
|
318 | 318 | |
|
319 | 319 | Test server cert which no longer is valid |
|
320 | 320 | |
|
321 | 321 | $ hg serve -R test -p $HGPORT2 -d --pid-file=hg2.pid --certificate=server-expired.pem |
|
322 | 322 | $ cat hg2.pid >> $DAEMON_PIDS |
|
323 | 323 | $ hg -R copy-pull pull --config web.cacerts="$CERTSDIR/pub-expired.pem" \ |
|
324 | 324 | > https://localhost:$HGPORT2/ |
|
325 | 325 | pulling from https://localhost:$HGPORT2/ |
|
326 | 326 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
327 | 327 | abort: error: *certificate verify failed* (glob) |
|
328 | 328 | [255] |
|
329 | 329 | |
|
330 | 330 | Disabling the TLS 1.0 warning works |
|
331 | 331 | $ hg -R copy-pull id https://localhost:$HGPORT/ \ |
|
332 | 332 | > --config hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 \ |
|
333 | 333 | > --config hostsecurity.disabletls10warning=true |
|
334 | 334 | 5fed3813f7f5 |
|
335 | 335 | |
|
336 | #if no-sslcontext no-py27+ | |
|
337 | Setting ciphers doesn't work in Python 2.6 | |
|
338 | $ P="$CERTSDIR" hg --config hostsecurity.ciphers=HIGH -R copy-pull id https://localhost:$HGPORT/ | |
|
339 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info | |
|
340 | abort: setting ciphers in [hostsecurity] is not supported by this version of Python | |
|
341 | (remove the config option or run Mercurial with a modern Python version (preferred)) | |
|
342 | [255] | |
|
343 | #endif | |
|
336 | Error message for setting ciphers is different depending on SSLContext support | |
|
344 | 337 |
|
|
345 | Setting ciphers works in Python 2.7+ but the error message is different on | |
|
346 | legacy ssl. We test legacy once and do more feature checking on modern | |
|
347 | configs. | |
|
348 | ||
|
349 | #if py27+ no-sslcontext | |
|
338 | #if no-sslcontext | |
|
350 | 339 | $ P="$CERTSDIR" hg --config hostsecurity.ciphers=invalid -R copy-pull id https://localhost:$HGPORT/ |
|
351 | 340 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info |
|
352 | 341 | abort: *No cipher can be selected. (glob) |
|
353 | 342 | [255] |
|
354 | 343 | |
|
355 | 344 | $ P="$CERTSDIR" hg --config hostsecurity.ciphers=HIGH -R copy-pull id https://localhost:$HGPORT/ |
|
356 | 345 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info |
|
357 | 346 | 5fed3813f7f5 |
|
358 | 347 |
|
|
359 | 348 |
|
|
360 | 349 |
|
|
361 | 350 | Setting ciphers to an invalid value aborts |
|
362 | 351 | $ P="$CERTSDIR" hg --config hostsecurity.ciphers=invalid -R copy-pull id https://localhost:$HGPORT/ |
|
363 | 352 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
364 | 353 | abort: could not set ciphers: No cipher can be selected. |
|
365 | 354 | (change cipher string (invalid) in config) |
|
366 | 355 | [255] |
|
367 | 356 | |
|
368 | 357 | $ P="$CERTSDIR" hg --config hostsecurity.localhost:ciphers=invalid -R copy-pull id https://localhost:$HGPORT/ |
|
369 | 358 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
370 | 359 | abort: could not set ciphers: No cipher can be selected. |
|
371 | 360 | (change cipher string (invalid) in config) |
|
372 | 361 | [255] |
|
373 | 362 | |
|
374 | 363 | Changing the cipher string works |
|
375 | 364 | |
|
376 | 365 | $ P="$CERTSDIR" hg --config hostsecurity.ciphers=HIGH -R copy-pull id https://localhost:$HGPORT/ |
|
377 | 366 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
378 | 367 | 5fed3813f7f5 |
|
379 | 368 |
|
|
380 | 369 |
|
|
381 | 370 |
|
|
382 | 371 | |
|
383 | 372 | - works without cacerts (hostfingerprints) |
|
384 | 373 | $ hg -R copy-pull id https://localhost:$HGPORT/ --insecure --config hostfingerprints.localhost=ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03 |
|
385 | 374 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
386 | 375 | (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, set the following config value in [hostsecurity] and remove the old one from [hostfingerprints] to upgrade to a more secure SHA-256 fingerprint: localhost.fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e) |
|
387 | 376 | 5fed3813f7f5 |
|
388 | 377 | |
|
389 | 378 | - works without cacerts (hostsecurity) |
|
390 | 379 | $ hg -R copy-pull id https://localhost:$HGPORT/ --config hostsecurity.localhost:fingerprints=sha1:ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 |
|
391 | 380 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
392 | 381 | 5fed3813f7f5 |
|
393 | 382 | |
|
394 | 383 | $ hg -R copy-pull id https://localhost:$HGPORT/ --config hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e |
|
395 | 384 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
396 | 385 | 5fed3813f7f5 |
|
397 | 386 | |
|
398 | 387 | - multiple fingerprints specified and first matches |
|
399 | 388 |
$ |
|
400 | 389 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
401 | 390 | (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, set the following config value in [hostsecurity] and remove the old one from [hostfingerprints] to upgrade to a more secure SHA-256 fingerprint: localhost.fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e) |
|
402 | 391 | 5fed3813f7f5 |
|
403 | 392 | |
|
404 | 393 |
$ |
|
405 | 394 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
406 | 395 | 5fed3813f7f5 |
|
407 | 396 | |
|
408 | 397 | - multiple fingerprints specified and last matches |
|
409 | 398 |
$ |
|
410 | 399 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
411 | 400 | (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, set the following config value in [hostsecurity] and remove the old one from [hostfingerprints] to upgrade to a more secure SHA-256 fingerprint: localhost.fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e) |
|
412 | 401 | 5fed3813f7f5 |
|
413 | 402 | |
|
414 | 403 |
$ |
|
415 | 404 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
416 | 405 | 5fed3813f7f5 |
|
417 | 406 | |
|
418 | 407 | - multiple fingerprints specified and none match |
|
419 | 408 | |
|
420 | 409 |
$ |
|
421 | 410 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
422 | 411 | abort: certificate for localhost has unexpected fingerprint ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03 |
|
423 | 412 | (check hostfingerprint configuration) |
|
424 | 413 | [255] |
|
425 | 414 | |
|
426 | 415 |
$ |
|
427 | 416 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
428 | 417 | abort: certificate for localhost has unexpected fingerprint sha1:ec:d8:7c:d6:b3:86:d0:4f:c1:b8:b4:1c:9d:8f:5e:16:8e:ef:1c:03 |
|
429 | 418 | (check hostsecurity configuration) |
|
430 | 419 | [255] |
|
431 | 420 | |
|
432 | 421 |
|
|
433 | 422 | $ hg -R copy-pull id https://localhost:$HGPORT1/ --config hostfingerprints.localhost=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 |
|
434 | 423 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
435 | 424 | abort: certificate for localhost has unexpected fingerprint f4:2f:5a:0c:3e:52:5b:db:e7:24:a8:32:1d:18:97:6d:69:b5:87:84 |
|
436 | 425 | (check hostfingerprint configuration) |
|
437 | 426 | [255] |
|
438 | 427 | |
|
439 | 428 | |
|
440 | 429 | - ignores that certificate doesn't match hostname |
|
441 | 430 | $ hg -R copy-pull id https://$LOCALIP:$HGPORT/ --config hostfingerprints.$LOCALIP=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 |
|
442 | 431 | warning: connecting to $LOCALIP using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
443 | 432 | (SHA-1 fingerprint for $LOCALIP found in legacy [hostfingerprints] section; if you trust this fingerprint, set the following config value in [hostsecurity] and remove the old one from [hostfingerprints] to upgrade to a more secure SHA-256 fingerprint: $LOCALIP.fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e) |
|
444 | 433 | 5fed3813f7f5 |
|
445 | 434 | |
|
446 | 435 | Ports used by next test. Kill servers. |
|
447 | 436 | |
|
448 | 437 | $ killdaemons.py hg0.pid |
|
449 | 438 | $ killdaemons.py hg1.pid |
|
450 | 439 | $ killdaemons.py hg2.pid |
|
451 | 440 | |
|
452 | 441 |
|
|
453 | 442 | Start servers running supported TLS versions |
|
454 | 443 | |
|
455 | 444 | $ cd test |
|
456 | 445 | $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV \ |
|
457 | 446 | > --config devel.serverexactprotocol=tls1.0 |
|
458 | 447 | $ cat ../hg0.pid >> $DAEMON_PIDS |
|
459 | 448 | $ hg serve -p $HGPORT1 -d --pid-file=../hg1.pid --certificate=$PRIV \ |
|
460 | 449 | > --config devel.serverexactprotocol=tls1.1 |
|
461 | 450 | $ cat ../hg1.pid >> $DAEMON_PIDS |
|
462 | 451 | $ hg serve -p $HGPORT2 -d --pid-file=../hg2.pid --certificate=$PRIV \ |
|
463 | 452 | > --config devel.serverexactprotocol=tls1.2 |
|
464 | 453 | $ cat ../hg2.pid >> $DAEMON_PIDS |
|
465 | 454 | $ cd .. |
|
466 | 455 | |
|
467 | 456 | Clients talking same TLS versions work |
|
468 | 457 | |
|
469 | 458 | $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.0 id https://localhost:$HGPORT/ |
|
470 | 459 | 5fed3813f7f5 |
|
471 | 460 | $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT1/ |
|
472 | 461 | 5fed3813f7f5 |
|
473 | 462 | $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT2/ |
|
474 | 463 | 5fed3813f7f5 |
|
475 | 464 | |
|
476 | 465 | Clients requiring newer TLS version than what server supports fail |
|
477 | 466 | |
|
478 | 467 | $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ |
|
479 | 468 | (could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support) |
|
480 | 469 | (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server) |
|
481 | 470 | (see https://mercurial-scm.org/wiki/SecureConnections for more info) |
|
482 | 471 | abort: error: *unsupported protocol* (glob) |
|
483 | 472 | [255] |
|
484 | 473 | |
|
485 | 474 | $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 id https://localhost:$HGPORT/ |
|
486 | 475 | (could not negotiate a common security protocol (tls1.1+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support) |
|
487 | 476 | (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server) |
|
488 | 477 | (see https://mercurial-scm.org/wiki/SecureConnections for more info) |
|
489 | 478 | abort: error: *unsupported protocol* (glob) |
|
490 | 479 | [255] |
|
491 | 480 | $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT/ |
|
492 | 481 | (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support) |
|
493 | 482 | (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server) |
|
494 | 483 | (see https://mercurial-scm.org/wiki/SecureConnections for more info) |
|
495 | 484 | abort: error: *unsupported protocol* (glob) |
|
496 | 485 | [255] |
|
497 | 486 | $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT1/ |
|
498 | 487 | (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support) |
|
499 | 488 | (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server) |
|
500 | 489 | (see https://mercurial-scm.org/wiki/SecureConnections for more info) |
|
501 | 490 | abort: error: *unsupported protocol* (glob) |
|
502 | 491 | [255] |
|
503 | 492 | |
|
504 | 493 | --insecure will allow TLS 1.0 connections and override configs |
|
505 | 494 | |
|
506 | 495 | $ hg --config hostsecurity.minimumprotocol=tls1.2 id --insecure https://localhost:$HGPORT1/ |
|
507 | 496 | warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering |
|
508 | 497 | 5fed3813f7f5 |
|
509 | 498 | |
|
510 | 499 | The per-host config option overrides the default |
|
511 | 500 | |
|
512 | 501 | $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \ |
|
513 | 502 | > --config hostsecurity.minimumprotocol=tls1.2 \ |
|
514 | 503 |
> --config hostsecurity.localhost:minimumprotocol=tls1.0 |
|
515 | 504 | 5fed3813f7f5 |
|
516 | 505 | |
|
517 | 506 | The per-host config option by itself works |
|
518 | 507 | |
|
519 | 508 | $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \ |
|
520 | 509 |
> --config hostsecurity.localhost:minimumprotocol=tls1.2 |
|
521 | 510 | (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support) |
|
522 | 511 | (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server) |
|
523 | 512 | (see https://mercurial-scm.org/wiki/SecureConnections for more info) |
|
524 | 513 | abort: error: *unsupported protocol* (glob) |
|
525 | 514 | [255] |
|
526 | 515 | |
|
527 | 516 | .hg/hgrc file [hostsecurity] settings are applied to remote ui instances (issue5305) |
|
528 | 517 | |
|
529 | 518 | $ cat >> copy-pull/.hg/hgrc << EOF |
|
530 | 519 | > [hostsecurity] |
|
531 | 520 | > localhost:minimumprotocol=tls1.2 |
|
532 | 521 | > EOF |
|
533 | 522 | $ P="$CERTSDIR" hg -R copy-pull id https://localhost:$HGPORT/ |
|
534 | 523 | (could not negotiate a common security protocol (tls1.2+) with localhost; the likely cause is Mercurial is configured to be more secure than the server can support) |
|
535 | 524 | (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.localhost:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server) |
|
536 | 525 | (see https://mercurial-scm.org/wiki/SecureConnections for more info) |
|
537 | 526 | abort: error: *unsupported protocol* (glob) |
|
538 | 527 | [255] |
|
539 | 528 | |
|
540 | 529 | $ killdaemons.py hg0.pid |
|
541 | 530 | $ killdaemons.py hg1.pid |
|
542 | 531 | $ killdaemons.py hg2.pid |
|
543 | 532 | #endif |
|
544 | 533 | |
|
545 | 534 | Prepare for connecting through proxy |
|
546 | 535 | |
|
547 | 536 | $ hg serve -R test -p $HGPORT -d --pid-file=hg0.pid --certificate=$PRIV |
|
548 | 537 | $ cat hg0.pid >> $DAEMON_PIDS |
|
549 | 538 | $ hg serve -R test -p $HGPORT2 -d --pid-file=hg2.pid --certificate=server-expired.pem |
|
550 | 539 | $ cat hg2.pid >> $DAEMON_PIDS |
|
551 | 540 |
|
|
552 | 541 | from the shell. So don't kill it. |
|
553 | 542 | $ tinyproxy.py $HGPORT1 localhost >proxy.log </dev/null 2>&1 & |
|
554 | 543 | $ while [ ! -f proxy.pid ]; do sleep 0; done |
|
555 | 544 | $ cat proxy.pid >> $DAEMON_PIDS |
|
556 | 545 | |
|
557 | 546 | $ echo "[http_proxy]" >> copy-pull/.hg/hgrc |
|
558 | 547 | $ echo "always=True" >> copy-pull/.hg/hgrc |
|
559 | 548 | $ echo "[hostfingerprints]" >> copy-pull/.hg/hgrc |
|
560 | 549 | $ echo "localhost =" >> copy-pull/.hg/hgrc |
|
561 | 550 | |
|
562 | 551 | Test unvalidated https through proxy |
|
563 | 552 | |
|
564 | 553 | $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull --insecure |
|
565 | 554 | pulling from https://localhost:$HGPORT/ |
|
566 | 555 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
567 | 556 | warning: connection security to localhost is disabled per current settings; communication is susceptible to eavesdropping and tampering |
|
568 | 557 | searching for changes |
|
569 | 558 | no changes found |
|
570 | 559 | |
|
571 | 560 | Test https with cacert and fingerprint through proxy |
|
572 | 561 | |
|
573 | 562 | $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \ |
|
574 | 563 |
> --config web.cacerts="$CERTSDIR/pub.pem" |
|
575 | 564 | pulling from https://localhost:$HGPORT/ |
|
576 | 565 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
577 | 566 | searching for changes |
|
578 | 567 | no changes found |
|
579 | 568 | $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull https://localhost:$HGPORT/ --config hostfingerprints.localhost=ecd87cd6b386d04fc1b8b41c9d8f5e168eef1c03 --trace |
|
580 | 569 | pulling from https://*:$HGPORT/ (glob) |
|
581 | 570 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
582 | 571 | (SHA-1 fingerprint for localhost found in legacy [hostfingerprints] section; if you trust this fingerprint, set the following config value in [hostsecurity] and remove the old one from [hostfingerprints] to upgrade to a more secure SHA-256 fingerprint: localhost.fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e) |
|
583 | 572 | searching for changes |
|
584 | 573 | no changes found |
|
585 | 574 | |
|
586 | 575 | Test https with cert problems through proxy |
|
587 | 576 | |
|
588 | 577 | $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \ |
|
589 | 578 |
> --config web.cacerts="$CERTSDIR/pub-other.pem" |
|
590 | 579 | pulling from https://localhost:$HGPORT/ |
|
591 | 580 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
592 | 581 | abort: error: *certificate verify failed* (glob) |
|
593 | 582 | [255] |
|
594 | 583 | $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull \ |
|
595 | 584 |
> --config web.cacerts="$CERTSDIR/pub-expired.pem" https://localhost:$HGPORT2/ |
|
596 | 585 | pulling from https://localhost:$HGPORT2/ |
|
597 | 586 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
598 | 587 | abort: error: *certificate verify failed* (glob) |
|
599 | 588 | [255] |
|
600 | 589 | |
|
601 | 590 | |
|
602 | 591 | $ killdaemons.py hg0.pid |
|
603 | 592 | |
|
604 | 593 |
|
|
605 | 594 |
|
|
606 | 595 | Start hgweb that requires client certificates: |
|
607 | 596 | |
|
608 | 597 | $ cd test |
|
609 | 598 | $ hg serve -p $HGPORT -d --pid-file=../hg0.pid --certificate=$PRIV \ |
|
610 | 599 | > --config devel.servercafile=$PRIV --config devel.serverrequirecert=true |
|
611 | 600 | $ cat ../hg0.pid >> $DAEMON_PIDS |
|
612 | 601 | $ cd .. |
|
613 | 602 | |
|
614 | 603 | without client certificate: |
|
615 | 604 | |
|
616 | 605 | $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ |
|
617 | 606 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
618 | 607 | abort: error: *handshake failure* (glob) |
|
619 | 608 | [255] |
|
620 | 609 | |
|
621 | 610 | with client certificate: |
|
622 | 611 | |
|
623 | 612 | $ cat << EOT >> $HGRCPATH |
|
624 | 613 | > [auth] |
|
625 | 614 | > l.prefix = localhost |
|
626 | 615 | > l.cert = $CERTSDIR/client-cert.pem |
|
627 | 616 | > l.key = $CERTSDIR/client-key.pem |
|
628 | 617 | > EOT |
|
629 | 618 | |
|
630 | 619 | $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \ |
|
631 | 620 |
> --config auth.l.key="$CERTSDIR/client-key-decrypted.pem" |
|
632 | 621 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
633 | 622 | 5fed3813f7f5 |
|
634 | 623 | |
|
635 | 624 | $ printf '1234\n' | env P="$CERTSDIR" hg id https://localhost:$HGPORT/ \ |
|
636 | 625 |
> --config ui.interactive=True --config ui.nontty=True |
|
637 | 626 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
638 | 627 | passphrase for */client-key.pem: 5fed3813f7f5 (glob) |
|
639 | 628 | |
|
640 | 629 | $ env P="$CERTSDIR" hg id https://localhost:$HGPORT/ |
|
641 | 630 | warning: connecting to localhost using legacy security technology (TLS 1.0); see https://mercurial-scm.org/wiki/SecureConnections for more info (?) |
|
642 | 631 | abort: error: * (glob) |
|
643 | 632 | [255] |
|
644 | 633 | |
|
645 | 634 |
|
General Comments 0
You need to be logged in to leave comments.
Login now