forked from Telodendria/Telodendria
Remove the redundant chroot option. This simplifies the config a bit.
This commit is contained in:
parent
414b8d47be
commit
5d9b0df0bf
5 changed files with 17 additions and 23 deletions
|
@ -4,7 +4,6 @@
|
|||
|
||||
server-name "localhost";
|
||||
base-url "http://localhost:8008";
|
||||
chroot "./chroot";
|
||||
id "jordan";
|
||||
data-dir "./data";
|
||||
federation "true";
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#
|
||||
# Telodendria production configuration file.
|
||||
#
|
||||
# See the following URL for the official documentation on the
|
||||
# options here:
|
||||
# The following man pages document the configuration:
|
||||
#
|
||||
# https://telodendria.io/#configure
|
||||
# - telodendria.conf(5)
|
||||
# - Config(5)
|
||||
#
|
||||
# Alternatively, see site/index.html in the source code.
|
||||
# Alternatively, find the man pages online at the
|
||||
# following URL:
|
||||
#
|
||||
# https://telodendria.io/#documentation
|
||||
#
|
||||
|
||||
listen "8008";
|
||||
|
@ -15,12 +18,11 @@ server-name "example.com";
|
|||
base-url "https://matrix.example.com";
|
||||
identity-server "https://identity.example.com";
|
||||
|
||||
chroot "/var/telodendria";
|
||||
id "_telodendria" "_telodendria";
|
||||
data-dir "./data";
|
||||
data-dir "/var/telodendria";
|
||||
federation "true";
|
||||
registration "false";
|
||||
log "./telodendria.log" {
|
||||
log "file" {
|
||||
level "message";
|
||||
timestampFormat "default";
|
||||
color "true";
|
||||
|
|
|
@ -211,7 +211,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
if (unveil(tConfig->chroot, "rwc") != 0)
|
||||
if (unveil(tConfig->dataDir, "rwc") != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unveil of data directory failed: %s", strerror(errno));
|
||||
exit = EXIT_FAILURE;
|
||||
|
@ -252,14 +252,13 @@ main(int argc, char **argv)
|
|||
Log(lc, LOG_DEBUG, "Server Name: %s", tConfig->serverName);
|
||||
Log(lc, LOG_DEBUG, "Base URL: %s", tConfig->baseUrl);
|
||||
Log(lc, LOG_DEBUG, "Identity Server: %s", tConfig->identityServer);
|
||||
Log(lc, LOG_DEBUG, "Chroot: %s", tConfig->chroot);
|
||||
Log(lc, LOG_DEBUG, "Run As: %s:%s", tConfig->uid, tConfig->gid);
|
||||
Log(lc, LOG_DEBUG, "Data Directory: %s", tConfig->dataDir);
|
||||
Log(lc, LOG_DEBUG, "Threads: %d", tConfig->threads);
|
||||
Log(lc, LOG_DEBUG, "Flags: %x", tConfig->flags);
|
||||
LogConfigUnindent(lc);
|
||||
|
||||
if (chdir(tConfig->chroot) != 0)
|
||||
if (chdir(tConfig->dataDir) != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to change into data directory: %s.", strerror(errno));
|
||||
exit = EXIT_FAILURE;
|
||||
|
@ -267,7 +266,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
Log(lc, LOG_DEBUG, "Changed working directory to: %s", tConfig->chroot);
|
||||
Log(lc, LOG_DEBUG, "Changed working directory to: %s", tConfig->dataDir);
|
||||
}
|
||||
|
||||
Log(lc, LOG_DEBUG, "Running as uid:gid: %d:%d.", getuid(), getgid());
|
||||
|
@ -306,11 +305,11 @@ main(int argc, char **argv)
|
|||
#ifndef __OpenBSD__
|
||||
if (chroot(".") == 0)
|
||||
{
|
||||
Log(lc, LOG_DEBUG, "Changed the root directory to: %s.", tConfig->chroot);
|
||||
Log(lc, LOG_DEBUG, "Changed the root directory to: %s.", tConfig->dataDir);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lc, LOG_WARNING, "Unable to chroot into directory: %s.", tConfig->chroot);
|
||||
Log(lc, LOG_WARNING, "Unable to chroot into directory: %s.", tConfig->dataDir);
|
||||
}
|
||||
#else
|
||||
Log(lc, LOG_DEBUG, "Not attempting chroot() after pledge() and unveil().");
|
||||
|
@ -341,11 +340,11 @@ main(int argc, char **argv)
|
|||
|
||||
/* These config values are no longer needed; don't hold them in
|
||||
* memory anymore */
|
||||
free(tConfig->chroot);
|
||||
free(tConfig->dataDir);
|
||||
free(tConfig->uid);
|
||||
free(tConfig->gid);
|
||||
|
||||
tConfig->chroot = NULL;
|
||||
tConfig->dataDir = NULL;
|
||||
tConfig->uid = NULL;
|
||||
tConfig->gid = NULL;
|
||||
|
||||
|
@ -380,6 +379,7 @@ finish:
|
|||
if (httpServer)
|
||||
{
|
||||
HttpServerFree(httpServer);
|
||||
Log(lc, LOG_DEBUG, "Freed HTTP Server.");
|
||||
}
|
||||
Log(lc, LOG_DEBUG, "Exiting with code '%d'.", exit);
|
||||
TelodendriaConfigFree(tConfig);
|
||||
|
|
|
@ -155,11 +155,6 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
tConfig->identityServer = NULL;
|
||||
}
|
||||
|
||||
GET_DIRECTIVE("chroot");
|
||||
ASSERT_NO_CHILDREN("chroot");
|
||||
ASSERT_VALUES("chroot", 1);
|
||||
COPY_VALUE(tConfig->chroot, 0);
|
||||
|
||||
GET_DIRECTIVE("id");
|
||||
ASSERT_NO_CHILDREN("id");
|
||||
COPY_VALUE(tConfig->uid, 0);
|
||||
|
@ -390,7 +385,6 @@ TelodendriaConfigFree(TelodendriaConfig * tConfig)
|
|||
free(tConfig->baseUrl);
|
||||
free(tConfig->identityServer);
|
||||
|
||||
free(tConfig->chroot);
|
||||
free(tConfig->uid);
|
||||
free(tConfig->gid);
|
||||
free(tConfig->dataDir);
|
||||
|
|
|
@ -56,7 +56,6 @@ typedef struct TelodendriaConfig
|
|||
char *baseUrl;
|
||||
char *identityServer;
|
||||
|
||||
char *chroot;
|
||||
char *uid;
|
||||
char *gid;
|
||||
char *dataDir;
|
||||
|
|
Loading…
Reference in a new issue