Add Profiles and Parameters

Updated Dec 21, 2023

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.

Before you begin

Steps

  1. Create a profile.
  2. Update a profile to use a parameter.
  3. Add Slang parameters to a rule.

Step 1: 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, 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.
     Profile:
        title: <profile_name>
        description: <profile_description>
  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:
     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:
    slang export <project_name> <project_name>.xml

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

    slang export <project_name> <project_name>.xml --scan_config <config_name> --profile profile.general_use.slang

    The results must have the local_admin_disabled rule marked NOT SELECTED.

Step 2: 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:

    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.

Step 3: Add Slang parameters to a rule

  1. Open the rule file.

  2. Add a parameters option and applicable values.

    For example:

     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.

Next steps

See also