ios_config_profile 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +29 -4
- data/lib/ios_config_profile.rb +1 -0
- data/lib/ios_config_profile/base.rb +19 -0
- data/lib/ios_config_profile/content/install_doc_payload.rb +1 -1
- data/lib/ios_config_profile/content/remove_doc_payload.rb +1 -1
- data/lib/ios_config_profile/content/web_clip_payload.rb +3 -3
- data/lib/ios_config_profile/device/app_lock_payload.rb +3 -3
- data/lib/ios_config_profile/device/dep_payload.rb +4 -4
- data/lib/ios_config_profile/device/mdm_payload.rb +2 -2
- data/lib/ios_config_profile/device/restrictions_payload.rb +3 -3
- data/lib/ios_config_profile/device/scep_payload.rb +3 -3
- data/lib/ios_config_profile/device/security_payload.rb +2 -2
- data/lib/ios_config_profile/device/vpn_payload.rb +3 -3
- data/lib/ios_config_profile/version.rb +1 -1
- data/spec/base_spec.rb +35 -0
- data/spec/content/remove_doc_payload_spec.rb +1 -1
- data/spec/content/web_clip_payload_spec.rb +1 -1
- data/spec/device/app_lock_payload_spec.rb +1 -1
- data/spec/device/mdm_payload_spec.rb +2 -2
- data/spec/device/security_payload_spec.rb +2 -2
- data/spec/device/vpn_payload_spec.rb +4 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 484593ccd957488fd9f9c9724007abc5ce862a04
|
4
|
+
data.tar.gz: 2cb6e494c411616491387468da5dc7a11a779470
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c3ff5e780b454ac27be0cefa1f0a2c51afbe2412e4868a360a119e1258320d3aab90f0a385fff084d8b44f900e5171af2269cfd45158c98aa72fe0ae4cb3f5b
|
7
|
+
data.tar.gz: 24c22198fb46cc69497e1dd97a41aa8a963034473c399ba9159477b30106951403a2e08f8b8dbb330a16ef8b57625de3e2604736f0408d040f9fa7c9ff3e6ace
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,40 @@
|
|
1
|
-
#
|
1
|
+
# IOSConfigProfile
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/ios_config_profile)
|
3
4
|
[ ](https://codeship.com/projects/73471)
|
4
5
|
[](https://gemnasium.com/cellabus/ios_config_profile)
|
5
6
|
[](https://codeclimate.com/github/cellabus/ios_config_profile)
|
6
7
|
[](https://codeclimate.com/github/cellabus/ios_config_profile/coverage)
|
8
|
+
[](https://hakiri.io/github/cellabus/ios_config_profile/master)
|
7
9
|
|
8
10
|
Gem for creating and manipulating Apple Configuration Profiles and Mobile
|
9
11
|
Device Management (MDM) Protocols
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this to your Gemfile
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'ios-cert-enrollment', git: 'https://github.com/cellabus/ios-cert-enrollment'
|
19
|
+
gem 'ios_config_profile'
|
20
|
+
```
|
21
|
+
|
22
|
+
This gem requires IOSCertEnrollment. The [rubygems version](https://rubygems.org/gems/ios-cert-enrollment) works
|
23
|
+
but it is highly recommended to use an [updated version](https://github.com/cellabus/ios-cert-enrollment).
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Apple Configuration Profiles are Property List (plist) files a type of XML file.
|
28
|
+
The plist gem converts hashes into plist files.
|
29
|
+
|
30
|
+
For a given configuration profile, you can initialize the class and export it
|
31
|
+
into a plist string. For example:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
payload = IOSConfigProfile::InstallBookPayload.new '12345'
|
35
|
+
payload = payload.to_command_payload
|
36
|
+
```
|
37
|
+
|
38
|
+
## Development
|
13
39
|
|
14
|
-
# Development
|
15
40
|
To run tests - `bundle exec rspec`
|
data/lib/ios_config_profile.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module IOSConfigProfile
|
2
|
+
@@root_domain = 'com.cellabus'
|
3
|
+
|
4
|
+
def self.root_domain= x
|
5
|
+
@@root_domain = x
|
6
|
+
end
|
7
|
+
def self.root_domain
|
8
|
+
@@root_domain
|
9
|
+
end
|
10
|
+
|
11
|
+
@@organization = 'Cellabus, Inc.'
|
12
|
+
|
13
|
+
def self.organization= x
|
14
|
+
@@organization = x
|
15
|
+
end
|
16
|
+
def self.organization
|
17
|
+
@@organization
|
18
|
+
end
|
19
|
+
end
|
@@ -22,14 +22,14 @@ module IOSConfigProfile
|
|
22
22
|
"Icon" => StringIO.new(icon),
|
23
23
|
"IsRemovable" => false,
|
24
24
|
"PayloadType" => "com.apple.webClip.managed",
|
25
|
-
"PayloadIdentifier" => "
|
25
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}.webclip",
|
26
26
|
"PayloadDescription" => "Add home screen website bookmark",
|
27
27
|
"PayloadUUID" => uuid,
|
28
28
|
"PayloadVersion" => 1,
|
29
29
|
}],
|
30
30
|
"PayloadType" => "Configuration",
|
31
|
-
"PayloadDisplayName" => "
|
32
|
-
"PayloadIdentifier" => "
|
31
|
+
"PayloadDisplayName" => "#{IOSConfigProfile.organization} Web Clip",
|
32
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}.config.mdm.#{SecureRandom.urlsafe_base64}",
|
33
33
|
"PayloadUUID" => uuid,
|
34
34
|
"PayloadVersion" => 1,
|
35
35
|
}
|
@@ -17,14 +17,14 @@ module IOSConfigProfile
|
|
17
17
|
"PayloadContent" => [{
|
18
18
|
"App" => { "Identifier" => app_bundle_id },
|
19
19
|
"PayloadType" => "com.apple.app.lock",
|
20
|
-
"PayloadIdentifier" => "
|
20
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}applock.profile.mdm",
|
21
21
|
"PayloadDescription" => "Lock device to an app",
|
22
22
|
"PayloadUUID" => uuid,
|
23
23
|
"PayloadVersion" => 1,
|
24
24
|
}],
|
25
25
|
"PayloadType" => "Configuration",
|
26
|
-
"PayloadDisplayName" => "
|
27
|
-
"PayloadIdentifier" => "
|
26
|
+
"PayloadDisplayName" => "#{IOSConfigProfile.organization} App Lock",
|
27
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}applock.profile.mdm",
|
28
28
|
"PayloadUUID" => uuid,
|
29
29
|
"PayloadVersion" => 1,
|
30
30
|
}
|
@@ -18,10 +18,10 @@ module IOSConfigProfile
|
|
18
18
|
def dep_payload
|
19
19
|
{
|
20
20
|
"PayloadContent" => [mdm_payload, security_payload],
|
21
|
-
"PayloadDescription" => "
|
22
|
-
"PayloadDisplayName" => "
|
23
|
-
"PayloadIdentifier" => "
|
24
|
-
"PayloadOrganization" =>
|
21
|
+
"PayloadDescription" => "#{IOSConfigProfile.organization} MDM Enrollment Profile",
|
22
|
+
"PayloadDisplayName" => "#{IOSConfigProfile.organization} MDM Enrollment Profile",
|
23
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}.mdm.enrollment.profile",
|
24
|
+
"PayloadOrganization" => IOSConfigProfile.organization,
|
25
25
|
"PayloadRemovalDisallowed" => false,
|
26
26
|
"PayloadType" => "Configuration",
|
27
27
|
"PayloadUUID" => uuid,
|
@@ -30,10 +30,10 @@ module IOSConfigProfile
|
|
30
30
|
|
31
31
|
"PayloadType" => "com.apple.mdm",
|
32
32
|
"PayloadVersion" => 1,
|
33
|
-
"PayloadIdentifier" => "
|
33
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}ipcu.profile.mdm",
|
34
34
|
"PayloadDisplayName" => "Mobile Device Management",
|
35
35
|
"PayloadDescription" => "Configures Mobile Device Management",
|
36
|
-
"PayloadOrganization" =>
|
36
|
+
"PayloadOrganization" => IOSConfigProfile.organization,
|
37
37
|
}
|
38
38
|
end
|
39
39
|
end
|
@@ -125,7 +125,7 @@ module IOSConfigProfile
|
|
125
125
|
def add_boilerplate(payload)
|
126
126
|
content = {
|
127
127
|
"PayloadType" => "com.apple.applicationaccess",
|
128
|
-
"PayloadIdentifier" => "
|
128
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}.restrictions",
|
129
129
|
"PayloadDescription" => "Restrict device capabilities",
|
130
130
|
"PayloadUUID" => uuid,
|
131
131
|
"PayloadRemovalDisallowed" => true,
|
@@ -134,8 +134,8 @@ module IOSConfigProfile
|
|
134
134
|
{
|
135
135
|
"PayloadContent" => [content],
|
136
136
|
"PayloadType" => "Configuration",
|
137
|
-
"PayloadDisplayName" => "
|
138
|
-
"PayloadIdentifier" => "
|
137
|
+
"PayloadDisplayName" => "#{IOSConfigProfile.organization} Device Restrictions",
|
138
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}.config.mdm.#{SecureRandom.urlsafe_base64}",
|
139
139
|
"PayloadUUID" => uuid,
|
140
140
|
"PayloadVersion" => 1,
|
141
141
|
}
|
@@ -15,7 +15,7 @@ module IOSConfigProfile
|
|
15
15
|
def security_payload
|
16
16
|
{
|
17
17
|
"URL" => url,
|
18
|
-
# 'Name' => '
|
18
|
+
# 'Name' => '#{IOSConfigProfile.organization} SCEP Payload',
|
19
19
|
# 'Subject' => '',
|
20
20
|
# 'Challenge' => '',
|
21
21
|
# 'Keysize' => 1024,
|
@@ -24,10 +24,10 @@ module IOSConfigProfile
|
|
24
24
|
|
25
25
|
"PayloadType" => "com.apple.security.scep",
|
26
26
|
"PayloadVersion" => 1,
|
27
|
-
"PayloadIdentifier" => "
|
27
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}.profile.scep",
|
28
28
|
"PayloadDisplayName" => "Security",
|
29
29
|
"PayloadDescription" => "Provides device authentication (certificate or identity).",
|
30
|
-
"PayloadOrganization" =>
|
30
|
+
"PayloadOrganization" => IOSConfigProfile.organization,
|
31
31
|
}
|
32
32
|
end
|
33
33
|
end
|
@@ -22,10 +22,10 @@ module IOSConfigProfile
|
|
22
22
|
|
23
23
|
"PayloadType" => "com.apple.security.pkcs12",
|
24
24
|
"PayloadVersion" => 1,
|
25
|
-
"PayloadIdentifier" => "
|
25
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}ipcu.profile.credential",
|
26
26
|
"PayloadDisplayName" => "Security",
|
27
27
|
"PayloadDescription" => "Provides device authentication (certificate or identity).",
|
28
|
-
"PayloadOrganization" =>
|
28
|
+
"PayloadOrganization" => IOSConfigProfile.organization,
|
29
29
|
}
|
30
30
|
end
|
31
31
|
end
|
@@ -17,7 +17,7 @@ module IOSConfigProfile
|
|
17
17
|
{
|
18
18
|
"PayloadContent" => [{
|
19
19
|
"PayloadType" => "com.apple.vpn.managed",
|
20
|
-
"PayloadIdentifier" => "
|
20
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}.vpn",
|
21
21
|
"PayloadDescription" => "Set up VPN networking access",
|
22
22
|
"PayloadUUID" => uuid,
|
23
23
|
"PayloadVersion" => 1,
|
@@ -29,8 +29,8 @@ module IOSConfigProfile
|
|
29
29
|
"VendorConfig" => get_vendor_config,
|
30
30
|
}],
|
31
31
|
"PayloadType" => "Configuration",
|
32
|
-
"PayloadDisplayName" => "
|
33
|
-
"PayloadIdentifier" => "
|
32
|
+
"PayloadDisplayName" => "#{IOSConfigProfile.organization} VPN Configuration",
|
33
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}.vpn",
|
34
34
|
"PayloadUUID" => uuid,
|
35
35
|
"PayloadVersion" => 1,
|
36
36
|
}
|
data/spec/base_spec.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe IOSConfigProfile do
|
4
|
+
context '@@root_domain' do
|
5
|
+
after :all do
|
6
|
+
IOSConfigProfile.root_domain = 'com.cellabus'
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'has a root domain' do
|
10
|
+
expect(IOSConfigProfile.root_domain).to eq 'com.cellabus'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'can set a root_domain' do
|
14
|
+
example = 'com.example'
|
15
|
+
IOSConfigProfile.root_domain = example
|
16
|
+
expect(IOSConfigProfile.root_domain).to eq example
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context '@@organization' do
|
21
|
+
after :all do
|
22
|
+
IOSConfigProfile.organization = 'Cellabus, Inc.'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'has an organization' do
|
26
|
+
expect(IOSConfigProfile.organization).to eq 'Cellabus, Inc.'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'can set an organization' do
|
30
|
+
example = 'example'
|
31
|
+
IOSConfigProfile.organization = example
|
32
|
+
expect(IOSConfigProfile.organization).to eq example
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -6,7 +6,7 @@ describe IOSConfigProfile::RemoveDocPayload do
|
|
6
6
|
describe "#initialize" do
|
7
7
|
it "must be initialized with a doc's url" do
|
8
8
|
payload = subject.new "1234"
|
9
|
-
expect(payload["PersistentID"]).to eq "
|
9
|
+
expect(payload["PersistentID"]).to eq "#{IOSConfigProfile.root_domain}.files.1234"
|
10
10
|
expect { subject.new nil }.to raise_error RuntimeError
|
11
11
|
end
|
12
12
|
it "has required payload values" do
|
@@ -5,7 +5,7 @@ describe IOSConfigProfile::WebClipPayload do
|
|
5
5
|
|
6
6
|
it "contains valid Configuration entries" do
|
7
7
|
expect(subject["PayloadType"]).to eq "Configuration"
|
8
|
-
expect(subject["PayloadDisplayName"]).to eq "
|
8
|
+
expect(subject["PayloadDisplayName"]).to eq "#{IOSConfigProfile.organization} Web Clip"
|
9
9
|
end
|
10
10
|
|
11
11
|
it "contains valid PayloadContent" do
|
@@ -11,7 +11,7 @@ describe IOSConfigProfile::AppLockPayload do
|
|
11
11
|
end
|
12
12
|
it "has required payload values" do
|
13
13
|
payload = subject.new "1234"
|
14
|
-
expect(payload["PayloadIdentifier"]).to eq "
|
14
|
+
expect(payload["PayloadIdentifier"]).to eq "#{IOSConfigProfile.root_domain}applock.profile.mdm"
|
15
15
|
expect(payload["PayloadContent"][0]["PayloadType"]).to eq "com.apple.app.lock"
|
16
16
|
end
|
17
17
|
it "has a uuid" do
|
@@ -16,10 +16,10 @@ describe IOSConfigProfile::MDMPayload do
|
|
16
16
|
|
17
17
|
"PayloadType" => "com.apple.mdm",
|
18
18
|
"PayloadVersion" => 1,
|
19
|
-
"PayloadIdentifier" => "
|
19
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}ipcu.profile.mdm",
|
20
20
|
"PayloadDisplayName" => "Mobile Device Management",
|
21
21
|
"PayloadDescription" => "Configures Mobile Device Management",
|
22
|
-
"PayloadOrganization" =>
|
22
|
+
"PayloadOrganization" => IOSConfigProfile.organization,
|
23
23
|
}
|
24
24
|
end
|
25
25
|
let(:url) { "https://example.com" }
|
@@ -9,10 +9,10 @@ describe IOSConfigProfile::SecurityPayload do
|
|
9
9
|
|
10
10
|
"PayloadType" => "com.apple.security.pkcs12",
|
11
11
|
"PayloadVersion" => 1,
|
12
|
-
"PayloadIdentifier" => "
|
12
|
+
"PayloadIdentifier" => "#{IOSConfigProfile.root_domain}ipcu.profile.credential",
|
13
13
|
"PayloadDisplayName" => "Security",
|
14
14
|
"PayloadDescription" => "Provides device authentication (certificate or identity).",
|
15
|
-
"PayloadOrganization" =>
|
15
|
+
"PayloadOrganization" => IOSConfigProfile.organization,
|
16
16
|
}
|
17
17
|
end
|
18
18
|
|
@@ -35,6 +35,10 @@ describe IOSConfigProfile::VPNPayload do
|
|
35
35
|
subject { IOSConfigProfile::VPNPayload.new config }
|
36
36
|
it "raises errors for unimplemented vpn types" do
|
37
37
|
subject.send :get_vendor_config
|
38
|
+
subject.vpn_config[:vpn_type] = "PPTP"
|
39
|
+
expect { subject.send :get_vendor_config }.to raise_error NotImplementedError
|
40
|
+
subject.vpn_config[:vpn_type] = "IKEv2"
|
41
|
+
expect { subject.send :get_vendor_config }.to raise_error NotImplementedError
|
38
42
|
subject.vpn_config[:vpn_type] = "AlwaysOn"
|
39
43
|
expect { subject.send :get_vendor_config }.to raise_error NotImplementedError
|
40
44
|
subject.vpn_config[:vpn_type] = "asdf"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ios_config_profile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: CFPropertyList
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- Rakefile
|
129
129
|
- ios_config_profile.gemspec
|
130
130
|
- lib/ios_config_profile.rb
|
131
|
+
- lib/ios_config_profile/base.rb
|
131
132
|
- lib/ios_config_profile/basic_payload.rb
|
132
133
|
- lib/ios_config_profile/command_payload.rb
|
133
134
|
- lib/ios_config_profile/content/install_application_payload.rb
|
@@ -156,6 +157,7 @@ files:
|
|
156
157
|
- lib/ios_config_profile/device/vpn_payload.rb
|
157
158
|
- lib/ios_config_profile/encrypted_payload.rb
|
158
159
|
- lib/ios_config_profile/version.rb
|
160
|
+
- spec/base_spec.rb
|
159
161
|
- spec/basic_payload_spec.rb
|
160
162
|
- spec/command_payload_spec.rb
|
161
163
|
- spec/content/install_application_payload_spec.rb
|
@@ -211,6 +213,7 @@ summary: This gem provides an easy way to generate configuration profiles for us
|
|
211
213
|
with Apple iOS devices. These profiles and payloads can be delivered via Apple MDM,
|
212
214
|
Apple's Configurator, or the iPhone Configuration Utility (IPCU).
|
213
215
|
test_files:
|
216
|
+
- spec/base_spec.rb
|
214
217
|
- spec/basic_payload_spec.rb
|
215
218
|
- spec/command_payload_spec.rb
|
216
219
|
- spec/content/install_application_payload_spec.rb
|