Support MAILFROMADDRESS, per longstanding user requests. Documented in twconfig man page.
This commit is contained in:
parent
c136c5b398
commit
12cef61f40
|
@ -274,6 +274,11 @@ However, mailing no violations reports will increase the amount of data
|
|||
that must be processed.
|
||||
.br
|
||||
Initial value: \fItrue\fR
|
||||
.IP \f(CWMAILFROMADDRESS\fP
|
||||
Specifies the value of the "From:" field in email reports.
|
||||
.br
|
||||
Initial value: \fItripwire@hostname\fP, where 'hostname' is the local
|
||||
machine name.
|
||||
.SH VERSION INFORMATION
|
||||
This man page describes
|
||||
.IR "Tripwire 2.4" "."
|
||||
|
|
|
@ -409,6 +409,9 @@ static void FillOutConfigInfo(cTWModeCommon* pModeInfo, const cConfigFile& cf)
|
|||
else
|
||||
pModeInfo->mMailNoViolations = true; // MAILPROGRAM is not required to be specified
|
||||
|
||||
if(cf.Lookup(TSTRING(_T("MAILFROMADDRESS")), str))
|
||||
pModeInfo->mMailFrom = str;
|
||||
|
||||
// SYSLOG reporting
|
||||
if(cf.Lookup(TSTRING(_T("SYSLOGREPORTING")), str))
|
||||
{
|
||||
|
|
|
@ -181,6 +181,7 @@ class cTWModeCommon
|
|||
unsigned short mSmtpPort; // port number of that SMTP host
|
||||
TSTRING mMailProgram; // full path to executable to use for piped mail
|
||||
bool mMailNoViolations; // Email out reports with no violations?
|
||||
TSTRING mMailFrom;
|
||||
|
||||
cTWModeCommon() : mVerbosity(1),
|
||||
mLocalProvided(false),
|
||||
|
|
|
@ -590,9 +590,15 @@ static bool EmailReportTo(const TSTRING &toAddress, const cFCOReportHeader& head
|
|||
cDisplayEncoder::EncodeInline( toAddress ).c_str());
|
||||
reportMail->AddRecipient(toAddress);
|
||||
|
||||
TSTRING machineName;
|
||||
iFSServices::GetInstance()->GetMachineNameFullyQualified(machineName);
|
||||
reportMail->SetFrom(TSS_GetString( cTripwire, tripwire::STR_EMAIL_FROM) + machineName);
|
||||
if (!modeCommon->mMailFrom.empty())
|
||||
reportMail->SetFrom(modeCommon->mMailFrom);
|
||||
else
|
||||
{
|
||||
TSTRING machineName;
|
||||
iFSServices::GetInstance()->GetMachineNameFullyQualified(machineName);
|
||||
reportMail->SetFrom(TSS_GetString( cTripwire, tripwire::STR_EMAIL_FROM) + machineName);
|
||||
}
|
||||
|
||||
reportMail->SetFromName(TSS_GetString(cTW, tw::STR_TSS_PRODUCT_NAME));
|
||||
|
||||
reportMail->SetSubject( trv.SingleLineReport() );
|
||||
|
@ -729,17 +735,23 @@ bool cTWCmdLineUtil::SendEmailTestMessage(const TSTRING &mAddress, const cTWMode
|
|||
// send the report
|
||||
try
|
||||
{
|
||||
// set up the cMailMessage class, and send it
|
||||
reportMail->AddRecipient(mAddress);
|
||||
// set up the cMailMessage class, and send it
|
||||
reportMail->AddRecipient(mAddress);
|
||||
|
||||
TSTRING machineName;
|
||||
iFSServices::GetInstance()->GetMachineNameFullyQualified(machineName);
|
||||
reportMail->SetFrom(TSS_GetString( cTripwire, tripwire::STR_EMAIL_FROM) + machineName);
|
||||
reportMail->SetFromName(TSS_GetString(cTW, tw::STR_TSS_PRODUCT_NAME));
|
||||
if (!modeCommon->mMailFrom.empty())
|
||||
reportMail->SetFrom(modeCommon->mMailFrom);
|
||||
else
|
||||
{
|
||||
TSTRING machineName;
|
||||
iFSServices::GetInstance()->GetMachineNameFullyQualified(machineName);
|
||||
reportMail->SetFrom(TSS_GetString( cTripwire, tripwire::STR_EMAIL_FROM) + machineName);
|
||||
}
|
||||
|
||||
reportMail->SetFromName(TSS_GetString(cTW, tw::STR_TSS_PRODUCT_NAME));
|
||||
|
||||
reportMail->SetSubject (TSS_GetString( cTripwire, tripwire::STR_TEST_EMAIL_SUBJECT));
|
||||
reportMail->SetBody (TSS_GetString( cTripwire, tripwire::STR_TEST_EMAIL_BODY));
|
||||
reportMail->Send();
|
||||
reportMail->SetSubject (TSS_GetString( cTripwire, tripwire::STR_TEST_EMAIL_SUBJECT));
|
||||
reportMail->SetBody (TSS_GetString( cTripwire, tripwire::STR_TEST_EMAIL_BODY));
|
||||
reportMail->Send();
|
||||
}
|
||||
catch(eError& e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue