Matrix - synapse

Hi all,

Could be useful for those who would like to install Matrix-synapse on a LOCAL NethServer.

REDIRECTION
On the main NethServer, directly connected to the Internet:

DOMAIN

Replace example.org and the LOCAL IP address with the domain / IP address you want to use.

Gateway → Reverse proxy → Virtual hosts → CREATE NEW




PORT 8448

1) Create new firewall object:
Gateway → Firewall objects → Hosts → Create new

image


2) Forward the port:
Gateway → Ports Forwarding → CREATE NEW




OPENING THE PORT

Usually the port 8008 is opened, otherwise insert it as below.

# config set fw_matrix service status enabled TCPPort 8448,8008 access green,red

# signal-event firewall-adjust

Hoping it will help someone,

Michel-André

######################################################################
######################################################################

If you want to install ELEMENT instead of RIOT.

To see all the versions available of ELEMENT: Releases · element-hq/element-web · GitHub

# cd /var/www/html

# wget https://github.com/vector-im/element-web/releases/download/v1.7.17/element-v1.7.17.tar.gz

# tar -zxf element-v1.7.17.tar.gz

# mv element-v1.7.17 element

# chown -R apache:apache element

# cp element/config.sample.json  element/config.json

# vi element/config.json

...
    "default_server_config": {
        "m.homeserver": {
            "base_url": "https://matrix.example.org",
            "server_name": "matrix.example.org"
        },
        "m.identity_server": {
            "base_url": "https://matrix.org"
        }
    },
...

# systemctl restart matrix-synapse

To access your Matrix: https://matrix.example.org/element.

If you want to access your Matrix without having to specify element i.e https://matrix.example.org,
use the --strip-components=1 with tar and all will ve extracted in the working directory

# pwd
/var/www/html

Extraction:

# tar -zxf element-v1.7.17.tar.gz --strip-components=1

# vi ./config.json

Michel-André

######################################################################
######################################################################

GitHub - element-hq/element-web: A glossy Matrix collaboration client for the web..

Important Security Note

We do not recommend running Element from the same domain name as your Matrix homeserver. The reason is the risk of XSS (cross-site-scripting) vulnerabilities that could occur if someone caused Element to load and render malicious user generated content from a Matrix API which then had trusted access to Element (or other apps) due to sharing the same domain.

We have put some coarse mitigations into place to try to protect against this situation, but it’s still not good practice to do it in the first place. See Make it crystal clear that you should not run Vector on the same domain as a HS · Issue #1977 · element-hq/element-web · GitHub for more details.

Michel-André

######################################################################
######################################################################

Hi all,

For Matrix Federation with no need for a SRV DNS record.

# mkdir -p /var/www/html/.well-known/matrix

# cat > /var/www/html/.well-known/matrix/server <<'EOT'
{ "m.server": "matrix.example.org:443" }
EOT

For testing:
Got to: https://federationtester.matrix.org/ and enter example.org → Go.
Then at the bottom of the page, View the json report and you should see at the top of the page of the report:

m.server "matrix.example.org:443"

At the bottom of the report:

FederationOK	true

Please, if someone can confirm.

Michel-André

3 Likes