deep-security / ops-tools

A set of handy tools to make it easier for Operations teams to run to Trend Micro Deep Security.
https://trendmicro.com/deepsecurity
Apache License 2.0
41 stars 34 forks source link

Set DPIRule to default state #2

Open sudofez opened 6 years ago

sudofez commented 6 years ago

Is there a way to set a DPIRule back to it's default state? I'm working on setting new rules to alert only for x amount of time during pre-prod testing and switching them back to their default state after I observe the rule impact.

Is this possible through the API or will I have to store the rule state in a DB or file somewhere before I switch the detectOnly boolean?

Something like this is what I'm after:

function setTempDetect($rules){

    foreach($r in $rules){

        if((New-TimeSpan -Start $r.Issued -End (Get-Date)).Days -le 7){
               $r.detectOnly = $true
        }
        else{
               $r.DetectOnly = setDefaultState($r) #<-----
            }
    }
}
andresark commented 5 years ago

It seems the updated API would allow for this use case, check the "detectOnly" field: https://automation.deepsecurity.trendmicro.com/article/11_3/api-reference?platform=on-premise#operation/modifyIntrusionPreventionRuleOnPolicy