Add profiles and parameters

After you create a Slang project or import an existing project, you can add profiles and parameters to give users options when scanning content.

These actions are required:

Create a profile

Profiles determine which rules apply to a project scan.

  1. Open Visual Studio Code (VS Code).
  2. Click File > Open Folder, and then navigate to the project folder.
  3. Right-click the project.slang file, and then select New File.
  4. Name the file profile.profile_name.slang, where profile_name is a name for your profile, and then save it in the project folder.
    Note: Profiles must be located in the folder with the project.slang file.
  5. Copy this content, and then paste it in the profile file.
    YAML
    Profile:
       title: <profile_name>
       description: <profile_description>
    Where:
    • profile_name is the name of your profile.
    • profile_description is a description for your profile.
  6. To set which rules apply to the profile, add additional lines for options, for example select_all_rules_except or select rules, and any applicable values.
    For example:
    Note: These lines should be indented at the same level as title: and description:.
    YAML
    select_all_rules_except: 
          - local_admin_disabled.slang
  7. Save the file.
    Note: The file name must start with profile. and end with .slang.
  8. Run this command to export your Slang project including the new added profiles:
    SHELL
    slang export <project_name> <project_name>.xml
    Where:
    • project_name is the name of your project.
    Note:

    For Windows 10 devices, run this command to export and test your project:

    SHELL
    slang export <project_name> <project_name>.xml --scan_config <config_name> --profile profile.general_use.slang
    Where:
    • project_name is the name of your project.
    • config_name is the name of your scan configuration.

    The results must have the local_admin_disabled rule marked NOT SELECTED.

Update a profile to use a parameter

  1. In the profile file, add a set_values option and applicable values.
    For example, this sets the minimum length of the General Use profile password to 12 characters:
    YAML
    Profile:
        title: General Use
        description: This profile selects rules applicable to general use systems
        select_all_rules_except:
           - local_admin_disabled.slang
        set_values:
           - min_password_param: 12
  2. Save the file.

Add Slang parameters to a rule

  1. Open the rule file.
  2. Add a parameters option and applicable values.
    For example:
    YAML
    Rule:
       title: Password Policies
       description: Password policies for <project_name>.Rule:
       title: Password Policies
       description: Password policies for <project_name>.
       checks: 
       - ALL:
         - windows.account.lockout_policy:
            threshold: 5
            duration: 5 minutes 
            observation_window: 1 hour 
         - windows.account.password_policy:
            allow_reversible_encryption: true
            maximum_password_age: 30 days
            minimum_passwords_remembered: 100
            require_password_complexity: true
            minimum_password_length: 0
       parameters: 
        min_password_param:
         title: Minimum required password length
         value: 8
  3. Save the file.