aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorJérémy Bobbio <lunar@debian.org>2011-04-23 02:35:02 +0200
committerNick Mathewson <nickm@torproject.org>2011-05-15 20:20:28 -0400
commitd41ac64ad68811d8575db6e456fba470b0c3fde7 (patch)
tree36c7e6b5e560f6dfe60d0734f6085ece6e3defee /src/or/connection.c
parent2b9c5ee301f705cbf69c725ca749d4ac752c06d3 (diff)
downloadtor-d41ac64ad68811d8575db6e456fba470b0c3fde7.tar
tor-d41ac64ad68811d8575db6e456fba470b0c3fde7.tar.gz
Add UnixSocketsGroupWritable config flag
When running a system-wide instance of Tor on Unix-like systems, having a ControlSocket is a quite handy mechanism to access Tor control channel. But it would be easier if access to the Unix domain socket can be granted by making control users members of the group running the Tor process. This change introduces a UnixSocketsGroupWritable option, which will create Unix domain sockets (and thus ControlSocket) 'g+rw'. This allows ControlSocket to offer same access control measures than ControlPort+CookieAuthFileGroupReadable. See <http://bugs.debian.org/552556> for more details.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r--src/or/connection.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 01b533d9b..d0898c5e5 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -966,6 +966,13 @@ connection_create_listener(const struct sockaddr *listensockaddr,
tor_socket_strerror(tor_socket_errno(s)));
goto err;
}
+ if (get_options()->UnixSocketsGroupWritable) {
+ if (chmod(address, 0660) < 0) {
+ log_warn(LD_FS,"Unable to make %s group-readable.", address);
+ tor_close_socket(s);
+ goto err;
+ }
+ }
if (listen(s,SOMAXCONN) < 0) {
log_warn(LD_NET, "Could not listen on %s: %s", address,