mirror of
https://github.com/matrix-org/dendrite
synced 2024-11-14 00:47:19 +00:00
Rename serverkeyapi to signingkeyserver (#1492)
* Rename serverkeyapi to signingkeyserver We use "api" for public facing stuff and "server" for internal stuff. As the server key API is internal only, we call it 'signing key server', which also clarifies the type of key (as opposed to TLS keys, E2E keys, etc) * Convert docker/scripts to use signing-key-server * Rename missed bits
This commit is contained in:
parent
533006141e
commit
bf7e85848b
38 changed files with 97 additions and 96 deletions
|
@ -253,12 +253,12 @@ room_server:
|
||||||
conn_max_lifetime: -1
|
conn_max_lifetime: -1
|
||||||
|
|
||||||
# Configuration for the Server Key API (for server signing keys).
|
# Configuration for the Server Key API (for server signing keys).
|
||||||
server_key_api:
|
signing_key_server:
|
||||||
internal_api:
|
internal_api:
|
||||||
listen: http://0.0.0.0:7780
|
listen: http://0.0.0.0:7780
|
||||||
connect: http://server_key_api:7780
|
connect: http://signing_key_server:7780
|
||||||
database:
|
database:
|
||||||
connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_serverkey?sslmode=disable
|
connection_string: postgresql://dendrite:itsasecret@postgres/dendrite_signingkeyserver?sslmode=disable
|
||||||
max_open_conns: 100
|
max_open_conns: 100
|
||||||
max_idle_conns: 2
|
max_idle_conns: 2
|
||||||
conn_max_lifetime: -1
|
conn_max_lifetime: -1
|
||||||
|
|
|
@ -128,9 +128,9 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
|
|
||||||
server_key_api:
|
signing_key_server:
|
||||||
hostname: server_key_api
|
hostname: signing_key_server
|
||||||
image: matrixdotorg/dendrite:serverkeyapi
|
image: matrixdotorg/dendrite:signingkeyserver
|
||||||
command: [
|
command: [
|
||||||
"--config=dendrite.yaml"
|
"--config=dendrite.yaml"
|
||||||
]
|
]
|
||||||
|
|
|
@ -17,5 +17,5 @@ docker build -t matrixdotorg/dendrite:keyserver --build-arg component=de
|
||||||
docker build -t matrixdotorg/dendrite:mediaapi --build-arg component=dendrite-media-api-server -f build/docker/Dockerfile.component .
|
docker build -t matrixdotorg/dendrite:mediaapi --build-arg component=dendrite-media-api-server -f build/docker/Dockerfile.component .
|
||||||
docker build -t matrixdotorg/dendrite:roomserver --build-arg component=dendrite-room-server -f build/docker/Dockerfile.component .
|
docker build -t matrixdotorg/dendrite:roomserver --build-arg component=dendrite-room-server -f build/docker/Dockerfile.component .
|
||||||
docker build -t matrixdotorg/dendrite:syncapi --build-arg component=dendrite-sync-api-server -f build/docker/Dockerfile.component .
|
docker build -t matrixdotorg/dendrite:syncapi --build-arg component=dendrite-sync-api-server -f build/docker/Dockerfile.component .
|
||||||
docker build -t matrixdotorg/dendrite:serverkeyapi --build-arg component=dendrite-server-key-api-server -f build/docker/Dockerfile.component .
|
docker build -t matrixdotorg/dendrite:signingkeyserver --build-arg component=dendrite-signing-key-server -f build/docker/Dockerfile.component .
|
||||||
docker build -t matrixdotorg/dendrite:userapi --build-arg component=dendrite-user-api-server -f build/docker/Dockerfile.component .
|
docker build -t matrixdotorg/dendrite:userapi --build-arg component=dendrite-user-api-server -f build/docker/Dockerfile.component .
|
||||||
|
|
|
@ -13,4 +13,5 @@ docker pull matrixdotorg/dendrite:keyserver
|
||||||
docker pull matrixdotorg/dendrite:mediaapi
|
docker pull matrixdotorg/dendrite:mediaapi
|
||||||
docker pull matrixdotorg/dendrite:roomserver
|
docker pull matrixdotorg/dendrite:roomserver
|
||||||
docker pull matrixdotorg/dendrite:syncapi
|
docker pull matrixdotorg/dendrite:syncapi
|
||||||
|
docker pull matrixdotorg/dendrite:signingkeyserver
|
||||||
docker pull matrixdotorg/dendrite:userapi
|
docker pull matrixdotorg/dendrite:userapi
|
||||||
|
|
|
@ -13,5 +13,5 @@ docker push matrixdotorg/dendrite:keyserver
|
||||||
docker push matrixdotorg/dendrite:mediaapi
|
docker push matrixdotorg/dendrite:mediaapi
|
||||||
docker push matrixdotorg/dendrite:roomserver
|
docker push matrixdotorg/dendrite:roomserver
|
||||||
docker push matrixdotorg/dendrite:syncapi
|
docker push matrixdotorg/dendrite:syncapi
|
||||||
docker push matrixdotorg/dendrite:serverkeyapi
|
docker push matrixdotorg/dendrite:signingkeyserver
|
||||||
docker push matrixdotorg/dendrite:userapi
|
docker push matrixdotorg/dendrite:userapi
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
for db in account device mediaapi syncapi roomserver serverkey keyserver federationsender appservice e2ekey naffka; do
|
for db in account device mediaapi syncapi roomserver signingkeyserver keyserver federationsender appservice e2ekey naffka; do
|
||||||
createdb -U dendrite -O dendrite dendrite_$db
|
createdb -U dendrite -O dendrite dendrite_$db
|
||||||
done
|
done
|
||||||
|
|
|
@ -94,7 +94,7 @@ func (m *DendriteMonolith) Start() {
|
||||||
cfg.MediaAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-mediaapi.db", m.StorageDirectory))
|
cfg.MediaAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-mediaapi.db", m.StorageDirectory))
|
||||||
cfg.SyncAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-syncapi.db", m.StorageDirectory))
|
cfg.SyncAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-syncapi.db", m.StorageDirectory))
|
||||||
cfg.RoomServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-roomserver.db", m.StorageDirectory))
|
cfg.RoomServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-roomserver.db", m.StorageDirectory))
|
||||||
cfg.ServerKeyAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-serverkey.db", m.StorageDirectory))
|
cfg.SigningKeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-signingkeyserver.db", m.StorageDirectory))
|
||||||
cfg.KeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-keyserver.db", m.StorageDirectory))
|
cfg.KeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-keyserver.db", m.StorageDirectory))
|
||||||
cfg.FederationSender.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-federationsender.db", m.StorageDirectory))
|
cfg.FederationSender.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-federationsender.db", m.StorageDirectory))
|
||||||
cfg.AppServiceAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-appservice.db", m.StorageDirectory))
|
cfg.AppServiceAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s/dendrite-p2p-appservice.db", m.StorageDirectory))
|
||||||
|
|
|
@ -36,7 +36,7 @@ import (
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/keyserver"
|
"github.com/matrix-org/dendrite/keyserver"
|
||||||
"github.com/matrix-org/dendrite/roomserver"
|
"github.com/matrix-org/dendrite/roomserver"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi"
|
"github.com/matrix-org/dendrite/signingkeyserver"
|
||||||
"github.com/matrix-org/dendrite/userapi"
|
"github.com/matrix-org/dendrite/userapi"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ func main() {
|
||||||
cfg.MediaAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-mediaapi.db", *instanceName))
|
cfg.MediaAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-mediaapi.db", *instanceName))
|
||||||
cfg.SyncAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-syncapi.db", *instanceName))
|
cfg.SyncAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-syncapi.db", *instanceName))
|
||||||
cfg.RoomServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-roomserver.db", *instanceName))
|
cfg.RoomServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-roomserver.db", *instanceName))
|
||||||
cfg.ServerKeyAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-serverkey.db", *instanceName))
|
cfg.SigningKeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-signingkeyserver.db", *instanceName))
|
||||||
cfg.FederationSender.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-federationsender.db", *instanceName))
|
cfg.FederationSender.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-federationsender.db", *instanceName))
|
||||||
cfg.AppServiceAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-appservice.db", *instanceName))
|
cfg.AppServiceAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-appservice.db", *instanceName))
|
||||||
cfg.Global.Kafka.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-naffka.db", *instanceName))
|
cfg.Global.Kafka.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-naffka.db", *instanceName))
|
||||||
|
@ -143,8 +143,8 @@ func main() {
|
||||||
userAPI := userapi.NewInternalAPI(accountDB, &cfg.UserAPI, nil, keyAPI)
|
userAPI := userapi.NewInternalAPI(accountDB, &cfg.UserAPI, nil, keyAPI)
|
||||||
keyAPI.SetUserAPI(userAPI)
|
keyAPI.SetUserAPI(userAPI)
|
||||||
|
|
||||||
serverKeyAPI := serverkeyapi.NewInternalAPI(
|
serverKeyAPI := signingkeyserver.NewInternalAPI(
|
||||||
&base.Base.Cfg.ServerKeyAPI, federation, base.Base.Caches,
|
&base.Base.Cfg.SigningKeyServer, federation, base.Base.Caches,
|
||||||
)
|
)
|
||||||
keyRing := serverKeyAPI.KeyRing()
|
keyRing := serverKeyAPI.KeyRing()
|
||||||
createKeyDB(
|
createKeyDB(
|
||||||
|
|
|
@ -78,7 +78,7 @@ func main() {
|
||||||
cfg.MediaAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-mediaapi.db", *instanceName))
|
cfg.MediaAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-mediaapi.db", *instanceName))
|
||||||
cfg.SyncAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-syncapi.db", *instanceName))
|
cfg.SyncAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-syncapi.db", *instanceName))
|
||||||
cfg.RoomServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-roomserver.db", *instanceName))
|
cfg.RoomServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-roomserver.db", *instanceName))
|
||||||
cfg.ServerKeyAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-serverkey.db", *instanceName))
|
cfg.SigningKeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-signingkeyserver.db", *instanceName))
|
||||||
cfg.KeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-keyserver.db", *instanceName))
|
cfg.KeyServer.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-keyserver.db", *instanceName))
|
||||||
cfg.FederationSender.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-federationsender.db", *instanceName))
|
cfg.FederationSender.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-federationsender.db", *instanceName))
|
||||||
cfg.AppServiceAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-appservice.db", *instanceName))
|
cfg.AppServiceAPI.Database.ConnectionString = config.DataSource(fmt.Sprintf("file:%s-appservice.db", *instanceName))
|
||||||
|
|
|
@ -26,7 +26,7 @@ func main() {
|
||||||
|
|
||||||
userAPI := base.UserAPIClient()
|
userAPI := base.UserAPIClient()
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
serverKeyAPI := base.ServerKeyAPIClient()
|
serverKeyAPI := base.SigningKeyServerHTTPClient()
|
||||||
keyRing := serverKeyAPI.KeyRing()
|
keyRing := serverKeyAPI.KeyRing()
|
||||||
fsAPI := base.FederationSenderHTTPClient()
|
fsAPI := base.FederationSenderHTTPClient()
|
||||||
rsAPI := base.RoomserverHTTPClient()
|
rsAPI := base.RoomserverHTTPClient()
|
||||||
|
|
|
@ -26,7 +26,7 @@ func main() {
|
||||||
|
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
|
|
||||||
serverKeyAPI := base.ServerKeyAPIClient()
|
serverKeyAPI := base.SigningKeyServerHTTPClient()
|
||||||
keyRing := serverKeyAPI.KeyRing()
|
keyRing := serverKeyAPI.KeyRing()
|
||||||
|
|
||||||
rsAPI := base.RoomserverHTTPClient()
|
rsAPI := base.RoomserverHTTPClient()
|
||||||
|
|
|
@ -27,7 +27,7 @@ import (
|
||||||
"github.com/matrix-org/dendrite/keyserver"
|
"github.com/matrix-org/dendrite/keyserver"
|
||||||
"github.com/matrix-org/dendrite/roomserver"
|
"github.com/matrix-org/dendrite/roomserver"
|
||||||
"github.com/matrix-org/dendrite/roomserver/api"
|
"github.com/matrix-org/dendrite/roomserver/api"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi"
|
"github.com/matrix-org/dendrite/signingkeyserver"
|
||||||
"github.com/matrix-org/dendrite/userapi"
|
"github.com/matrix-org/dendrite/userapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ func main() {
|
||||||
cfg.KeyServer.InternalAPI.Connect = httpAddr
|
cfg.KeyServer.InternalAPI.Connect = httpAddr
|
||||||
cfg.MediaAPI.InternalAPI.Connect = httpAddr
|
cfg.MediaAPI.InternalAPI.Connect = httpAddr
|
||||||
cfg.RoomServer.InternalAPI.Connect = httpAddr
|
cfg.RoomServer.InternalAPI.Connect = httpAddr
|
||||||
cfg.ServerKeyAPI.InternalAPI.Connect = httpAddr
|
cfg.SigningKeyServer.InternalAPI.Connect = httpAddr
|
||||||
cfg.SyncAPI.InternalAPI.Connect = httpAddr
|
cfg.SyncAPI.InternalAPI.Connect = httpAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,14 +68,14 @@ func main() {
|
||||||
accountDB := base.CreateAccountsDB()
|
accountDB := base.CreateAccountsDB()
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
|
|
||||||
serverKeyAPI := serverkeyapi.NewInternalAPI(
|
skAPI := signingkeyserver.NewInternalAPI(
|
||||||
&base.Cfg.ServerKeyAPI, federation, base.Caches,
|
&base.Cfg.SigningKeyServer, federation, base.Caches,
|
||||||
)
|
)
|
||||||
if base.UseHTTPAPIs {
|
if base.UseHTTPAPIs {
|
||||||
serverkeyapi.AddInternalRoutes(base.InternalAPIMux, serverKeyAPI, base.Caches)
|
signingkeyserver.AddInternalRoutes(base.InternalAPIMux, skAPI, base.Caches)
|
||||||
serverKeyAPI = base.ServerKeyAPIClient()
|
skAPI = base.SigningKeyServerHTTPClient()
|
||||||
}
|
}
|
||||||
keyRing := serverKeyAPI.KeyRing()
|
keyRing := skAPI.KeyRing()
|
||||||
|
|
||||||
rsImpl := roomserver.NewInternalAPI(
|
rsImpl := roomserver.NewInternalAPI(
|
||||||
base, keyRing,
|
base, keyRing,
|
||||||
|
@ -134,7 +134,7 @@ func main() {
|
||||||
EDUInternalAPI: eduInputAPI,
|
EDUInternalAPI: eduInputAPI,
|
||||||
FederationSenderAPI: fsAPI,
|
FederationSenderAPI: fsAPI,
|
||||||
RoomserverAPI: rsAPI,
|
RoomserverAPI: rsAPI,
|
||||||
ServerKeyAPI: serverKeyAPI,
|
ServerKeyAPI: skAPI,
|
||||||
UserAPI: userAPI,
|
UserAPI: userAPI,
|
||||||
KeyAPI: keyAPI,
|
KeyAPI: keyAPI,
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ func main() {
|
||||||
base := setup.NewBaseDendrite(cfg, "RoomServerAPI", true)
|
base := setup.NewBaseDendrite(cfg, "RoomServerAPI", true)
|
||||||
defer base.Close() // nolint: errcheck
|
defer base.Close() // nolint: errcheck
|
||||||
|
|
||||||
serverKeyAPI := base.ServerKeyAPIClient()
|
serverKeyAPI := base.SigningKeyServerHTTPClient()
|
||||||
keyRing := serverKeyAPI.KeyRing()
|
keyRing := serverKeyAPI.KeyRing()
|
||||||
|
|
||||||
fsAPI := base.FederationSenderHTTPClient()
|
fsAPI := base.FederationSenderHTTPClient()
|
||||||
|
|
|
@ -16,21 +16,21 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi"
|
"github.com/matrix-org/dendrite/signingkeyserver"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cfg := setup.ParseFlags(false)
|
cfg := setup.ParseFlags(false)
|
||||||
base := setup.NewBaseDendrite(cfg, "ServerKeyAPI", true)
|
base := setup.NewBaseDendrite(cfg, "SigningKeyServer", true)
|
||||||
defer base.Close() // nolint: errcheck
|
defer base.Close() // nolint: errcheck
|
||||||
|
|
||||||
federation := base.CreateFederationClient()
|
federation := base.CreateFederationClient()
|
||||||
|
|
||||||
intAPI := serverkeyapi.NewInternalAPI(&base.Cfg.ServerKeyAPI, federation, base.Caches)
|
intAPI := signingkeyserver.NewInternalAPI(&base.Cfg.SigningKeyServer, federation, base.Caches)
|
||||||
serverkeyapi.AddInternalRoutes(base.InternalAPIMux, intAPI, base.Caches)
|
signingkeyserver.AddInternalRoutes(base.InternalAPIMux, intAPI, base.Caches)
|
||||||
|
|
||||||
base.SetupAndServeHTTP(
|
base.SetupAndServeHTTP(
|
||||||
base.Cfg.ServerKeyAPI.InternalAPI.Listen,
|
base.Cfg.SigningKeyServer.InternalAPI.Listen,
|
||||||
setup.NoExternalListener,
|
setup.NoExternalListener,
|
||||||
nil, nil,
|
nil, nil,
|
||||||
)
|
)
|
|
@ -168,7 +168,7 @@ func main() {
|
||||||
cfg.FederationSender.Database.ConnectionString = "file:/idb/dendritejs_fedsender.db"
|
cfg.FederationSender.Database.ConnectionString = "file:/idb/dendritejs_fedsender.db"
|
||||||
cfg.MediaAPI.Database.ConnectionString = "file:/idb/dendritejs_mediaapi.db"
|
cfg.MediaAPI.Database.ConnectionString = "file:/idb/dendritejs_mediaapi.db"
|
||||||
cfg.RoomServer.Database.ConnectionString = "file:/idb/dendritejs_roomserver.db"
|
cfg.RoomServer.Database.ConnectionString = "file:/idb/dendritejs_roomserver.db"
|
||||||
cfg.ServerKeyAPI.Database.ConnectionString = "file:/idb/dendritejs_serverkey.db"
|
cfg.SigningKeyServer.Database.ConnectionString = "file:/idb/dendritejs_signingkeyserver.db"
|
||||||
cfg.SyncAPI.Database.ConnectionString = "file:/idb/dendritejs_syncapi.db"
|
cfg.SyncAPI.Database.ConnectionString = "file:/idb/dendritejs_syncapi.db"
|
||||||
cfg.KeyServer.Database.ConnectionString = "file:/idb/dendritejs_e2ekey.db"
|
cfg.KeyServer.Database.ConnectionString = "file:/idb/dendritejs_e2ekey.db"
|
||||||
cfg.Global.Kafka.UseNaffka = true
|
cfg.Global.Kafka.UseNaffka = true
|
||||||
|
|
|
@ -27,7 +27,7 @@ func main() {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
cfg.ServerKeyAPI.KeyPerspectives = config.KeyPerspectives{
|
cfg.SigningKeyServer.KeyPerspectives = config.KeyPerspectives{
|
||||||
{
|
{
|
||||||
ServerName: "matrix.org",
|
ServerName: "matrix.org",
|
||||||
Keys: []config.KeyPerspectiveTrustKey{
|
Keys: []config.KeyPerspectiveTrustKey{
|
||||||
|
|
|
@ -252,13 +252,13 @@ room_server:
|
||||||
max_idle_conns: 2
|
max_idle_conns: 2
|
||||||
conn_max_lifetime: -1
|
conn_max_lifetime: -1
|
||||||
|
|
||||||
# Configuration for the Server Key API (for server signing keys).
|
# Configuration for the Signing Key Server (for server signing keys).
|
||||||
server_key_api:
|
signing_key_server:
|
||||||
internal_api:
|
internal_api:
|
||||||
listen: http://localhost:7780
|
listen: http://localhost:7780
|
||||||
connect: http://localhost:7780
|
connect: http://localhost:7780
|
||||||
database:
|
database:
|
||||||
connection_string: file:serverkeyapi.db
|
connection_string: file:signingkeyserver.db
|
||||||
max_open_conns: 100
|
max_open_conns: 100
|
||||||
max_idle_conns: 2
|
max_idle_conns: 2
|
||||||
conn_max_lifetime: -1
|
conn_max_lifetime: -1
|
||||||
|
|
|
@ -109,7 +109,7 @@ Assuming that Postgres 9.5 (or later) is installed:
|
||||||
* Create the component databases:
|
* Create the component databases:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
for i in account device mediaapi syncapi roomserver serverkey federationsender appservice e2ekey naffka; do
|
for i in account device mediaapi syncapi roomserver signingkeyserver federationsender appservice e2ekey naffka; do
|
||||||
sudo -u postgres createdb -O dendrite dendrite_$i
|
sudo -u postgres createdb -O dendrite dendrite_$i
|
||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
|
@ -62,7 +62,7 @@ type Dendrite struct {
|
||||||
KeyServer KeyServer `yaml:"key_server"`
|
KeyServer KeyServer `yaml:"key_server"`
|
||||||
MediaAPI MediaAPI `yaml:"media_api"`
|
MediaAPI MediaAPI `yaml:"media_api"`
|
||||||
RoomServer RoomServer `yaml:"room_server"`
|
RoomServer RoomServer `yaml:"room_server"`
|
||||||
ServerKeyAPI ServerKeyAPI `yaml:"server_key_api"`
|
SigningKeyServer SigningKeyServer `yaml:"signing_key_server"`
|
||||||
SyncAPI SyncAPI `yaml:"sync_api"`
|
SyncAPI SyncAPI `yaml:"sync_api"`
|
||||||
UserAPI UserAPI `yaml:"user_api"`
|
UserAPI UserAPI `yaml:"user_api"`
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ func (c *Dendrite) Defaults() {
|
||||||
c.KeyServer.Defaults()
|
c.KeyServer.Defaults()
|
||||||
c.MediaAPI.Defaults()
|
c.MediaAPI.Defaults()
|
||||||
c.RoomServer.Defaults()
|
c.RoomServer.Defaults()
|
||||||
c.ServerKeyAPI.Defaults()
|
c.SigningKeyServer.Defaults()
|
||||||
c.SyncAPI.Defaults()
|
c.SyncAPI.Defaults()
|
||||||
c.UserAPI.Defaults()
|
c.UserAPI.Defaults()
|
||||||
c.AppServiceAPI.Defaults()
|
c.AppServiceAPI.Defaults()
|
||||||
|
@ -318,7 +318,7 @@ func (c *Dendrite) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
||||||
&c.Global, &c.ClientAPI,
|
&c.Global, &c.ClientAPI,
|
||||||
&c.EDUServer, &c.FederationAPI, &c.FederationSender,
|
&c.EDUServer, &c.FederationAPI, &c.FederationSender,
|
||||||
&c.KeyServer, &c.MediaAPI, &c.RoomServer,
|
&c.KeyServer, &c.MediaAPI, &c.RoomServer,
|
||||||
&c.ServerKeyAPI, &c.SyncAPI, &c.UserAPI,
|
&c.SigningKeyServer, &c.SyncAPI, &c.UserAPI,
|
||||||
&c.AppServiceAPI,
|
&c.AppServiceAPI,
|
||||||
} {
|
} {
|
||||||
c.Verify(configErrs, isMonolith)
|
c.Verify(configErrs, isMonolith)
|
||||||
|
@ -333,7 +333,7 @@ func (c *Dendrite) Wiring() {
|
||||||
c.KeyServer.Matrix = &c.Global
|
c.KeyServer.Matrix = &c.Global
|
||||||
c.MediaAPI.Matrix = &c.Global
|
c.MediaAPI.Matrix = &c.Global
|
||||||
c.RoomServer.Matrix = &c.Global
|
c.RoomServer.Matrix = &c.Global
|
||||||
c.ServerKeyAPI.Matrix = &c.Global
|
c.SigningKeyServer.Matrix = &c.Global
|
||||||
c.SyncAPI.Matrix = &c.Global
|
c.SyncAPI.Matrix = &c.Global
|
||||||
c.UserAPI.Matrix = &c.Global
|
c.UserAPI.Matrix = &c.Global
|
||||||
c.AppServiceAPI.Matrix = &c.Global
|
c.AppServiceAPI.Matrix = &c.Global
|
||||||
|
@ -524,13 +524,13 @@ func (config *Dendrite) FederationSenderURL() string {
|
||||||
return string(config.FederationSender.InternalAPI.Connect)
|
return string(config.FederationSender.InternalAPI.Connect)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServerKeyAPIURL returns an HTTP URL for where the server key API is listening.
|
// SigningKeyServerURL returns an HTTP URL for where the signing key server is listening.
|
||||||
func (config *Dendrite) ServerKeyAPIURL() string {
|
func (config *Dendrite) SigningKeyServerURL() string {
|
||||||
// Hard code the server key API server to talk HTTP for now.
|
// Hard code the signing key server to talk HTTP for now.
|
||||||
// If we support HTTPS we need to think of a practical way to do certificate validation.
|
// If we support HTTPS we need to think of a practical way to do certificate validation.
|
||||||
// People setting up servers shouldn't need to get a certificate valid for the public
|
// People setting up servers shouldn't need to get a certificate valid for the public
|
||||||
// internet for an internal API.
|
// internet for an internal API.
|
||||||
return string(config.ServerKeyAPI.InternalAPI.Connect)
|
return string(config.SigningKeyServer.InternalAPI.Connect)
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyServerURL returns an HTTP URL for where the key server is listening.
|
// KeyServerURL returns an HTTP URL for where the key server is listening.
|
||||||
|
|
|
@ -2,12 +2,12 @@ package config
|
||||||
|
|
||||||
import "github.com/matrix-org/gomatrixserverlib"
|
import "github.com/matrix-org/gomatrixserverlib"
|
||||||
|
|
||||||
type ServerKeyAPI struct {
|
type SigningKeyServer struct {
|
||||||
Matrix *Global `yaml:"-"`
|
Matrix *Global `yaml:"-"`
|
||||||
|
|
||||||
InternalAPI InternalAPIOptions `yaml:"internal_api"`
|
InternalAPI InternalAPIOptions `yaml:"internal_api"`
|
||||||
|
|
||||||
// The ServerKey database caches the public keys of remote servers.
|
// The SigningKeyServer database caches the public keys of remote servers.
|
||||||
// It may be accessed by the FederationAPI, the ClientAPI, and the MediaAPI.
|
// It may be accessed by the FederationAPI, the ClientAPI, and the MediaAPI.
|
||||||
Database DatabaseOptions `yaml:"database"`
|
Database DatabaseOptions `yaml:"database"`
|
||||||
|
|
||||||
|
@ -19,17 +19,17 @@ type ServerKeyAPI struct {
|
||||||
PreferDirectFetch bool `yaml:"prefer_direct_fetch"`
|
PreferDirectFetch bool `yaml:"prefer_direct_fetch"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ServerKeyAPI) Defaults() {
|
func (c *SigningKeyServer) Defaults() {
|
||||||
c.InternalAPI.Listen = "http://localhost:7780"
|
c.InternalAPI.Listen = "http://localhost:7780"
|
||||||
c.InternalAPI.Connect = "http://localhost:7780"
|
c.InternalAPI.Connect = "http://localhost:7780"
|
||||||
c.Database.Defaults()
|
c.Database.Defaults()
|
||||||
c.Database.ConnectionString = "file:serverkeyapi.db"
|
c.Database.ConnectionString = "file:signingkeyserver.db"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ServerKeyAPI) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
func (c *SigningKeyServer) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
||||||
checkURL(configErrs, "server_key_api.internal_api.listen", string(c.InternalAPI.Listen))
|
checkURL(configErrs, "signing_key_server.internal_api.listen", string(c.InternalAPI.Listen))
|
||||||
checkURL(configErrs, "server_key_api.internal_api.bind", string(c.InternalAPI.Connect))
|
checkURL(configErrs, "signing_key_server.internal_api.bind", string(c.InternalAPI.Connect))
|
||||||
checkNotEmpty(configErrs, "server_key_api.database.connection_string", string(c.Database.ConnectionString))
|
checkNotEmpty(configErrs, "signing_key_server.database.connection_string", string(c.Database.ConnectionString))
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeyPerspectives are used to configure perspective key servers for
|
// KeyPerspectives are used to configure perspective key servers for
|
|
@ -46,8 +46,8 @@ import (
|
||||||
keyinthttp "github.com/matrix-org/dendrite/keyserver/inthttp"
|
keyinthttp "github.com/matrix-org/dendrite/keyserver/inthttp"
|
||||||
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||||
rsinthttp "github.com/matrix-org/dendrite/roomserver/inthttp"
|
rsinthttp "github.com/matrix-org/dendrite/roomserver/inthttp"
|
||||||
serverKeyAPI "github.com/matrix-org/dendrite/serverkeyapi/api"
|
skapi "github.com/matrix-org/dendrite/signingkeyserver/api"
|
||||||
skinthttp "github.com/matrix-org/dendrite/serverkeyapi/inthttp"
|
skinthttp "github.com/matrix-org/dendrite/signingkeyserver/inthttp"
|
||||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||||
userapiinthttp "github.com/matrix-org/dendrite/userapi/inthttp"
|
userapiinthttp "github.com/matrix-org/dendrite/userapi/inthttp"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -208,15 +208,15 @@ func (b *BaseDendrite) FederationSenderHTTPClient() federationSenderAPI.Federati
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServerKeyAPIClient returns ServerKeyInternalAPI for hitting the server key API over HTTP
|
// SigningKeyServerHTTPClient returns SigningKeyServer for hitting the signing key server over HTTP
|
||||||
func (b *BaseDendrite) ServerKeyAPIClient() serverKeyAPI.ServerKeyInternalAPI {
|
func (b *BaseDendrite) SigningKeyServerHTTPClient() skapi.SigningKeyServerAPI {
|
||||||
f, err := skinthttp.NewServerKeyClient(
|
f, err := skinthttp.NewSigningKeyServerClient(
|
||||||
b.Cfg.ServerKeyAPIURL(),
|
b.Cfg.SigningKeyServerURL(),
|
||||||
b.apiHttpClient,
|
b.apiHttpClient,
|
||||||
b.Caches,
|
b.Caches,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Panic("NewServerKeyInternalAPIHTTP failed", b.httpClient)
|
logrus.WithError(err).Panic("SigningKeyServerHTTPClient failed", b.httpClient)
|
||||||
}
|
}
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import (
|
||||||
keyAPI "github.com/matrix-org/dendrite/keyserver/api"
|
keyAPI "github.com/matrix-org/dendrite/keyserver/api"
|
||||||
"github.com/matrix-org/dendrite/mediaapi"
|
"github.com/matrix-org/dendrite/mediaapi"
|
||||||
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||||
serverKeyAPI "github.com/matrix-org/dendrite/serverkeyapi/api"
|
serverKeyAPI "github.com/matrix-org/dendrite/signingkeyserver/api"
|
||||||
"github.com/matrix-org/dendrite/syncapi"
|
"github.com/matrix-org/dendrite/syncapi"
|
||||||
userapi "github.com/matrix-org/dendrite/userapi/api"
|
userapi "github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/matrix-org/dendrite/userapi/storage/accounts"
|
"github.com/matrix-org/dendrite/userapi/storage/accounts"
|
||||||
|
@ -50,7 +50,7 @@ type Monolith struct {
|
||||||
EDUInternalAPI eduServerAPI.EDUServerInputAPI
|
EDUInternalAPI eduServerAPI.EDUServerInputAPI
|
||||||
FederationSenderAPI federationSenderAPI.FederationSenderInternalAPI
|
FederationSenderAPI federationSenderAPI.FederationSenderInternalAPI
|
||||||
RoomserverAPI roomserverAPI.RoomserverInternalAPI
|
RoomserverAPI roomserverAPI.RoomserverInternalAPI
|
||||||
ServerKeyAPI serverKeyAPI.ServerKeyInternalAPI
|
ServerKeyAPI serverKeyAPI.SigningKeyServerAPI
|
||||||
UserAPI userapi.UserInternalAPI
|
UserAPI userapi.UserInternalAPI
|
||||||
KeyAPI keyAPI.KeyInternalAPI
|
KeyAPI keyAPI.KeyInternalAPI
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ func MakeConfig(configDir, kafkaURI, database, host string, startPort int) (*con
|
||||||
cfg.KeyServer.Database.ConnectionString = config.DataSource(database)
|
cfg.KeyServer.Database.ConnectionString = config.DataSource(database)
|
||||||
cfg.MediaAPI.Database.ConnectionString = config.DataSource(database)
|
cfg.MediaAPI.Database.ConnectionString = config.DataSource(database)
|
||||||
cfg.RoomServer.Database.ConnectionString = config.DataSource(database)
|
cfg.RoomServer.Database.ConnectionString = config.DataSource(database)
|
||||||
cfg.ServerKeyAPI.Database.ConnectionString = config.DataSource(database)
|
cfg.SigningKeyServer.Database.ConnectionString = config.DataSource(database)
|
||||||
cfg.SyncAPI.Database.ConnectionString = config.DataSource(database)
|
cfg.SyncAPI.Database.ConnectionString = config.DataSource(database)
|
||||||
cfg.UserAPI.AccountDatabase.ConnectionString = config.DataSource(database)
|
cfg.UserAPI.AccountDatabase.ConnectionString = config.DataSource(database)
|
||||||
cfg.UserAPI.DeviceDatabase.ConnectionString = config.DataSource(database)
|
cfg.UserAPI.DeviceDatabase.ConnectionString = config.DataSource(database)
|
||||||
|
@ -104,7 +104,7 @@ func MakeConfig(configDir, kafkaURI, database, host string, startPort int) (*con
|
||||||
cfg.KeyServer.InternalAPI.Listen = assignAddress()
|
cfg.KeyServer.InternalAPI.Listen = assignAddress()
|
||||||
cfg.MediaAPI.InternalAPI.Listen = assignAddress()
|
cfg.MediaAPI.InternalAPI.Listen = assignAddress()
|
||||||
cfg.RoomServer.InternalAPI.Listen = assignAddress()
|
cfg.RoomServer.InternalAPI.Listen = assignAddress()
|
||||||
cfg.ServerKeyAPI.InternalAPI.Listen = assignAddress()
|
cfg.SigningKeyServer.InternalAPI.Listen = assignAddress()
|
||||||
cfg.SyncAPI.InternalAPI.Listen = assignAddress()
|
cfg.SyncAPI.InternalAPI.Listen = assignAddress()
|
||||||
cfg.UserAPI.InternalAPI.Listen = assignAddress()
|
cfg.UserAPI.InternalAPI.Listen = assignAddress()
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ func MakeConfig(configDir, kafkaURI, database, host string, startPort int) (*con
|
||||||
cfg.KeyServer.InternalAPI.Connect = cfg.KeyServer.InternalAPI.Listen
|
cfg.KeyServer.InternalAPI.Connect = cfg.KeyServer.InternalAPI.Listen
|
||||||
cfg.MediaAPI.InternalAPI.Connect = cfg.MediaAPI.InternalAPI.Listen
|
cfg.MediaAPI.InternalAPI.Connect = cfg.MediaAPI.InternalAPI.Listen
|
||||||
cfg.RoomServer.InternalAPI.Connect = cfg.RoomServer.InternalAPI.Listen
|
cfg.RoomServer.InternalAPI.Connect = cfg.RoomServer.InternalAPI.Listen
|
||||||
cfg.ServerKeyAPI.InternalAPI.Connect = cfg.ServerKeyAPI.InternalAPI.Listen
|
cfg.SigningKeyServer.InternalAPI.Connect = cfg.SigningKeyServer.InternalAPI.Listen
|
||||||
cfg.SyncAPI.InternalAPI.Connect = cfg.SyncAPI.InternalAPI.Listen
|
cfg.SyncAPI.InternalAPI.Connect = cfg.SyncAPI.InternalAPI.Listen
|
||||||
cfg.UserAPI.InternalAPI.Connect = cfg.UserAPI.InternalAPI.Listen
|
cfg.UserAPI.InternalAPI.Connect = cfg.UserAPI.InternalAPI.Listen
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ func NewInternalAPI(
|
||||||
cfg := &base.Cfg.RoomServer
|
cfg := &base.Cfg.RoomServer
|
||||||
|
|
||||||
var perspectiveServerNames []gomatrixserverlib.ServerName
|
var perspectiveServerNames []gomatrixserverlib.ServerName
|
||||||
for _, kp := range base.Cfg.ServerKeyAPI.KeyPerspectives {
|
for _, kp := range base.Cfg.SigningKeyServer.KeyPerspectives {
|
||||||
perspectiveServerNames = append(perspectiveServerNames, kp.ServerName)
|
perspectiveServerNames = append(perspectiveServerNames, kp.ServerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServerKeyInternalAPI interface {
|
type SigningKeyServerAPI interface {
|
||||||
gomatrixserverlib.KeyDatabase
|
gomatrixserverlib.KeyDatabase
|
||||||
|
|
||||||
KeyRing() *gomatrixserverlib.KeyRing
|
KeyRing() *gomatrixserverlib.KeyRing
|
|
@ -7,13 +7,13 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/internal/config"
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/api"
|
"github.com/matrix-org/dendrite/signingkeyserver/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServerKeyAPI struct {
|
type ServerKeyAPI struct {
|
||||||
api.ServerKeyInternalAPI
|
api.SigningKeyServerAPI
|
||||||
|
|
||||||
ServerName gomatrixserverlib.ServerName
|
ServerName gomatrixserverlib.ServerName
|
||||||
ServerPublicKey ed25519.PublicKey
|
ServerPublicKey ed25519.PublicKey
|
|
@ -7,26 +7,26 @@ import (
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/internal/caching"
|
"github.com/matrix-org/dendrite/internal/caching"
|
||||||
"github.com/matrix-org/dendrite/internal/httputil"
|
"github.com/matrix-org/dendrite/internal/httputil"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/api"
|
"github.com/matrix-org/dendrite/signingkeyserver/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/opentracing/opentracing-go"
|
"github.com/opentracing/opentracing-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTP paths for the internal HTTP APIs
|
// HTTP paths for the internal HTTP APIs
|
||||||
const (
|
const (
|
||||||
ServerKeyInputPublicKeyPath = "/serverkeyapi/inputPublicKey"
|
ServerKeyInputPublicKeyPath = "/signingkeyserver/inputPublicKey"
|
||||||
ServerKeyQueryPublicKeyPath = "/serverkeyapi/queryPublicKey"
|
ServerKeyQueryPublicKeyPath = "/signingkeyserver/queryPublicKey"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewServerKeyClient creates a ServerKeyInternalAPI implemented by talking to a HTTP POST API.
|
// NewSigningKeyServerClient creates a SigningKeyServerAPI implemented by talking to a HTTP POST API.
|
||||||
// If httpClient is nil an error is returned
|
// If httpClient is nil an error is returned
|
||||||
func NewServerKeyClient(
|
func NewSigningKeyServerClient(
|
||||||
serverKeyAPIURL string,
|
serverKeyAPIURL string,
|
||||||
httpClient *http.Client,
|
httpClient *http.Client,
|
||||||
cache caching.ServerKeyCache,
|
cache caching.ServerKeyCache,
|
||||||
) (api.ServerKeyInternalAPI, error) {
|
) (api.SigningKeyServerAPI, error) {
|
||||||
if httpClient == nil {
|
if httpClient == nil {
|
||||||
return nil, errors.New("NewRoomserverInternalAPIHTTP: httpClient is <nil>")
|
return nil, errors.New("NewSigningKeyServerClient: httpClient is <nil>")
|
||||||
}
|
}
|
||||||
return &httpServerKeyInternalAPI{
|
return &httpServerKeyInternalAPI{
|
||||||
serverKeyAPIURL: serverKeyAPIURL,
|
serverKeyAPIURL: serverKeyAPIURL,
|
|
@ -7,11 +7,11 @@ import (
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/matrix-org/dendrite/internal/caching"
|
"github.com/matrix-org/dendrite/internal/caching"
|
||||||
"github.com/matrix-org/dendrite/internal/httputil"
|
"github.com/matrix-org/dendrite/internal/httputil"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/api"
|
"github.com/matrix-org/dendrite/signingkeyserver/api"
|
||||||
"github.com/matrix-org/util"
|
"github.com/matrix-org/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func AddRoutes(s api.ServerKeyInternalAPI, internalAPIMux *mux.Router, cache caching.ServerKeyCache) {
|
func AddRoutes(s api.SigningKeyServerAPI, internalAPIMux *mux.Router, cache caching.ServerKeyCache) {
|
||||||
internalAPIMux.Handle(ServerKeyQueryPublicKeyPath,
|
internalAPIMux.Handle(ServerKeyQueryPublicKeyPath,
|
||||||
httputil.MakeInternalAPI("queryPublicKeys", func(req *http.Request) util.JSONResponse {
|
httputil.MakeInternalAPI("queryPublicKeys", func(req *http.Request) util.JSONResponse {
|
||||||
request := api.QueryPublicKeysRequest{}
|
request := api.QueryPublicKeysRequest{}
|
|
@ -1,4 +1,4 @@
|
||||||
package serverkeyapi
|
package signingkeyserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -16,18 +16,18 @@ import (
|
||||||
"github.com/matrix-org/dendrite/federationapi/routing"
|
"github.com/matrix-org/dendrite/federationapi/routing"
|
||||||
"github.com/matrix-org/dendrite/internal/caching"
|
"github.com/matrix-org/dendrite/internal/caching"
|
||||||
"github.com/matrix-org/dendrite/internal/config"
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/api"
|
"github.com/matrix-org/dendrite/signingkeyserver/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
type server struct {
|
type server struct {
|
||||||
name gomatrixserverlib.ServerName // server name
|
name gomatrixserverlib.ServerName // server name
|
||||||
validity time.Duration // key validity duration from now
|
validity time.Duration // key validity duration from now
|
||||||
config *config.ServerKeyAPI // skeleton config, from TestMain
|
config *config.SigningKeyServer // skeleton config, from TestMain
|
||||||
fedconfig *config.FederationAPI //
|
fedconfig *config.FederationAPI //
|
||||||
fedclient *gomatrixserverlib.FederationClient // uses MockRoundTripper
|
fedclient *gomatrixserverlib.FederationClient // uses MockRoundTripper
|
||||||
cache *caching.Caches // server-specific cache
|
cache *caching.Caches // server-specific cache
|
||||||
api api.ServerKeyInternalAPI // server-specific server key API
|
api api.SigningKeyServerAPI // server-specific server key API
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) renew() {
|
func (s *server) renew() {
|
||||||
|
@ -76,8 +76,8 @@ func TestMain(m *testing.M) {
|
||||||
cfg.Global.PrivateKey = testPriv
|
cfg.Global.PrivateKey = testPriv
|
||||||
cfg.Global.KeyID = serverKeyID
|
cfg.Global.KeyID = serverKeyID
|
||||||
cfg.Global.KeyValidityPeriod = s.validity
|
cfg.Global.KeyValidityPeriod = s.validity
|
||||||
cfg.ServerKeyAPI.Database.ConnectionString = config.DataSource("file::memory:")
|
cfg.SigningKeyServer.Database.ConnectionString = config.DataSource("file::memory:")
|
||||||
s.config = &cfg.ServerKeyAPI
|
s.config = &cfg.SigningKeyServer
|
||||||
s.fedconfig = &cfg.FederationAPI
|
s.fedconfig = &cfg.FederationAPI
|
||||||
|
|
||||||
// Create a transport which redirects federation requests to
|
// Create a transport which redirects federation requests to
|
|
@ -1,4 +1,4 @@
|
||||||
package serverkeyapi
|
package signingkeyserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ed25519"
|
"crypto/ed25519"
|
||||||
|
@ -7,28 +7,28 @@ import (
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/matrix-org/dendrite/internal/caching"
|
"github.com/matrix-org/dendrite/internal/caching"
|
||||||
"github.com/matrix-org/dendrite/internal/config"
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/api"
|
"github.com/matrix-org/dendrite/signingkeyserver/api"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/internal"
|
"github.com/matrix-org/dendrite/signingkeyserver/internal"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/inthttp"
|
"github.com/matrix-org/dendrite/signingkeyserver/inthttp"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/storage"
|
"github.com/matrix-org/dendrite/signingkeyserver/storage"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/storage/cache"
|
"github.com/matrix-org/dendrite/signingkeyserver/storage/cache"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AddInternalRoutes registers HTTP handlers for the internal API. Invokes functions
|
// AddInternalRoutes registers HTTP handlers for the internal API. Invokes functions
|
||||||
// on the given input API.
|
// on the given input API.
|
||||||
func AddInternalRoutes(router *mux.Router, intAPI api.ServerKeyInternalAPI, caches *caching.Caches) {
|
func AddInternalRoutes(router *mux.Router, intAPI api.SigningKeyServerAPI, caches *caching.Caches) {
|
||||||
inthttp.AddRoutes(intAPI, router, caches)
|
inthttp.AddRoutes(intAPI, router, caches)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInternalAPI returns a concerete implementation of the internal API. Callers
|
// NewInternalAPI returns a concerete implementation of the internal API. Callers
|
||||||
// can call functions directly on the returned API or via an HTTP interface using AddInternalRoutes.
|
// can call functions directly on the returned API or via an HTTP interface using AddInternalRoutes.
|
||||||
func NewInternalAPI(
|
func NewInternalAPI(
|
||||||
cfg *config.ServerKeyAPI,
|
cfg *config.SigningKeyServer,
|
||||||
fedClient gomatrixserverlib.KeyClient,
|
fedClient gomatrixserverlib.KeyClient,
|
||||||
caches *caching.Caches,
|
caches *caching.Caches,
|
||||||
) api.ServerKeyInternalAPI {
|
) api.SigningKeyServerAPI {
|
||||||
innerDB, err := storage.NewDatabase(
|
innerDB, err := storage.NewDatabase(
|
||||||
&cfg.Database,
|
&cfg.Database,
|
||||||
cfg.Matrix.ServerName,
|
cfg.Matrix.ServerName,
|
|
@ -22,8 +22,8 @@ import (
|
||||||
"golang.org/x/crypto/ed25519"
|
"golang.org/x/crypto/ed25519"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/internal/config"
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/storage/postgres"
|
"github.com/matrix-org/dendrite/signingkeyserver/storage/postgres"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/storage/sqlite3"
|
"github.com/matrix-org/dendrite/signingkeyserver/storage/sqlite3"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
"golang.org/x/crypto/ed25519"
|
"golang.org/x/crypto/ed25519"
|
||||||
|
|
||||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||||
"github.com/matrix-org/dendrite/serverkeyapi/storage/sqlite3"
|
"github.com/matrix-org/dendrite/signingkeyserver/storage/sqlite3"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue