ContinuousAssurance/ContinuousAssurance.ps1

Set-StrictMode -Version Latest
function Install-AzSKContinuousAssurance 
{
    <#
    .SYNOPSIS
    This command would help in installing Automation Account in your subscription to setup Continuous Assurance feature of AzSK
    .DESCRIPTION
    This command will install an Automation Account (Name: AzSKContinuousAssurance) which runs security scan on subscription and resource groups which are specified during installation.
    Security scan results will be populated in OMS which is configured during installation. Also detailed logs will be stored in storage account (Name: azskyyyyMMddHHmmss format).
     
    .PARAMETER SubscriptionId
        Subscription id in which Automation Account needs to be installed
    .PARAMETER AutomationAccountLocation
        Location of resource group which contains Automation Account. This is optional. Default location is EastUS2.
    .PARAMETER ResourceGroupNames
        Comma separated Application resource group names on which security scan should be performed by Automation Account.
    .PARAMETER OMSWorkspaceId
        Workspace ID of OMS where security scan results will be populated
    .PARAMETER OMSSharedKey
        Shared key of OMS which is used to monitor security scan results
    .PARAMETER LoggingOption
        Gives the flexibility for the users to choose from central sub reports storage mode vs individual sub reports storage in CA Scaling scenario
    .PARAMETER Preview
        This enables the preview feature for CA. Currently you need to use this switch to install CA in central scanning mode.
    .PARAMETER AzureADAppName
        Name for the Azure Active Directory (AD) Application that will be created in the subscription for running the runbook
    .PARAMETER AltOMSWorkspaceId
        Alternate Workspace ID of OMS to monitor security scan results
    .PARAMETER AltOMSSharedKey
        Shared key of Alternate OMS which is used to monitor security scan results
    .PARAMETER WebhookUrl
        All the scan results shall be posted to this configured webhook
    .PARAMETER WebhookAuthZHeaderName
        Name of the AuthZ header (typically 'Authorization')
    .PARAMETER WebhookAuthZHeaderValue
        Value of the AuthZ header
    .PARAMETER ScanIntervalInHours
        Overrides the default scan interval (24hrs) with the custom provided value
    .PARAMETER LoggingOption
        This provides the capability to users to store the CA scan logs on central subscription or on individual subscriptions
    .PARAMETER SkipTargetSubscriptionConfig
        It would skip all the required central scanning confiuration on the targets subs. It is owners responsibility to get the target subs configured correctly
    .PARAMETER Preview
        This enables the preview capabilites of CA. You must provide this option to enable CA in central scanning mode.
    .PARAMETER TargetSubscriptionIds
        Comma separated values of target subscriptionIds that will be monitord through CA from a central subscrition.
    .NOTES
     
 
    .LINK
    https://aka.ms/azskossdocs
 
    #>

    Param(
        [Parameter(Position = 0, Mandatory = $true, ParameterSetName = "Default")]
        [Parameter(Position = 0, Mandatory = $true, ParameterSetName = "Preview")]
        [string]
        [Alias("sid")]
        $SubscriptionId ,

        [Parameter(Mandatory = $true, ParameterSetName = "Preview")]
        [string]
        [Alias("tsids")]
        $TargetSubscriptionIds,

        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [string]
        [Alias("loc")]
        $AutomationAccountLocation="EastUS2",

        [Parameter(Position = 1, Mandatory = $true, ParameterSetName = "Preview")]
        [Parameter(Position = 1, Mandatory = $true, ParameterSetName = "Default")]
        [string]
        [ValidateNotNullOrEmpty()]
        [Alias("rgns")]
        $ResourceGroupNames ,       

        [Parameter(Position = 2, Mandatory = $true, ParameterSetName = "Preview")]
        [Parameter(Position = 2, Mandatory = $true, ParameterSetName = "Default")]
        [string]
        [ValidateNotNullOrEmpty()]
        [Alias("owid")]
        $OMSWorkspaceId,

        [Parameter(Position = 3, Mandatory = $true, ParameterSetName = "Preview")]
        [Parameter(Position = 3, Mandatory = $true, ParameterSetName = "Default")]
        [string]
        [ValidateNotNullOrEmpty()]
        [Alias("okey")]
        $OMSSharedKey,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("aowid")]
        $AltOMSWorkspaceId,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("aokey")]
        $AltOMSSharedKey,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("wurl")]
        $WebhookUrl,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("whn")]
        $WebhookAuthZHeaderName,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("whv")]
        $WebhookAuthZHeaderValue,


        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]        
        [Parameter(Mandatory = $false, ParameterSetName = "Default")]        
        [string]
        [ValidateNotNullOrEmpty()]
        [Alias("spn")]
        $AzureADAppName,

        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [CAReportsLocation]
        [Alias("lo")]
        $LoggingOption,

        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [Parameter(Mandatory = $false, ParameterSetName = "Default")]        
        [int]
        [Alias("si")]
        $ScanIntervalInHours,

        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [switch]
        $SkipTargetSubscriptionConfig,

        [Parameter(Mandatory = $true, ParameterSetName = "Preview")]
        [switch]
        [Alias("prv")]
        $Preview
    )
    Begin
    {
        [CommandHelper]::BeginCommand($PSCmdlet.MyInvocation);
        [ListenerHelper]::RegisterListeners();
    }
    Process
    {
        try 
        {
            $ccAccount = [CCAutomation]::new($SubscriptionId, $PSCmdlet.MyInvocation,`
                $AutomationAccountLocation, $ResourceGroupNames,`
                $AzureADAppName, $ScanIntervalInHours);
            #set the OMS settings
            $ccAccount.SetOMSSettings($OMSWorkspaceId, $OMSSharedKey, $AltOMSWorkspaceId, $AltOMSSharedKey);

            #set the Webhook settings
            $ccAccount.SetWebhookSettings($WebhookUrl, $WebhookAuthZHeaderName, $WebhookAuthZHeaderValue);

            if ($ccAccount) 
            {
                if($Preview)
                {
                    $ccAccount.IsPreviewModeEnabled = $true;
                    $ccAccount.TargetSubscriptionIds = $TargetSubscriptionIds;
                    $ccAccount.SkipTargetSubscriptionConfig = $SkipTargetSubscriptionConfig;
                    if($null -eq $LoggingOption)
                    {
                        $ccAccount.LoggingOption = [CAReportsLocation]::CentralSub;
                    }
                    else
                    {
                        $ccAccount.LoggingOption = $LoggingOption;
                    }
                }
                return $ccAccount.InvokeFunction($ccAccount.InstallAzSKContinuousAssurance);
            }            
        }
        catch 
        {
            [EventBase]::PublishGenericException($_);
        }  
    }
    End
    {
        [ListenerHelper]::UnregisterListeners();
    }
}

