fleet/website/config/policies.js
Eric 4fd1efe98a
Website: Add API to send signed CSR emails (#8408)
This pull request relies on the `mdm-gen-cert` command from
https://github.com/fleetdm/fleet/pull/8884.
Closes: https://github.com/fleetdm/fleet/issues/8223

Changes:
- Updated the deploy Fleet website workflow to:
   - Add Go as a dependency
   - Build the mdm-gen-cert binary in `/website/.tools/`
   - add the `/.tools/` folder to the Heroku app
- Added `deliver-apple-csr.js` -  an API that:
- can be called by making a `POST` request to
`/api/v1/deliver-apple-csr`
   - accepts `csr` as an input
- runs the `mdm-gen-cert` command with the `csr` set as an environment
variable
- returns an `invalidEmailDomain` response if the user's email domain is
in the array of banned email domains.
- saves the users organization and email address to the website's
database
- Sends an email to the requesting user's email address with the signed
CSR attached as a text file named `apple-apns-request.txt`
   - Posts a message to a channel in the Fleet Slack.
- Added a new model: `CertificateSigningRequests` that contains two
required attributes: `emailAddress` and `organization`
- Added a new email template `email-signed-csr-for-apns`
- Updated routes, policies, eslintrc, and rebuilt cloud-sdk


Before this can be merged, we will need to:
- [x] Add new config variables in Heroku
   - [x] `sails.config.custom.mdmVendorCertPem` 
   - [x] `sails.config.custom.mdmVendorKeyPem`
   - [x] `sails.config.custom.mdmVendorKeyPassphrase`
   - [x] `sails.config.custom.slackWebhookUrlForMDMSignups`
- [x] Add the `CertificateSigningRequests` model to the website's
database
2023-01-19 14:43:14 -06:00

54 lines
1.5 KiB
JavaScript
Vendored

/**
* Policy Mappings
* (sails.config.policies)
*
* Policies are simple functions which run **before** your actions.
*
* For more information on configuring policies, check out:
* https://sailsjs.com/docs/concepts/policies
*/
module.exports.policies = {
'*': 'is-logged-in',
'admin/*': 'is-super-admin',
// Bypass the `is-logged-in` policy for:
'entrance/*': true,
'webhooks/*': true,
'account/logout': true,
'view-homepage-or-redirect': true,
'view-faq': true,
'view-contact': true,
'view-get-started': true,
'view-pricing': true,
'legal/view-terms': true,
'legal/view-privacy': true,
'deliver-contact-form-message': true,
'view-query-detail': true,
'view-query-library': true,
'docs/*': true,
'handbook/*': true,
'download-sitemap': true,
'view-transparency': true,
'view-press-kit': true,
'view-platform': true,
'view-landing': true,
'deliver-demo-signup': true,
'articles/*': true,
'reports/*': true,
'view-sales-one-pager': true,
'try-fleet/view-register': true,
'try-fleet/view-sandbox-login': true,
'try-fleet/view-sandbox-teleporter-or-redirect-because-expired': true,
'create-or-update-one-newsletter-subscription': true,
'unsubscribe-from-all-newsletters': true,
'view-osquery-table-details': true,
'view-connect-vanta': true,
'view-vanta-authorization': true,
'create-vanta-authorization-request': true,
'view-fleet-mdm': true,
'deliver-mdm-beta-signup': true,
'deliver-apple-csr': true,
};