Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7fff2448a1 | ||
|
6571ff76b1 | ||
|
16690a0329 | ||
|
6ac593f0fa | ||
|
1581ab9e07 | ||
|
a1adca72e8 |
@@ -6,6 +6,11 @@ EXPOSE 8090
|
|||||||
|
|
||||||
ADD build/libs/mxisd.jar /mxisd.jar
|
ADD build/libs/mxisd.jar /mxisd.jar
|
||||||
ADD src/docker/start.sh /start.sh
|
ADD src/docker/start.sh /start.sh
|
||||||
|
RUN mkdir -p /var/mxisd
|
||||||
|
|
||||||
ENV JAVA_OPTS=""
|
ENV JAVA_OPTS=""
|
||||||
|
ENV CONF_FILE_PATH="/etc/mxisd/mxisd.yaml"
|
||||||
|
ENV SIGN_KEY_PATH="/var/mxisd/sign.key"
|
||||||
|
ENV SQLITE_DATABASE_PATH="/var/mxisd/mxisd.db"
|
||||||
|
|
||||||
CMD [ "/start.sh" ]
|
CMD [ "/start.sh" ]
|
@@ -18,7 +18,7 @@ It is specifically designed to connect to an Identity store (AD/Samba/LDAP, SQL
|
|||||||
and ease the integration of the Matrix ecosystem with an existing infrastructure, or to build a new one using lasting
|
and ease the integration of the Matrix ecosystem with an existing infrastructure, or to build a new one using lasting
|
||||||
tools.
|
tools.
|
||||||
|
|
||||||
The core principle of mxisd is to map between Matrix IDs and 3PIDs (Thrid-party Identifiers) for the Homeserver and its
|
The core principle of mxisd is to map between Matrix IDs and 3PIDs (Third-party Identifiers) for the Homeserver and its
|
||||||
users. 3PIDs can be anything that identify a user, like:
|
users. 3PIDs can be anything that identify a user, like:
|
||||||
- Full name
|
- Full name
|
||||||
- Email address
|
- Email address
|
||||||
|
@@ -37,6 +37,8 @@ Install via:
|
|||||||
See the [Latest release](https://github.com/kamax-io/mxisd/releases/latest) for links to each.
|
See the [Latest release](https://github.com/kamax-io/mxisd/releases/latest) for links to each.
|
||||||
|
|
||||||
## Configure
|
## Configure
|
||||||
|
**NOTE**: please view the install instruction for your platform, as this step might be optional/handled for you.
|
||||||
|
|
||||||
Create/edit a minimal configuration (see installer doc for the location):
|
Create/edit a minimal configuration (see installer doc for the location):
|
||||||
```
|
```
|
||||||
matrix.domain: 'MyMatrixDomain.org'
|
matrix.domain: 'MyMatrixDomain.org'
|
||||||
|
@@ -5,10 +5,18 @@ Pull the latest stable image:
|
|||||||
docker pull kamax/mxisd
|
docker pull kamax/mxisd
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Configure
|
||||||
|
On first run, simply using `MATRIX_DOMAIN` as an environment variable will create a default config for you.
|
||||||
|
You can also provide a configuration file named `mxisd.yaml` in the volume mapped to `/etc/mxisd` before starting your
|
||||||
|
container.
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
Run it (adapt volume paths to your host):
|
Use the following command after adapting to your needs:
|
||||||
|
- The `MATRIX_DOMAIN` environment variable to yours
|
||||||
|
- The volumes host paths
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run --rm -v /data/mxisd/etc:/etc/mxisd -v /data/mxisd/var:/var/mxisd -p 8090:8090 -t kamax/mxisd
|
docker run --rm -e MATRIX_DOMAIN=example.org -v /data/mxisd/etc:/etc/mxisd -v /data/mxisd/var:/var/mxisd -p 8090:8090 -t kamax/mxisd
|
||||||
```
|
```
|
||||||
|
|
||||||
For more info, including the list of possible tags, see [the public repository](https://hub.docker.com/r/kamax/mxisd/)
|
For more info, including the list of possible tags, see [the public repository](https://hub.docker.com/r/kamax/mxisd/)
|
||||||
|
@@ -1,2 +1,26 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
if ! [ -z "$CONF_FILE_PATH" ] && ! [ -f "CONF_FILE_PATH" ]; then
|
||||||
|
echo "Generating config file $CONF_FILE_PATH"
|
||||||
|
touch "CONF_FILE_PATH"
|
||||||
|
|
||||||
|
if ! [ -z "$MATRIX_DOMAIN" ]; then
|
||||||
|
echo "Setting matrix domain to $MATRIX_DOMAIN"
|
||||||
|
echo "matrix.domain: $MATRIX_DOMAIN" >> "$CONF_FILE_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -z "$SIGN_KEY_PATH" ]; then
|
||||||
|
echo "Setting signing key path to $SIGN_KEY_PATH"
|
||||||
|
echo "key.path: $SIGN_KEY_PATH" >> "$CONF_FILE_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -z "$SQLITE_DATABASE_PATH" ]; then
|
||||||
|
echo "Setting SQLite DB path to $SQLITE_DATABASE_PATH"
|
||||||
|
echo "storage.provider.sqlite.database: $SQLITE_DATABASE_PATH" >> "$CONF_FILE_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Starting mxisd..."
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Dspring.config.location=/etc/mxisd/ -Dspring.config.name=mxisd -jar /mxisd.jar
|
exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Dspring.config.location=/etc/mxisd/ -Dspring.config.name=mxisd -jar /mxisd.jar
|
@@ -68,13 +68,16 @@ public class LdapThreePidProvider extends LdapGenericBackend implements IThreePi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Optional<String> lookup(LdapConnection conn, String medium, String value) {
|
private Optional<String> lookup(LdapConnection conn, String medium, String value) {
|
||||||
Optional<String> queryOpt = getCfg().getIdentity().getQuery(medium);
|
Optional<String> tPidQueryOpt = getCfg().getIdentity().getQuery(medium);
|
||||||
if (!queryOpt.isPresent()) {
|
if (!tPidQueryOpt.isPresent()) {
|
||||||
log.warn("{} is not a configured 3PID type for LDAP lookup", medium);
|
log.warn("{} is not a configured 3PID type for LDAP lookup", medium);
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
String searchQuery = queryOpt.get().replaceAll(getCfg().getIdentity().getToken(), value);
|
// we merge 3PID specific query with global/specific filter, if one exists.
|
||||||
|
String tPidQuery = tPidQueryOpt.get().replaceAll(getCfg().getIdentity().getToken(), value);
|
||||||
|
String searchQuery = buildWithFilter(tPidQuery, getCfg().getIdentity().getFilter());
|
||||||
|
|
||||||
try (EntryCursor cursor = conn.search(getBaseDn(), searchQuery, SearchScope.SUBTREE, getUidAtt())) {
|
try (EntryCursor cursor = conn.search(getBaseDn(), searchQuery, SearchScope.SUBTREE, getUidAtt())) {
|
||||||
while (cursor.next()) {
|
while (cursor.next()) {
|
||||||
Entry entry = cursor.get();
|
Entry entry = cursor.get();
|
||||||
|
@@ -162,11 +162,14 @@ public class LdapConfig {
|
|||||||
throw new IllegalStateException("LDAP port is not valid");
|
throw new IllegalStateException("LDAP port is not valid");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(conn.getBaseDn())) {
|
||||||
|
throw new ConfigurationException("ldap.connection.baseDn");
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtils.isBlank(attribute.getUid().getType())) {
|
if (StringUtils.isBlank(attribute.getUid().getType())) {
|
||||||
throw new IllegalStateException("Attribute UID Type cannot be empty");
|
throw new IllegalStateException("Attribute UID Type cannot be empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (StringUtils.isBlank(attribute.getUid().getValue())) {
|
if (StringUtils.isBlank(attribute.getUid().getValue())) {
|
||||||
throw new IllegalStateException("Attribute UID value cannot be empty");
|
throw new IllegalStateException("Attribute UID value cannot be empty");
|
||||||
}
|
}
|
||||||
|
@@ -46,16 +46,14 @@ public class NotificationManager {
|
|||||||
this.handlers = new HashMap<>();
|
this.handlers = new HashMap<>();
|
||||||
handlers.forEach(h -> {
|
handlers.forEach(h -> {
|
||||||
log.info("Found handler {} for medium {}", h.getId(), h.getMedium());
|
log.info("Found handler {} for medium {}", h.getId(), h.getMedium());
|
||||||
String handlerId = cfg.getHandler().get(h.getMedium());
|
String handlerId = cfg.getHandler().getOrDefault(h.getMedium(), "raw");
|
||||||
if (StringUtils.isBlank(handlerId) || StringUtils.equals(handlerId, h.getId())) {
|
if (StringUtils.equals(handlerId, h.getId())) {
|
||||||
this.handlers.put(h.getMedium(), h);
|
this.handlers.put(h.getMedium(), h);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info("--- Notification handler ---");
|
log.info("--- Notification handler ---");
|
||||||
this.handlers.forEach((k, v) -> {
|
this.handlers.forEach((k, v) -> log.info("\tHandler for {}: {}", k, v.getId()));
|
||||||
log.info("\tHandler for {}: {}", k, v.getId());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private INotificationHandler ensureMedium(String medium) {
|
private INotificationHandler ensureMedium(String medium) {
|
||||||
|
Reference in New Issue
Block a user