cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
Cisco Secure Email Support Community

Product Support Talos Support Cisco Support Reference + Current Release
Gateway Reputation Lookup Open a support case Secure Email Guided Setup
Gateway: 14.0.0-698
Cloud Gateway Email Status Portal Support & Downloads docs.ces.cisco.com
Email and Web Manager: 14.0.0-404
Email and Web Manager Web & Email Reputation Worldwide Contacts Product Naming Quick Reference
Reporting Plug-in: 1.1.0.136
Encryption Bug Search
Encryption Plug-in: 1.2.1.167
Cloud Mailbox Notification Service
Outlook Add-in(s): More info

647
Views
0
Helpful
1
Replies
Enam Rahman
Beginner

Postini Safelist/Blocklist migration script

Has anyone written a script to take safelist/blocklist entries from Postini and modify them to spit out a CSV file that a Cisco IronPort SMA can understand? If so, would you mind sharing please?

1 REPLY 1
slm04747
Beginner

Here's the script we use.  We're in an Exchange 2010 environment, so the script looks up the current aliases for each primary address in the Postini file in our Active Directory.  This way we drop mailboxes that are gone but still had Postini entries and we get any new aliases that hadn't made it into Postini.  the resultant file can be imported into Ironport.

It's been a while so I don't remember if I had to tweak lline endings or anything, but this should get you ont eh right track.

$sess = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://YourServersFQDN/powershell -Authentication kerberos -WarningAction SilentlyContinue

Import-PSSession $sess -WarningAction SilentlyContinue -verbose

    $infile = 'postini.csv'

    $outfile = 'slbl.csv'

    $postini = $null # Input from Postini

    $Iron = $null # Output for Ironport

    $aliases = $null

    $Mailbox = $null

    $datestring = $null

    $holddate = $null

    $blocks = $null

    $blocksenders = $null

    $safe = $null

    $safeSenders = $null

    $innerpostini = $null

    $counter = 0

    # Import input file

    $postini = Import-Csv -Path $InFile | Where-Object {$_.approved_senders -ne 'NULL' -or $_.blocked_senders -ne 'NULL'}

    # Initialiaze output file

    Remove-Item $outfile

    $holddate = Get-Date

    $datestring = ($holddate).toshortdatestring() + ', ' + ($holddate).toshorttimestring()

    # "# File exported by the Powershell at $Datestring" | Out-File -LiteralPath $OutFile

    $postini | % {

        # For each line, Get aliases

        Write-Output "$counter - $($_.address)"

        $innerpostini = $_

        $Mailbox = Get-Mailbox $_.address -ErrorAction 'SilentlyContinue'

        $counter++

        if ($Mailbox -ne $null) {

            $aliases = (Get-Mailbox $_.address | Select-Object emailaddresses -ExpandProperty emailaddresses | where {$_ -like 'smtp*'}).replace('smtp:','').replace('SMTP:','')

            $aliases | % {

                $blocks = $null

                $blocksenders = $null

                $safe = $null

                $safeSenders = $null

            # For each Alias process blocks, Then approved

            if ($innerpostini.blocked_senders -ne 'NULL') {

                $blocksenders = ($innerpostini.blocked_senders).replace(',',', ').replace(' @',' ')

                if ($blocksenders.substring(0,1) -eq '@') {

                    $blocksenders = $blocksenders.remove(0,1)

                }

                $blocks = $_ + ', BLOCKED, ' + $blocksenders

                $blocks | Out-File $OutFile -Append -NoClobber

            }

            if ($innerpostini.approved_senders -ne 'NULL') {

                $safesenders = ($innerpostini.approved_senders).replace(',',', ').replace(' @',' ')

                if ($safesenders.substring(0,1) -eq '@') {

                    $safesenders = $safesenders.remove(0,1)

                }

                $safe = $_ + ', SAFE, ' + $safesenders

                $safe | Out-File $OutFile -Append -NoClobber

            }

        }

    }

}

Content for Community-Ad