function Update-AzSKContinuousAssurance 
{
    <#
    .SYNOPSIS
    This command would help in updating user configurable properties of Continuous Assurance Automation Account in your subscription
    .DESCRIPTION
    This command is helpful if you want to update any of the following properties. 1. App Resource Groups 2. OMS Workspace ID 3. OMS Shared Key
    4. Connection in Run as Account 5. Update/Renew Certificate in Run as Account
 
    .PARAMETER SubscriptionId
        Subscription id in which Automation Account exists
    .PARAMETER ResourceGroupNames
        Comma separated Application resource group names on which security scan should be performed by Automation Account
    .PARAMETER OMSWorkspaceId
        Workspace ID of OMS where security scan results will be populated
    .PARAMETER OMSSharedKey
        Shared key of OMS which is used to monitor security scan results
    .PARAMETER AzureADAppName
        Name for the Azure Active Directory (AD) Application that will be created to update automation account Connection in Run As Account for running the runbook
    .PARAMETER UpdateCertificate
        Switch to update certificate credential for AzureADApp SPN and also upload the certificate to automation account.
    .PARAMETER TargetSubscriptionIds
        Comma separated values of targetsubscriptionIds that will get monitored from the central subscription through CA.
    .PARAMETER AltOMSWorkspaceId
        Alternate Workspace ID of OMS to monitor security scan results
    .PARAMETER AltOMSSharedKey
        Shared key of Alternate OMS which is used to monitor security scan results
    .PARAMETER WebhookUrl
        All the scan results shall be posted to this configured webhook
    .PARAMETER WebhookAuthZHeaderName
        Name of the AuthZ header (typically 'Authorization')
    .PARAMETER WebhookAuthZHeaderValue
        Value of the AuthZ header
    .PARAMETER ScanIntervalInHours
        Overrides the default scan interval (24hrs) with the custom provided value
    .PARAMETER SkipTargetSubscriptionConfig
        It would skip all the required central scanning confiuration on the targets subs. It is owners responsibility to get the target subs configured correctly
    .PARAMETER LoggingOption
        This provides the capability to users to store the CA scan logs on central subscription or on individual subscriptions
    .PARAMETER Preview
        This enables the preview capabilites of CA. You must provide this option to enable CA in central scanning mode.
    .NOTES
     
 
    .LINK
    https://aka.ms/azskossdocs
 
    #>

    Param(
        [Parameter(Position = 0, Mandatory = $true, ParameterSetName = "Default")]
        [Parameter(Position = 0, Mandatory = $true, ParameterSetName = "Preview")]
        [string]
        [Alias("sid")]
        $SubscriptionId,

        [Parameter(Mandatory = $true, ParameterSetName = "Preview")]
        [string]
        [Alias("tsids")]
        $TargetSubscriptionIds,
        
        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("rgns")]
        $ResourceGroupNames,       
        
        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("owid")]
        $OMSWorkspaceId,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("okey")]
        $OMSSharedKey,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("aowid")]
        $AltOMSWorkspaceId,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("aokey")]
        $AltOMSSharedKey,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("wurl")]
        $WebhookUrl,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("whn")]
        $WebhookAuthZHeaderName,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [string]
        [Alias("whv")]
        $WebhookAuthZHeaderValue,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [ValidateNotNullOrEmpty()]
        [Alias("spn")]
        $AzureADAppName,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [switch]
        [Alias("fra")]
        $FixRuntimeAccount,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [switch]
        [Alias("rc")]
        $RenewCertificate,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [switch]
        [Alias("fm")]
        $FixModules,

        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [CAReportsLocation]
        [Alias("lo")]
        $LoggingOption,

        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [int]
        [Alias("si")]
        $ScanIntervalInHours,

        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [switch]
        $SkipTargetSubscriptionConfig,

        [Parameter(Mandatory = $true, ParameterSetName = "Preview")]
        [switch]
        [Alias("prv")]
        $Preview
    )
    Begin
    {
        [CommandHelper]::BeginCommand($PSCmdlet.MyInvocation);
        [ListenerHelper]::RegisterListeners();
    }
    Process
    {
    try 
        {
            $ccAccount = [CCAutomation]::new($SubscriptionId, $PSCmdlet.MyInvocation,`
                $null, $ResourceGroupNames,`
                $AzureADAppName, $ScanIntervalInHours);

            #set the OMS settings
            $ccAccount.SetOMSSettings($OMSWorkspaceId, $OMSSharedKey, $AltOMSWorkspaceId, $AltOMSSharedKey);

            #set the Webhook settings
            $ccAccount.SetWebhookSettings($WebhookUrl, $WebhookAuthZHeaderName, $WebhookAuthZHeaderValue);

            if ($ccAccount) 
            {
                if($Preview)
                {
                    $ccAccount.IsPreviewModeEnabled = $true;
                    $ccAccount.TargetSubscriptionIds = $TargetSubscriptionIds;
                    $ccAccount.SkipTargetSubscriptionConfig = $SkipTargetSubscriptionConfig;
                    if($null -eq $LoggingOption)
                    {
                        $ccAccount.LoggingOption = [CAReportsLocation]::CentralSub;
                    }
                    else
                    {
                        $ccAccount.LoggingOption = $LoggingOption;
                    }
                }
                return $ccAccount.InvokeFunction($ccAccount.UpdateAzSKContinuousAssurance,@($FixRuntimeAccount,$RenewCertificate,$FixModules));
            }
            
        }
        catch 
        {
            [EventBase]::PublishGenericException($_);
        }  
    }
    End
    {
        [ListenerHelper]::UnregisterListeners();
    }
}

