Merge lp:~ralsina/ubuntu-push/merge-automatic into lp:ubuntu-push
- merge-automatic
- Merge into trunk
Proposed by
Roberto Alsina
Status: | Merged |
---|---|
Approved by: | Roberto Alsina |
Approved revision: | no longer in the source branch. |
Merged at revision: | 131 |
Proposed branch: | lp:~ralsina/ubuntu-push/merge-automatic |
Merge into: | lp:ubuntu-push |
Diff against target: |
934 lines (+296/-151) 23 files modified
bus/unitygreeter/unitygreeter.go (+52/-0) client/service/postal.go (+14/-0) client/service/postal_test.go (+15/-11) client/session/session_test.go (+4/-25) debian/changelog (+7/-0) docs/example-client/main.qml (+8/-0) docs/example-client/manifest.json (+2/-2) sampleconfigs/dev.json (+1/-1) server/acceptance/acceptance_test.go (+1/-1) server/acceptance/ssl/README (+1/-1) server/acceptance/ssl/testing.cert (+7/-7) server/acceptance/ssl/testing.key (+7/-7) server/acceptance/suites/broadcast.go (+1/-1) server/acceptance/suites/suite.go (+1/-1) server/config_test.go (+12/-11) server/dev/server.go (+2/-2) server/listener/listener.go (+4/-13) server/listener/listener_test.go (+9/-17) server/runner_devices.go (+2/-29) server/runner_http.go (+6/-1) server/runner_test.go (+45/-6) server/tlsconfig.go (+53/-0) testing/tls.go (+42/-15) |
To merge this branch: | bzr merge lp:~ralsina/ubuntu-push/merge-automatic |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Roberto Alsina (community) | Approve | ||
Review via email:
|
Commit message
Updates from the automatic branch
Description of the change
Updates from the automatic branch
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Roberto Alsina (ralsina) : | # |
review:
Approve
- 131. By Roberto Alsina
-
Updates from the automatic branch
Approved by: Roberto Alsina
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'bus/unitygreeter' | |||
2 | === added file 'bus/unitygreeter/unitygreeter.go' | |||
3 | --- bus/unitygreeter/unitygreeter.go 1970-01-01 00:00:00 +0000 | |||
4 | +++ bus/unitygreeter/unitygreeter.go 2014-09-10 15:12:43 +0000 | |||
5 | @@ -0,0 +1,52 @@ | |||
6 | 1 | /* | ||
7 | 2 | Copyright 2014 Canonical Ltd. | ||
8 | 3 | |||
9 | 4 | This program is free software: you can redistribute it and/or modify it | ||
10 | 5 | under the terms of the GNU General Public License version 3, as published | ||
11 | 6 | by the Free Software Foundation. | ||
12 | 7 | |||
13 | 8 | This program is distributed in the hope that it will be useful, but | ||
14 | 9 | WITHOUT ANY WARRANTY; without even the implied warranties of | ||
15 | 10 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
16 | 11 | PURPOSE. See the GNU General Public License for more details. | ||
17 | 12 | |||
18 | 13 | You should have received a copy of the GNU General Public License along | ||
19 | 14 | with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | 15 | */ | ||
21 | 16 | |||
22 | 17 | // Package unitygreeter retrieves information about the Unity Greeter | ||
23 | 18 | // using Unity's dbus interface | ||
24 | 19 | package unitygreeter | ||
25 | 20 | |||
26 | 21 | import ( | ||
27 | 22 | "launchpad.net/ubuntu-push/bus" | ||
28 | 23 | "launchpad.net/ubuntu-push/logger" | ||
29 | 24 | ) | ||
30 | 25 | |||
31 | 26 | // Well known address for the UnityGreeter API | ||
32 | 27 | var BusAddress bus.Address = bus.Address{ | ||
33 | 28 | Interface: "com.canonical.UnityGreeter", | ||
34 | 29 | Path: "/", | ||
35 | 30 | Name: "com.canonical.UnityGreeter", | ||
36 | 31 | } | ||
37 | 32 | |||
38 | 33 | // UnityGreeter encapsulates info needed to call out to the UnityGreeter API | ||
39 | 34 | type UnityGreeter struct { | ||
40 | 35 | bus bus.Endpoint | ||
41 | 36 | log logger.Logger | ||
42 | 37 | } | ||
43 | 38 | |||
44 | 39 | // New returns a new UnityGreeter that'll use the provided bus.Endpoint | ||
45 | 40 | func New(endp bus.Endpoint, log logger.Logger) *UnityGreeter { | ||
46 | 41 | return &UnityGreeter{endp, log} | ||
47 | 42 | } | ||
48 | 43 | |||
49 | 44 | // GetUnityGreeter returns the window stack state | ||
50 | 45 | func (greeter *UnityGreeter) IsActive() bool { | ||
51 | 46 | result, err := greeter.bus.GetProperty("IsActive") | ||
52 | 47 | if err != nil { | ||
53 | 48 | greeter.log.Errorf("GetUnityGreeter call returned %v", err) | ||
54 | 49 | return false | ||
55 | 50 | } | ||
56 | 51 | return result.(bool) | ||
57 | 52 | } | ||
58 | 0 | 53 | ||
59 | === modified file 'client/service/postal.go' | |||
60 | --- client/service/postal.go 2014-08-21 19:05:15 +0000 | |||
61 | +++ client/service/postal.go 2014-09-10 15:12:43 +0000 | |||
62 | @@ -27,6 +27,7 @@ | |||
63 | 27 | "launchpad.net/ubuntu-push/bus/emblemcounter" | 27 | "launchpad.net/ubuntu-push/bus/emblemcounter" |
64 | 28 | "launchpad.net/ubuntu-push/bus/haptic" | 28 | "launchpad.net/ubuntu-push/bus/haptic" |
65 | 29 | "launchpad.net/ubuntu-push/bus/notifications" | 29 | "launchpad.net/ubuntu-push/bus/notifications" |
66 | 30 | "launchpad.net/ubuntu-push/bus/unitygreeter" | ||
67 | 30 | "launchpad.net/ubuntu-push/bus/windowstack" | 31 | "launchpad.net/ubuntu-push/bus/windowstack" |
68 | 31 | "launchpad.net/ubuntu-push/click" | 32 | "launchpad.net/ubuntu-push/click" |
69 | 32 | "launchpad.net/ubuntu-push/click/cblacklist" | 33 | "launchpad.net/ubuntu-push/click/cblacklist" |
70 | @@ -76,6 +77,7 @@ | |||
71 | 76 | EmblemCounterEndp bus.Endpoint | 77 | EmblemCounterEndp bus.Endpoint |
72 | 77 | HapticEndp bus.Endpoint | 78 | HapticEndp bus.Endpoint |
73 | 78 | NotificationsEndp bus.Endpoint | 79 | NotificationsEndp bus.Endpoint |
74 | 80 | UnityGreeterEndp bus.Endpoint | ||
75 | 79 | WindowStackEndp bus.Endpoint | 81 | WindowStackEndp bus.Endpoint |
76 | 80 | // presenters: | 82 | // presenters: |
77 | 81 | Presenters []Presenter | 83 | Presenters []Presenter |
78 | @@ -85,6 +87,7 @@ | |||
79 | 85 | sound *sounds.Sound | 87 | sound *sounds.Sound |
80 | 86 | // the url dispatcher, used for stuff. | 88 | // the url dispatcher, used for stuff. |
81 | 87 | urlDispatcher urldispatcher.URLDispatcher | 89 | urlDispatcher urldispatcher.URLDispatcher |
82 | 90 | unityGreeter *unitygreeter.UnityGreeter | ||
83 | 88 | windowStack *windowstack.WindowStack | 91 | windowStack *windowstack.WindowStack |
84 | 89 | // fallback values for simplified notification usage | 92 | // fallback values for simplified notification usage |
85 | 90 | fallbackVibration *launch_helper.Vibration | 93 | fallbackVibration *launch_helper.Vibration |
86 | @@ -115,6 +118,7 @@ | |||
87 | 115 | svc.NotificationsEndp = bus.SessionBus.Endpoint(notifications.BusAddress, log) | 118 | svc.NotificationsEndp = bus.SessionBus.Endpoint(notifications.BusAddress, log) |
88 | 116 | svc.EmblemCounterEndp = bus.SessionBus.Endpoint(emblemcounter.BusAddress, log) | 119 | svc.EmblemCounterEndp = bus.SessionBus.Endpoint(emblemcounter.BusAddress, log) |
89 | 117 | svc.HapticEndp = bus.SessionBus.Endpoint(haptic.BusAddress, log) | 120 | svc.HapticEndp = bus.SessionBus.Endpoint(haptic.BusAddress, log) |
90 | 121 | svc.UnityGreeterEndp = bus.SessionBus.Endpoint(unitygreeter.BusAddress, log) | ||
91 | 118 | svc.WindowStackEndp = bus.SessionBus.Endpoint(windowstack.BusAddress, log) | 122 | svc.WindowStackEndp = bus.SessionBus.Endpoint(windowstack.BusAddress, log) |
92 | 119 | svc.msgHandler = svc.messageHandler | 123 | svc.msgHandler = svc.messageHandler |
93 | 120 | svc.launchers = launch_helper.DefaultLaunchers(log) | 124 | svc.launchers = launch_helper.DefaultLaunchers(log) |
94 | @@ -169,6 +173,7 @@ | |||
95 | 169 | } else { | 173 | } else { |
96 | 170 | svc.HelperPool = launch_helper.NewHelperPool(svc.launchers, svc.Log) | 174 | svc.HelperPool = launch_helper.NewHelperPool(svc.launchers, svc.Log) |
97 | 171 | } | 175 | } |
98 | 176 | svc.unityGreeter = unitygreeter.New(svc.UnityGreeterEndp, svc.Log) | ||
99 | 172 | svc.windowStack = windowstack.New(svc.WindowStackEndp, svc.Log) | 177 | svc.windowStack = windowstack.New(svc.WindowStackEndp, svc.Log) |
100 | 173 | 178 | ||
101 | 174 | go svc.consumeHelperResults(svc.HelperPool.Start()) | 179 | go svc.consumeHelperResults(svc.HelperPool.Start()) |
102 | @@ -224,6 +229,7 @@ | |||
103 | 224 | {"notifications", svc.NotificationsEndp}, | 229 | {"notifications", svc.NotificationsEndp}, |
104 | 225 | {"emblemcounter", svc.EmblemCounterEndp}, | 230 | {"emblemcounter", svc.EmblemCounterEndp}, |
105 | 226 | {"haptic", svc.HapticEndp}, | 231 | {"haptic", svc.HapticEndp}, |
106 | 232 | {"unitygreeter", svc.UnityGreeterEndp}, | ||
107 | 227 | {"windowstack", svc.WindowStackEndp}, | 233 | {"windowstack", svc.WindowStackEndp}, |
108 | 228 | } | 234 | } |
109 | 229 | for _, endp := range endps { | 235 | for _, endp := range endps { |
110 | @@ -414,6 +420,14 @@ | |||
111 | 414 | // no need to log, (it's been logged already) | 420 | // no need to log, (it's been logged already) |
112 | 415 | return false | 421 | return false |
113 | 416 | } | 422 | } |
114 | 423 | |||
115 | 424 | if output.Notification.Card != nil && output.Notification.Card.Popup { | ||
116 | 425 | if svc.unityGreeter.IsActive() { | ||
117 | 426 | // Screen is locked, ensure popup is false | ||
118 | 427 | output.Notification.Card.Popup = false | ||
119 | 428 | } | ||
120 | 429 | } | ||
121 | 430 | |||
122 | 417 | if !svc.windowStack.IsAppFocused(app) { | 431 | if !svc.windowStack.IsAppFocused(app) { |
123 | 418 | if isBlacklisted(app) { | 432 | if isBlacklisted(app) { |
124 | 419 | svc.Log.Debugf("notification skipped (except emblem counter) because app is blacklisted") | 433 | svc.Log.Debugf("notification skipped (except emblem counter) because app is blacklisted") |
125 | 420 | 434 | ||
126 | === modified file 'client/service/postal_test.go' | |||
127 | --- client/service/postal_test.go 2014-09-01 14:32:51 +0000 | |||
128 | +++ client/service/postal_test.go 2014-09-10 15:12:43 +0000 | |||
129 | @@ -161,17 +161,18 @@ | |||
130 | 161 | } | 161 | } |
131 | 162 | 162 | ||
132 | 163 | type postalSuite struct { | 163 | type postalSuite struct { |
144 | 164 | log *helpers.TestLogger | 164 | log *helpers.TestLogger |
145 | 165 | cfg *PostalServiceSetup | 165 | cfg *PostalServiceSetup |
146 | 166 | bus bus.Endpoint | 166 | bus bus.Endpoint |
147 | 167 | notifBus bus.Endpoint | 167 | notifBus bus.Endpoint |
148 | 168 | counterBus bus.Endpoint | 168 | counterBus bus.Endpoint |
149 | 169 | hapticBus bus.Endpoint | 169 | hapticBus bus.Endpoint |
150 | 170 | winStackBus bus.Endpoint | 170 | unityGreeterBus bus.Endpoint |
151 | 171 | fakeLauncher *fakeHelperLauncher | 171 | winStackBus bus.Endpoint |
152 | 172 | getTempDir func(string) (string, error) | 172 | fakeLauncher *fakeHelperLauncher |
153 | 173 | oldIsBlisted func(*click.AppId) bool | 173 | getTempDir func(string) (string, error) |
154 | 174 | blacklisted bool | 174 | oldIsBlisted func(*click.AppId) bool |
155 | 175 | blacklisted bool | ||
156 | 175 | } | 176 | } |
157 | 176 | 177 | ||
158 | 177 | type ualPostalSuite struct { | 178 | type ualPostalSuite struct { |
159 | @@ -194,6 +195,7 @@ | |||
160 | 194 | ps.notifBus = testibus.NewTestingEndpoint(condition.Work(true), condition.Work(true)) | 195 | ps.notifBus = testibus.NewTestingEndpoint(condition.Work(true), condition.Work(true)) |
161 | 195 | ps.counterBus = testibus.NewTestingEndpoint(condition.Work(true), condition.Work(true)) | 196 | ps.counterBus = testibus.NewTestingEndpoint(condition.Work(true), condition.Work(true)) |
162 | 196 | ps.hapticBus = testibus.NewTestingEndpoint(condition.Work(true), condition.Work(true)) | 197 | ps.hapticBus = testibus.NewTestingEndpoint(condition.Work(true), condition.Work(true)) |
163 | 198 | ps.unityGreeterBus = testibus.NewTestingEndpoint(condition.Work(true), condition.Work(true), false) | ||
164 | 197 | ps.winStackBus = testibus.NewTestingEndpoint(condition.Work(true), condition.Work(true), []windowstack.WindowsInfo{}) | 199 | ps.winStackBus = testibus.NewTestingEndpoint(condition.Work(true), condition.Work(true), []windowstack.WindowsInfo{}) |
165 | 198 | ps.fakeLauncher = &fakeHelperLauncher{ch: make(chan []byte)} | 200 | ps.fakeLauncher = &fakeHelperLauncher{ch: make(chan []byte)} |
166 | 199 | ps.blacklisted = false | 201 | ps.blacklisted = false |
167 | @@ -226,6 +228,7 @@ | |||
168 | 226 | pst.NotificationsEndp = ps.notifBus | 228 | pst.NotificationsEndp = ps.notifBus |
169 | 227 | pst.EmblemCounterEndp = ps.counterBus | 229 | pst.EmblemCounterEndp = ps.counterBus |
170 | 228 | pst.HapticEndp = ps.hapticBus | 230 | pst.HapticEndp = ps.hapticBus |
171 | 231 | pst.UnityGreeterEndp = ps.unityGreeterBus | ||
172 | 229 | pst.WindowStackEndp = ps.winStackBus | 232 | pst.WindowStackEndp = ps.winStackBus |
173 | 230 | pst.launchers = map[string]launch_helper.HelperLauncher{} | 233 | pst.launchers = map[string]launch_helper.HelperLauncher{} |
174 | 231 | return pst | 234 | return pst |
175 | @@ -543,6 +546,7 @@ | |||
176 | 543 | svc.EmblemCounterEndp = endp | 546 | svc.EmblemCounterEndp = endp |
177 | 544 | svc.HapticEndp = endp | 547 | svc.HapticEndp = endp |
178 | 545 | svc.NotificationsEndp = endp | 548 | svc.NotificationsEndp = endp |
179 | 549 | svc.UnityGreeterEndp = ps.unityGreeterBus | ||
180 | 546 | svc.WindowStackEndp = ps.winStackBus | 550 | svc.WindowStackEndp = ps.winStackBus |
181 | 547 | svc.launchers = map[string]launch_helper.HelperLauncher{} | 551 | svc.launchers = map[string]launch_helper.HelperLauncher{} |
182 | 548 | svc.fallbackVibration = &launch_helper.Vibration{Pattern: []uint32{1}} | 552 | svc.fallbackVibration = &launch_helper.Vibration{Pattern: []uint32{1}} |
183 | 549 | 553 | ||
184 | === modified file 'client/session/session_test.go' | |||
185 | --- client/session/session_test.go 2014-08-26 16:05:28 +0000 | |||
186 | +++ client/session/session_test.go 2014-09-10 15:12:43 +0000 | |||
187 | @@ -1489,14 +1489,7 @@ | |||
188 | 1489 | 1489 | ||
189 | 1490 | func (cs *clientSessionSuite) TestDialBadServerName(c *C) { | 1490 | func (cs *clientSessionSuite) TestDialBadServerName(c *C) { |
190 | 1491 | // a borked server name | 1491 | // a borked server name |
199 | 1492 | cert, err := tls.X509KeyPair(helpers.TestCertPEMBlock, helpers.TestKeyPEMBlock) | 1492 | lst, err := tls.Listen("tcp", "localhost:0", helpers.TestTLSServerConfig) |
192 | 1493 | c.Assert(err, IsNil) | ||
193 | 1494 | tlsCfg := &tls.Config{ | ||
194 | 1495 | Certificates: []tls.Certificate{cert}, | ||
195 | 1496 | SessionTicketsDisabled: true, | ||
196 | 1497 | } | ||
197 | 1498 | |||
198 | 1499 | lst, err := tls.Listen("tcp", "localhost:0", tlsCfg) | ||
200 | 1500 | c.Assert(err, IsNil) | 1493 | c.Assert(err, IsNil) |
201 | 1501 | // advertise | 1494 | // advertise |
202 | 1502 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | 1495 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
203 | @@ -1541,19 +1534,12 @@ | |||
204 | 1541 | 1534 | ||
205 | 1542 | func (cs *clientSessionSuite) TestDialWorks(c *C) { | 1535 | func (cs *clientSessionSuite) TestDialWorks(c *C) { |
206 | 1543 | // happy path thoughts | 1536 | // happy path thoughts |
215 | 1544 | cert, err := tls.X509KeyPair(helpers.TestCertPEMBlock, helpers.TestKeyPEMBlock) | 1537 | lst, err := tls.Listen("tcp", "localhost:0", helpers.TestTLSServerConfig) |
208 | 1545 | c.Assert(err, IsNil) | ||
209 | 1546 | tlsCfg := &tls.Config{ | ||
210 | 1547 | Certificates: []tls.Certificate{cert}, | ||
211 | 1548 | SessionTicketsDisabled: true, | ||
212 | 1549 | } | ||
213 | 1550 | |||
214 | 1551 | lst, err := tls.Listen("tcp", "localhost:0", tlsCfg) | ||
216 | 1552 | c.Assert(err, IsNil) | 1538 | c.Assert(err, IsNil) |
217 | 1553 | // advertise | 1539 | // advertise |
218 | 1554 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | 1540 | ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
219 | 1555 | b, err := json.Marshal(map[string]interface{}{ | 1541 | b, err := json.Marshal(map[string]interface{}{ |
221 | 1556 | "domain": "localhost", | 1542 | "domain": "push-delivery", |
222 | 1557 | "hosts": []string{"nowhere", lst.Addr().String()}, | 1543 | "hosts": []string{"nowhere", lst.Addr().String()}, |
223 | 1558 | }) | 1544 | }) |
224 | 1559 | if err != nil { | 1545 | if err != nil { |
225 | @@ -1649,14 +1635,7 @@ | |||
226 | 1649 | 1635 | ||
227 | 1650 | func (cs *clientSessionSuite) TestDialWorksDirect(c *C) { | 1636 | func (cs *clientSessionSuite) TestDialWorksDirect(c *C) { |
228 | 1651 | // happy path thoughts | 1637 | // happy path thoughts |
237 | 1652 | cert, err := tls.X509KeyPair(helpers.TestCertPEMBlock, helpers.TestKeyPEMBlock) | 1638 | lst, err := tls.Listen("tcp", "localhost:0", helpers.TestTLSServerConfig) |
230 | 1653 | c.Assert(err, IsNil) | ||
231 | 1654 | tlsCfg := &tls.Config{ | ||
232 | 1655 | Certificates: []tls.Certificate{cert}, | ||
233 | 1656 | SessionTicketsDisabled: true, | ||
234 | 1657 | } | ||
235 | 1658 | |||
236 | 1659 | lst, err := tls.Listen("tcp", "localhost:0", tlsCfg) | ||
238 | 1660 | c.Assert(err, IsNil) | 1639 | c.Assert(err, IsNil) |
239 | 1661 | sess, err := NewSession(lst.Addr().String(), dialTestConf, "wah", cs.lvls, cs.log) | 1640 | sess, err := NewSession(lst.Addr().String(), dialTestConf, "wah", cs.lvls, cs.log) |
240 | 1662 | c.Assert(err, IsNil) | 1641 | c.Assert(err, IsNil) |
241 | 1663 | 1642 | ||
242 | === modified file 'debian/changelog' | |||
243 | --- debian/changelog 2014-09-08 18:05:12 +0000 | |||
244 | +++ debian/changelog 2014-09-10 15:12:43 +0000 | |||
245 | @@ -1,3 +1,10 @@ | |||
246 | 1 | ubuntu-push (0.64.1) UNRELEASED; urgency=medium | ||
247 | 2 | |||
248 | 3 | [ Roberto Alsina ] | ||
249 | 4 | * Don't show popups if the screen is locked. | ||
250 | 5 | |||
251 | 6 | -- Roberto Alsina <ralsina@yoga> Wed, 10 Sep 2014 12:08:36 -0300 | ||
252 | 7 | |||
253 | 1 | ubuntu-push (0.64+14.10.20140908-0ubuntu1) utopic; urgency=medium | 8 | ubuntu-push (0.64+14.10.20140908-0ubuntu1) utopic; urgency=medium |
254 | 2 | 9 | ||
255 | 3 | [ Roberto Alsina ] | 10 | [ Roberto Alsina ] |
256 | 4 | 11 | ||
257 | === modified file 'docs/example-client/main.qml' | |||
258 | --- docs/example-client/main.qml 2014-09-05 14:40:39 +0000 | |||
259 | +++ docs/example-client/main.qml 2014-09-10 15:12:43 +0000 | |||
260 | @@ -46,6 +46,7 @@ | |||
261 | 46 | id: nickEdit | 46 | id: nickEdit |
262 | 47 | focus: true | 47 | focus: true |
263 | 48 | placeholderText: "Your nickname" | 48 | placeholderText: "Your nickname" |
264 | 49 | inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhPreferLowercase | ||
265 | 49 | anchors.left: parent.left | 50 | anchors.left: parent.left |
266 | 50 | anchors.right: loginButton.left | 51 | anchors.right: loginButton.left |
267 | 51 | anchors.top: parent.top | 52 | anchors.top: parent.top |
268 | @@ -85,6 +86,7 @@ | |||
269 | 85 | 86 | ||
270 | 86 | TextField { | 87 | TextField { |
271 | 87 | id: messageEdit | 88 | id: messageEdit |
272 | 89 | inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhPreferLowercase | ||
273 | 88 | anchors.right: parent.right | 90 | anchors.right: parent.right |
274 | 89 | anchors.left: parent.left | 91 | anchors.left: parent.left |
275 | 90 | anchors.top: nickEdit.bottom | 92 | anchors.top: nickEdit.bottom |
276 | @@ -223,6 +225,7 @@ | |||
277 | 223 | text: "Enable Notifications" | 225 | text: "Enable Notifications" |
278 | 224 | control: Switch { | 226 | control: Switch { |
279 | 225 | id: annoyingSwitch | 227 | id: annoyingSwitch |
280 | 228 | checked: true | ||
281 | 226 | } | 229 | } |
282 | 227 | } | 230 | } |
283 | 228 | ListItem.Standard { | 231 | ListItem.Standard { |
284 | @@ -230,6 +233,7 @@ | |||
285 | 230 | enabled: annoyingSwitch.checked | 233 | enabled: annoyingSwitch.checked |
286 | 231 | control: Switch { | 234 | control: Switch { |
287 | 232 | id: popupSwitch | 235 | id: popupSwitch |
288 | 236 | checked: true | ||
289 | 233 | } | 237 | } |
290 | 234 | } | 238 | } |
291 | 235 | ListItem.Standard { | 239 | ListItem.Standard { |
292 | @@ -237,6 +241,7 @@ | |||
293 | 237 | enabled: annoyingSwitch.checked | 241 | enabled: annoyingSwitch.checked |
294 | 238 | control: Switch { | 242 | control: Switch { |
295 | 239 | id: persistSwitch | 243 | id: persistSwitch |
296 | 244 | checked: true | ||
297 | 240 | } | 245 | } |
298 | 241 | } | 246 | } |
299 | 242 | ListItem.Standard { | 247 | ListItem.Standard { |
300 | @@ -244,6 +249,7 @@ | |||
301 | 244 | enabled: annoyingSwitch.checked | 249 | enabled: annoyingSwitch.checked |
302 | 245 | control: Switch { | 250 | control: Switch { |
303 | 246 | id: soundSwitch | 251 | id: soundSwitch |
304 | 252 | checked: true | ||
305 | 247 | } | 253 | } |
306 | 248 | } | 254 | } |
307 | 249 | ListItem.Standard { | 255 | ListItem.Standard { |
308 | @@ -251,6 +257,7 @@ | |||
309 | 251 | enabled: annoyingSwitch.checked | 257 | enabled: annoyingSwitch.checked |
310 | 252 | control: Switch { | 258 | control: Switch { |
311 | 253 | id: vibrateSwitch | 259 | id: vibrateSwitch |
312 | 260 | checked: true | ||
313 | 254 | } | 261 | } |
314 | 255 | } | 262 | } |
315 | 256 | ListItem.Standard { | 263 | ListItem.Standard { |
316 | @@ -258,6 +265,7 @@ | |||
317 | 258 | enabled: annoyingSwitch.checked | 265 | enabled: annoyingSwitch.checked |
318 | 259 | control: Slider { | 266 | control: Slider { |
319 | 260 | id: counterSlider | 267 | id: counterSlider |
320 | 268 | value: 42 | ||
321 | 261 | } | 269 | } |
322 | 262 | } | 270 | } |
323 | 263 | } | 271 | } |
324 | 264 | 272 | ||
325 | === modified file 'docs/example-client/manifest.json' | |||
326 | --- docs/example-client/manifest.json 2014-09-05 14:40:39 +0000 | |||
327 | +++ docs/example-client/manifest.json 2014-09-10 15:12:43 +0000 | |||
328 | @@ -14,6 +14,6 @@ | |||
329 | 14 | }, | 14 | }, |
330 | 15 | "maintainer": "Roberto Alsina <roberto.alsina@canonical.com>", | 15 | "maintainer": "Roberto Alsina <roberto.alsina@canonical.com>", |
331 | 16 | "name": "com.ubuntu.developer.ralsina.hello", | 16 | "name": "com.ubuntu.developer.ralsina.hello", |
334 | 17 | "title": "ubuntu-push-example", | 17 | "title": "Hello", |
335 | 18 | "version": "0.4" | 18 | "version": "0.4.2" |
336 | 19 | } | 19 | } |
337 | 20 | 20 | ||
338 | === modified file 'sampleconfigs/dev.json' | |||
339 | --- sampleconfigs/dev.json 2014-07-15 17:14:07 +0000 | |||
340 | +++ sampleconfigs/dev.json 2014-09-10 15:12:43 +0000 | |||
341 | @@ -10,5 +10,5 @@ | |||
342 | 10 | "http_read_timeout": "5s", | 10 | "http_read_timeout": "5s", |
343 | 11 | "http_write_timeout": "5s", | 11 | "http_write_timeout": "5s", |
344 | 12 | "max_notifications_per_app": 25, | 12 | "max_notifications_per_app": 25, |
346 | 13 | "delivery_domain": "localhost" | 13 | "delivery_domain": "push-delivery" |
347 | 14 | } | 14 | } |
348 | 15 | 15 | ||
349 | === modified file 'server/acceptance/acceptance_test.go' | |||
350 | --- server/acceptance/acceptance_test.go 2014-05-02 09:56:49 +0000 | |||
351 | +++ server/acceptance/acceptance_test.go 2014-09-10 15:12:43 +0000 | |||
352 | @@ -34,7 +34,7 @@ | |||
353 | 34 | cfg := make(map[string]interface{}) | 34 | cfg := make(map[string]interface{}) |
354 | 35 | suites.FillServerConfig(cfg, addr) | 35 | suites.FillServerConfig(cfg, addr) |
355 | 36 | suites.FillHTTPServerConfig(cfg, httpAddr) | 36 | suites.FillHTTPServerConfig(cfg, httpAddr) |
357 | 37 | cfg["delivery_domain"] = "localhost" | 37 | cfg["delivery_domain"] = "push-delivery" |
358 | 38 | return cfg | 38 | return cfg |
359 | 39 | } | 39 | } |
360 | 40 | 40 | ||
361 | 41 | 41 | ||
362 | === modified file 'server/acceptance/ssl/README' | |||
363 | --- server/acceptance/ssl/README 2014-02-21 16:17:28 +0000 | |||
364 | +++ server/acceptance/ssl/README 2014-09-10 15:12:43 +0000 | |||
365 | @@ -3,6 +3,6 @@ | |||
366 | 3 | 3 | ||
367 | 4 | Generated with: | 4 | Generated with: |
368 | 5 | 5 | ||
370 | 6 | go run /usr/lib/go/src/pkg/crypto/tls/generate_cert.go -ca -host localhost -rsa-bits 512 -duration 87600h | 6 | go run /usr/lib/go/src/pkg/crypto/tls/generate_cert.go -ca -host push-delivery -rsa-bits 512 -duration 87600h |
371 | 7 | 7 | ||
372 | 8 | and then renamed. | 8 | and then renamed. |
373 | 9 | 9 | ||
374 | === modified file 'server/acceptance/ssl/testing.cert' | |||
375 | --- server/acceptance/ssl/testing.cert 2014-01-14 15:35:20 +0000 | |||
376 | +++ server/acceptance/ssl/testing.cert 2014-09-10 15:12:43 +0000 | |||
377 | @@ -1,10 +1,10 @@ | |||
378 | 1 | -----BEGIN CERTIFICATE----- | 1 | -----BEGIN CERTIFICATE----- |
379 | 2 | MIIBYzCCAQ+gAwIBAgIBADALBgkqhkiG9w0BAQUwEjEQMA4GA1UEChMHQWNtZSBD | 2 | MIIBYzCCAQ+gAwIBAgIBADALBgkqhkiG9w0BAQUwEjEQMA4GA1UEChMHQWNtZSBD |
387 | 3 | bzAeFw0xMzEyMTkyMDU1NDNaFw0yMzEyMTcyMDU1NDNaMBIxEDAOBgNVBAoTB0Fj | 3 | bzAeFw0xNDA4MjkxMjQyMDFaFw0yNDA4MjYxMjQyMDFaMBIxEDAOBgNVBAoTB0Fj |
388 | 4 | bWUgQ28wWjALBgkqhkiG9w0BAQEDSwAwSAJBAPw+niki17X2qALE2A2AzE1q5dvK | 4 | bWUgQ28wXDANBgkqhkiG9w0BAQEFAANLADBIAkEA1FT6lkow0eky+Dnj2Z4nTrTF |
389 | 5 | 9CI4OduRtT9IgbFLC6psqAT21NA+QbY17nWSSpyP65zkMkwKXrbDzstwLPkCAwEA | 5 | DgcKOt9Wr4B4gRH1bWmRqScOPxyHA5YodN7O1w8X8sdWko9puf59I1sWWr5LNwID |
390 | 6 | AaNUMFIwDgYDVR0PAQH/BAQDAgCkMBMGA1UdJQQMMAoGCCsGAQUFBwMBMA8GA1Ud | 6 | AQABo1IwUDAOBgNVHQ8BAf8EBAMCAKQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDwYD |
391 | 7 | EwEB/wQFMAMBAf8wGgYDVR0RBBMwEYIJbG9jYWxob3N0hwR/AAABMAsGCSqGSIb3 | 7 | VR0TAQH/BAUwAwEB/zAYBgNVHREEETAPgg1wdXNoLWRlbGl2ZXJ5MAsGCSqGSIb3 |
392 | 8 | DQEBBQNBAFqiVI+Km2XPSO+pxITaPvhmuzg+XG3l1+2di3gL+HlDobocjBqRctRU | 8 | DQEBBQNBABtWCdMFkhIO8+oM3vugOWle9WJZ1FCRWD+cMl76mI1lhmNF4lvEZG47 |
393 | 9 | YySO32W07acjGJmCHUKpCJuq9X8hpmk= | 9 | xUjekA1+heU39WpOEzZSybrOdiEaGbI= |
394 | 10 | -----END CERTIFICATE----- | 10 | -----END CERTIFICATE----- |
395 | 11 | 11 | ||
396 | === modified file 'server/acceptance/ssl/testing.key' | |||
397 | --- server/acceptance/ssl/testing.key 2014-01-14 15:35:20 +0000 | |||
398 | +++ server/acceptance/ssl/testing.key 2014-09-10 15:12:43 +0000 | |||
399 | @@ -1,9 +1,9 @@ | |||
400 | 1 | -----BEGIN RSA PRIVATE KEY----- | 1 | -----BEGIN RSA PRIVATE KEY----- |
408 | 2 | MIIBPAIBAAJBAPw+niki17X2qALE2A2AzE1q5dvK9CI4OduRtT9IgbFLC6psqAT2 | 2 | MIIBOgIBAAJBANRU+pZKMNHpMvg549meJ060xQ4HCjrfVq+AeIER9W1pkaknDj8c |
409 | 3 | 1NA+QbY17nWSSpyP65zkMkwKXrbDzstwLPkCAwEAAQJAKwXbIBULScP6QA6m8xam | 3 | hwOWKHTeztcPF/LHVpKPabn+fSNbFlq+SzcCAwEAAQJBAIOO+4xu/3yv/rKqO7C0 |
410 | 4 | wgWbkvN41GVWqPafPV32kPBvKwSc+M1e+JR7g3/xPZE7TCELcfYi4yXEHZZI3Pbh | 4 | Oyqa+pVMa1w60R0AfqmKFQTqiTgevM77uqjpW1+t0hpK20nyj6MUIPaL+9kZgp7t |
411 | 5 | oQIhAP/UsgJbsfH1GFv8Y8qGl5l/kmwwkwHhuKvEC87Yur9FAiEA/GlQv3ZfaXnT | 5 | mnECIQDqw79PXSzudf10XGy9ve5bRazINHxQYgJ7FvlTT6JhdQIhAOeJxq9zcKni |
412 | 6 | lcCFT0aL02O0RDiRYyMUG/JAZQJs6CUCIQCHO5SZYIUwxIGK5mCNxxXOAzyQSiD7 | 6 | 69ueO1ualz0hn8w6uHPsG9FlZ8C+7Jh7AiAWJgebjjfZ+4nA+6NKt2uQct9dOA5u |
413 | 7 | hqkKywf+4FvfDQIhALa0TLyqJFom0t7c4iIGAIRc8UlIYQSPiajI64+x9775AiEA | 7 | awC+6ij1ojK4rQIgNEqAbcWDj0qpe8sLms+aEntSjJxCZiPP0IW3XeeApZsCIDwo |
414 | 8 | 0v4fgSK/Rq059zW1753JjuB6aR0Uh+3RqJII4dUR1Wg= | 8 | x+YyxXQWJlf9L5TNYPRo+KFEdk3Cew0lv6QNs+xe |
415 | 9 | -----END RSA PRIVATE KEY----- | 9 | -----END RSA PRIVATE KEY----- |
416 | 10 | 10 | ||
417 | === modified file 'server/acceptance/suites/broadcast.go' | |||
418 | --- server/acceptance/suites/broadcast.go 2014-08-15 09:33:48 +0000 | |||
419 | +++ server/acceptance/suites/broadcast.go 2014-09-10 15:12:43 +0000 | |||
420 | @@ -261,7 +261,7 @@ | |||
421 | 261 | host, err := gh.Get() | 261 | host, err := gh.Get() |
422 | 262 | c.Assert(err, IsNil) | 262 | c.Assert(err, IsNil) |
423 | 263 | expected := &gethosts.Host{ | 263 | expected := &gethosts.Host{ |
425 | 264 | Domain: "localhost", | 264 | Domain: "push-delivery", |
426 | 265 | Hosts: []string{s.ServerAddr}, | 265 | Hosts: []string{s.ServerAddr}, |
427 | 266 | } | 266 | } |
428 | 267 | c.Check(host, DeepEquals, expected) | 267 | c.Check(host, DeepEquals, expected) |
429 | 268 | 268 | ||
430 | === modified file 'server/acceptance/suites/suite.go' | |||
431 | --- server/acceptance/suites/suite.go 2014-08-27 21:19:51 +0000 | |||
432 | +++ server/acceptance/suites/suite.go 2014-09-10 15:12:43 +0000 | |||
433 | @@ -111,7 +111,7 @@ | |||
434 | 111 | } | 111 | } |
435 | 112 | 112 | ||
436 | 113 | func testClientSession(addr string, deviceId, model, imageChannel string, reportPings bool) *acceptance.ClientSession { | 113 | func testClientSession(addr string, deviceId, model, imageChannel string, reportPings bool) *acceptance.ClientSession { |
438 | 114 | tlsConfig, err := kit.MakeTLSConfig("", false, helpers.SourceRelative("../ssl/testing.cert"), "") | 114 | tlsConfig, err := kit.MakeTLSConfig("push-delivery", false, helpers.SourceRelative("../ssl/testing.cert"), "") |
439 | 115 | if err != nil { | 115 | if err != nil { |
440 | 116 | panic(fmt.Sprintf("could not read ssl/testing.cert: %v", err)) | 116 | panic(fmt.Sprintf("could not read ssl/testing.cert: %v", err)) |
441 | 117 | } | 117 | } |
442 | 118 | 118 | ||
443 | === modified file 'server/config_test.go' | |||
444 | --- server/config_test.go 2014-02-10 23:19:08 +0000 | |||
445 | +++ server/config_test.go 2014-09-10 15:12:43 +0000 | |||
446 | @@ -26,6 +26,7 @@ | |||
447 | 26 | . "launchpad.net/gocheck" | 26 | . "launchpad.net/gocheck" |
448 | 27 | 27 | ||
449 | 28 | "launchpad.net/ubuntu-push/config" | 28 | "launchpad.net/ubuntu-push/config" |
450 | 29 | helpers "launchpad.net/ubuntu-push/testing" | ||
451 | 29 | ) | 30 | ) |
452 | 30 | 31 | ||
453 | 31 | type configSuite struct{} | 32 | type configSuite struct{} |
454 | @@ -52,22 +53,22 @@ | |||
455 | 52 | c.Check(cfg.Addr(), Equals, "127.0.0.1:9999") | 53 | c.Check(cfg.Addr(), Equals, "127.0.0.1:9999") |
456 | 53 | } | 54 | } |
457 | 54 | 55 | ||
459 | 55 | func (s *configSuite) TestDevicesParsedConfigLoadFinish(c *C) { | 56 | func (s *configSuite) TestTLSParsedConfigLoadPEMs(c *C) { |
460 | 56 | tmpDir := c.MkDir() | 57 | tmpDir := c.MkDir() |
462 | 57 | cfg := &DevicesParsedConfig{ | 58 | cfg := &TLSParsedConfig{ |
463 | 58 | ParsedKeyPEMFile: "key.key", | 59 | ParsedKeyPEMFile: "key.key", |
464 | 59 | ParsedCertPEMFile: "cert.cert", | 60 | ParsedCertPEMFile: "cert.cert", |
465 | 60 | } | 61 | } |
467 | 61 | err := cfg.FinishLoad(tmpDir) | 62 | err := cfg.LoadPEMs(tmpDir) |
468 | 62 | c.Check(err, ErrorMatches, "reading key_pem_file:.*no such file.*") | 63 | c.Check(err, ErrorMatches, "reading key_pem_file:.*no such file.*") |
470 | 63 | err = ioutil.WriteFile(filepath.Join(tmpDir, "key.key"), []byte("KeY"), os.ModePerm) | 64 | err = ioutil.WriteFile(filepath.Join(tmpDir, "key.key"), helpers.TestKeyPEMBlock, os.ModePerm) |
471 | 64 | c.Assert(err, IsNil) | 65 | c.Assert(err, IsNil) |
473 | 65 | err = cfg.FinishLoad(tmpDir) | 66 | err = cfg.LoadPEMs(tmpDir) |
474 | 66 | c.Check(err, ErrorMatches, "reading cert_pem_file:.*no such file.*") | 67 | c.Check(err, ErrorMatches, "reading cert_pem_file:.*no such file.*") |
481 | 67 | err = ioutil.WriteFile(filepath.Join(tmpDir, "cert.cert"), []byte("CeRt"), os.ModePerm) | 68 | err = ioutil.WriteFile(filepath.Join(tmpDir, "cert.cert"), helpers.TestCertPEMBlock, os.ModePerm) |
482 | 68 | c.Assert(err, IsNil) | 69 | c.Assert(err, IsNil) |
483 | 69 | err = cfg.FinishLoad(tmpDir) | 70 | err = cfg.LoadPEMs(tmpDir) |
484 | 70 | c.Assert(err, IsNil) | 71 | c.Assert(err, IsNil) |
485 | 71 | c.Check(string(cfg.KeyPEMBlock()), Equals, "KeY") | 72 | tlsCfg := cfg.TLSServerConfig() |
486 | 72 | c.Check(string(cfg.CertPEMBlock()), Equals, "CeRt") | 73 | c.Check(tlsCfg.Certificates, HasLen, 1) |
487 | 73 | } | 74 | } |
488 | 74 | 75 | ||
489 | === modified file 'server/dev/server.go' | |||
490 | --- server/dev/server.go 2014-07-08 15:08:52 +0000 | |||
491 | +++ server/dev/server.go 2014-09-10 15:12:43 +0000 | |||
492 | @@ -64,7 +64,7 @@ | |||
493 | 64 | if err != nil { | 64 | if err != nil { |
494 | 65 | server.BootLogFatalf("reading config: %v", err) | 65 | server.BootLogFatalf("reading config: %v", err) |
495 | 66 | } | 66 | } |
497 | 67 | err = cfg.DevicesParsedConfig.FinishLoad(filepath.Dir(cfgFpaths[len(cfgFpaths)-1])) | 67 | err = cfg.DevicesParsedConfig.LoadPEMs(filepath.Dir(cfgFpaths[len(cfgFpaths)-1])) |
498 | 68 | if err != nil { | 68 | if err != nil { |
499 | 69 | server.BootLogFatalf("reading config: %v", err) | 69 | server.BootLogFatalf("reading config: %v", err) |
500 | 70 | } | 70 | } |
501 | @@ -95,7 +95,7 @@ | |||
502 | 95 | }) | 95 | }) |
503 | 96 | }) | 96 | }) |
504 | 97 | handler := api.PanicTo500Handler(mux, logger) | 97 | handler := api.PanicTo500Handler(mux, logger) |
506 | 98 | go server.HTTPServeRunner(nil, handler, &cfg.HTTPServeParsedConfig)() | 98 | go server.HTTPServeRunner(nil, handler, &cfg.HTTPServeParsedConfig, nil)() |
507 | 99 | // listen for device connections | 99 | // listen for device connections |
508 | 100 | server.DevicesRunner(lst, func(conn net.Conn) error { | 100 | server.DevicesRunner(lst, func(conn net.Conn) error { |
509 | 101 | track := session.NewTracker(logger) | 101 | track := session.NewTracker(logger) |
510 | 102 | 102 | ||
511 | === modified file 'server/listener/listener.go' | |||
512 | --- server/listener/listener.go 2014-03-06 19:21:44 +0000 | |||
513 | +++ server/listener/listener.go 2014-09-10 15:12:43 +0000 | |||
514 | @@ -30,10 +30,8 @@ | |||
515 | 30 | type DeviceListenerConfig interface { | 30 | type DeviceListenerConfig interface { |
516 | 31 | // Addr to listen on. | 31 | // Addr to listen on. |
517 | 32 | Addr() string | 32 | Addr() string |
522 | 33 | // TLS key | 33 | // TLS config |
523 | 34 | KeyPEMBlock() []byte | 34 | TLSServerConfig() *tls.Config |
520 | 35 | // TLS cert | ||
521 | 36 | CertPEMBlock() []byte | ||
524 | 37 | } | 35 | } |
525 | 38 | 36 | ||
526 | 39 | // DeviceListener listens and setup sessions from device connections. | 37 | // DeviceListener listens and setup sessions from device connections. |
527 | @@ -52,15 +50,8 @@ | |||
528 | 52 | return nil, err | 50 | return nil, err |
529 | 53 | } | 51 | } |
530 | 54 | } | 52 | } |
540 | 55 | cert, err := tls.X509KeyPair(cfg.CertPEMBlock(), cfg.KeyPEMBlock()) | 53 | tlsCfg := cfg.TLSServerConfig() |
541 | 56 | if err != nil { | 54 | return &DeviceListener{tls.NewListener(lst, tlsCfg)}, nil |
533 | 57 | return nil, err | ||
534 | 58 | } | ||
535 | 59 | tlsCfg := &tls.Config{ | ||
536 | 60 | Certificates: []tls.Certificate{cert}, | ||
537 | 61 | SessionTicketsDisabled: true, | ||
538 | 62 | } | ||
539 | 63 | return &DeviceListener{tls.NewListener(lst, tlsCfg)}, err | ||
542 | 64 | } | 55 | } |
543 | 65 | 56 | ||
544 | 66 | // handleTemporary checks and handles if the error is just a temporary network | 57 | // handleTemporary checks and handles if the error is just a temporary network |
545 | 67 | 58 | ||
546 | === modified file 'server/listener/listener_test.go' | |||
547 | --- server/listener/listener_test.go 2014-08-04 14:47:00 +0000 | |||
548 | +++ server/listener/listener_test.go 2014-09-10 15:12:43 +0000 | |||
549 | @@ -18,7 +18,6 @@ | |||
550 | 18 | 18 | ||
551 | 19 | import ( | 19 | import ( |
552 | 20 | "crypto/tls" | 20 | "crypto/tls" |
553 | 21 | "crypto/x509" | ||
554 | 22 | "net" | 21 | "net" |
555 | 23 | "os/exec" | 22 | "os/exec" |
556 | 24 | "regexp" | 23 | "regexp" |
557 | @@ -68,12 +67,8 @@ | |||
558 | 68 | return cfg.addr | 67 | return cfg.addr |
559 | 69 | } | 68 | } |
560 | 70 | 69 | ||
567 | 71 | func (cfg *testDevListenerCfg) KeyPEMBlock() []byte { | 70 | func (cfg *testDevListenerCfg) TLSServerConfig() *tls.Config { |
568 | 72 | return helpers.TestKeyPEMBlock | 71 | return helpers.TestTLSServerConfig |
563 | 73 | } | ||
564 | 74 | |||
565 | 75 | func (cfg *testDevListenerCfg) CertPEMBlock() []byte { | ||
566 | 76 | return helpers.TestCertPEMBlock | ||
569 | 77 | } | 72 | } |
570 | 78 | 73 | ||
571 | 79 | func (s *listenerSuite) TestDeviceListen(c *C) { | 74 | func (s *listenerSuite) TestDeviceListen(c *C) { |
572 | @@ -130,11 +125,8 @@ | |||
573 | 130 | return err | 125 | return err |
574 | 131 | } | 126 | } |
575 | 132 | 127 | ||
581 | 133 | func testTlsDial(c *C, addr string) (net.Conn, error) { | 128 | func testTlsDial(addr string) (net.Conn, error) { |
582 | 134 | cp := x509.NewCertPool() | 129 | return tls.Dial("tcp", addr, helpers.TestTLSClientConfig) |
578 | 135 | ok := cp.AppendCertsFromPEM((&testDevListenerCfg{}).CertPEMBlock()) | ||
579 | 136 | c.Assert(ok, Equals, true) | ||
580 | 137 | return tls.Dial("tcp", addr, &tls.Config{RootCAs: cp}) | ||
583 | 138 | } | 130 | } |
584 | 139 | 131 | ||
585 | 140 | func testWriteByte(c *C, conn net.Conn, toWrite uint32) { | 132 | func testWriteByte(c *C, conn net.Conn, toWrite uint32) { |
586 | @@ -159,11 +151,11 @@ | |||
587 | 159 | errCh <- lst.AcceptLoop(testSession, s.testlog) | 151 | errCh <- lst.AcceptLoop(testSession, s.testlog) |
588 | 160 | }() | 152 | }() |
589 | 161 | listenerAddr := lst.Addr().String() | 153 | listenerAddr := lst.Addr().String() |
591 | 162 | conn1, err := testTlsDial(c, listenerAddr) | 154 | conn1, err := testTlsDial(listenerAddr) |
592 | 163 | c.Assert(err, IsNil) | 155 | c.Assert(err, IsNil) |
593 | 164 | defer conn1.Close() | 156 | defer conn1.Close() |
594 | 165 | testWriteByte(c, conn1, '1') | 157 | testWriteByte(c, conn1, '1') |
596 | 166 | conn2, err := testTlsDial(c, listenerAddr) | 158 | conn2, err := testTlsDial(listenerAddr) |
597 | 167 | c.Assert(err, IsNil) | 159 | c.Assert(err, IsNil) |
598 | 168 | defer conn2.Close() | 160 | defer conn2.Close() |
599 | 169 | testWriteByte(c, conn2, '2') | 161 | testWriteByte(c, conn2, '2') |
600 | @@ -203,7 +195,7 @@ | |||
601 | 203 | res, err := cmd.Output() | 195 | res, err := cmd.Output() |
602 | 204 | c.Assert(err, IsNil) | 196 | c.Assert(err, IsNil) |
603 | 205 | c.Assert(string(res), Matches, "(?s).*timed out.*") | 197 | c.Assert(string(res), Matches, "(?s).*timed out.*") |
605 | 206 | conn2, err := testTlsDial(c, listenerAddr) | 198 | conn2, err := testTlsDial(listenerAddr) |
606 | 207 | c.Assert(err, IsNil) | 199 | c.Assert(err, IsNil) |
607 | 208 | defer conn2.Close() | 200 | defer conn2.Close() |
608 | 209 | testWriteByte(c, conn2, '2') | 201 | testWriteByte(c, conn2, '2') |
609 | @@ -225,7 +217,7 @@ | |||
610 | 225 | }, s.testlog) | 217 | }, s.testlog) |
611 | 226 | }() | 218 | }() |
612 | 227 | listenerAddr := lst.Addr().String() | 219 | listenerAddr := lst.Addr().String() |
614 | 228 | _, err = testTlsDial(c, listenerAddr) | 220 | _, err = testTlsDial(listenerAddr) |
615 | 229 | c.Assert(err, Not(IsNil)) | 221 | c.Assert(err, Not(IsNil)) |
616 | 230 | lst.Close() | 222 | lst.Close() |
617 | 231 | c.Check(<-errCh, ErrorMatches, ".*use of closed.*") | 223 | c.Check(<-errCh, ErrorMatches, ".*use of closed.*") |
618 | @@ -244,7 +236,7 @@ | |||
619 | 244 | }() | 236 | }() |
620 | 245 | listenerAddr := lst.Addr().String() | 237 | listenerAddr := lst.Addr().String() |
621 | 246 | c.Check(listenerAddr, Equals, foreignLst.Addr().String()) | 238 | c.Check(listenerAddr, Equals, foreignLst.Addr().String()) |
623 | 247 | conn1, err := testTlsDial(c, listenerAddr) | 239 | conn1, err := testTlsDial(listenerAddr) |
624 | 248 | c.Assert(err, IsNil) | 240 | c.Assert(err, IsNil) |
625 | 249 | defer conn1.Close() | 241 | defer conn1.Close() |
626 | 250 | testWriteByte(c, conn1, '1') | 242 | testWriteByte(c, conn1, '1') |
627 | 251 | 243 | ||
628 | === modified file 'server/runner_devices.go' | |||
629 | --- server/runner_devices.go 2014-03-12 12:34:18 +0000 | |||
630 | +++ server/runner_devices.go 2014-09-10 15:12:43 +0000 | |||
631 | @@ -17,7 +17,6 @@ | |||
632 | 17 | package server | 17 | package server |
633 | 18 | 18 | ||
634 | 19 | import ( | 19 | import ( |
635 | 20 | "fmt" | ||
636 | 21 | "net" | 20 | "net" |
637 | 22 | "syscall" | 21 | "syscall" |
638 | 23 | "time" | 22 | "time" |
639 | @@ -36,26 +35,8 @@ | |||
640 | 36 | ParsedSessionQueueSize config.ConfigQueueSize `json:"session_queue_size"` | 35 | ParsedSessionQueueSize config.ConfigQueueSize `json:"session_queue_size"` |
641 | 37 | ParsedBrokerQueueSize config.ConfigQueueSize `json:"broker_queue_size"` | 36 | ParsedBrokerQueueSize config.ConfigQueueSize `json:"broker_queue_size"` |
642 | 38 | // device listener configuration | 37 | // device listener configuration |
663 | 39 | ParsedAddr config.ConfigHostPort `json:"addr"` | 38 | ParsedAddr config.ConfigHostPort `json:"addr"` |
664 | 40 | ParsedKeyPEMFile string `json:"key_pem_file"` | 39 | TLSParsedConfig |
645 | 41 | ParsedCertPEMFile string `json:"cert_pem_file"` | ||
646 | 42 | // private post-processed config | ||
647 | 43 | certPEMBlock []byte | ||
648 | 44 | keyPEMBlock []byte | ||
649 | 45 | } | ||
650 | 46 | |||
651 | 47 | func (cfg *DevicesParsedConfig) FinishLoad(baseDir string) error { | ||
652 | 48 | keyPEMBlock, err := config.LoadFile(cfg.ParsedKeyPEMFile, baseDir) | ||
653 | 49 | if err != nil { | ||
654 | 50 | return fmt.Errorf("reading key_pem_file: %v", err) | ||
655 | 51 | } | ||
656 | 52 | certPEMBlock, err := config.LoadFile(cfg.ParsedCertPEMFile, baseDir) | ||
657 | 53 | if err != nil { | ||
658 | 54 | return fmt.Errorf("reading cert_pem_file: %v", err) | ||
659 | 55 | } | ||
660 | 56 | cfg.keyPEMBlock = keyPEMBlock | ||
661 | 57 | cfg.certPEMBlock = certPEMBlock | ||
662 | 58 | return nil | ||
665 | 59 | } | 40 | } |
666 | 60 | 41 | ||
667 | 61 | func (cfg *DevicesParsedConfig) PingInterval() time.Duration { | 42 | func (cfg *DevicesParsedConfig) PingInterval() time.Duration { |
668 | @@ -78,14 +59,6 @@ | |||
669 | 78 | return cfg.ParsedAddr.HostPort() | 59 | return cfg.ParsedAddr.HostPort() |
670 | 79 | } | 60 | } |
671 | 80 | 61 | ||
672 | 81 | func (cfg *DevicesParsedConfig) KeyPEMBlock() []byte { | ||
673 | 82 | return cfg.keyPEMBlock | ||
674 | 83 | } | ||
675 | 84 | |||
676 | 85 | func (cfg *DevicesParsedConfig) CertPEMBlock() []byte { | ||
677 | 86 | return cfg.certPEMBlock | ||
678 | 87 | } | ||
679 | 88 | |||
680 | 89 | // DevicesRunner returns a function to accept device connections. | 62 | // DevicesRunner returns a function to accept device connections. |
681 | 90 | // If adoptLst is not nil it will be used as the underlying listener, instead | 63 | // If adoptLst is not nil it will be used as the underlying listener, instead |
682 | 91 | // of creating one, wrapped in a TLS layer. | 64 | // of creating one, wrapped in a TLS layer. |
683 | 92 | 65 | ||
684 | === modified file 'server/runner_http.go' | |||
685 | --- server/runner_http.go 2014-03-25 19:02:18 +0000 | |||
686 | +++ server/runner_http.go 2014-09-10 15:12:43 +0000 | |||
687 | @@ -17,6 +17,7 @@ | |||
688 | 17 | package server | 17 | package server |
689 | 18 | 18 | ||
690 | 19 | import ( | 19 | import ( |
691 | 20 | "crypto/tls" | ||
692 | 20 | "net" | 21 | "net" |
693 | 21 | "net/http" | 22 | "net/http" |
694 | 22 | 23 | ||
695 | @@ -32,7 +33,8 @@ | |||
696 | 32 | 33 | ||
697 | 33 | // HTTPServeRunner returns a function to serve HTTP requests. | 34 | // HTTPServeRunner returns a function to serve HTTP requests. |
698 | 34 | // If httpLst is not nil it will be used as the underlying listener. | 35 | // If httpLst is not nil it will be used as the underlying listener. |
700 | 35 | func HTTPServeRunner(httpLst net.Listener, h http.Handler, parsedCfg *HTTPServeParsedConfig) func() { | 36 | // If tlsCfg is not nit server over TLS with the config. |
701 | 37 | func HTTPServeRunner(httpLst net.Listener, h http.Handler, parsedCfg *HTTPServeParsedConfig, tlsCfg *tls.Config) func() { | ||
702 | 36 | if httpLst == nil { | 38 | if httpLst == nil { |
703 | 37 | var err error | 39 | var err error |
704 | 38 | httpLst, err = net.Listen("tcp", parsedCfg.ParsedHTTPAddr.HostPort()) | 40 | httpLst, err = net.Listen("tcp", parsedCfg.ParsedHTTPAddr.HostPort()) |
705 | @@ -46,6 +48,9 @@ | |||
706 | 46 | ReadTimeout: parsedCfg.ParsedHTTPReadTimeout.TimeDuration(), | 48 | ReadTimeout: parsedCfg.ParsedHTTPReadTimeout.TimeDuration(), |
707 | 47 | WriteTimeout: parsedCfg.ParsedHTTPWriteTimeout.TimeDuration(), | 49 | WriteTimeout: parsedCfg.ParsedHTTPWriteTimeout.TimeDuration(), |
708 | 48 | } | 50 | } |
709 | 51 | if tlsCfg != nil { | ||
710 | 52 | httpLst = tls.NewListener(httpLst, tlsCfg) | ||
711 | 53 | } | ||
712 | 49 | return func() { | 54 | return func() { |
713 | 50 | err := srv.Serve(httpLst) | 55 | err := srv.Serve(httpLst) |
714 | 51 | if err != nil { | 56 | if err != nil { |
715 | 52 | 57 | ||
716 | === modified file 'server/runner_test.go' | |||
717 | --- server/runner_test.go 2014-03-25 19:02:18 +0000 | |||
718 | +++ server/runner_test.go 2014-09-10 15:12:43 +0000 | |||
719 | @@ -17,6 +17,7 @@ | |||
720 | 17 | package server | 17 | package server |
721 | 18 | 18 | ||
722 | 19 | import ( | 19 | import ( |
723 | 20 | "crypto/tls" | ||
724 | 20 | "fmt" | 21 | "fmt" |
725 | 21 | "io/ioutil" | 22 | "io/ioutil" |
726 | 22 | "net" | 23 | "net" |
727 | @@ -68,7 +69,7 @@ | |||
728 | 68 | func (s *runnerSuite) TestHTTPServeRunner(c *C) { | 69 | func (s *runnerSuite) TestHTTPServeRunner(c *C) { |
729 | 69 | errCh := make(chan interface{}, 1) | 70 | errCh := make(chan interface{}, 1) |
730 | 70 | h := http.HandlerFunc(testHandle) | 71 | h := http.HandlerFunc(testHandle) |
732 | 71 | runner := HTTPServeRunner(nil, h, &testHTTPServeParsedConfig) | 72 | runner := HTTPServeRunner(nil, h, &testHTTPServeParsedConfig, nil) |
733 | 72 | c.Assert(s.lst, Not(IsNil)) | 73 | c.Assert(s.lst, Not(IsNil)) |
734 | 73 | defer s.lst.Close() | 74 | defer s.lst.Close() |
735 | 74 | c.Check(s.kind, Equals, "http") | 75 | c.Check(s.kind, Equals, "http") |
736 | @@ -89,16 +90,25 @@ | |||
737 | 89 | c.Check(<-errCh, Matches, "accepting http connections:.*closed.*") | 90 | c.Check(<-errCh, Matches, "accepting http connections:.*closed.*") |
738 | 90 | } | 91 | } |
739 | 91 | 92 | ||
740 | 93 | func cert() tls.Certificate { | ||
741 | 94 | cert, err := tls.X509KeyPair(helpers.TestCertPEMBlock, helpers.TestKeyPEMBlock) | ||
742 | 95 | if err != nil { | ||
743 | 96 | panic(err) | ||
744 | 97 | } | ||
745 | 98 | return cert | ||
746 | 99 | } | ||
747 | 100 | |||
748 | 92 | var testDevicesParsedConfig = DevicesParsedConfig{ | 101 | var testDevicesParsedConfig = DevicesParsedConfig{ |
749 | 93 | ParsedPingInterval: config.ConfigTimeDuration{60 * time.Second}, | 102 | ParsedPingInterval: config.ConfigTimeDuration{60 * time.Second}, |
750 | 94 | ParsedExchangeTimeout: config.ConfigTimeDuration{10 * time.Second}, | 103 | ParsedExchangeTimeout: config.ConfigTimeDuration{10 * time.Second}, |
751 | 95 | ParsedBrokerQueueSize: config.ConfigQueueSize(1000), | 104 | ParsedBrokerQueueSize: config.ConfigQueueSize(1000), |
752 | 96 | ParsedSessionQueueSize: config.ConfigQueueSize(10), | 105 | ParsedSessionQueueSize: config.ConfigQueueSize(10), |
753 | 97 | ParsedAddr: "127.0.0.1:0", | 106 | ParsedAddr: "127.0.0.1:0", |
758 | 98 | ParsedKeyPEMFile: "", | 107 | TLSParsedConfig: TLSParsedConfig{ |
759 | 99 | ParsedCertPEMFile: "", | 108 | ParsedKeyPEMFile: "", |
760 | 100 | keyPEMBlock: helpers.TestKeyPEMBlock, | 109 | ParsedCertPEMFile: "", |
761 | 101 | certPEMBlock: helpers.TestCertPEMBlock, | 110 | cert: cert(), |
762 | 111 | }, | ||
763 | 102 | } | 112 | } |
764 | 103 | 113 | ||
765 | 104 | func (s *runnerSuite) TestDevicesRunner(c *C) { | 114 | func (s *runnerSuite) TestDevicesRunner(c *C) { |
766 | @@ -135,7 +145,36 @@ | |||
767 | 135 | lst0, err := net.Listen("tcp", "127.0.0.1:0") | 145 | lst0, err := net.Listen("tcp", "127.0.0.1:0") |
768 | 136 | c.Assert(err, IsNil) | 146 | c.Assert(err, IsNil) |
769 | 137 | defer lst0.Close() | 147 | defer lst0.Close() |
771 | 138 | HTTPServeRunner(lst0, nil, &testHTTPServeParsedConfig) | 148 | HTTPServeRunner(lst0, nil, &testHTTPServeParsedConfig, nil) |
772 | 139 | c.Assert(s.lst, Equals, lst0) | 149 | c.Assert(s.lst, Equals, lst0) |
773 | 140 | c.Check(s.kind, Equals, "http") | 150 | c.Check(s.kind, Equals, "http") |
774 | 141 | } | 151 | } |
775 | 152 | |||
776 | 153 | func (s *runnerSuite) TestHTTPServeRunnerTLS(c *C) { | ||
777 | 154 | errCh := make(chan interface{}, 1) | ||
778 | 155 | h := http.HandlerFunc(testHandle) | ||
779 | 156 | runner := HTTPServeRunner(nil, h, &testHTTPServeParsedConfig, helpers.TestTLSServerConfig) | ||
780 | 157 | c.Assert(s.lst, Not(IsNil)) | ||
781 | 158 | defer s.lst.Close() | ||
782 | 159 | c.Check(s.kind, Equals, "http") | ||
783 | 160 | go func() { | ||
784 | 161 | defer func() { | ||
785 | 162 | errCh <- recover() | ||
786 | 163 | }() | ||
787 | 164 | runner() | ||
788 | 165 | }() | ||
789 | 166 | cli := http.Client{ | ||
790 | 167 | Transport: &http.Transport{ | ||
791 | 168 | TLSClientConfig: helpers.TestTLSClientConfig, | ||
792 | 169 | }, | ||
793 | 170 | } | ||
794 | 171 | resp, err := cli.Get(fmt.Sprintf("https://%s/", s.lst.Addr())) | ||
795 | 172 | c.Assert(err, IsNil) | ||
796 | 173 | defer resp.Body.Close() | ||
797 | 174 | c.Assert(resp.StatusCode, Equals, 200) | ||
798 | 175 | body, err := ioutil.ReadAll(resp.Body) | ||
799 | 176 | c.Assert(err, IsNil) | ||
800 | 177 | c.Check(string(body), Equals, "yay!\n") | ||
801 | 178 | s.lst.Close() | ||
802 | 179 | c.Check(<-errCh, Matches, "accepting http connections:.*closed.*") | ||
803 | 180 | } | ||
804 | 142 | 181 | ||
805 | === added file 'server/tlsconfig.go' | |||
806 | --- server/tlsconfig.go 1970-01-01 00:00:00 +0000 | |||
807 | +++ server/tlsconfig.go 2014-09-10 15:12:43 +0000 | |||
808 | @@ -0,0 +1,53 @@ | |||
809 | 1 | /* | ||
810 | 2 | Copyright 2013-2014 Canonical Ltd. | ||
811 | 3 | |||
812 | 4 | This program is free software: you can redistribute it and/or modify it | ||
813 | 5 | under the terms of the GNU General Public License version 3, as published | ||
814 | 6 | by the Free Software Foundation. | ||
815 | 7 | |||
816 | 8 | This program is distributed in the hope that it will be useful, but | ||
817 | 9 | WITHOUT ANY WARRANTY; without even the implied warranties of | ||
818 | 10 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
819 | 11 | PURPOSE. See the GNU General Public License for more details. | ||
820 | 12 | |||
821 | 13 | You should have received a copy of the GNU General Public License along | ||
822 | 14 | with this program. If not, see <http://www.gnu.org/licenses/>. | ||
823 | 15 | */ | ||
824 | 16 | |||
825 | 17 | package server | ||
826 | 18 | |||
827 | 19 | import ( | ||
828 | 20 | "crypto/tls" | ||
829 | 21 | "fmt" | ||
830 | 22 | |||
831 | 23 | "launchpad.net/ubuntu-push/config" | ||
832 | 24 | ) | ||
833 | 25 | |||
834 | 26 | // A TLSParsedConfig holds and can be used to parse a tls server config. | ||
835 | 27 | type TLSParsedConfig struct { | ||
836 | 28 | ParsedKeyPEMFile string `json:"key_pem_file"` | ||
837 | 29 | ParsedCertPEMFile string `json:"cert_pem_file"` | ||
838 | 30 | // private post-processed config | ||
839 | 31 | cert tls.Certificate | ||
840 | 32 | } | ||
841 | 33 | |||
842 | 34 | func (cfg *TLSParsedConfig) LoadPEMs(baseDir string) error { | ||
843 | 35 | keyPEMBlock, err := config.LoadFile(cfg.ParsedKeyPEMFile, baseDir) | ||
844 | 36 | if err != nil { | ||
845 | 37 | return fmt.Errorf("reading key_pem_file: %v", err) | ||
846 | 38 | } | ||
847 | 39 | certPEMBlock, err := config.LoadFile(cfg.ParsedCertPEMFile, baseDir) | ||
848 | 40 | if err != nil { | ||
849 | 41 | return fmt.Errorf("reading cert_pem_file: %v", err) | ||
850 | 42 | } | ||
851 | 43 | cfg.cert, err = tls.X509KeyPair(certPEMBlock, keyPEMBlock) | ||
852 | 44 | return err | ||
853 | 45 | } | ||
854 | 46 | |||
855 | 47 | func (cfg *TLSParsedConfig) TLSServerConfig() *tls.Config { | ||
856 | 48 | tlsCfg := &tls.Config{ | ||
857 | 49 | Certificates: []tls.Certificate{cfg.cert}, | ||
858 | 50 | SessionTicketsDisabled: true, | ||
859 | 51 | } | ||
860 | 52 | return tlsCfg | ||
861 | 53 | } | ||
862 | 0 | 54 | ||
863 | === modified file 'testing/tls.go' | |||
864 | --- testing/tls.go 2014-01-21 21:36:07 +0000 | |||
865 | +++ testing/tls.go 2014-09-10 15:12:43 +0000 | |||
866 | @@ -16,26 +16,53 @@ | |||
867 | 16 | 16 | ||
868 | 17 | package testing | 17 | package testing |
869 | 18 | 18 | ||
871 | 19 | // key&cert generated with go run /usr/lib/go/src/pkg/crypto/tls/generate_cert.go -ca -host localhost -rsa-bits 512 -duration 87600h | 19 | import ( |
872 | 20 | "crypto/tls" | ||
873 | 21 | "crypto/x509" | ||
874 | 22 | ) | ||
875 | 23 | |||
876 | 24 | // key&cert generated with go run /usr/lib/go/src/pkg/crypto/tls/generate_cert.go -ca -host push-delivery -rsa-bits 512 -duration 87600h | ||
877 | 20 | var ( | 25 | var ( |
878 | 21 | TestKeyPEMBlock = []byte(`-----BEGIN RSA PRIVATE KEY----- | 26 | TestKeyPEMBlock = []byte(`-----BEGIN RSA PRIVATE KEY----- |
886 | 22 | MIIBPAIBAAJBAPw+niki17X2qALE2A2AzE1q5dvK9CI4OduRtT9IgbFLC6psqAT2 | 27 | MIIBOgIBAAJBANRU+pZKMNHpMvg549meJ060xQ4HCjrfVq+AeIER9W1pkaknDj8c |
887 | 23 | 1NA+QbY17nWSSpyP65zkMkwKXrbDzstwLPkCAwEAAQJAKwXbIBULScP6QA6m8xam | 28 | hwOWKHTeztcPF/LHVpKPabn+fSNbFlq+SzcCAwEAAQJBAIOO+4xu/3yv/rKqO7C0 |
888 | 24 | wgWbkvN41GVWqPafPV32kPBvKwSc+M1e+JR7g3/xPZE7TCELcfYi4yXEHZZI3Pbh | 29 | Oyqa+pVMa1w60R0AfqmKFQTqiTgevM77uqjpW1+t0hpK20nyj6MUIPaL+9kZgp7t |
889 | 25 | oQIhAP/UsgJbsfH1GFv8Y8qGl5l/kmwwkwHhuKvEC87Yur9FAiEA/GlQv3ZfaXnT | 30 | mnECIQDqw79PXSzudf10XGy9ve5bRazINHxQYgJ7FvlTT6JhdQIhAOeJxq9zcKni |
890 | 26 | lcCFT0aL02O0RDiRYyMUG/JAZQJs6CUCIQCHO5SZYIUwxIGK5mCNxxXOAzyQSiD7 | 31 | 69ueO1ualz0hn8w6uHPsG9FlZ8C+7Jh7AiAWJgebjjfZ+4nA+6NKt2uQct9dOA5u |
891 | 27 | hqkKywf+4FvfDQIhALa0TLyqJFom0t7c4iIGAIRc8UlIYQSPiajI64+x9775AiEA | 32 | awC+6ij1ojK4rQIgNEqAbcWDj0qpe8sLms+aEntSjJxCZiPP0IW3XeeApZsCIDwo |
892 | 28 | 0v4fgSK/Rq059zW1753JjuB6aR0Uh+3RqJII4dUR1Wg= | 33 | x+YyxXQWJlf9L5TNYPRo+KFEdk3Cew0lv6QNs+xe |
893 | 29 | -----END RSA PRIVATE KEY-----`) | 34 | -----END RSA PRIVATE KEY-----`) |
894 | 30 | 35 | ||
895 | 31 | TestCertPEMBlock = []byte(`-----BEGIN CERTIFICATE----- | 36 | TestCertPEMBlock = []byte(`-----BEGIN CERTIFICATE----- |
896 | 32 | MIIBYzCCAQ+gAwIBAgIBADALBgkqhkiG9w0BAQUwEjEQMA4GA1UEChMHQWNtZSBD | 37 | MIIBYzCCAQ+gAwIBAgIBADALBgkqhkiG9w0BAQUwEjEQMA4GA1UEChMHQWNtZSBD |
904 | 33 | bzAeFw0xMzEyMTkyMDU1NDNaFw0yMzEyMTcyMDU1NDNaMBIxEDAOBgNVBAoTB0Fj | 38 | bzAeFw0xNDA4MjkxMjQyMDFaFw0yNDA4MjYxMjQyMDFaMBIxEDAOBgNVBAoTB0Fj |
905 | 34 | bWUgQ28wWjALBgkqhkiG9w0BAQEDSwAwSAJBAPw+niki17X2qALE2A2AzE1q5dvK | 39 | bWUgQ28wXDANBgkqhkiG9w0BAQEFAANLADBIAkEA1FT6lkow0eky+Dnj2Z4nTrTF |
906 | 35 | 9CI4OduRtT9IgbFLC6psqAT21NA+QbY17nWSSpyP65zkMkwKXrbDzstwLPkCAwEA | 40 | DgcKOt9Wr4B4gRH1bWmRqScOPxyHA5YodN7O1w8X8sdWko9puf59I1sWWr5LNwID |
907 | 36 | AaNUMFIwDgYDVR0PAQH/BAQDAgCkMBMGA1UdJQQMMAoGCCsGAQUFBwMBMA8GA1Ud | 41 | AQABo1IwUDAOBgNVHQ8BAf8EBAMCAKQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDwYD |
908 | 37 | EwEB/wQFMAMBAf8wGgYDVR0RBBMwEYIJbG9jYWxob3N0hwR/AAABMAsGCSqGSIb3 | 42 | VR0TAQH/BAUwAwEB/zAYBgNVHREEETAPgg1wdXNoLWRlbGl2ZXJ5MAsGCSqGSIb3 |
909 | 38 | DQEBBQNBAFqiVI+Km2XPSO+pxITaPvhmuzg+XG3l1+2di3gL+HlDobocjBqRctRU | 43 | DQEBBQNBABtWCdMFkhIO8+oM3vugOWle9WJZ1FCRWD+cMl76mI1lhmNF4lvEZG47 |
910 | 39 | YySO32W07acjGJmCHUKpCJuq9X8hpmk= | 44 | xUjekA1+heU39WpOEzZSybrOdiEaGbI= |
911 | 40 | -----END CERTIFICATE-----`) | 45 | -----END CERTIFICATE-----`) |
912 | 41 | ) | 46 | ) |
913 | 47 | |||
914 | 48 | // test tls server & client config | ||
915 | 49 | var TestTLSServerConfig, TestTLSClientConfig *tls.Config | ||
916 | 50 | |||
917 | 51 | func init() { | ||
918 | 52 | cert, err := tls.X509KeyPair(TestCertPEMBlock, TestKeyPEMBlock) | ||
919 | 53 | if err != nil { | ||
920 | 54 | panic(err) | ||
921 | 55 | } | ||
922 | 56 | TestTLSServerConfig = &tls.Config{ | ||
923 | 57 | Certificates: []tls.Certificate{cert}, | ||
924 | 58 | } | ||
925 | 59 | cp := x509.NewCertPool() | ||
926 | 60 | ok := cp.AppendCertsFromPEM(TestCertPEMBlock) | ||
927 | 61 | if !ok { | ||
928 | 62 | panic("failed to parse test cert") | ||
929 | 63 | } | ||
930 | 64 | TestTLSClientConfig = &tls.Config{ | ||
931 | 65 | RootCAs: cp, | ||
932 | 66 | ServerName: "push-delivery", | ||
933 | 67 | } | ||
934 | 68 | } |