|
|
|
|
|
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/local/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/local/sbin/postfix reload";
|
|
|
|
|
|
AddPostfixToSnfuserGroupCommand = "/usr/sbin/usermod -G snfuser _postfix";
|
|
|
|
|
|
|
|
|
} else if ("FreeBSD" == OperatingSystemType) {
|
|
|
} else if ("FreeBSD" == OperatingSystemType) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PostfixMainCfPath = "/usr/local/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/usr/local/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/usr/local/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/usr/local/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/local/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/local/sbin/postfix reload";
|
|
|
|
|
|
AddPostfixToSnfuserGroupCommand = "/usr/sbin/pw mod group -n snfuser -m postfix";
|
|
|
|
|
|
|
|
|
} else if ("Ubuntu" == OperatingSystemType) {
|
|
|
} else if ("Ubuntu" == OperatingSystemType) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
|
|
|
AddPostfixToSnfuserGroupCommand = "/usr/sbin/usermod -G snfuser postfix";
|
|
|
|
|
|
|
|
|
} else if ("RedHat" == OperatingSystemType) {
|
|
|
} else if ("RedHat" == OperatingSystemType) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
|
|
|
AddPostfixToSnfuserGroupCommand = "/usr/sbin/usermod -G snfuser postfix";
|
|
|
|
|
|
|
|
|
} else if ("Suse" == OperatingSystemType) {
|
|
|
} else if ("Suse" == OperatingSystemType) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMainCfPath = "/etc/postfix/main.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
PostfixMasterCfPath = "/etc/postfix/master.cf";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
ReloadMtaCommand = "/usr/sbin/postfix reload";
|
|
|
|
|
|
AddPostfixToSnfuserGroupCommand = "/usr/sbin/usermod -G snfuser postfix";
|
|
|
|
|
|
|
|
|
} else {
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Verbose()) {
|
|
|
if (Verbose()) {
|
|
|
|
|
|
|
|
|
std::cout << "Integrate with postfix...\n";
|
|
|
|
|
|
|
|
|
std::cout << "Integrate with postfix...add postfix user to snfuser group...\n";
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Succeeded;
|
|
|
|
|
|
|
|
|
if (!Explain()) {
|
|
|
if (!Explain()) {
|
|
|
|
|
|
|
|
|
|
|
|
Succeeded = (std::system(AddPostfixToSnfuserGroupCommand.c_str()) == 0);
|
|
|
|
|
|
|
|
|
|
|
|
if (!Succeeded) {
|
|
|
|
|
|
std::string Temp;
|
|
|
|
|
|
|
|
|
|
|
|
Temp = "Error adding the postfix user to the snfuser group with the command '";
|
|
|
|
|
|
Temp += AddPostfixToSnfuserGroupCommand;
|
|
|
|
|
|
Temp += "': ";
|
|
|
|
|
|
Temp += strerror(errno);
|
|
|
|
|
|
throw std::runtime_error(Temp);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
SaveFile->CreateBackupFile(PostfixMainCfPath); // Save any existing file.
|
|
|
SaveFile->CreateBackupFile(PostfixMainCfPath); // Save any existing file.
|
|
|
|
|
|
|
|
|
Input.open(PostfixMainCfPath.c_str()); // Read the contents.
|
|
|
Input.open(PostfixMainCfPath.c_str()); // Read the contents.
|
|
|
|
|
|
|
|
|
std::string Line;
|
|
|
std::string Line;
|
|
|
bool ModifiedLine = false;
|
|
|
bool ModifiedLine = false;
|
|
|
|
|
|
|
|
|
PostfixMilterConf MilterConf(PostfixSocketSpec); // Object to update the config line.
|
|
|
|
|
|
|
|
|
PostfixMilterConf MilterConf(PostfixSocketSpec); // Object to update the config line.
|
|
|
|
|
|
|
|
|
while (getline(Input, Line)) {
|
|
|
|
|
|
|
|
|
while (getline(Input, Line)) {
|
|
|
|
|
|
|
|
|
MilterConf.ConfLine(Line); // Load the object with the line.
|
|
|
|
|
|
|
|
|
MilterConf.ConfLine(Line); // Load the object with the line.
|
|
|
|
|
|
|
|
|
if (MilterConf.IsMilterLine() && !ModifiedLine) { // Check for milter integration line.
|
|
|
|
|
|
|
|
|
if (MilterConf.IsMilterLine() && !ModifiedLine) { // Check for milter integration line.
|
|
|
// Ignore subsequence integration lines.
|
|
|
// Ignore subsequence integration lines.
|
|
|
MilterConf.AddIntegration(); // Found milter line. Add integration.
|
|
|
MilterConf.AddIntegration(); // Found milter line. Add integration.
|
|
|
|
|
|
|