# Policy Types

## Cypher Policies

HPE Morpheus Enterprise allows administrators to set robust Cypher policies, which determine global, role, and/or specific user access to configured Cypher secret mount points. A number of considerations should be made when deploying Cypher Access policies, including how user role permissions will interact with the policy and how conflicts between overlapping policies are resolved.

### Role Permissions

User Role permissions (Administration > Roles) greatly affect Cypher access. Cypher access Role permissions are set from the Features tab of the selected Role under “Tools: Cypher”. The Role permission should be set based on the highest level of access to any one individual Cypher entry needed for the specific Role. For example, if the Role needs no access to any Cypher entries, set the feature permission to “None” and hide the Cypher UI from the Role completely. Alternatively, if the Role needs to use and decrypt even one Cypher entry, set the feature permission to “Full Decrypt”. The complete set of available permissions are below:

- **NONE:** Cypher UI hidden
- **READ:** Cypher UI present, entries can be listed
- **USER:** Cypher UI present, user sees and can use their own entries, user can create new entries
- **FULL:** Cypher UI present, user sees and can use all entries, user can create new entries, user cannot decrypt any entries
- **FULL DECRYPT:** Full access to Cypher features including the ability to decrypt secrets

### Cypher Access Policies

Like other Policy types, Cypher Access Policies are created in Administration > Policies. Click + ADD POLICY to create new. Set the type to “Cypher Access” and the relevant configuration options will be displayed. In addition to the type, enter a name for the Policy in the top section.

