Skip to content

Commit 95f0806

Browse files
authored
Merge pull request #3 from nimbolus/add-token-metdata-option
Add token metdata option
2 parents e614d57 + 86341bd commit 95f0806

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

docs/install.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Installation
22

3-
1. Create config file based on [nova-instance-identity.sample.conf](../dist/nova-instance-identity.sample.conf):
3+
1. Create config file based on [nova-instance-identity.sample.conf](../sample/nova-instance-identity.sample.conf):
44

55
```sh
66
mkdir /etc/nova-instance-identity
@@ -16,7 +16,7 @@ podman run -d --name nova_instance_identity --net host \
1616
ghcr.io/nimbolus/openstack-nova-instance-identity-provider
1717
```
1818

19-
3. If using [kolla-ansible](https://docs.openstack.org/kolla-ansible/latest/), optionally create a haproxy config based on [haproxy.sample.cfg](../dist/haproxy.sample.cfg) at `/etc/kolla/config/haproxy/services.d/nova-instance-identity.cfg` on your deployment host and rollout haproxy role.
19+
3. If using [kolla-ansible](https://docs.openstack.org/kolla-ansible/latest/), optionally create a haproxy config based on [haproxy.sample.cfg](../sample/haproxy.sample.cfg) at `/etc/kolla/config/haproxy/services.d/nova-instance-identity.cfg` on your deployment host and rollout haproxy role.
2020

2121
4. Register the vendordata endpoint in `nova.conf`, e.g. with kolla-ansible add the following config to `/etc/kolla/config/nova.conf` on your deployment host and rollout nova role.
2222

main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
help="Port the service listens to"),
1818
cfg.BoolOpt('project_name_lookup', default=False,
1919
help="Lookup project name and add corresponding token claim"),
20+
cfg.DictOpt('token_metadata', default={},
21+
help="Attributes that will be returned alongside with the token"),
2022
]
2123

2224
CONF.register_opts(common_opts)
@@ -106,7 +108,7 @@ def vendordata():
106108
return jsonify({
107109
'token': token,
108110
'expires_at': expires_at,
109-
})
111+
} | CONF.token_metadata)
110112

111113

112114
def handle_sigterm(signum, frame):

sample/haproxy.sample.cfg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
frontend nova_instance_identity_front
2+
mode http
3+
http-request del-header X-Forwarded-Proto
4+
timeout client 6h
5+
option httplog
6+
option forwardfor
7+
http-request set-header X-Forwarded-Proto https if { ssl_fc }
8+
bind {{ kolla_internal_vip_address }}:8001 ssl crt /etc/haproxy/certificates/haproxy-internal.pem alpn h2,http/1.1
9+
default_backend nova_instance_identity_back
10+
11+
backend nova_instance_identity_back
12+
mode http
13+
timeout server 6h
14+
server {{ ansible_hostname }} 127.0.0.1:8001 check inter 2000 rise 2 fall 5
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[DEFAULT]
2+
listen_host = 0.0.0.0
3+
listen_port = 8001
4+
project_name_lookup = False
5+
token_metadata = auth_url:https://keystone.example.com/v3,region_name:eu-central-1
6+
7+
[keystone_authtoken]
8+
auth_type = password
9+
www_authenticate_uri = https://keystone.example.com
10+
auth_url = https://keystone.example.com
11+
project_domain_id = default
12+
user_domain_id = default
13+
project_name = service
14+
username = nova
15+
password = secret
16+
region_name = RegionOne
17+
interface = public
18+
memcache_security_strategy = ENCRYPT
19+
memcache_secret_key = secret
20+
memcached_servers = memcached.example.com:11211
21+
22+
[oidc_provider]
23+
issuer_url = https://nova-instance-identity.example.com
24+
audience = openstack
25+
signing_algorithm = ES256
26+
jwks_state = jwks.json
27+
key_rotation_period = 24
28+
token_lifetime = 1

0 commit comments

Comments
 (0)