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