Securing an app (API)
Step four: Securing an app
Once the app is uploaded and you have obtained the IDs for the policies and profiles, you can secure the app by calling POST app-market/policy. Use the policyIds[] parameter to pass the per-app policy GUIDs for each policy that you want to apply.
Examples
This command selects an app ID and secures it with three policies and their associated profiles. It also asks the policy console to sign the app with a signing profile specified with a signing profile ID.
Request
curl -b c.txt -c c.txt -X POST https://bc.qwe.com/mocana-app-control/rest/app-market/policy \
-F appId=87f5da9-8673-41bd-8d09-c8dcb5a916a8 \
-F policyCodes[]=POLICY_CODE_MAP_NEXT \
-F policyCodes[]=POLICY_CODE_SECURE_CONNECTION \
-F vpn_profile=40a6c1ac-a7b9-4903-a857-7db71db23881 \
-F policyCodes[]=POLICY_CODE_APP_CUSTOMIZATION \
-F app_customization_profile_id=6b61c1d2-f149-4680-b325-fb4efa24ed71 \
-F policyCodes[]=POLICY_CODE_LOCAL_AUTH \
-F local_auth_profile_id=82904240-d018-4122-b13d-1d561587ab07 \
-F policyCodes[]=POLICY_CODE_SIGNING \
-F signing_profile_id=6b61c1d2-f149-9876-b325-fb4efa74ed71 \
-F signing="{\"signing_type\":\"SIGN_ON_CONSOLE\"}"
This command secures the app with a master profile and signs it:
Request
curl -b c.txt -c c.txt -X POST https://bc.qwe.com/mocana-app-control/rest/app-market/policy \
-F appId=11eef64f-4d55-4637-ab3c-eef20a108596 \
-F policyIds[]=63ee4324-45f1-442c-9ead-b2b797c52b05 \
-F master_profile_id=2ee64c1b-729f-4139-bd4d-ffd44a0f13ca \
-F signing_profile_id=6b61c1d2-f149-9876-b325-fb4efa74ed71 \
-F signing="{\"signing_type\":\"SIGN_ON_CONSOLE\"}"
This command secures the app with a master profile, designating a signing profile to be used to sign externally:
Request
curl -b c.txt -c c.txt -X POST https://bc.qwe.com/mocana-app-control/rest/app-market/policy \
-F appId=11eef64f-4d55-4637-ab3c-eef20a108596 \
-F policyIds[]=63ee4324-45f1-442c-9ead-b2b797c52b05 \
-F master_profile_id=2ee64c1b-729f-4139-bd4d-ffd44a0f13ca \
-F policyIds[]=12ee1242-45f1-442c-9ead-bd4d-ffd44a0f13ca \
-F signing_profile_id=2ee64c1b-729f-4139-bd4d-ffd44a034xca \
-F signing="{\"signing_type\":\"SIGN_EXTERNALLY\"}"
You can also secure the app without signing it on the console, if you intend to sign it yourself. If you include a signing_profile_id with SKIP_CODESIGN, the profile is ignored.
Request
curl -b c.txt -c c.txt -X POST https://bc.qwe.com/mocana-app-control/rest/app-market/policy \
-F appId=11eef64f-4d55-4637-ab3c-eef20a108596 \
-F policyIds[]=63ee4324-45f1-442c-9ead-b2b797c52b05 \
-F master_profile_id=2ee64c1b-729f-4139-bd4d-ffd44a0f13ca \
-F signing="{\"signing_type\":\"SKIP_CODESIGN\"}"
See app-market/policy for more information.
Securing an app involves these steps:
Creating profiles for the policies you want to apply (Defining security policies (API))
Choosing a code signing type and signing profile (Code signing (API))
Securing the app with those policies and profiles
Downloading or exporting the app, optionally code signing outside the console (Downloading and exporting apps (API))