From c3b7791f4549f9c92c97c291dabf372bb6d27922 Mon Sep 17 00:00:00 2001 From: creme Date: Mon, 4 Dec 2023 18:42:30 +0000 Subject: [PATCH] update from server state --- etc/cron.d/backup | 1 - etc/cron.d/tilde_admin | 2 +- etc/nginx/nginx.conf | 4 +- etc/nginx/sites-available/envs.net.conf | 46 ++------------- etc/nginx/snippets/matrix.conf | 76 +++++++++++++++++++++++++ var/tilde/admins | 2 +- 6 files changed, 85 insertions(+), 46 deletions(-) create mode 100644 etc/nginx/snippets/matrix.conf diff --git a/etc/cron.d/backup b/etc/cron.d/backup index 3546377..a3dbea2 100644 --- a/etc/cron.d/backup +++ b/etc/cron.d/backup @@ -4,5 +4,4 @@ SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root -#13 1,13 * * * root /root/backup-server.sh 13 1 * * * root /root/backup-server.sh diff --git a/etc/cron.d/tilde_admin b/etc/cron.d/tilde_admin index 79a5134..a59383e 100644 --- a/etc/cron.d/tilde_admin +++ b/etc/cron.d/tilde_admin @@ -4,4 +4,4 @@ SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -5 0 * * * root make -C /var/tilde/admins/ DEST_DIR=/var/ DEST_OWNER=root DEST_GROUP=www-data >/dev/null 2>&1 +#5 0 * * * root make -C /var/tilde/admins/ DEST_DIR=/var/ DEST_OWNER=root DEST_GROUP=www-data >/dev/null 2>&1 diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf index 0ecf829..3baf41d 100644 --- a/etc/nginx/nginx.conf +++ b/etc/nginx/nginx.conf @@ -86,8 +86,8 @@ http { # borrowed from Apache # (Could use $host instead of $server_name to log vhost aliases separately) log_format vhost_combined '$server_name $remote_addr - $remote_user [$time_local] ' - '"$request" $status $body_bytes_sent ' - '"$http_referer" "$http_user_agent"'; + '"$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent"'; log_format vcombined '$host:$server_port ' '$remote_addr - $remote_user [$time_local] ' diff --git a/etc/nginx/sites-available/envs.net.conf b/etc/nginx/sites-available/envs.net.conf index 27e73fb..142c8da 100644 --- a/etc/nginx/sites-available/envs.net.conf +++ b/etc/nginx/sites-available/envs.net.conf @@ -65,47 +65,7 @@ server { # } ## matrix - location /.well-known/matrix/support { - add_header Access-Control-Allow-Origin '*'; - add_header Content-Type application/json; - return 200 '{"admins": [{"matrix_id": "@creme:envs.net", "email_address": "hostmaster@envs.net", "role": "admin"}], "support_page": "https://matrix.to/#/#envs:envs.net"}'; - } - - location /.well-known/matrix/server { - add_header Access-Control-Allow-Origin '*'; - add_header Content-Type application/json; - return 200 '{"m.server": "matrix.envs.net:443"}'; - } - - location /.well-known/matrix/client { - add_header Access-Control-Allow-Origin '*'; - add_header Content-Type application/json; - return 200 '{"m.homeserver": {"base_url": "https://matrix.envs.net"}, "m.integrations": {"managers": [{"ui_url": "https://dimension.envs.net/riot", "api_url": "https://dimension.envs.net/api/v1/scalar"}, {"ui_url": "https://scalar.vector.im/", "api_url": "https://scalar.vector.im/api"}]}, "m.integrations_widget": {"url": "https://dimension.envs.net/riot", "data": {"api_url": "https://dimension.envs.net/api/v1/scalar"}}, "m.tile_server": {"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=jrKVgM1ozvdgREfvtZ8X"}}'; - } - - location ^~ /_matrix/media { - return 302 https://matrix.envs.net$request_uri; - } - - location ^~ /_matrix/maubot { - include proxy_params; - proxy_ssl_name $http_host; - proxy_ssl_server_name on; - - proxy_pass https://matrix.envs.net; - } - - location ^~ /_matrix/maubot/v1/logs { - include proxy_params; - proxy_ssl_name $http_host; - proxy_ssl_server_name on; - - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_pass https://matrix.envs.net; - } - + include snippets/matrix.conf; ## users location ~ ^/(~|u/)(?[\w-]+)(?/.*)?$ { @@ -169,6 +129,10 @@ server { return 301 https://help.envs.net/; } + location /register { + return 301 https://envs.net/signup/; + } + location /irc { return 301 https://envs.net/chat/irc/; } diff --git a/etc/nginx/snippets/matrix.conf b/etc/nginx/snippets/matrix.conf new file mode 100644 index 0000000..754ca8e --- /dev/null +++ b/etc/nginx/snippets/matrix.conf @@ -0,0 +1,76 @@ +# matrix/support +location /.well-known/matrix/support { + add_header Access-Control-Allow-Origin '*'; + add_header Content-Type application/json; + return 200 '{ + "admins": [ + { + "matrix_id": "@creme:envs.net", + "email_address": "hostmaster@envs.net", + "role": "admin" + } + ], + "support_page": "https://matrix.to/#/#envs:envs.net", + "abuse_reports": "https://matrix.to/#/#abuse:envs.net" +}'; +} + +# matrix/server +location /.well-known/matrix/server { + add_header Access-Control-Allow-Origin '*'; + add_header Content-Type application/json; + return 200 '{ + "m.server": "matrix.envs.net:443" +}'; +} + +# matrix/client +location /.well-known/matrix/client { + add_header Access-Control-Allow-Origin '*'; + add_header Content-Type application/json; + return 200 '{ + "m.homeserver": { + "base_url": "https://matrix.envs.net" + }, + "m.tile_server": { + "map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=jrKVgM1ozvdgREfvtZ8X" + } +}'; +} + +## +location ^~ /_matrix { + add_header Access-Control-Allow-Origin '*'; + add_header Content-Type application/json; + return 404 '{ + "errcode": "M_NOT_FOUND", + "error": "There are no Matrix endpoints here. Perhaps you forgot to resolve the client-server API URL?", + "solution": "Go to matrix.envs.net", + "spec": "https://spec.matrix.org/v1.9/server-server-api/#resolving-server-names" +}'; +} + +# media +location ^~ /_matrix/media { + return 302 https://matrix.envs.net$request_uri; +} + +# maubot +location ^~ /_matrix/maubot { + include proxy_params; + proxy_ssl_name $http_host; + proxy_ssl_server_name on; + + proxy_pass https://matrix.envs.net; +} + +location ^~ /_matrix/maubot/v1/logs { + include proxy_params; + proxy_ssl_name $http_host; + proxy_ssl_server_name on; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_pass https://matrix.envs.net; +} diff --git a/var/tilde/admins b/var/tilde/admins index 918bc04..073ce09 160000 --- a/var/tilde/admins +++ b/var/tilde/admins @@ -1 +1 @@ -Subproject commit 918bc0406fb046ad3baaf1b27708ef5e59c24752 +Subproject commit 073ce09fcff03144a840bb7728a45b47f7fa1487