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