Skip to content

Commit b841a77

Browse files
committed
match authenticated user and principal before signing certificate for user
1 parent e08c602 commit b841a77

File tree

14 files changed

+1007
-963
lines changed

14 files changed

+1007
-963
lines changed

go-ssh-signer/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ type AccessToken struct {
6363
type SignRequest struct {
6464
Filename string `json:"filename"`
6565
PublicKey string `json:"publicKey"`
66-
Hostname string `json:"data"`
66+
Hostname string `json:"principal"`
6767
}
6868

6969
type SignedResponse struct {

ssh-key-signer-server/environment-setup/dev/docker/docker-compose.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ssh-key-signer
1+
name: dev-ca
22

33
networks:
44
local:
@@ -24,7 +24,6 @@ services:
2424
interval: 5s
2525
timeout: 2s
2626
retries: 15
27-
container_name: app_db
2827
networks:
2928
- local
3029
sso:
@@ -55,18 +54,16 @@ services:
5554
timeout: 2s
5655
retries: 15
5756
command: --verbose start-dev --health-enabled=true --import-realm
58-
container_name: app_sso
5957
networks:
6058
- local
6159
sso-init:
6260
image: node:latest
63-
container_name: sso-init
6461
depends_on:
6562
sso:
6663
condition: service_healthy
6764
volumes:
6865
- ./keycloak/init.js:/tmp/init.js
69-
entrypoint: ["node", "/tmp/init.js"]
66+
entrypoint: [ "node", "/tmp/init.js" ]
7067
environment:
7168
KC_ADMIN_USERNAME: admin
7269
KC_ADMIN_PASSWORD: admin

ssh-key-signer-server/environment-setup/dev/docker/keycloak/init.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@
1111
do not share the secret key in public
1212
*/
1313
const clientSecret = 'UTRtYkyYN1nbgdPPbBru1FDVsE8ye5JE';
14+
const testUserNames = ["user", "binarycodes"]
1415

15-
const users = [{
16-
username: "user",
17-
firstName: "John",
18-
lastName: "Doe",
19-
20-
emailVerified: true,
21-
enabled: true,
22-
credentials: [{
23-
type: "password",
24-
value: "user",
25-
temporary: false
26-
}]
27-
}];
16+
const users = testUserNames.map(user=> {
17+
return {
18+
username: user,
19+
firstName: `Firstname ${user}`,
20+
lastName: `Lastname ${user}`,
21+
email: `${user}@example.com`,
22+
emailVerified: true,
23+
enabled: true,
24+
credentials: [{
25+
type: "password",
26+
value: `${user}`,
27+
temporary: false
28+
}]
29+
};
30+
})
2831

2932
/* wrapped in a function because we may need to generate access token more than once during the setup process */
3033
const fetchToken = async () => {
@@ -72,7 +75,10 @@
7275
const createRealmResponse = await fetch(`${keycloakBaseUrl}/admin/realms`, {
7376
method: "POST",
7477
headers: await authorization_header(),
75-
body: JSON.stringify({ realm: realmName, enabled: true })
78+
body: JSON.stringify({
79+
realm: realmName,
80+
enabled: true
81+
})
7682
});
7783

7884
if (createRealmResponse.ok) {

0 commit comments

Comments
 (0)