function Get-AzSKContinuousAssurance 
{
    <#
    .SYNOPSIS
    This command would help in getting details of Continuous Assurance Automation Account in your subscription
    .DESCRIPTION
 
    .PARAMETER SubscriptionId
        Subscription id in which Automation Account exists
    .PARAMETER ExhaustiveCheck
        Does the full scan of CA Setup
    .PARAMETER Preview
        This switch enables preview capabilities of AzSK CA
    .LINK
    https://aka.ms/azskossdocs
 
    #>

    Param(
        [Parameter(Position = 0, Mandatory = $true)]
        [string]
        [Alias("sid")]
        $SubscriptionId,

        [Parameter(Mandatory = $false)]
        [switch]
        [Alias("ec")]
        $ExhaustiveCheck        
    )
    Begin
    {
        [CommandHelper]::BeginCommand($PSCmdlet.MyInvocation);
        [ListenerHelper]::RegisterListeners();
    }
    Process
    {
    try 
        {
            $ccAccount = [CCAutomation]::new($SubscriptionId, $PSCmdlet.MyInvocation);

            if ($ccAccount) 
            {                
                $ccAccount.ExhaustiveCheck = $ExhaustiveCheck;
                return $ccAccount.InvokeFunction($ccAccount.GetAzSKContinuousAssurance);
            }
        }
        catch 
        {
            [EventBase]::PublishGenericException($_);
        }  
    }
    End
    {
        [ListenerHelper]::UnregisterListeners();
    }
}

