mirror of
https://github.com/anope/anope.git
synced 2026-07-04 04:23:12 +02:00
Use paths relative to data/conf in the config file.
This was done in some places already but not consistently. Closes #349.
This commit is contained in:
@@ -238,15 +238,15 @@ serverinfo
|
||||
|
||||
/*
|
||||
* The filename containing the Anope process ID. The path is relative to the
|
||||
* services root directory.
|
||||
* data directory.
|
||||
*/
|
||||
pid = "data/anope.pid"
|
||||
pid = "anope.pid"
|
||||
|
||||
/*
|
||||
* The filename containing the Message of the Day. The path is relative to the
|
||||
* services root directory.
|
||||
* config directory.
|
||||
*/
|
||||
motd = "conf/motd.txt"
|
||||
motd = "motd.txt"
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -580,7 +580,8 @@ module { name = "sasl" }
|
||||
name = "ssl_gnutls"
|
||||
|
||||
/*
|
||||
* An optional certificate and key for ssl_gnutls to give to the uplink.
|
||||
* An optional certificate and key for ssl_gnutls to give to the uplink. All
|
||||
* paths are relative to the config directory.
|
||||
*
|
||||
* You can generate your own certificate and key pair by using:
|
||||
*
|
||||
@@ -588,8 +589,8 @@ module { name = "sasl" }
|
||||
* certtool --generate-self-signed --load-privkey privkey.pem --outfile fullchain.pem
|
||||
*
|
||||
*/
|
||||
cert = "data/fullchain.pem"
|
||||
key = "data/privkey.pem"
|
||||
cert = "fullchain.pem"
|
||||
key = "privkey.pem"
|
||||
|
||||
/*
|
||||
* Diffie-Hellman parameters to use when acting as a server. This is only
|
||||
@@ -602,7 +603,7 @@ module { name = "sasl" }
|
||||
* certtool --generate-dh-params --bits 2048 --outfile dhparams.pem
|
||||
*
|
||||
*/
|
||||
# dhparams = "data/dhparams.pem"
|
||||
#dhparams = "dhparams.pem"
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -620,14 +621,15 @@ module { name = "sasl" }
|
||||
|
||||
/*
|
||||
* An optional certificate and key for ssl_openssl to give to the uplink.
|
||||
* All paths are relative to the config directory.
|
||||
*
|
||||
* You can generate your own certificate and key pair by using:
|
||||
*
|
||||
* openssl genrsa -out privkey.pem 2048
|
||||
* openssl req -new -x509 -key privkey.pem -out fullchain.pem -days 1095
|
||||
*/
|
||||
cert = "data/fullchain.pem"
|
||||
key = "data/privkey.pem"
|
||||
cert = "fullchain.pem"
|
||||
key = "privkey.pem"
|
||||
|
||||
/*
|
||||
* If you wish to increase security you can disable support for older
|
||||
|
||||
@@ -235,15 +235,15 @@ serverinfo
|
||||
|
||||
/*
|
||||
* The filename containing the Anope process ID. The path is relative to the
|
||||
* services root directory.
|
||||
* data directory.
|
||||
*/
|
||||
pid = "data/anope.pid"
|
||||
pid = "anope.pid"
|
||||
|
||||
/*
|
||||
* The filename containing the Message of the Day. The path is relative to the
|
||||
* services root directory.
|
||||
* config directory.
|
||||
*/
|
||||
motd = "conf/motd.txt"
|
||||
motd = "motd.txt"
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -329,9 +329,9 @@ public:
|
||||
{
|
||||
Configuration::Block *config = conf->GetModule(this);
|
||||
|
||||
const Anope::string certfile = config->Get<const Anope::string>("cert", "data/fullchain.pem");
|
||||
const Anope::string keyfile = config->Get<const Anope::string>("key", "data/privkey.pem");
|
||||
const Anope::string dhfile = config->Get<const Anope::string>("dh", "data/dhparams.pem");
|
||||
const Anope::string certfile = Anope::ExpandConfig(config->Get<const Anope::string>("cert", "fullchain.pem"));
|
||||
const Anope::string keyfile = Anope::ExpandConfig(config->Get<const Anope::string>("key", "privkey.pem"));
|
||||
const Anope::string dhfile = Anope::ExpandConfig(config->Get<const Anope::string>("dh", "dhparams.pem"));
|
||||
|
||||
CheckFile(certfile);
|
||||
CheckFile(keyfile);
|
||||
|
||||
@@ -146,8 +146,8 @@ public:
|
||||
{
|
||||
Configuration::Block *config = conf->GetModule(this);
|
||||
|
||||
this->certfile = config->Get<const Anope::string>("cert", "data/fullchain.pem");
|
||||
this->keyfile = config->Get<const Anope::string>("key", "data/privkey.pem");
|
||||
this->certfile = Anope::ExpandConfig(config->Get<const Anope::string>("cert", "fullchain.pem"));
|
||||
this->keyfile = Anope::ExpandConfig(config->Get<const Anope::string>("key", "privkey.pem"));
|
||||
|
||||
if (Anope::IsFile(this->certfile.c_str()))
|
||||
{
|
||||
|
||||
+4
-1
@@ -218,7 +218,10 @@ static void remove_pidfile()
|
||||
|
||||
static void write_pidfile()
|
||||
{
|
||||
const auto pidfile = Config->GetBlock("serverinfo")->Get<const Anope::string>("pid");
|
||||
auto pidfile = Anope::ExpandData(Config->GetBlock("serverinfo")->Get<const Anope::string>("pid"));
|
||||
if (pidfile.empty())
|
||||
return;
|
||||
|
||||
std::ofstream stream(pidfile.str());
|
||||
if (!stream.is_open())
|
||||
throw CoreException("Can not write to PID file " + pidfile);
|
||||
|
||||
+3
-2
@@ -241,10 +241,11 @@ void MOTD::Run(MessageSource &source, const std::vector<Anope::string> ¶ms,
|
||||
if (s != Me)
|
||||
return;
|
||||
|
||||
std::ifstream stream(Config->GetBlock("serverinfo")->Get<const Anope::string>("motd").str());
|
||||
auto motdfile = Anope::ExpandConfig(Config->GetBlock("serverinfo")->Get<const Anope::string>("motd"));
|
||||
std::ifstream stream(motdfile.str());
|
||||
if (!stream.is_open())
|
||||
{
|
||||
IRCD->SendNumeric(ERR_NOSUCHNICK, source.GetSource(), "- MOTD file not found! Please contact your IRC administrator.");
|
||||
IRCD->SendNumeric(ERR_NOSUCHNICK, source.GetSource(), "- MOTD file not readable! Please contact your IRC administrator.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -810,8 +810,11 @@ void Anope::UpdateTime()
|
||||
#endif
|
||||
}
|
||||
|
||||
Anope::string Anope::Expand(const Anope::string& base, const Anope::string& fragment)
|
||||
Anope::string Anope::Expand(const Anope::string &base, const Anope::string &fragment)
|
||||
{
|
||||
if (fragment.empty())
|
||||
return ""; // We can't expand an empty fragment.
|
||||
|
||||
// The fragment is an absolute path, don't modify it.
|
||||
if (std::filesystem::path(fragment.str()).is_absolute())
|
||||
return fragment;
|
||||
|
||||
Reference in New Issue
Block a user