![../../_images/polname.png](https://support.hpe.com/hpesc/public/api/document/sd00007732en_us/GUID-F8F43DED-7C86-4242-8B6E-37376AC02AEE-high.png)

In the next section, enter the key path to which the Policy will apply. In addition to static entries that point to one specific Cypher entry, this field supports pattern matching with regex. For example, enter “.\*” to refer to all Cypher entries or “secret/.\*” to refer to all entries under the secret mount point.

In addition to the path, set the privileges users in the Policy scope should have on the indicated path.

- **LIST:** See the entries on the indicated path listed in the Cypher UI
- **READ:** Decrypt the entries on the indicated path
- **WRITE:** Add new entries on the indicated path
- **UPDATE:** Edit Cypher entries on the indicated path
- **DELETE:** Delete entries on the indicated path

![../../_images/polconfig.png](https://support.hpe.com/hpesc/public/api/document/sd00007732en_us/GUID-3073851F-5D93-4F03-94A1-C77B7D140E46-high.png)

Finally, set the scope for the Policy. Cypher Access Policies support Global, Role, and User scope. For example, you may want to block off sets of Cypher entries for various departments within your organization. If you have existing Roles in HPE Morpheus Enterprise for each department, you can set up Role-scoped Policies to ensure they can only list, use, and add Cypher entries which are relevant to their own department.

![../../_images/polfilter.png](https://support.hpe.com/hpesc/public/api/document/sd00007732en_us/GUID-63A43C98-F636-420D-828D-19BF24B01237-high.png)

IMPORTANT

When Cypher Access Policies conflict, the Policy with the longest path string length (typically the most specific) takes precedence. For example, a Policy giving LIST and READ access to “secret/aws/.\*” would be superseded by a Policy giving NO access to “secret/aws/my-secret-key”. In such a case, the user would see everything at the “secret/aws/.\*” path except the one indicated in the more specific Policy. When Policies targeting the same path differ only in their scope, the following scope precedence is applied: Role > User > Global. For example, if a Role-scoped Policy targeting “.\*” grants LIST and READ while a User-scoped Policy targeting the same path grants LIST, the user would be granted the rights in the Role-scoped Policy.

### Cloud Profiles

Terraform Cloud Profiles are created on each Cloud detail page (Infrastructure > Clouds > Selected Cloud > ProfilesTab), encrypted in Cypher, and create a Cypher entry that is visible both on the Profile tab of the Cloud detail page and in Cypher. When added to a Cloud they create a Cypher entry at path tfvars/profile/cloud/$cloudCode/variables. If a Cloud profile Cypher entry is restricted by a Cypher Access policy, it will be (or will not be) listable/readable/deletable as dictated by the Policy but still will be viewable from the Cloud detail page if the user has sufficient permissions. Restricting or granting access to Cloud profiles via Policy does not affect access on the Cloud. Other Role permissions, such as “Admin: Profiles”, “Infrastructure: Clouds”, and Cloud/Group access must be used to restrict access via Cloud detail pages.

### Example Policy

In my example organization, I have one department that needs access to AWS-related secrets and another department that needs access to Azure-related secrets. There are many other secrets stored in my appliance but I don’t want either of these departments to access any of those.

![../../_images/cypherlist.png](https://support.hpe.com/hpesc/public/api/document/sd00007732en_us/GUID-E85ADD10-D850-4AC0-B155-027367EC2C47-high.png)

For the first department, I’ve set up a Policy that allows them to list and read (including use and decryption rights) AWS secrets. A second Policy specifically excludes them from seeing one specific entry. The Policy with the more specific path will supersede the more generic Policy that includes a wildcard.

![../../_images/pollist.png](https://support.hpe.com/hpesc/public/api/document/sd00007732en_us/GUID-1FF1D390-EB0B-4C24-9289-4AF2717D8895-high.png)

By impersonating the user, we see they indeed have access to just the two desired Cypher entries.

![../../_images/user1cypher.png](https://support.hpe.com/hpesc/public/api/document/sd00007732en_us/GUID-3BD14A79-055F-4C2E-AF21-EDE494DAB877-high.png)

For the second department, I have set up a Policy that allows them to list and read (including use and decryption rights) Azure secrets.

![../../_images/cypherlist2.png](https://support.hpe.com/hpesc/public/api/document/sd00007732en_us/GUID-6FD23103-1276-4EBB-AC2A-15440A479D4D-high.png)

By impersonating the user once again, we see they indeed have access only to Azure entries.

![../../_images/user2cypher.png](https://support.hpe.com/hpesc/public/api/document/sd00007732en_us/GUID-E2E311FD-BE92-4152-A79B-AB71DBA890B9-high.png)

## Expiration Policies

Expiration policies set an expiration timeframe for any instance provisioned into the cloud, role, group or by the user the policy is added to. When an instance expires, it is terminated and deleted.

Configuration options for expiration policies:

Expiration Type
:   - User Configurable- expiration timeframe is editable during provisioning
    - Fixed Expiration- user cannot change expiration timeframe

Expiration Days
:   Configures the number of days the instance is allowed to exist before being removed.

Renewal Days
:   If the instance is renewed, this is the number of days by which the expiration date is increased.

Notification Days
:   This allows an email notice to be sent out X days before the instance is set to expire.

Notification Message
:   Customizable message for notification emails. The default message is `Instance ${instance?.name} is set to expire on ${instance?.expireDate}`

Auto Approve Extensions
:   Enable this to auto-approve extension requests, bypassing approval workflows.

Instances with expirations show the time until expiration in the instance detail pane. Instances with active expiration policies can be extended by selecting the EXTEND NOW button in the instance detail pane. The extension length is set in the policy by the RENEWAL DAYS field.

Expirations can also be added to any instance during provisioning by entering the number of days in the EXPIRATION DAYS field in the Lifecycle section of the automation section of the provisioning wizard. Expiration can be added to any instance even if no policies have been created.

NOTE

Expiration and Shutdown Policies will be enforced on Instances created when converting a discovered host to managed.

## Instance and Host Names

Naming Policies will populate a fixed or editable name for instances, hosts and hostnames. The Name Pattern field uses ${variable} string interpolation.

NAMING TYPE
:   User Configurable
    :   Naming pattern will pre-populate during provisioning but can be edited by the user.

    Fixed Name
    :   Naming pattern will pre-populate during provisioning and cannot be changed.

NAME PATTERN
:   The Name Pattern field uses Static text and/or `${variable}` string interpolation, such as `morpheus${cloudCode}${type}${sequence+3000}`

    An example Instance Name Policy using a naming pattern with User Initials, Cloud Code, Instance Type, and a sequential number starting at 3000 is `${userInitials}-${cloudCode}-${type}-${sequence+3000}`, resulting in an Instance Name of **md-vmwd3-centos-3001** for the first instance, followed by **md-vmwd3-centos-3002** and so on.

    Commonly used variables for naming patterns include:

    ```
    ```
    ${groupName}  
    ${groupCode}  
    ${cloudName}  
    ${cloudCode}  
    ${type}  
    ${accountId}  
    ${account}  
    ${accountType}  
    ${platform}  
    ${platform == 'windows' ? 'w':'l'} # results in `w` for Windows platforms and `l` for Linux Platforms  
    ${userId}  
    ${username}  
    ${userInitials}  
    ${provisionType}  
    ${instance.instanceContext} # Environment Code  
    ${sequence} # results in 1  
    ${sequence+100} # results in 101  
    ${sequence.toString().padLeft(5,'0')} #results in 00001
    ```
    ```

    Cloud codes and Group codes are fields found in their respective configuration panes.

AUTO RESOLVE CONFLICTS
:   HPE Morpheus Enterprise will automatically resolve naming conflicts by appending a sequential -number to the name when enabled.

## Shutdown Policies

Shutdown policies dictate the number of days an instance is allowed to run before it is shut down. Shutdown is consistent across cloud types i.e.: in VMware, a VM is powered off. In AWS, an instance is stopped. Etc.

Configuration options for shutdown policies:

Shutdown Type
:   User Configurable
    :   Shutdown timeframe is editable during provisioning.

    Fixed Expiration
    :   User cannot change shutdown timeframe during provisioning.

Expiration Days
:   Configures the number of days the instance is allowed to exist before being shut down.

Renewal Days
:   If the instance is renewed, this is the number of days by which the shutdown date is increased.

Notification Days
:   This allows an email notice to be sent out X days before the instance is set to shut down.

Notification Message
:   Customizable message for notification email.

Auto Approve Extensions
:   Enable this to auto-approve extension requests, bypassing approval workflows.

NOTE

Expiration and Shutdown Policies will be enforced on Instances created when converting a discovered host to managed.

## Provision Approval

HPE Morpheus Enterprise Provision Approvals enable an approval workflow via internal HPE Morpheus Enterprise approval or via ServiceNow workflow. If a ServiceNow integration is present, the ServiceNow option is enabled. The Approval workflow to be selected is dynamically created by querying the ServiceNow Workflow table in the integrated ServiceNow instance.

This ServiceNow approval integration enables users to use the HPE Morpheus Enterprise Self-Service provisioning portal to provision new instances and still respect the required ServiceNow business approval workflow.

## Power Schedules

Power Schedules set daily times to shutdown and startup instances. Power schedule can be created and managed in Library > Automation > Power Scheduling

NOTE

Power Schedule Policies will apply to Instances created in a Group or Cloud after the Policy is enabled, and will not apply to pre-existing Instances.

Configuration options for Power Schedule Policies:

DESCRIPTION
:   Add details about your Policy for reference in the Policies tab.

Enabled
:   Policies can be edited and disabled or enabled at any time. Disabling a Power Schedule Policy will prevent the Power Schedule from running on the Groups Instances until re-enabled.

ENFORCEMENT TYPE
:   - User Configurable: Power Schedule choice is editable by User during provisioning.
    - Fixed Schedule: User cannot change Power Schedule setting during provisioning.

POWER SCHEDULE
:   Select Power Schedule to use in the Policy. Power schedule can be added in Library > Automation > Power Scheduling

TENANTS
:   Leave blank for the Policy to apply to all Tenants, or search for and select Tenants to enforce the Policy on specific Tenants.

## Max Resources

Max Resource policies allow setting quotas for Clouds, Groups, Roles or Users for maximum amount of Memory, Storage, Cores, Hosts, VM’s, or Containers that can be created in the Cloud, Group, Role or by the User the Policy is assigned to.

Configuration options for Max Resources Policies:

Max Containers
:   Sets the maximum combined total of Containers in Instances per Policy Scope.

Max Cores
:   Sets the maximum combined total of Cores in Instances per Policy Scope.

Max Hosts
:   Sets the maximum total of Hosts per Policy Scope.

Max Memory
:   Sets the maximum combined total of RAM (capacity) for Instances per Policy Scope.

Max Storage
:   Sets the maximum combined total of Storage (capacity) for Instances per Policy Scope.

Max VMs
:   Sets the maximum total of managed Virtual Machines per Policy Scope.

TENANTS
:   Leave blank for the Policy to apply to all Tenants, or search for and select Tenants to enforce the Policy on specific Tenants.

## User Creation

The User Creation policy controls the “CREATE YOUR USER” flag in the User Config options during provisioning do be always disabled, always enabled, enabled by default, or disabled by default.

Configuration options for User Creation Policies:

TYPE
:   User Creation

DESCRIPTION
:   Description to identify the policy config

Enabled
:   Policies enforcement can be disabled or enabled at any time.

ENFORCEMENT TYPE
:   - User Configurable: User Creation choice is editable by User during provisioning.
    - Fixed: User cannot change User Creation setting during provisioning.

CREATE USER
:   Check to allow or force user creation. Uncheck to disable by default or force no user creation.

TENANTS
:   Leave blank for the Policy to apply to all Tenants, or search for and select Tenants to enforce the Policy on specific Tenants.
