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";
|
server-name "localhost";
|
||||||
base-url "http://localhost:8008";
|
base-url "http://localhost:8008";
|
||||||
chroot "./chroot";
|
|
||||||
id "jordan";
|
id "jordan";
|
||||||
data-dir "./data";
|
data-dir "./data";
|
||||||
federation "true";
|
federation "true";
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
#
|
#
|
||||||
# Telodendria production configuration file.
|
# Telodendria production configuration file.
|
||||||
#
|
#
|
||||||
# See the following URL for the official documentation on the
|
# The following man pages document the configuration:
|
||||||
# options here:
|
|
||||||
#
|
#
|
||||||
# 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";
|
listen "8008";
|
||||||
|
@ -15,12 +18,11 @@ server-name "example.com";
|
||||||
base-url "https://matrix.example.com";
|
base-url "https://matrix.example.com";
|
||||||
identity-server "https://identity.example.com";
|
identity-server "https://identity.example.com";
|
||||||
|
|
||||||
chroot "/var/telodendria";
|
|
||||||
id "_telodendria" "_telodendria";
|
id "_telodendria" "_telodendria";
|
||||||
data-dir "./data";
|
data-dir "/var/telodendria";
|
||||||
federation "true";
|
federation "true";
|
||||||
registration "false";
|
registration "false";
|
||||||
log "./telodendria.log" {
|
log "file" {
|
||||||
level "message";
|
level "message";
|
||||||
timestampFormat "default";
|
timestampFormat "default";
|
||||||
color "true";
|
color "true";
|
||||||
|
|
|
@ -211,7 +211,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#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));
|
Log(lc, LOG_ERROR, "Unveil of data directory failed: %s", strerror(errno));
|
||||||
exit = EXIT_FAILURE;
|
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, "Server Name: %s", tConfig->serverName);
|
||||||
Log(lc, LOG_DEBUG, "Base URL: %s", tConfig->baseUrl);
|
Log(lc, LOG_DEBUG, "Base URL: %s", tConfig->baseUrl);
|
||||||
Log(lc, LOG_DEBUG, "Identity Server: %s", tConfig->identityServer);
|
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, "Run As: %s:%s", tConfig->uid, tConfig->gid);
|
||||||
Log(lc, LOG_DEBUG, "Data Directory: %s", tConfig->dataDir);
|
Log(lc, LOG_DEBUG, "Data Directory: %s", tConfig->dataDir);
|
||||||
Log(lc, LOG_DEBUG, "Threads: %d", tConfig->threads);
|
Log(lc, LOG_DEBUG, "Threads: %d", tConfig->threads);
|
||||||
Log(lc, LOG_DEBUG, "Flags: %x", tConfig->flags);
|
Log(lc, LOG_DEBUG, "Flags: %x", tConfig->flags);
|
||||||
LogConfigUnindent(lc);
|
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));
|
Log(lc, LOG_ERROR, "Unable to change into data directory: %s.", strerror(errno));
|
||||||
exit = EXIT_FAILURE;
|
exit = EXIT_FAILURE;
|
||||||
|
@ -267,7 +266,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
else
|
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());
|
Log(lc, LOG_DEBUG, "Running as uid:gid: %d:%d.", getuid(), getgid());
|
||||||
|
@ -306,11 +305,11 @@ main(int argc, char **argv)
|
||||||
#ifndef __OpenBSD__
|
#ifndef __OpenBSD__
|
||||||
if (chroot(".") == 0)
|
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
|
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
|
#else
|
||||||
Log(lc, LOG_DEBUG, "Not attempting chroot() after pledge() and unveil().");
|
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
|
/* These config values are no longer needed; don't hold them in
|
||||||
* memory anymore */
|
* memory anymore */
|
||||||
free(tConfig->chroot);
|
free(tConfig->dataDir);
|
||||||
free(tConfig->uid);
|
free(tConfig->uid);
|
||||||
free(tConfig->gid);
|
free(tConfig->gid);
|
||||||
|
|
||||||
tConfig->chroot = NULL;
|
tConfig->dataDir = NULL;
|
||||||
tConfig->uid = NULL;
|
tConfig->uid = NULL;
|
||||||
tConfig->gid = NULL;
|
tConfig->gid = NULL;
|
||||||
|
|
||||||
|
@ -380,6 +379,7 @@ finish:
|
||||||
if (httpServer)
|
if (httpServer)
|
||||||
{
|
{
|
||||||
HttpServerFree(httpServer);
|
HttpServerFree(httpServer);
|
||||||
|
Log(lc, LOG_DEBUG, "Freed HTTP Server.");
|
||||||
}
|
}
|
||||||
Log(lc, LOG_DEBUG, "Exiting with code '%d'.", exit);
|
Log(lc, LOG_DEBUG, "Exiting with code '%d'.", exit);
|
||||||
TelodendriaConfigFree(tConfig);
|
TelodendriaConfigFree(tConfig);
|
||||||
|
|
|
@ -155,11 +155,6 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
||||||
tConfig->identityServer = NULL;
|
tConfig->identityServer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_DIRECTIVE("chroot");
|
|
||||||
ASSERT_NO_CHILDREN("chroot");
|
|
||||||
ASSERT_VALUES("chroot", 1);
|
|
||||||
COPY_VALUE(tConfig->chroot, 0);
|
|
||||||
|
|
||||||
GET_DIRECTIVE("id");
|
GET_DIRECTIVE("id");
|
||||||
ASSERT_NO_CHILDREN("id");
|
ASSERT_NO_CHILDREN("id");
|
||||||
COPY_VALUE(tConfig->uid, 0);
|
COPY_VALUE(tConfig->uid, 0);
|
||||||
|
@ -390,7 +385,6 @@ TelodendriaConfigFree(TelodendriaConfig * tConfig)
|
||||||
free(tConfig->baseUrl);
|
free(tConfig->baseUrl);
|
||||||
free(tConfig->identityServer);
|
free(tConfig->identityServer);
|
||||||
|
|
||||||
free(tConfig->chroot);
|
|
||||||
free(tConfig->uid);
|
free(tConfig->uid);
|
||||||
free(tConfig->gid);
|
free(tConfig->gid);
|
||||||
free(tConfig->dataDir);
|
free(tConfig->dataDir);
|
||||||
|
|
|
@ -56,7 +56,6 @@ typedef struct TelodendriaConfig
|
||||||
char *baseUrl;
|
char *baseUrl;
|
||||||
char *identityServer;
|
char *identityServer;
|
||||||
|
|
||||||
char *chroot;
|
|
||||||
char *uid;
|
char *uid;
|
||||||
char *gid;
|
char *gid;
|
||||||
char *dataDir;
|
char *dataDir;
|
||||||
|
|
Loading…
Reference in a new issue