Skip to main content

hmailserver: Notes from the field

hmailserver is one of free open source mail servers running on Microsoft Windows operating system.

Logging setttings

Enable logging consumes a lot of disk space if our mail server is busy all day, but it surely helps us find out what really happened.


Powershell script scanning awstats log file to remove email addresses that no longer exist


# Default hmailserver's log folder
$Dir="C:\Program Files (x86)\hMailServer\Logs"

# Email pattern
$regex = '\b[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b'
$today = (Get-Date).ToString("yyyy-MM-dd")

# Scan hmailserver's awstats log file for 550 return code
Select-String -Pattern '\tSMTP\t\?\t550\t0$' $Dir\hmailserver_awstats.log  | Out-File $Dir\hmailserver_awstats-$today.txt -width 200 -Append


if($?) {
select-string -Path $Dir\hmailserver_awstats-$today.txt -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value } > $Dir\hmailserver_awstats-$today-filtered.txt
}



# Remove duplicate lines
if($?) {
Get-Content $Dir\hmailserver_awstats-$today-filtered.log.txt | sort | Get-Unique > $Dir\hmailserver_awstats-$today-unique.txt
}
# End of script

Popular posts from this blog

MSSQL: Fix error 'Consistency validation for SQL Server registry keys'

While installing Microsof SQL Server 2012, I ran into the following error. "The SQL Server registry keys from a prior installation cannot be modified. To continue, see SQL Server Setup documentation about how to fix registry keys." How to fix Replace the D:\x64\FixSqlRegistryKey_x86.exe file with the original file from the ENU\SQLFULL_ENU.iso file downloading from Microsoft Download Center. This ISO file is 4.2GB. So you can click FixSqlRegistryKey_x86.exe to download this file only. After replacing that file, press Re-run to check. All rules are passed.

IBM Domino: How to enable HTTP Request logging in Domino

http://www-01.ibm.com/support/docview.wss?uid=swg21099151 Technote (FAQ) Question How do you enable HTTP request logging when using a Lotus® Domino® Web server? You want a record of all requests sent by Web browsers to the Domino server to use for troubleshooting. Answer Below is a short guide to turning on request logging that provides the basic logging level. More verbose logging can be enabled by following the instructions in  "Overview of HTTP Request Logs" (#7003598) . Important:  HTTP request logging should be used only for troubleshooting specific issues, and usually at the direction of and with assistance from IBM Support. Do not use request logging for other purposes, such as administrative reasons. Because these log files grow in size over time, you should not leave this setting enabled for long periods or you will exhaust the available drive space. To enable logging of HTTP requests for a Domino server for the current HTTP session only, enter the f

Metasploit Framework: Notes

"The Metasploit Framework contains a suite of tools that you can use to test security vulnerabilities, enumerate networks, execute attacks, and evade detection."