Awesome
This is an application service that bridges Matrix to Rocket.Chat.
This Project is currently not maintained. There were breaking changes in the matrix API, which means that inviting the bot doesn't work (other things might be broken too). I might work on a re-write of the bridge. But if I ever release it, then it will take quite some time.
Warning: This application service is still in development. Do not use it! There will be breaking changes!
Compiling from Source
To compile the application service you need Rust >= 1.34.
It's highly recommended that you use rustup.
git clone https://github.com/exul/matrix-rocketchat.git
cd matrix-rocketchat
cargo build --release
./target/release/matrix-rocketchat
Dependencies
SQLite is used to store the data:
# On Ubuntu
sudo apt-get install libsqlite3-dev
# On Arch Linux
sudo pacman -S sqlite
If you are using the application service on Linux, you'll have to install OpenSSL:
# On Ubuntu
sudo apt-get install libssl-dev
# On Arch Linux
sudo pacman -S openssl
HTTPS
It's strongly recommended to use HTTPS when running the service!
The HTTPS configuration can either be done as part of the application service or a reverse proxy can be used.
Application Service
The service can be exposed via HTTPS by providing a PKCS 12 file and a password to decrypt the file.
To convert a certificate and a private key into a PKCS 12 file, the following command can be used:
openssl pkcs12 -export -in fullchain.pem -inkey privkey.pem -out cert.p12
The command will prompt for a password.
Configuration parameters:
as_address: "0.0.0.0:8822"
as_url: "https://matrix-rocketchat.example.org:8822"
use_https: true
pkcs12_path: "/pass/to/cert.p12
pkcs12_password: "p12password"
Reverse Proxy
The application service can be run behind a reverse proxy and let the reverse proxy handle the HTTPS.
In this case, it's important to bind the application service only to localhost!
NGINX example config:
http {
ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.1;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
server {
server_name matrix-rocketchat.example.org;
listen 443 ssl;
location / {
proxy_pass http://localhost:8822/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
port_in_redirect off;
}
}
}
Configuration parameters:
as_address: "127.0.0.1:8822"
as_url: "https://matrix-rocketchat.example.org"
use_https: false
Acknowledgement
I learned a lot by reading the code of the following projects:
- Ruma (a Matrix Server mainly written by Jimmy Cuadra)
- Gitter Bridge (mainly written by Remi Rampin)
From the first one I learned a lot about Rust and Iron. The second one helped me to understand how a Matrix bridge works.
Logo
Special thanks to Steffi who created the logo for this project.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.