function Remove-AzSKContinuousAssurance 
{
    <#
    .SYNOPSIS
    This command would help in removing resources created by Continuous Assurance installation in your subscription
    .DESCRIPTION
 
    .PARAMETER SubscriptionId
        Subscription id in which Automation Account exists
    .PARAMETER DeleteStorageReports
        Switch to specify whether security scan logs/reports stored in storage account also should be removed permanently.
    .PARAMETER TargetSubscriptionIds
        Comma separated values of subscriptionsId which would de-registered from the central scanning mode.
    .PARAMETER Force
        Switch to force this cmdlet to remove CA resources
    .PARAMETER Preview
        This enables preview feature of AzSK CA in central scanning mode. Use this switch along with DeleteStorageReports switch to delete the st
    .LINK
    https://aka.ms/azskossdocs
 
    #>

    Param(
        [Parameter(Position = 0, Mandatory = $true, ParameterSetName = "Default")]
        [Parameter(Position = 0, Mandatory = $true, ParameterSetName = "Preview")]
        [string]
        [Alias("sid")]
        $SubscriptionId,
        
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [string]
        [Alias("tsids")]
        $TargetSubscriptionIds,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]        
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [switch]
        [Alias("dsr")]
        $DeleteStorageReports,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]        
        [switch]
        [Alias("f")]
        $Force,

        [Parameter(Mandatory = $true, ParameterSetName = "Preview")]        
        [switch]
        [Alias("prv")]
        $Preview        
    )
    Begin
    {
        [CommandHelper]::BeginCommand($PSCmdlet.MyInvocation);
        [ListenerHelper]::RegisterListeners();
    }
    Process
    {
    try 
        {
            $ccAccount = [CCAutomation]::new($SubscriptionId, $PSCmdlet.MyInvocation);

            if ($ccAccount) 
            {
                if($Preview)
                {
                    $ccAccount.IsPreviewModeEnabled = $true;
                    $ccAccount.TargetSubscriptionIds = $TargetSubscriptionIds;
                }
                
                return $ccAccount.InvokeFunction($ccAccount.RemoveAzSKContinuousAssurance,@($DeleteStorageReports, $Force));
            }
            
        }
        catch 
        {
            [EventBase]::PublishGenericException($_);
        }  
    }
    End
    {
        [ListenerHelper]::UnregisterListeners();
    }
}

