mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
ejabberd: fix mod_matrix_gw (#373257)
This commit is contained in:
@@ -2,7 +2,7 @@ let
|
||||
cert =
|
||||
pkgs:
|
||||
pkgs.runCommand "selfSignedCerts" { buildInputs = [ pkgs.openssl ]; } ''
|
||||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=example.com/CN=muc.example.com' -days 36500
|
||||
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj '/CN=example.com/CN=muc.example.com/CN=matrix.example.com' -days 36500
|
||||
mkdir -p $out
|
||||
cp key.pem cert.pem $out
|
||||
'';
|
||||
@@ -20,12 +20,12 @@ import ../make-test-python.nix (
|
||||
{
|
||||
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
||||
networking.extraHosts = ''
|
||||
${nodes.server.config.networking.primaryIPAddress} example.com
|
||||
${nodes.server.networking.primaryIPAddress} example.com
|
||||
'';
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.callPackage ./xmpp-sendmessage.nix {
|
||||
connectTo = nodes.server.config.networking.primaryIPAddress;
|
||||
connectTo = nodes.server.networking.primaryIPAddress;
|
||||
})
|
||||
];
|
||||
};
|
||||
@@ -35,6 +35,7 @@ import ../make-test-python.nix (
|
||||
security.pki.certificateFiles = [ "${cert pkgs}/cert.pem" ];
|
||||
networking.extraHosts = ''
|
||||
${config.networking.primaryIPAddress} example.com
|
||||
${config.networking.primaryIPAddress} matrix.example.com
|
||||
'';
|
||||
|
||||
services.ejabberd = {
|
||||
@@ -65,6 +66,12 @@ import ../make-test-python.nix (
|
||||
port: 5269
|
||||
ip: "::"
|
||||
module: ejabberd_s2s_in
|
||||
-
|
||||
port: 8448
|
||||
module: ejabberd_http
|
||||
tls: true
|
||||
request_handlers:
|
||||
"/_matrix": mod_matrix_gw
|
||||
-
|
||||
port: 5347
|
||||
ip: "127.0.0.1"
|
||||
@@ -275,9 +282,15 @@ import ../make-test-python.nix (
|
||||
plugins:
|
||||
- "pep"
|
||||
mod_push: {}
|
||||
mod_matrix_gw:
|
||||
key_name: key1
|
||||
key: MATRIX_SECRET
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.ejabberd.serviceConfig.EnvironmentFile = pkgs.writeText "ejabberd.env" ''
|
||||
EJABBERD_MACRO_MATRIX_SECRET=SU4mu/j8b8A1i1EdyxIcKlFlrp+eSRBIlZwGyHP7Mfo=
|
||||
'';
|
||||
networking.firewall.enable = false;
|
||||
};
|
||||
};
|
||||
@@ -291,6 +304,8 @@ import ../make-test-python.nix (
|
||||
|
||||
assert "status: started" in server.succeed(ejabberd_prefix + "status")
|
||||
|
||||
server.succeed("curl https://matrix.example.com:8448/_matrix/key/v2/server")
|
||||
|
||||
server.succeed(
|
||||
ejabberd_prefix + "register azurediamond example.com hunter2",
|
||||
ejabberd_prefix + "register cthon98 example.com nothunter2",
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
gawk,
|
||||
fetchFromGitHub,
|
||||
fetchgit,
|
||||
fetchpatch2,
|
||||
beamPackages,
|
||||
nixosTests,
|
||||
withMysql ? false,
|
||||
@@ -172,6 +173,14 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
hash = "sha256-9TyIgsinUpUbirwqg61EYnPB/OyE5vhl3MBMRihqAtE=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Fix json_encode_with_kv_list used in mod_matrix_gw
|
||||
(fetchpatch2 {
|
||||
url = "https://github.com/processone/ejabberd/commit/056635119c8b9f169f1c59cccbf81faab88a6712.patch?full_index=1";
|
||||
hash = "sha256-53NMT/SwPtaeo8zaJ1JHW6HUZrxkITi731UOdsFAlJ4=";
|
||||
})
|
||||
];
|
||||
|
||||
passthru.tests = {
|
||||
inherit (nixosTests) ejabberd;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user