Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Should not require TLS key with tls set to false #5841

Closed
openscript opened this issue Aug 10, 2019 · 4 comments
Closed

Should not require TLS key with tls set to false #5841

openscript opened this issue Aug 10, 2019 · 4 comments

Comments

@openscript
Copy link

Description

The tls_private_key_path file is required even tls seems to be disabled in the homeserver.yaml.

Steps to reproduce

  1. Use the official docker image with synapse 1.2.1
  2. Set the following configuration to the config:
listeners:
  # TLS-enabled listener: for when matrix traffic is sent directly to synapse.
  #
  # Disabled by default. To enable it, uncomment the following. (Note that you
  # will also need to give Synapse a TLS key and certificate: see the TLS section
  # below.)
  #
  #- port: 8448
  #  type: http
  #  tls: true
  #  resources:
  #    - names: [client, federation]

  # Unsecure HTTP listener: for when matrix traffic passes through a reverse proxy
  # that unwraps TLS.
  #
  # If you plan to use a reverse proxy, please see
  # https://github.com/matrix-org/synapse/blob/master/docs/reverse_proxy.rst.
  #
  - port: 8008
    tls: false
    type: http
    x_forwarded: true

    resources:
      - names: [client, federation]
        compress: false
  1. Start synapse:
synapse       | 2019-08-10 13:10:44,783 - root - 226 - WARNING - None - ***** STARTING SERVER *****
synapse       | 2019-08-10 13:10:44,791 - root - 227 - WARNING - None - Server /usr/local/lib/python3.7/site-packages/synapse/app/homeserver.py version 1.2.1
synapse       | 2019-08-10 13:10:44,792 - root - 228 - INFO - None - Server hostname: chat.openscript.cloud
synapse       | 2019-08-10 13:10:44,793 - twisted - 254 - INFO - None - Redirected stdout/stderr to logs
synapse       | 2019-08-10 13:10:44,874 - twisted - 254 - ERROR -  - Traceback (most recent call last):
synapse       | 2019-08-10 13:10:44,875 - twisted - 254 - ERROR -  -   File "/usr/local/lib/python3.7/site-packages/synapse/config/_base.py", line 113, in check_file
synapse       | 2019-08-10 13:10:44,876 - twisted - 254 - ERROR -  -     os.stat(file_path)
synapse       | 2019-08-10 13:10:44,876 - twisted - 254 - ERROR -  - FileNotFoundError: [Errno 2] No such file or directory: '/data/chat.openscript.tls.key'
synapse       | 2019-08-10 13:10:44,877 - twisted - 254 - ERROR -  - 
synapse       | 2019-08-10 13:10:44,877 - twisted - 254 - ERROR -  - During handling of the above exception, another exception occurred:
synapse       | 2019-08-10 13:10:44,877 - twisted - 254 - ERROR -  - 
synapse       | 2019-08-10 13:10:44,878 - twisted - 254 - ERROR -  - Traceback (most recent call last):
synapse       | 2019-08-10 13:10:44,878 - twisted - 254 - ERROR -  -   File "/usr/local/lib/python3.7/site-packages/synapse/app/_base.py", line 253, in start
synapse       | 2019-08-10 13:10:44,879 - twisted - 254 - ERROR -  -     refresh_certificate(hs)
synapse       | 2019-08-10 13:10:44,879 - twisted - 254 - ERROR -  -   File "/usr/local/lib/python3.7/site-packages/synapse/app/_base.py", line 208, in refresh_certificate
synapse       | 2019-08-10 13:10:44,880 - twisted - 254 - ERROR -  -     hs.config.read_certificate_from_disk(require_cert_and_key=True)
synapse       | 2019-08-10 13:10:44,880 - twisted - 254 - ERROR -  -   File "/usr/local/lib/python3.7/site-packages/synapse/config/tls.py", line 214, in read_certificate_from_disk
synapse       | 2019-08-10 13:10:44,880 - twisted - 254 - ERROR -  -     self.tls_private_key = self.read_tls_private_key()
synapse       | 2019-08-10 13:10:44,881 - twisted - 254 - ERROR -  -   File "/usr/local/lib/python3.7/site-packages/synapse/config/tls.py", line 454, in read_tls_private_key
synapse       | 2019-08-10 13:10:44,881 - twisted - 254 - ERROR -  -     private_key_pem = self.read_file(private_key_path, "tls_private_key_path")
synapse       | 2019-08-10 13:10:44,882 - twisted - 254 - ERROR -  -   File "/usr/local/lib/python3.7/site-packages/synapse/config/_base.py", line 135, in read_file
synapse       | 2019-08-10 13:10:44,882 - twisted - 254 - ERROR -  -     cls.check_file(file_path, config_name)
synapse       | 2019-08-10 13:10:44,883 - twisted - 254 - ERROR -  -   File "/usr/local/lib/python3.7/site-packages/synapse/config/_base.py", line 117, in check_file
synapse       | 2019-08-10 13:10:44,883 - twisted - 254 - ERROR -  -     % (file_path, config_name, e.strerror)
synapse       | 2019-08-10 13:10:44,884 - twisted - 254 - ERROR -  - synapse.config._base.ConfigError: Error accessing file '/data/chat.openscript.tls.key' (config for tls_private_key_path): No such file or directory

Version information

  • Homeserver: private homeserver

If not matrix.org:

  • Version: Synapse 1.2.1

  • Install method: Official docker image

  • Platform: Docker
@openscript
Copy link
Author

This is not an actual bug. Unfortunately the config file was not properly read.

@Mika2147
Copy link

Got the same problem. How did you solve it?

@dimm0
Copy link

dimm0 commented Jan 2, 2020

Same problem here

@dimm0
Copy link

dimm0 commented Jan 2, 2020

This fixed it: #5671

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants