addigy 2.3.0 → 2.5.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.
- package/index.d.ts +6 -1
- package/index.js +144 -0
- package/package.json +3 -3
- package/types.d.ts +49 -2
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Extension, IAddigyConfig, IAddigyInternalAuthObject, NotificationSettings, PPPCInput, SupportedOsVersions } from './types';
|
|
1
|
+
import { CustomFact, Extension, FilevaultRequest, IAddigyConfig, IAddigyInternalAuthObject, NotificationSettings, PPPCInput, SupportedOsVersions } from './types';
|
|
2
2
|
export * from './types';
|
|
3
3
|
declare enum AlertStatus {
|
|
4
4
|
Acknowledged = "Acknowledged",
|
|
@@ -61,7 +61,12 @@ export declare class Addigy {
|
|
|
61
61
|
}): Promise<any>;
|
|
62
62
|
createNotificationSettingsPolicy(authObject: IAddigyInternalAuthObject, name: string, notificationSettings: NotificationSettings[]): Promise<any>;
|
|
63
63
|
createCustomProfile(authObject: IAddigyInternalAuthObject, name: string, customProfileText: string, supportedOsVersions: SupportedOsVersions, payloadScope?: 'System' | 'User', is_profile_signed?: boolean): Promise<any>;
|
|
64
|
+
createMdmProfile(authObject: IAddigyInternalAuthObject, mdmProfile: any): Promise<any>;
|
|
65
|
+
createFilevaultPolicy(authObject: IAddigyInternalAuthObject, name: string, filevault: FilevaultRequest, payloadPriority?: number): Promise<any>;
|
|
64
66
|
createPPPCPolicy(authObject: IAddigyInternalAuthObject, name: string, pppcPolicy: PPPCInput[]): Promise<any>;
|
|
67
|
+
createCustomFact(authObject: IAddigyInternalAuthObject, name: string, script: string, scriptType: 'bash' | 'python' | 'zsh'): Promise<CustomFact>;
|
|
68
|
+
getCustomFacts(authObject: IAddigyInternalAuthObject): Promise<CustomFact[]>;
|
|
69
|
+
getCustomFactByName(authObject: IAddigyInternalAuthObject, name: string): Promise<CustomFact | undefined>;
|
|
65
70
|
getMdmConfigurations(authObject: IAddigyInternalAuthObject): Promise<any[]>;
|
|
66
71
|
getMdmConfigurationByName(authObject: IAddigyInternalAuthObject, name: string): Promise<any>;
|
|
67
72
|
getFileVaultKeys(authObject: IAddigyInternalAuthObject): Promise<object[]>;
|
package/index.js
CHANGED
|
@@ -727,6 +727,102 @@ class Addigy {
|
|
|
727
727
|
throw err;
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
|
+
async createMdmProfile(authObject, mdmProfile) {
|
|
731
|
+
try {
|
|
732
|
+
let res = await this._addigyRequest('https://app-prod.addigy.com/api/mdm/user/profiles/configurations', {
|
|
733
|
+
headers: {
|
|
734
|
+
Cookie: `auth_token=${authObject.authToken};`,
|
|
735
|
+
origin: 'https://app-prod.addigy.com',
|
|
736
|
+
},
|
|
737
|
+
method: 'POST',
|
|
738
|
+
json: { payloads: mdmProfile },
|
|
739
|
+
});
|
|
740
|
+
return JSON.parse(res.body);
|
|
741
|
+
}
|
|
742
|
+
catch (err) {
|
|
743
|
+
throw err;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
async createFilevaultPolicy(authObject, name, filevault, payloadPriority = 1) {
|
|
747
|
+
const groupUUID = uuid_1.v4();
|
|
748
|
+
const encryptCertPayloadUUID = uuid_1.v4();
|
|
749
|
+
const basePayload = {
|
|
750
|
+
payload_display_name: name,
|
|
751
|
+
payload_version: 1,
|
|
752
|
+
payload_group_id: groupUUID,
|
|
753
|
+
addigy_payload_version: 0,
|
|
754
|
+
payload_priority: payloadPriority,
|
|
755
|
+
};
|
|
756
|
+
const payloads = [
|
|
757
|
+
{
|
|
758
|
+
...basePayload,
|
|
759
|
+
payload_type: 'com.apple.MCX.FileVault2',
|
|
760
|
+
addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.MCX.FileVault2',
|
|
761
|
+
payload_identifier: `com.addigy.securityAndPrivacy.com.apple.MCX.FileVault2.${groupUUID}`,
|
|
762
|
+
payload_uuid: uuid_1.v4(),
|
|
763
|
+
enable: filevault.enable ? 'On' : 'Off',
|
|
764
|
+
defer: filevault.defer,
|
|
765
|
+
use_recovery_key: true,
|
|
766
|
+
show_recovery_key: filevault.showRecoveryKey === undefined ? null : filevault.showRecoveryKey,
|
|
767
|
+
defer_dont_ask_at_user_logout: filevault.deferDontAskAtUserLogout === undefined
|
|
768
|
+
? null
|
|
769
|
+
: filevault.deferDontAskAtUserLogout,
|
|
770
|
+
defer_force_at_user_login_max_bypass_attempts: filevault.deferForceAtUserLoginMaxBypassAttempts === undefined
|
|
771
|
+
? null
|
|
772
|
+
: filevault.deferForceAtUserLoginMaxBypassAttempts,
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
...basePayload,
|
|
776
|
+
payload_type: 'com.apple.MCX',
|
|
777
|
+
addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.MCX',
|
|
778
|
+
payload_identifier: `com.addigy.securityAndPrivacy.com.apple.MCX.${groupUUID} `,
|
|
779
|
+
payload_uuid: uuid_1.v4(),
|
|
780
|
+
destroy_fv_key_on_standby: filevault.destroyFvKeyOnStandby === undefined
|
|
781
|
+
? null
|
|
782
|
+
: filevault.destroyFvKeyOnStandby,
|
|
783
|
+
dont_allow_fde_disable: true,
|
|
784
|
+
},
|
|
785
|
+
];
|
|
786
|
+
if (filevault.escrowRecoveryKey)
|
|
787
|
+
payloads.push({
|
|
788
|
+
...basePayload,
|
|
789
|
+
addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.security.pkcs1',
|
|
790
|
+
payload_type: 'com.apple.security.pkcs1',
|
|
791
|
+
payload_identifier: `com.addigy.securityAndPrivacy.com.apple.security.pkcs1.${groupUUID}`,
|
|
792
|
+
payload_uuid: uuid_1.v4(),
|
|
793
|
+
is_from_security_profile: true,
|
|
794
|
+
}, {
|
|
795
|
+
...basePayload,
|
|
796
|
+
addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryKeyEscrow',
|
|
797
|
+
payload_type: 'com.apple.security.FDERecoveryKeyEscrow',
|
|
798
|
+
payload_identifier: `com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryKeyEscrow.${groupUUID}`,
|
|
799
|
+
payload_uuid: uuid_1.v4(),
|
|
800
|
+
encrypt_cert_payload_uuid: encryptCertPayloadUUID,
|
|
801
|
+
location: 'Key will be escrowed to an Addigy secure database.',
|
|
802
|
+
}, {
|
|
803
|
+
...basePayload,
|
|
804
|
+
addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryRedirect',
|
|
805
|
+
payload_type: 'com.apple.security.FDERecoveryRedirect',
|
|
806
|
+
payload_identifier: `com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryRedirect.${groupUUID}`,
|
|
807
|
+
payload_uuid: uuid_1.v4(),
|
|
808
|
+
encrypt_cert_payload_uuid: encryptCertPayloadUUID,
|
|
809
|
+
redirect_url: '',
|
|
810
|
+
});
|
|
811
|
+
try {
|
|
812
|
+
let res = await this._addigyRequest('https://app-prod.addigy.com/api/mdm/user/profiles/configurations', {
|
|
813
|
+
headers: {
|
|
814
|
+
Cookie: `auth_token=${authObject.authToken};`,
|
|
815
|
+
origin: 'https://app-prod.addigy.com',
|
|
816
|
+
},
|
|
817
|
+
method: 'POST',
|
|
818
|
+
json: { payloads },
|
|
819
|
+
});
|
|
820
|
+
return JSON.parse(res.body);
|
|
821
|
+
}
|
|
822
|
+
catch (err) {
|
|
823
|
+
throw err;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
730
826
|
async createPPPCPolicy(authObject, name, pppcPolicy) {
|
|
731
827
|
const groupUUID = uuid_1.v4();
|
|
732
828
|
const payload = {
|
|
@@ -801,6 +897,54 @@ class Addigy {
|
|
|
801
897
|
});
|
|
802
898
|
return JSON.parse(res.body);
|
|
803
899
|
}
|
|
900
|
+
async createCustomFact(authObject, name, script, scriptType) {
|
|
901
|
+
const shebang = {
|
|
902
|
+
bash: '#!/bin/bash',
|
|
903
|
+
python: '#!/usr/bin/python',
|
|
904
|
+
zsh: '#!/bin/zsh',
|
|
905
|
+
};
|
|
906
|
+
const body = {
|
|
907
|
+
name,
|
|
908
|
+
os_architectures: {
|
|
909
|
+
linux_arm: {
|
|
910
|
+
is_supported: false,
|
|
911
|
+
language: '',
|
|
912
|
+
shebang: '',
|
|
913
|
+
script: '',
|
|
914
|
+
},
|
|
915
|
+
darwin_amd64: {
|
|
916
|
+
is_supported: true,
|
|
917
|
+
language: scriptType,
|
|
918
|
+
shebang: shebang[scriptType],
|
|
919
|
+
script,
|
|
920
|
+
},
|
|
921
|
+
},
|
|
922
|
+
return_type: 'string',
|
|
923
|
+
};
|
|
924
|
+
const res = await this._addigyRequest('https://app-prod.addigy.com/api/services/facts/custom', {
|
|
925
|
+
headers: {
|
|
926
|
+
Cookie: `auth_token=${authObject.authToken};`,
|
|
927
|
+
origin: 'https://app-prod.addigy.com',
|
|
928
|
+
},
|
|
929
|
+
method: 'POST',
|
|
930
|
+
json: body,
|
|
931
|
+
});
|
|
932
|
+
return JSON.parse(res.body);
|
|
933
|
+
}
|
|
934
|
+
async getCustomFacts(authObject) {
|
|
935
|
+
const res = await this._addigyRequest('https://app-prod.addigy.com/api/services/facts/custom', {
|
|
936
|
+
headers: {
|
|
937
|
+
Cookie: `auth_token=${authObject.authToken};`,
|
|
938
|
+
origin: 'https://app-prod.addigy.com',
|
|
939
|
+
},
|
|
940
|
+
method: 'GET',
|
|
941
|
+
});
|
|
942
|
+
return JSON.parse(res.body);
|
|
943
|
+
}
|
|
944
|
+
async getCustomFactByName(authObject, name) {
|
|
945
|
+
const facts = await this.getCustomFacts(authObject);
|
|
946
|
+
return facts.find((e) => e.name === name);
|
|
947
|
+
}
|
|
804
948
|
async getMdmConfigurations(authObject) {
|
|
805
949
|
var _a;
|
|
806
950
|
try {
|
package/package.json
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@expo/plist": "0.0.18",
|
|
10
10
|
"form-data": "4.0.0",
|
|
11
|
-
"got": "11.8.
|
|
11
|
+
"got": "11.8.5",
|
|
12
12
|
"uuid": "8.3.2"
|
|
13
13
|
},
|
|
14
14
|
"description": "",
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@pliancy/eslint-config-ts": "0.0.5",
|
|
17
17
|
"@pliancy/semantic-release-config-npm": "2.1.0",
|
|
18
|
-
"@types/got": "9.6.
|
|
18
|
+
"@types/got": "9.6.12",
|
|
19
19
|
"@types/jest": "26.0.23",
|
|
20
20
|
"@types/node": "15.12.5",
|
|
21
21
|
"@types/uuid": "8.3.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"tsc": "tsc -p tsconfig.build.json"
|
|
60
60
|
},
|
|
61
61
|
"types": "index.d.ts",
|
|
62
|
-
"version": "2.
|
|
62
|
+
"version": "2.5.0",
|
|
63
63
|
"volta": {
|
|
64
64
|
"node": "14.17.1",
|
|
65
65
|
"yarn": "1.22.10"
|
package/types.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export interface IAddigyInternalAuthObject {
|
|
|
10
10
|
emailAddress: string;
|
|
11
11
|
}
|
|
12
12
|
export interface Payload {
|
|
13
|
-
addigy_payload_type: 'com.addigy.syspolicy.system-extension-policy.com.apple.system-extension-policy' | 'com.addigy.TCC.configuration-profile-policy.com.apple.TCC.configuration-profile-policy' | 'com.addigy.syspolicy.kernel-extension-policy.com.apple.syspolicy.kernel-extension-policy' | 'com.addigy.notifications.com.apple.notificationsettings' | 'com.addigy.custom.mdm.payload';
|
|
14
|
-
payload_type: 'com.apple.system-extension-policy' | 'com.apple.syspolicy.kernel-extension-policy' | 'com.apple.TCC.configuration-profile-policy' | 'com.apple.notificationsettings' | 'custom';
|
|
13
|
+
addigy_payload_type: 'com.addigy.syspolicy.system-extension-policy.com.apple.system-extension-policy' | 'com.addigy.TCC.configuration-profile-policy.com.apple.TCC.configuration-profile-policy' | 'com.addigy.syspolicy.kernel-extension-policy.com.apple.syspolicy.kernel-extension-policy' | 'com.addigy.notifications.com.apple.notificationsettings' | 'com.addigy.custom.mdm.payload' | 'com.addigy.securityAndPrivacy.com.apple.MCX.FileVault2' | 'com.addigy.securityAndPrivacy.com.apple.MCX' | 'com.addigy.securityAndPrivacy.com.apple.security.pkcs1' | 'com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryKeyEscrow' | 'com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryRedirect';
|
|
14
|
+
payload_type: 'com.apple.system-extension-policy' | 'com.apple.syspolicy.kernel-extension-policy' | 'com.apple.TCC.configuration-profile-policy' | 'com.apple.notificationsettings' | 'custom' | 'com.apple.MCX.FileVault2' | 'com.apple.MCX' | 'com.apple.security.pkcs1' | 'com.apple.security.FDERecoveryKeyEscrow' | 'com.apple.security.FDERecoveryRedirect';
|
|
15
15
|
payload_version: number;
|
|
16
16
|
payload_identifier: string;
|
|
17
17
|
payload_uuid: string;
|
|
@@ -147,3 +147,50 @@ export interface SupportedOsVersions {
|
|
|
147
147
|
iOS?: string;
|
|
148
148
|
tvOS?: string;
|
|
149
149
|
}
|
|
150
|
+
export interface FilevaultPayload extends Payload {
|
|
151
|
+
enable?: 'On' | 'Off';
|
|
152
|
+
defer?: boolean;
|
|
153
|
+
use_recovery_key?: boolean;
|
|
154
|
+
show_recovery_key?: boolean | null;
|
|
155
|
+
defer_dont_ask_at_user_logout?: boolean | null;
|
|
156
|
+
defer_force_at_user_login_max_bypass_attempts?: number | null;
|
|
157
|
+
addigy_payload_version?: number;
|
|
158
|
+
destroy_fv_key_on_standby?: boolean | null;
|
|
159
|
+
dont_allow_fde_disable?: boolean;
|
|
160
|
+
is_from_security_profile?: boolean;
|
|
161
|
+
encrypt_cert_payload_uuid?: string;
|
|
162
|
+
location?: string;
|
|
163
|
+
payload_priority?: number;
|
|
164
|
+
redirect_url?: string;
|
|
165
|
+
}
|
|
166
|
+
export interface FilevaultRequest {
|
|
167
|
+
enable?: boolean;
|
|
168
|
+
defer?: boolean;
|
|
169
|
+
showRecoveryKey?: boolean;
|
|
170
|
+
destroyFvKeyOnStandby?: boolean;
|
|
171
|
+
escrowRecoveryKey?: boolean;
|
|
172
|
+
deferDontAskAtUserLogout?: boolean;
|
|
173
|
+
deferForceAtUserLoginMaxBypassAttempts?: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
174
|
+
}
|
|
175
|
+
export interface CustomFact {
|
|
176
|
+
organization_id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
return_type: string;
|
|
179
|
+
identifier: string;
|
|
180
|
+
version: number;
|
|
181
|
+
os_architectures: CustomFactOSArchitectures;
|
|
182
|
+
notes: string;
|
|
183
|
+
provider: string;
|
|
184
|
+
source: string;
|
|
185
|
+
}
|
|
186
|
+
export interface CustomFactOSArchitectures {
|
|
187
|
+
linux_arm: CustomFactOSArchitecturesData;
|
|
188
|
+
darwin_amd64: CustomFactOSArchitecturesData;
|
|
189
|
+
}
|
|
190
|
+
export interface CustomFactOSArchitecturesData {
|
|
191
|
+
language: string;
|
|
192
|
+
is_supported: boolean;
|
|
193
|
+
shebang: string;
|
|
194
|
+
script: string;
|
|
195
|
+
md5_hash: string;
|
|
196
|
+
}
|