Some checks failed
continuous-integration/drone/push Build is failing
144 lines
3.7 KiB
C++
144 lines
3.7 KiB
C++
/**
|
|
* hermes antispam proxy
|
|
* Copyright (C) 2006, 2007 Juan José Gutiérrez de Quevedo <juanjo@gutierrezdequevedo.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*
|
|
* @author Juan José Gutiérrez de Quevedo <juanjo@gutierrezdequevedo.com>
|
|
*/
|
|
#ifndef CONFIGFILE_H
|
|
#define CONFIGFILE_H
|
|
|
|
#include "hermes.h"
|
|
#include <list>
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <fstream>
|
|
|
|
#include "Utils.h"
|
|
|
|
using namespace std;
|
|
|
|
class Configfile
|
|
{
|
|
private:
|
|
static string parseAsString(string);
|
|
static bool parseAsBool(string);
|
|
static long parseAsInt(string);
|
|
static list<string> parseAsList(string);
|
|
int uid;
|
|
int gid;
|
|
bool background;
|
|
string chroot;
|
|
bool drop_privileges;
|
|
string user;
|
|
string group;
|
|
string pid_file;
|
|
int listening_port;
|
|
string bind_to;
|
|
string server_host;
|
|
int server_port;
|
|
string database_file;
|
|
bool greylist;
|
|
bool throttle;
|
|
int throttling_time;
|
|
int number_of_unimplemented_commands_allowed;
|
|
bool allow_data_before_banner;
|
|
list<string> dns_blacklist_domains;
|
|
int dns_blacklist_percentage;
|
|
list<string> dns_whitelist_domains;
|
|
int dns_whitelist_percentage;
|
|
bool add_status_header;
|
|
int banner_delay_time;
|
|
int initial_expiry;
|
|
int initial_blacklist;
|
|
int whitelist_expiry;
|
|
bool submit_stats;
|
|
bool submit_stats_ssl;
|
|
string submit_stats_username;
|
|
string submit_stats_password;
|
|
int log_level;
|
|
string file_logger_filename;
|
|
bool keep_file_locked;
|
|
int log_rotation_frequency;
|
|
string rotate_filename;
|
|
bool clean_db;
|
|
bool outgoing_ssl;
|
|
bool incoming_ssl;
|
|
string private_key_file;
|
|
string certificate_file;
|
|
string dhparams_file;
|
|
bool add_headers;
|
|
string hostname;
|
|
bool whitelisted_disables_everything;
|
|
bool reject_no_reverse_resolution;
|
|
bool check_helo_against_reverse;
|
|
bool query_spf;
|
|
bool return_temp_error_on_reject;
|
|
public:
|
|
Configfile();
|
|
void parse(string);
|
|
void validateConfig();
|
|
int getUid();
|
|
int getGid();
|
|
bool& getBackground();
|
|
string& getChroot();
|
|
bool& getDropPrivileges();
|
|
string& getUser();
|
|
string& getGroup();
|
|
string& getPidFile();
|
|
int& getListeningPort();
|
|
string& getBindTo();
|
|
string& getServerHost();
|
|
int& getServerPort();
|
|
string& getDatabaseFile();
|
|
bool& getGreylist();
|
|
bool& getThrottle();
|
|
int& getThrottlingTime();
|
|
int& getNumberOfUnimplementedCommandsAllowed();
|
|
bool& getAllowDataBeforeBanner();
|
|
list<string>& getDnsBlacklistDomains();
|
|
int& getDnsBlacklistPercentage();
|
|
list<string>& getDnsWhitelistDomains();
|
|
int& getDnsWhitelistPercentage();
|
|
bool& getAddStatusHeader();
|
|
int& getBannerDelayTime();
|
|
int& getInitialExpiry();
|
|
int& getInitialBlacklist();
|
|
int& getWhitelistExpiry();
|
|
bool& getSubmitStats();
|
|
bool& getSubmitStatsSsl();
|
|
string& getSubmitStatsUsername();
|
|
string& getSubmitStatsPassword();
|
|
int& getLogLevel();
|
|
string& getFileLoggerFilename();
|
|
bool& getKeepFileLocked();
|
|
int& getLogRotationFrequency();
|
|
string& getRotateFilename();
|
|
bool& getCleanDb();
|
|
bool& getOutgoingSsl();
|
|
bool& getIncomingSsl();
|
|
string& getPrivateKeyFile();
|
|
string& getCertificateFile();
|
|
string& getDhparamsFile();
|
|
bool& getAddHeaders();
|
|
string& getHostname();
|
|
bool& getWhitelistedDisablesEverything();
|
|
bool& getRejectNoReverseResolution();
|
|
bool& getCheckHeloAgainstReverse();
|
|
bool& getQuerySpf();
|
|
bool& getReturnTempErrorOnReject();
|
|
};
|
|
|
|
#endif //CONFIGFILE_H
|