function Set-AzSKAlertMonitoring
{
    <#
    .SYNOPSIS
    This command would help in removing resources created by Continuous Assurance installation in your subscription
    .DESCRIPTION
 
    .PARAMETER SubscriptionId
        Subscription id in which Automation Account exists
    .PARAMETER DeleteStorageReports
        Switch to specify whether security scan logs/reports stored in storage account also should be removed permanently.
    .PARAMETER TargetSubscriptionIds
        Comma separated values of subscriptionsId which would de-registered from the central scanning mode.
    .PARAMETER Force
        Switch to force this cmdlet to remove CA resources
    .PARAMETER Preview
        This enables preview feature of AzSK CA in central scanning mode. Use this switch along with DeleteStorageReports switch to delete the st
    .LINK
    https://aka.ms/azsdkossdocs
 
    #>

    Param(
        [Parameter(Mandatory = $true, ParameterSetName = "Default")]
        [Parameter(Mandatory = $true, ParameterSetName = "Preview")]
        [string]
        $SubscriptionId,
        
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [string]
        $TargetSubscriptionIds,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]        
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [switch]
        $DeleteStorageReports,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]        
        [switch]
        $Force,

        [Parameter(Mandatory = $true, ParameterSetName = "Preview")]        
        [switch]
        $Preview        
    )
    Begin
    {
        [CommandHelper]::BeginCommand($PSCmdlet.MyInvocation);
        [ListenerHelper]::RegisterListeners();
    }
    Process
    {
    try 
        {
            $ccAccount = [CCAutomation]::new($SubscriptionId, $PSCmdlet.MyInvocation);

            if ($ccAccount) 
            {
                if($Preview)
                {
                    $ccAccount.IsPreviewModeEnabled = $true;
                    $ccAccount.TargetSubscriptionIds = $TargetSubscriptionIds;
                }
                
                return $ccAccount.InvokeFunction($ccAccount.SetAzSKAlertMonitoringRunbook,@($Force));
            }
            
        }
        catch 
        {
            [EventBase]::PublishGenericException($_);
        }  
    }
    End
    {
        [ListenerHelper]::UnregisterListeners();
    }
}

function Remove-AzSKAlertMonitoring
{
    <#
    .SYNOPSIS
    This command would help in removing resources created by Continuous Assurance installation in your subscription
    .DESCRIPTION
 
    .PARAMETER SubscriptionId
        Subscription id in which Automation Account exists
    .PARAMETER DeleteStorageReports
        Switch to specify whether security scan logs/reports stored in storage account also should be removed permanently.
    .PARAMETER TargetSubscriptionIds
        Comma separated values of subscriptionsId which would de-registered from the central scanning mode.
    .PARAMETER Force
        Switch to force this cmdlet to remove CA resources
    .PARAMETER Preview
        This enables preview feature of AzSK CA in central scanning mode. Use this switch along with DeleteStorageReports switch to delete the st
    .LINK
    https://aka.ms/azsdkossdocs
 
    #>

    Param(
        [Parameter(Mandatory = $true, ParameterSetName = "Default")]
        [Parameter(Mandatory = $true, ParameterSetName = "Preview")]
        [string]
        $SubscriptionId,
        
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [string]
        $TargetSubscriptionIds,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]        
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]
        [switch]
        $DeleteStorageReports,

        [Parameter(Mandatory = $false, ParameterSetName = "Default")]
        [Parameter(Mandatory = $false, ParameterSetName = "Preview")]        
        [switch]
        $Force,

        [Parameter(Mandatory = $true, ParameterSetName = "Preview")]        
        [switch]
        $Preview        
    )
    Begin
    {
        [CommandHelper]::BeginCommand($PSCmdlet.MyInvocation);
        [ListenerHelper]::RegisterListeners();
    }
    Process
    {
    try 
        {
            $ccAccount = [CCAutomation]::new($SubscriptionId, $PSCmdlet.MyInvocation);
            if ($ccAccount) 
            {            
                return $ccAccount.InvokeFunction($ccAccount.RemoveAzSKAlertMonitoringWebhook,@($Force));
            }
            
        }
        catch 
        {
            [EventBase]::PublishGenericException($_);
        }  
    }
    End
    {
        [ListenerHelper]::UnregisterListeners();
    }
}