Skip to content

LocalCluster does not respect security configuration #2815

Closed

Description

@rbubley

I encountered this error in distributed 1.28.1, but from inspecting the code, I expect this to still be an issue in master.

LocalCluster accepts a parameter 'security', but defaults it to None.

By contrast, Scheduler (for example), will read the security parameter from the configs if it is not explicitly set, using
self.security = security or Security()

Depending on your configuration, this can lead to the LocalCluster failing:

>>> distributed.deploy.LocalCluster()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/distributed/deploy/local.py", line 219, in __init__
    self.start(ip=ip, n_workers=n_workers)
  File "/usr/local/lib/python2.7/site-packages/distributed/deploy/local.py", line 257, in start
    self.sync(self._start, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/distributed/deploy/local.py", line 250, in sync
    return sync(self.loop, func, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/distributed/utils.py", line 331, in sync
    six.reraise(*error[0])
  File "/usr/local/lib/python2.7/site-packages/distributed/utils.py", line 316, in f
    result[0] = yield future
  File "/usr/local/lib/python2.7/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
  File "/usr/local/lib/python2.7/site-packages/tornado/concurrent.py", line 261, in result
    raise_exc_info(self._exc_info)
  File "/usr/local/lib/python2.7/site-packages/tornado/gen.py", line 326, in wrapper
    yielded = next(result)
  File "/usr/local/lib/python2.7/site-packages/distributed/deploy/local.py", line 283, in _start
    self.scheduler.start(address)
  File "/usr/local/lib/python2.7/site-packages/distributed/scheduler.py", line 1199, in start
    self.listen(addr_or_port, listen_args=self.listen_args)
  File "/usr/local/lib/python2.7/site-packages/distributed/core.py", line 320, in listen
    connection_args=listen_args,
  File "/usr/local/lib/python2.7/site-packages/distributed/comm/core.py", line 258, in listen
    loc, handle_comm, deserialize, **(connection_args or {})
  File "/usr/local/lib/python2.7/site-packages/distributed/comm/tcp.py", line 530, in get_listener
    return self._listener_class(loc, handle_comm, deserialize, **connection_args)
  File "/usr/local/lib/python2.7/site-packages/distributed/comm/tcp.py", line 402, in __init__
    self._check_encryption(address, connection_args)
  File "/usr/local/lib/python2.7/site-packages/distributed/comm/tcp.py", line 339, in _check_encryption
    "refusing communication from/to %r" % (self.prefix + address,)
RuntimeError: encryption required by Dask configuration, refusing communication from/to 'tcp://127.0.0.1'

Activity

  1. TomAugspurger commented on Jul 1, 2019

    @TomAugspurger
    Member

    Hmm what's the expected behavior here? I'm not familiar with our TLS stuff, but using TLS for LocalCluster doesn't seem likely to work. What options do we have?

  2. mrocklin commented on Jul 1, 2019

    @mrocklin
    Member

    By contrast, Scheduler (for example), will read the security parameter from the configs if it is not explicitly set, using

    But since LocalCluster just passes the security value to Scheduler, wouldn't this work as expected?

    RuntimeError: encryption required by Dask configuration, refusing communication from/to 'tcp://127.0.0.1'

    I'm curious, have you set up TLS somewhere in your configuration perhaps?

  3. rbubley commented on Jul 2, 2019

    @rbubley
    ContributorAuthor

    So, in my use case, I do indeed have TLS set-up in the dask configuration file (with require-encryption and default-scheme=tls. The motivation for me to do this was to ensure TLS was used for Client-Scheduler communication. I actually don't care what happens Scheduler-Worker, but this approach will make it go over TLS.

    If I create a LocalCluster, then (unlike many other distributed objects), LocalCluster does not default to having its security parameter set by the configuration - it defaults to security=None. When LocalCluster starts the Scheduler, the Scheduler does read the configuration. It is this mismatch that is causing the problem.

  4. mrocklin commented on Jul 2, 2019

    @mrocklin
    Member
  5. jcrist commented on Jul 2, 2019

    @jcrist
    Member

    Yeah, local cluster should default to reading in the configuration as the scheduler does. Would you care to submit a PR fixing this?

  6. rbubley commented on Jul 2, 2019

    @rbubley
    ContributorAuthor

    I can write a PR to fix the issue, but I'm afraid I don't have time to write a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions