Compare commits
38 Commits
3d1a8c4495
...
2.6.0
| Author | SHA1 | Date | |
|---|---|---|---|
| f54ed462b1 | |||
| 7498dcf122 | |||
| 7e5665a56f | |||
| f633e9d256 | |||
| bdfe4a00a9 | |||
| 50d4f0fa30 | |||
| bb190230b2 | |||
| c9bafd9af2 | |||
| 3c9c8ca1b5 | |||
| dacf96140c | |||
| 1d228d75e6 | |||
| 62530eda08 | |||
| 15c3e6b425 | |||
| 945a2dbdf5 | |||
| d5cebf103d | |||
| de14f80a40 | |||
| 7ed6db537d | |||
| 9d8d88527c | |||
| a1c82878f2 | |||
| ab95c8ee32 | |||
| e50a49b198 | |||
| 4492888557 | |||
| ed5407fc42 | |||
| a2911f2ace | |||
| e99578d168 | |||
| d471ea71d7 | |||
| 56115df282 | |||
| 2e1194d216 | |||
| ee001d543c | |||
| a826eb319e | |||
| 6b557e9954 | |||
| 041a4d1b73 | |||
| c1a1741bfb | |||
| 6e1058c484 | |||
| 5f6fb38485 | |||
| c9046ffbd0 | |||
| cf97c5a88f | |||
| 46dc07ef07 |
@@ -34,7 +34,7 @@ jobs:
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
fetch-depth: 0
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
@@ -2,7 +2,7 @@ FROM --platform=$BUILDPLATFORM openjdk:8-jre-alpine AS builder
|
||||
|
||||
RUN apk update && apk add gradle git && rm -rf /var/lib/apk/* /var/cache/apk/*
|
||||
|
||||
WORKDIR /ma1sd
|
||||
WORKDIR /mxids
|
||||
COPY . .
|
||||
RUN ./gradlew shadowJar
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FROM --platform=$BUILDPLATFORM openjdk:11.0.16-jre-slim
|
||||
|
||||
VOLUME /etc/ma1sd
|
||||
VOLUME /var/ma1sd
|
||||
VOLUME /etc/mxids
|
||||
VOLUME /var/mxids
|
||||
EXPOSE 8090
|
||||
|
||||
ENV JAVA_OPTS=""
|
||||
|
||||
36
build.gradle
36
build.gradle
@@ -52,7 +52,7 @@ mainClassName = 'io.kamax.mxisd.MxisdStandaloneExec'
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
|
||||
String ma1sdVersion() {
|
||||
String mxidsVersion() {
|
||||
def versionPattern = Pattern.compile("v(\\d+\\.)?(\\d+\\.)?(\\d+)(-.*)?")
|
||||
|
||||
String version = System.getenv('MXIDS_BUILD_VERSION')
|
||||
@@ -78,7 +78,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0'
|
||||
classpath 'com.github.johnrengelman:shadow:8.1.1'
|
||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.51.0'
|
||||
}
|
||||
}
|
||||
@@ -89,30 +89,30 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
// Logging
|
||||
api 'org.slf4j:slf4j-simple:1.7.36'
|
||||
api 'org.slf4j:slf4j-simple:2.0.12'
|
||||
|
||||
// Easy file management
|
||||
api 'commons-io:commons-io:2.15.1'
|
||||
|
||||
// Config management
|
||||
api 'org.yaml:snakeyaml:1.28'
|
||||
api 'org.yaml:snakeyaml:2.2'
|
||||
|
||||
// Dependencies from old Matrix-java-sdk
|
||||
api 'org.apache.commons:commons-lang3:3.14.0'
|
||||
api 'com.squareup.okhttp3:okhttp:4.12.0'
|
||||
api 'commons-codec:commons-codec:1.15'
|
||||
api 'commons-codec:commons-codec:1.16.1'
|
||||
|
||||
// ORMLite
|
||||
api 'com.j256.ormlite:ormlite-jdbc:5.7'
|
||||
api 'com.j256.ormlite:ormlite-jdbc:6.1'
|
||||
|
||||
// ed25519 handling
|
||||
api 'net.i2p.crypto:eddsa:0.3.0'
|
||||
|
||||
// LDAP connector
|
||||
api 'org.apache.directory.api:api-all:1.0.3'
|
||||
api 'org.apache.directory.api:api-all:2.1.6'
|
||||
|
||||
// DNS lookups
|
||||
api 'dnsjava:dnsjava:2.1.9'
|
||||
api 'dnsjava:dnsjava:3.5.3'
|
||||
|
||||
// HTTP connections
|
||||
api 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||
@@ -125,7 +125,7 @@ dependencies {
|
||||
api 'com.sun.mail:javax.mail:1.6.2'
|
||||
|
||||
// Google Firebase Authentication backend
|
||||
api 'com.google.firebase:firebase-admin:5.11.0'
|
||||
api 'com.google.firebase:firebase-admin:9.2.0'
|
||||
|
||||
// Connection Pool
|
||||
api 'com.mchange:c3p0:0.10.0'
|
||||
@@ -137,16 +137,16 @@ dependencies {
|
||||
api 'org.postgresql:postgresql:42.7.3'
|
||||
|
||||
// MariaDB/MySQL
|
||||
api 'org.mariadb.jdbc:mariadb-java-client:2.7.12'
|
||||
api 'org.mariadb.jdbc:mariadb-java-client:3.3.3'
|
||||
|
||||
// UNIX sockets
|
||||
api 'com.kohlschutter.junixsocket:junixsocket-core:2.9.0'
|
||||
|
||||
// Twilio SDK for SMS
|
||||
api 'com.twilio.sdk:twilio:7.55.3'
|
||||
api 'com.twilio.sdk:twilio:10.1.2'
|
||||
|
||||
// SendGrid SDK to send emails from GCE
|
||||
api 'com.sendgrid:sendgrid-java:2.2.2'
|
||||
api 'com.sendgrid:sendgrid-java:4.10.2'
|
||||
|
||||
// ZT-Exec for exec identity store
|
||||
api 'org.zeroturnaround:zt-exec:1.12'
|
||||
@@ -158,9 +158,9 @@ dependencies {
|
||||
api 'commons-cli:commons-cli:1.6.0'
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'com.github.tomakehurst:wiremock:2.27.2'
|
||||
testImplementation 'com.unboundid:unboundid-ldapsdk:4.0.14'
|
||||
testImplementation 'com.icegreen:greenmail:1.6.15'
|
||||
testImplementation 'com.github.tomakehurst:wiremock:3.0.1'
|
||||
testImplementation 'com.unboundid:unboundid-ldapsdk:7.0.0'
|
||||
testImplementation 'com.icegreen:greenmail:2.0.1'
|
||||
}
|
||||
|
||||
jar {
|
||||
@@ -172,9 +172,9 @@ jar {
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
baseName = project.name
|
||||
classifier = null
|
||||
version = null
|
||||
archiveBaseName.set(project.name)
|
||||
archiveClassifier.set('') // Set to an empty string if you don't need a classifier.
|
||||
archiveVersion.set('') // Set to an empty string if you don't want the version in the jar name.
|
||||
}
|
||||
|
||||
task debBuild(dependsOn: shadowJar) {
|
||||
|
||||
@@ -16,7 +16,7 @@ TCP 443
|
||||
+<---------------------------------<+
|
||||
|
|
||||
| +-------------------+
|
||||
TCP 8090 +-> | ma1sd |
|
||||
TCP 8090 +-> | mxids |
|
||||
| |
|
||||
| - Profile's 3PIDs |
|
||||
| - 3PID Invites |
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
#Thu Dec 05 22:39:36 MSK 2019
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#
|
||||
matrix:
|
||||
domain: ''
|
||||
v1: true # deprecated
|
||||
v1: false # deprecated
|
||||
v2: true # MSC2140 API v2. Riot require enabled V2 API.
|
||||
|
||||
|
||||
@@ -32,11 +32,11 @@ matrix:
|
||||
# /!\ THIS MUST **NOT** BE YOUR HOMESERVER KEYS FILE /!\
|
||||
# If this path does not exist, it will be auto-generated.
|
||||
#
|
||||
# During testing, /var/tmp/ma1sd/keys is a possible value
|
||||
# During testing, /var/tmp/mxids/keys is a possible value
|
||||
# For production, recommended location shall be one of the following:
|
||||
# - /var/lib/ma1sd/keys
|
||||
# - /var/opt/ma1sd/keys
|
||||
# - /var/local/ma1sd/keys
|
||||
# - /var/lib/mxids/keys
|
||||
# - /var/opt/mxids/keys
|
||||
# - /var/local/mxids/keys
|
||||
#
|
||||
key:
|
||||
path: ''
|
||||
@@ -46,20 +46,20 @@ key:
|
||||
# /!\ THIS MUST **NOT** BE YOUR HOMESERVER DATABASE /!\
|
||||
#
|
||||
# Examples:
|
||||
# - /var/opt/ma1sd/store.db
|
||||
# - /var/local/ma1sd/store.db
|
||||
# - /var/lib/ma1sd/store.db
|
||||
# - /var/opt/mxids/store.db
|
||||
# - /var/local/mxids/store.db
|
||||
# - /var/lib/mxids/store.db
|
||||
#
|
||||
storage:
|
||||
# backend: sqlite # or postgresql
|
||||
provider:
|
||||
sqlite:
|
||||
database: '/path/to/ma1sd.db'
|
||||
database: '/path/to/mxids.db'
|
||||
# postgresql:
|
||||
# # Wrap all string values with quotes to avoid yaml parsing mistakes
|
||||
# database: '//localhost/ma1sd' # or full variant //192.168.1.100:5432/ma1sd_database
|
||||
# username: 'ma1sd_user'
|
||||
# password: 'ma1sd_password'
|
||||
# database: '//localhost/mxids' # or full variant //192.168.1.100:5432/mxids_database
|
||||
# username: 'mxids_user'
|
||||
# password: 'mxids_password'
|
||||
#
|
||||
# # Pool configuration for postgresql backend.
|
||||
# #######
|
||||
@@ -190,10 +190,10 @@ threepid:
|
||||
# terms:
|
||||
# en: # lang
|
||||
# name: term name en # localized name
|
||||
# url: https://ma1sd.host.tld/term_en.html # localized url
|
||||
# url: https://mxids.host.tld/term_en.html # localized url
|
||||
# fe: # lang
|
||||
# name: term name fr # localized name
|
||||
# url: https://ma1sd.host.tld/term_fr.html # localized url
|
||||
# url: https://mxids.host.tld/term_fr.html # localized url
|
||||
# regexp:
|
||||
# - '/_matrix/identity/v2/account.*'
|
||||
# - '/_matrix/identity/v2/hash_details'
|
||||
@@ -1,6 +1,6 @@
|
||||
Package: ma1sd
|
||||
Package: mxids
|
||||
Maintainer: ma1uta <sablintolya@gmail.com>
|
||||
Homepage: https://github.com/ma1uta/ma1sd
|
||||
Homepage: https://git.cqre.net/cqrenet/mxids.git
|
||||
Description: Federated Matrix Identity Server
|
||||
Architecture: all
|
||||
Section: net
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Add service account
|
||||
useradd -r ma1sd || true
|
||||
useradd -r mxids || true
|
||||
|
||||
# Set permissions for data directory
|
||||
chown -R ma1sd:ma1sd %DEB_DATA_DIR%
|
||||
chown -R mxids:mxids %DEB_DATA_DIR%
|
||||
|
||||
# Create symlink to ma1sd run script
|
||||
ln -sfT /usr/lib/ma1sd/ma1sd /usr/bin/ma1sd
|
||||
# Create symlink to mxids run script
|
||||
ln -sfT /usr/lib/mxids/mxids /usr/bin/mxids
|
||||
|
||||
# Enable systemd service
|
||||
systemctl enable ma1sd.service
|
||||
systemctl enable mxids.service
|
||||
|
||||
# If we already have a config file setup, we attempt to run ma1sd automatically
|
||||
# If we already have a config file setup, we attempt to run mxids automatically
|
||||
# Specifically targeted at upgrades where the service needs to be restarted
|
||||
if [ -f "%DEB_CONF_FILE%" ]; then
|
||||
systemctl restart ma1sd.service
|
||||
systemctl restart mxids.service
|
||||
fi
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Stop running instance if needed
|
||||
systemctl stop ma1sd.service
|
||||
systemctl stop mxids.service
|
||||
|
||||
# Disable service if exists
|
||||
systemctl disable ma1sd.service
|
||||
systemctl disable mxids.service
|
||||
|
||||
# remove symlink
|
||||
rm /usr/bin/ma1sd
|
||||
rm /usr/bin/mxids
|
||||
|
||||
@@ -27,8 +27,8 @@ if [[ -n "$CONF_FILE_PATH" ]] && [ ! -f "$CONF_FILE_PATH" ]; then
|
||||
echo >> "$CONF_FILE_PATH"
|
||||
fi
|
||||
|
||||
echo "Starting ma1sd..."
|
||||
echo "Starting mxids..."
|
||||
echo
|
||||
fi
|
||||
|
||||
exec java -jar /app/ma1sd.jar -c /etc/ma1sd/ma1sd.yaml
|
||||
exec java -jar /app/mxids.jar -c /etc/mxids/mxids.yaml
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MxisdStandaloneExec {
|
||||
private static final Logger log = LoggerFactory.getLogger("App");
|
||||
|
||||
public static void main(String[] args) {
|
||||
String logLevel = System.getenv("MA1SD_LOG_LEVEL");
|
||||
String logLevel = System.getenv("MXIDS_LOG_LEVEL");
|
||||
if (StringUtils.isNotBlank(logLevel)) {
|
||||
System.setProperty("org.slf4j.simpleLogger.log.io.kamax.mxisd", logLevel);
|
||||
}
|
||||
@@ -59,8 +59,8 @@ public class MxisdStandaloneExec {
|
||||
System.out.println(" -c, --config Set the configuration file location");
|
||||
System.out.println(" -v Increase log level (log more info)");
|
||||
System.out.println(" -vv Further increase log level");
|
||||
System.out.println(" --dump Dump the full ma1sd configuration");
|
||||
System.out.println(" --dump-and-exit Dump the full ma1sd configuration and exit");
|
||||
System.out.println(" --dump Dump the full mxids configuration");
|
||||
System.out.println(" --dump-and-exit Dump the full mxids configuration and exit");
|
||||
System.out.println(" ");
|
||||
System.exit(0);
|
||||
return;
|
||||
@@ -88,7 +88,7 @@ public class MxisdStandaloneExec {
|
||||
}
|
||||
|
||||
if (Objects.isNull(cfg)) {
|
||||
cfg = YamlConfigLoader.tryLoadFromFile("ma1sd.yaml").orElseGet(MxisdConfig::new);
|
||||
cfg = YamlConfigLoader.tryLoadFromFile("mxids.yaml").orElseGet(MxisdConfig::new);
|
||||
}
|
||||
|
||||
if (dump) {
|
||||
@@ -98,17 +98,17 @@ public class MxisdStandaloneExec {
|
||||
}
|
||||
}
|
||||
|
||||
log.info("ma1sd starting");
|
||||
log.info("mxids starting");
|
||||
log.info("Version: {}", Mxisd.Version);
|
||||
|
||||
HttpMxisd mxisd = new HttpMxisd(cfg);
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
mxisd.stop();
|
||||
log.info("ma1sd stopped");
|
||||
log.info("mxids stopped");
|
||||
}));
|
||||
mxisd.start();
|
||||
|
||||
log.info("ma1sd started");
|
||||
log.info("mxids started");
|
||||
} catch (ConfigurationException e) {
|
||||
log.error(e.getDetailedMessage());
|
||||
log.error(e.getMessage());
|
||||
|
||||
@@ -33,8 +33,8 @@ public class RestBackendConfig {
|
||||
|
||||
public static class IdentityEndpoints {
|
||||
|
||||
private String single = "/_ma1sd/backend/api/v1/identity/single";
|
||||
private String bulk = "/_ma1sd/backend/api/v1/identity/bulk";
|
||||
private String single = "/_mxids/backend/api/v1/identity/single";
|
||||
private String bulk = "/_mxids/backend/api/v1/identity/bulk";
|
||||
|
||||
public String getSingle() {
|
||||
return single;
|
||||
@@ -56,9 +56,9 @@ public class RestBackendConfig {
|
||||
|
||||
public static class ProfileEndpoints {
|
||||
|
||||
private String displayName = "/_ma1sd/backend/api/v1/profile/displayName";
|
||||
private String threepids = "/_ma1sd/backend/api/v1/profile/threepids";
|
||||
private String roles = "/_ma1sd/backend/api/v1/profile/roles";
|
||||
private String displayName = "/_mxids/backend/api/v1/profile/displayName";
|
||||
private String threepids = "/_mxids/backend/api/v1/profile/threepids";
|
||||
private String roles = "/_mxids/backend/api/v1/profile/roles";
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
@@ -88,8 +88,8 @@ public class RestBackendConfig {
|
||||
|
||||
public static class Endpoints {
|
||||
|
||||
private String auth = "/_ma1sd/backend/api/v1/auth/login";
|
||||
private String directory = "/_ma1sd/backend/api/v1/directory/user/search";
|
||||
private String auth = "/_mxids/backend/api/v1/auth/login";
|
||||
private String directory = "/_mxids/backend/api/v1/directory/user/search";
|
||||
private IdentityEndpoints identity = new IdentityEndpoints();
|
||||
private ProfileEndpoints profile = new ProfileEndpoints();
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* ma1sd - Matrix Identity Server Daemon
|
||||
* mxids - Matrix Identity Server Daemon
|
||||
* Copyright (C) 2020 Anatoliy SAblin
|
||||
*
|
||||
* https://www.github.com/ma1uta/ma1sd/
|
||||
* https://git.cqre.net/cqrenet/mxids/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.concurrent.Executors;
|
||||
|
||||
public class InternalInviteManagerHandler extends BasicHttpHandler {
|
||||
|
||||
public static final String PATH = "/_ma1sd/internal/admin/inv_manager";
|
||||
public static final String PATH = "/_mxids/internal/admin/inv_manager";
|
||||
|
||||
private final InvitationManager invitationManager;
|
||||
private final ExecutorService executors = Executors.newFixedThreadPool(1);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## ma1sd start up script for UN*X
|
||||
## mxids start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
@@ -21,10 +21,10 @@ while [ -h "$PRG" ] ; do
|
||||
done
|
||||
|
||||
APP_HOME=`dirname "$PRG"`
|
||||
APP_NAME="ma1sd"
|
||||
APP_NAME="mxids"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and MA1SD_OPTS to pass JVM options to this script.
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and MXIDS_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
@@ -61,7 +61,7 @@ case "`uname`" in
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/ma1sd.jar
|
||||
CLASSPATH=$APP_HOME/mxids.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
@@ -158,7 +158,7 @@ for s in "${@}" ; do
|
||||
done
|
||||
|
||||
# Collect JVM options
|
||||
JVM_OPTS=$DEFAULT_JVM_OPTS" "$JAVA_OPTS" "$MA1SD_OPTS
|
||||
JVM_OPTS=$DEFAULT_JVM_OPTS" "$JAVA_OPTS" "$MXIDS_OPTS
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
@@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=ma1sd
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
User=ma1sd
|
||||
ExecStart=/usr/bin/ma1sd -c /etc/ma1sd/ma1sd.yaml
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
10
src/systemd/mxids.service
Normal file
10
src/systemd/mxids.service
Normal file
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=mxids
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
User=mxids
|
||||
ExecStart=/usr/bin/mxids -c /etc/mxids/mxids.yaml
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user