match 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b05098619e6260e1ea328c60d267cab0e14b2674
4
+ data.tar.gz: d01c956fec14a9f4c6c8db830c90659bfe1393da
5
+ SHA512:
6
+ metadata.gz: 7b2c24bbcf2df8eaa0fd10a3b261f2fb3c5615c5e6272c6b9f4f50d380a54a88c76f72022a6bfe4c6ad35af4a877687b6da1b1fe8beaf3ad43fc9b8c796cfe85
7
+ data.tar.gz: f430beaf50b3d6da26720e13735e1ed44e563326deae4b17bb3663160a2ab77a18c027f61d9153d093de1cff10e1a2e7451af3d1e6319dcc0536007b5e89ed6f
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Felix Krause
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,331 @@
1
+ <h3 align="center">
2
+ <a href="https://github.com/fastlane/fastlane">
3
+ <img src="assets/fastlane.png" width="150" />
4
+ <br />
5
+ fastlane
6
+ </a>
7
+ </h3>
8
+ <p align="center">
9
+ <a href="https://github.com/fastlane/deliver">deliver</a> &bull;
10
+ <a href="https://github.com/fastlane/snapshot">snapshot</a> &bull;
11
+ <a href="https://github.com/fastlane/frameit">frameit</a> &bull;
12
+ <a href="https://github.com/fastlane/pem">pem</a> &bull;
13
+ <a href="https://github.com/fastlane/sigh">sigh</a> &bull;
14
+ <a href="https://github.com/fastlane/produce">produce</a> &bull;
15
+ <a href="https://github.com/fastlane/cert">cert</a> &bull;
16
+ <a href="https://github.com/fastlane/spaceship">spaceship</a> &bull;
17
+ <a href="https://github.com/fastlane/pilot">pilot</a> &bull;
18
+ <a href="https://github.com/fastlane/boarding">boarding</a> &bull;
19
+ <a href="https://github.com/fastlane/gym">gym</a> &bull;
20
+ <a href="https://github.com/fastlane/scan">scan</a> &bull;
21
+ <b>match</b>
22
+ </p>
23
+ -------
24
+
25
+ <p align="center">
26
+ <img src="assets/match.png" height="110">
27
+ </p>
28
+
29
+ match
30
+ ============
31
+
32
+ [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/fastlane/match/blob/master/LICENSE)
33
+ [![Gem](https://img.shields.io/gem/v/match.svg?style=flat)](http://rubygems.org/gems/match)
34
+ [![Build Status](https://img.shields.io/travis/fastlane/match/master.svg?style=flat)](https://travis-ci.org/fastlane/match)
35
+
36
+ ###### Easily sync your certificates and profiles across your team using git
37
+
38
+ A new approach to iOS code signing: Share one code signing identity across your development team to simplify your codesigning setup and prevent code signing issues.
39
+
40
+ -------
41
+ <p align="center">
42
+ <a href="#why-match">Why?</a> &bull;
43
+ <a href="#installation">Installation</a> &bull;
44
+ <a href="#usage">Usage</a> &bull;
45
+ <a href="#is-this-secure">Is this secure?</a> &bull;
46
+ <a href="#need-help">Need help?</a>
47
+ </p>
48
+
49
+ -------
50
+
51
+ <h5 align="center"><code>match</code> is part of <a href="https://fastlane.tools">fastlane</a>: connect all deployment tools into one streamlined workflow.</h5>
52
+
53
+ ## Why match?
54
+
55
+ Before starting to use `match`, make sure to read the [codesigning.guide](https://codesigning.guide)
56
+
57
+ > When deploying an app to the App Store, beta testing service or even installing it on a device, most development teams have separate code signing identities for every member. This results in dozens of profiles including a lot of duplicates.
58
+
59
+ > You have to manually renew and download the latest set of provisioning profiles every time you add a new device or a certificate expires. Additionally this requires spending a lot of time when setting up a new machine that will build your app.
60
+
61
+ **A new approach**
62
+
63
+ > Share one code signing identity across your development team to simplify your setup and prevent code signing issues. What if there was a central place where your code signing identity and profiles are kept, so anyone in the team can access them during the build process?
64
+
65
+ ### Why not let Xcode handle all this?
66
+
67
+ - You have full control over what happens
68
+ - You have access to all the certificates and profiles, which are all securely stored in git
69
+ - You share one code signing identity across the team to have fewer certificates and profiles
70
+ - Xcode sometimes revokes certificates which breaks your setup causing failed builds
71
+ - More predictable builds by settings profiles in an explicit way instead of using the `Automatic` setting
72
+ - It just works™
73
+
74
+ ### What does `match` do for you?
75
+
76
+ | match
77
+ --------------------------|------------------------------------------------------------
78
+ :arrows_counterclockwise: | Automatically sync your iOS keys and profiles across all your team members using git
79
+ :package: | Handle all the heavy lifting of creating and storing your certificates and profiles
80
+ :computer: | Setup codesigning on a new machine in under a minute
81
+ :dart: | Designed to work with apps with multiple targets and bundle identifiers
82
+ :lock: | You have full control over your files and Git repo, no third party service involved
83
+ :sparkles: | Provisioning profile will always match the correct certificate
84
+ :boom: | Easily reset your existing profiles and certificates if your current account has expired or invalid profiles
85
+ :recycle: | Automatically renew your provisioning profiles to include all your devices using the `--force`
86
+ :busts_in_silhouette: | Support for multiple Apple accounts and multiple teams
87
+ :sparkles: | Tightly integrated with [fastlane](https://fastlane.tools) to work seamlessly with [gym](https://github.com/fastlane/gym) and other build tools
88
+
89
+ For more information about the concept, visit [codesigning.guide](https://codesigning.guide).
90
+
91
+ ## Installation
92
+
93
+ ```
94
+ sudo gem install match
95
+ ```
96
+
97
+ Make sure you have the latest version of the Xcode command line tools installed:
98
+
99
+ xcode-select --install
100
+
101
+ ## Usage
102
+
103
+ ### Setup
104
+
105
+ 1. Create a **new, private Git repo** (e.g. on [GitHub](https://github.com/new) or [BitBucket](https://bitbucket.org/repo/create)) and name it something like `certificates`. **Important:** Make sure the repository is set to *private*.
106
+
107
+ 2. Optional: Create a **new, shared Apple Developer Portal account**, something like `office@company.com` that will be shared across your team from now on (for more information visit [codesigning.guide](https://codesigning.guide))
108
+
109
+ 3. Run the following in your project folder to start using `match`:
110
+
111
+ ```
112
+ match init
113
+ ```
114
+
115
+ <img src="assets/match_init.gif" width="550" />
116
+
117
+ You'll be asked to enter the URL to your Git repo. This can be either a `https://` or a `git` URL. `match init` won't read or modify your certificates or profiles.
118
+
119
+ This will create a `Matchfile` in your current directory (or in your `./fastlane/` folder).
120
+
121
+ Example content (for more advanced setups check out the [fastlane section](#fastlane)):
122
+
123
+ ```ruby
124
+ git_url "https://github.com/fastlane/certificates"
125
+
126
+ app_identifier "tools.fastlane.app"
127
+ username "user@fastlane.tools"
128
+ ```
129
+
130
+ ### Run
131
+
132
+ > Before running `match` for the first time, you should consider clearing your existing profiles and certificates using the [match nuke command](#nuke).
133
+
134
+ After running `match init` you can run the following to generate new certificates and profiles:
135
+
136
+ ```
137
+ match appstore
138
+ ```
139
+ ```
140
+ match development
141
+ ```
142
+
143
+ <img src="assets/match_appstore_small.gif" width="550" />
144
+
145
+ This will create a new certificate and provisioning profile (if required) and store them in your Git repo. If you previously ran `match` it will automatically install the existing profiles from the Git repo.
146
+
147
+ The provisioning profiles are installed in `~/Library/MobileDevice/Provisioning Profiles` while the certificates and private keys are installed in your Keychain.
148
+
149
+ To get a more detailed output of what `match` is doing use
150
+
151
+ ```
152
+ match --verbose
153
+ ```
154
+
155
+ For a list of all available options run
156
+
157
+ ```
158
+ match --help
159
+ ```
160
+
161
+ #### Passphrase
162
+
163
+ When running `match` for the first time on a new machine, it will ask you for the passphrase for the Git repository. This is an additional layer of security: each of the files will be encrypted using `openssl`.Make sure to remember the password, as you'll need it when you run match on a different machine
164
+
165
+ #### New machine
166
+
167
+ To set up the certificates and provisioning profiles on a new machine, you just run the same command using:
168
+
169
+ ```
170
+ match development
171
+ ```
172
+
173
+ You can also run `match` in a `readonly` mode to be sure it won't create any new certificates or profiles.
174
+
175
+ ```
176
+ match development --readonly
177
+ ```
178
+
179
+ #### Access Control
180
+
181
+ A benefit of using `match` is that it enables you to give the developers of your team access to the code signing certificates without having to give everyone access to the Developer Portal:
182
+
183
+ 1. Run `match` to store the certificates in a Git repo
184
+ 2. Grant access to the Git repo to your developers and give them the passphrase
185
+ 3. The developers can now run `match` which will install the latest code signing profiles so they can build and sign the application without having to have access to the developer portal
186
+ 4. Every time you run `match` to update the profiles (e.g. add a new device), all your developers will automatically get the latest profiles when running `match`
187
+
188
+ If you decide to run `match` without access to the developer portal, make sure to use the `--readonly` option so that the commands don't ask you for the password to the developer portal.
189
+
190
+ The advantage of this approach is that no one in your team will revoke a certificate by mistake. Additionally it is recommended to install the [FixCode Xcode Plugin](https://github.com/neonichu/FixCode) to disable the `Fix Issue` button.
191
+
192
+ #### Git Repo
193
+
194
+ After running `match` for the first time, your Git repo will contain 2 directories:
195
+
196
+ - The `certs` folder contains all certificates with their private keys
197
+ - The `profiles` folder contains all provisioning profiles
198
+
199
+ Additionally, `match` creates a nice repo `README.md` for you, making it easy to onboard new team members:
200
+
201
+ <p align="center">
202
+ <img src="assets/github_repo.png" width="700" />
203
+ </p>
204
+
205
+ #### fastlane
206
+
207
+ Add `match` to your `Fastfile` to automatically fetch the latest code signing certificates with [fastlane](https://fastlane.tools).
208
+
209
+ ```ruby
210
+ match(type: "appstore")
211
+
212
+ match(git_url: "https://github.com/fastlane/certificates",
213
+ type: "development")
214
+
215
+ match(git_url: "https://github.com/fastlane/certificates",
216
+ type: "adhoc",
217
+ app_identifier: "tools.fastlane.app")
218
+
219
+ # `match` should be called before building the app with `gym`
220
+ gym
221
+ ...
222
+ ```
223
+
224
+ ##### Multiple Targets
225
+
226
+ If you app has multiple targets (e.g. Today Widget or WatchOS Extension)
227
+
228
+ ```ruby
229
+ match(app_identifier: "tools.fastlane.app", type: "appstore")
230
+ match(app_identifier: "tools.fastlane.app.today_widget", type: "appstore")
231
+ ```
232
+
233
+ `match` can even use the same one Git repository for all bundle identifiers.
234
+
235
+ ### Setup Xcode project
236
+
237
+ To make sure Xcode is using the right provisioning profile for each target, don't use the `Automatic` feature for the profile selection.
238
+
239
+ Additionally it is recommended to disable the `Fix Issue` button using the [FixCode Xcode Plugin](https://github.com/neonichu/FixCode). The `Fix Issue` button can revoke your existing certificates, which will invalidate your provisioning profiles.
240
+
241
+ #### To build from the command line using [fastlane](https://fastlane.tools)
242
+
243
+ `match` automatically pre-fills environment variables with the UUIDs of the correct provisioning profiles, ready to be used in your Xcode project.
244
+
245
+ <img src="assets/UDIDPrint.png" width="700" />
246
+
247
+ Open your target settings, open the dropdown for `Provisioning Profile` and select `Other`:
248
+
249
+ <img src="assets/XcodeProjectSettings.png" width="700" />
250
+
251
+ Profile environment variables are named after `$(sigh_<bundle_identifier>_<profile_type>)`
252
+
253
+ e.g. `$(sigh_tools.fastlane.app_development)`
254
+
255
+ #### To build from Xcode manually
256
+
257
+ This is useful when installing your application on your device using the Development profile.
258
+
259
+ You can statically select the right provisioning profile in your Xcode project (the name will be `tools.fastlane.app Development`).
260
+
261
+ ### Nuke
262
+
263
+ If you never really cared about code signing and have a messy Apple Developer account with a lot of invalid, expired or Xcode managed profiles/certificates, you can use the `match nuke` command to revoke your certificates and provisioning profiles. Don't worry, apps that are already available in the App Store will still work. After clearing your account you'll start from a clean state, and you can run `match` to generate your certificates and profiles again.
264
+
265
+ To revoke all certificates and provisioning profiles for a specific environment:
266
+
267
+ ```sh
268
+ match nuke development
269
+ match nuke distribution
270
+ ```
271
+
272
+ <img src="assets/match_nuke.gif" width="550" />
273
+
274
+ You'll have to confirm a list of profiles / certificates that will be deleted.
275
+
276
+ ## Is this secure?
277
+
278
+ Both your keys and provisioning profiles are encrypted using OpenSSL using a passphrase.
279
+
280
+ Storing your private keys in a Git repo may sound off-putting at first. We did an in-depth analysis of potential security issues and came to the following conclusions:
281
+
282
+ #### What could happen if someone stole a private key?
283
+
284
+ If attackers would have your certificate and provisioning profile, they could codesign an application with the same bundle identifier.
285
+
286
+ What's the worst that could happen for each of the profile types?
287
+
288
+ ##### App Store Profiles
289
+
290
+ An App Store profile can't be used for anything as long as it's not re-signed by Apple. The only way to get an app resigned is to submit an app for review (which takes around 7 days). Attackers could only submit an app for review, if they also got access to your iTunes Connect credentials (which are not stored in git, but in your local keychain). Additionally you get an email notification every time a build gets uploaded to cancel the submission even before your app gets into the review stage.
291
+
292
+ ##### Development and Ad Hoc Profiles
293
+
294
+ In general those profiles are harmless as they can only be used to install a signed application on a small subset of devices. To add new devices, the attacker would also need your Apple Developer Portal credentials (which are not stored in git, but in your local keychain).
295
+
296
+ ##### Enterprise Profiles
297
+
298
+ Attackers could use an In-House profile to distribute signed application to a potentially unlimited number of devices. All this would run under your company name and it could eventually lead to Apple revoking your In-House account. However it is very easy to revoke a certificate to remotely break the app on all devices.
299
+
300
+ Because of the potentially dangerous nature of In-House profiles we decided to not allow the use of `match` with enterprise accounts.
301
+
302
+ ##### To sum up
303
+
304
+ - You have full control over the access list of your Git repo, no third party service involved
305
+ - Even if your certificates are leaked, they can't be used to cause any harm without your iTunes Connect login credentials
306
+ - `match` does not currently support In-House Enterprise profiles as they are harder to control
307
+ - If you use GitHub or Bitbucket we encourage enabling 2 factor authentication for all accounts that have access to the certificates repo
308
+ - The complete source code of `match` is fully open source on [GitHub](https://github.com/fastlane/match)
309
+
310
+ ## [`fastlane`](https://fastlane.tools) Toolchain
311
+
312
+ - [`fastlane`](https://fastlane.tools): Connect all deployment tools into one streamlined workflow
313
+ - [`deliver`](https://github.com/fastlane/deliver): Upload screenshots, metadata and your app to the App Store
314
+ - [`snapshot`](https://github.com/fastlane/snapshot): Automate taking localized screenshots of your iOS app on every device
315
+ - [`frameit`](https://github.com/fastlane/frameit): Quickly put your screenshots into the right device frames
316
+ - [`pem`](https://github.com/fastlane/pem): Automatically generate and renew your push notification profiles
317
+ - [`produce`](https://github.com/fastlane/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
318
+ - [`cert`](https://github.com/fastlane/cert): Automatically create and maintain iOS code signing certificates
319
+ - [`spaceship`](https://github.com/fastlane/spaceship): Ruby library to access the Apple Dev Center and iTunes Connect
320
+ - [`pilot`](https://github.com/fastlane/pilot): The best way to manage your TestFlight testers and builds from your terminal
321
+ - [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
322
+ - [`gym`](https://github.com/fastlane/gym): Building your iOS apps has never been easier
323
+ - [`scan`](https://github.com/fastlane/scan): The easiest way to run tests of your iOS and Mac app
324
+
325
+ # Need help?
326
+ Please submit an issue on GitHub and provide information about your setup
327
+
328
+ # License
329
+ This project is licensed under the terms of the MIT license. See the LICENSE file.
330
+
331
+ > This project and all fastlane tools are in no way affiliated with Apple Inc. This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs. All fastlane tools run on your own computer or server, so your credentials or other sensitive information will never leave your own computer. You are responsible for how you use fastlane tools.
data/bin/match ADDED
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.push File.expand_path("../../lib", __FILE__)
4
+
5
+ require 'match'
6
+ require 'commander'
7
+
8
+ HighLine.track_eof = false
9
+
10
+ class MatchApplication
11
+ include Commander::Methods
12
+
13
+ # rubocop:disable Metrics/MethodLength
14
+ def run
15
+ program :version, Match::VERSION
16
+ program :description, Match::DESCRIPTION
17
+ program :help, 'Author', 'Felix Krause <match@krausefx.com>'
18
+ program :help, 'Website', 'https://fastlane.tools'
19
+ program :help, 'GitHub', 'https://github.com/fastlane/match'
20
+ program :help_formatter, :compact
21
+
22
+ global_option('--verbose') { $verbose = true }
23
+
24
+ FastlaneCore::CommanderGenerator.new.generate(Match::Options.available_options)
25
+
26
+ command :run do |c|
27
+ c.syntax = 'match'
28
+ c.description = Match::DESCRIPTION
29
+
30
+ c.action do |args, options|
31
+ if args.count > 0
32
+ FastlaneCore::UI.user_error!("Please run `match [type]`, allowed values: development, adhoc or appstore")
33
+ end
34
+
35
+ params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
36
+ params.load_configuration_file("Matchfile")
37
+ Match::Runner.new.run(params)
38
+ end
39
+ end
40
+
41
+ Match.environments.each do |type|
42
+ command type do |c|
43
+ c.syntax = "match #{type}"
44
+ c.description = "Run match for a #{type} provisioning profile"
45
+
46
+ c.action do |args, options|
47
+ params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
48
+ params.load_configuration_file("Matchfile") # this has to be done *before* overwriting the value
49
+ params[:type] = type.to_s
50
+ Match::Runner.new.run(params)
51
+ end
52
+ end
53
+ end
54
+
55
+ command :init do |c|
56
+ c.syntax = 'match init'
57
+ c.description = 'Create the Matchfile for you'
58
+ c.action do |args, options|
59
+ containing = (File.directory?("fastlane") ? 'fastlane' : '.')
60
+ path = File.join(containing, "Matchfile")
61
+
62
+ if File.exist?(path)
63
+ FastlaneCore::UI.user_error!("You already got a Matchfile in this directory")
64
+ return 0
65
+ end
66
+
67
+ Match::Setup.new.run(path)
68
+ end
69
+ end
70
+
71
+ command "nuke" do |c|
72
+ # We have this empty command here, since otherwise the normal `match` command will be executed
73
+ c.syntax = "match nuke"
74
+ c.description = "Delete all certificates and provisioning profiles from the Apple Dev Portal"
75
+ c.action do |args, options|
76
+ FastlaneCore::UI.user_error!("Please run `match nuke [type], allowed values: distribution and development")
77
+ end
78
+ end
79
+
80
+ ["development", "distribution"].each do |type|
81
+ command "nuke #{type}" do |c|
82
+ c.syntax = "match nuke #{type}"
83
+ c.description = "Delete all certificates and provisioning profiles from the Apple Dev Portal of the type #{type}"
84
+ c.action do |args, options|
85
+ params = FastlaneCore::Configuration.create(Match::Options.available_options, options.__hash__)
86
+ params.load_configuration_file("Matchfile")
87
+ Match::Nuke.new.run(params, type: type.to_s)
88
+ end
89
+ end
90
+ end
91
+
92
+ default_command :run
93
+
94
+ run!
95
+ end
96
+ # rubocop:enable Metrics/MethodLength
97
+ end
98
+
99
+ begin
100
+ FastlaneCore::UpdateChecker.start_looking_for_update('match')
101
+ MatchApplication.new.run
102
+ ensure
103
+ FastlaneCore::UpdateChecker.show_update_status('match', Match::VERSION)
104
+ end