From 80d087404f62dec363779160bbe54ba885370e2e Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 9 Dec 2018 17:46:48 +0000 Subject: [PATCH 1/3] Allow disabling admin socket with AdminListen="none" --- src/config/config.go | 2 +- src/yggdrasil/admin.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config/config.go b/src/config/config.go index 904907b2..9671eca3 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -3,7 +3,7 @@ package config // NodeConfig defines all configuration values needed to run a signle yggdrasil node type NodeConfig struct { Listen string `comment:"Listen address for peer connections. Default is to listen for all\nTCP connections over IPv4 and IPv6 with a random port."` - AdminListen string `comment:"Listen address for admin connections Default is to listen for local\nconnections either on TCP/9001 or a UNIX socket depending on your\nplatform. Use this value for yggdrasilctl -endpoint=X."` + AdminListen string `comment:"Listen address for admin connections. Default is to listen for local\nconnections either on TCP/9001 or a UNIX socket depending on your\nplatform. Use this value for yggdrasilctl -endpoint=X. To disable\nthe admin socket, use the value \"none\" instead."` Peers []string `comment:"List of connection strings for static peers in URI format, e.g.\ntcp://a.b.c.d:e or socks://a.b.c.d:e/f.g.h.i:j."` InterfacePeers map[string][]string `comment:"List of connection strings for static peers in URI format, arranged\nby source interface, e.g. { \"eth0\": [ tcp://a.b.c.d:e ] }. Note that\nSOCKS peerings will NOT be affected by this option and should go in\nthe \"Peers\" section instead."` ReadTimeout int32 `comment:"Read timeout for connections, specified in milliseconds. If less\nthan 6000 and not negative, 6000 (the default) is used. If negative,\nreads won't time out."` diff --git a/src/yggdrasil/admin.go b/src/yggdrasil/admin.go index 2c65b6a8..19c8d0ad 100644 --- a/src/yggdrasil/admin.go +++ b/src/yggdrasil/admin.go @@ -326,7 +326,9 @@ func (a *admin) init(c *Core, listenaddr string) { // start runs the admin API socket to listen for / respond to admin API calls. func (a *admin) start() error { - go a.listen() + if a.listenaddr != "none" { + go a.listen() + } return nil } From 5ed197b3ca7992b7599c2d295a4d8077a955e82a Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 9 Dec 2018 17:48:35 +0000 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a073532f..d2c58a27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Add Docker support - Add `-json` command line flag for generating and normalising configuration in plain JSON - Build name and version numbers are now imprinted onto the build, accessible through `yggdrasil -version` and `yggdrasilctl getSelf` +- Add ability to disable admin socket by setting `AdminListen` to `"none"` ### Changed - Switched to Chord DHT (instead of Kademlia, although protocol-compatible) From 6801d713a7e73f7ec661cf71137432a5d0d4402b Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 9 Dec 2018 17:53:31 +0000 Subject: [PATCH 3/3] Also don't start if AdminListen is empty --- src/yggdrasil/admin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yggdrasil/admin.go b/src/yggdrasil/admin.go index 19c8d0ad..dea4577a 100644 --- a/src/yggdrasil/admin.go +++ b/src/yggdrasil/admin.go @@ -326,7 +326,7 @@ func (a *admin) init(c *Core, listenaddr string) { // start runs the admin API socket to listen for / respond to admin API calls. func (a *admin) start() error { - if a.listenaddr != "none" { + if a.listenaddr != "none" && a.listenaddr != "" { go a.listen() } return nil