Skip to the content.

Tìm hiểu Token trong Keystone.

1.Khái niệm.

2. Token provider.

Loại token được cung cấp bởi keystone có thể cấu hình thông qua file /etc/keystone/keystone.conf . Hiện tại (Train và Stein) có hai token provider được hỗ trợ là FernetJWS. Ngoài ra một số phiên bản cũ hỗ trợ các keystone provider như UUID, PKI.

2.1.Token provider.

2.2. PKI/PKIZ token

2.3. Fernet.

2.4. JWS token

3. Fernet.

3.1. Fernet token là gì?

3.2. Fernet key là gì?

3.3. Các loại key khác nhau

3.4. Rotate Fernet key.

- Bước đầu chưa có key repo sẽ khởi tạo một key repo bằng `keystone-manager` để tạo hai key trong repo. Khi hai  file được tạo thì sẽ có file tên 1 là primary key và file 0 sẽ là staged key và không có secondary key.
- Lần rotate đầu tiên, staged 0 sẽ trở thành primary key 2, primary key 1 trở thành secondary key và staged mới sẽ được tạo ra với file name là 0.
- Lần rotate thứ 2, staged 0 trở thành primary key 3, primary key 2 trở thành secondary key 2, secondary 1 giữ nguyên và tạo ra staged key mới.

Ví dụ, token có hạn là 24h và muốn rotate key mỗi 6h. Chúng ta sẽ phải cấu hình để token tạo lúc 8h sáng thứ 2 vẫn sử dụng được vào 7h50 sáng thứ 3, giả sử như token không bị thu hồi sớm. Để làm được điều này thì chúng ta sẽ cấu hình max_active_keys=6 trong file cấu hình keystone. Tùy chọn này sẽ cho phép keystone giữ tối đa 6 key một lúc, do đó, nó sẽ giữ được 1 primary key, 1 staged key và 4 secondary key. Có thể được minh họa như sau:

token_expiration = 24
rotation_frequency = 6
max_active_keys = (token_expiration / rotation_frequency) + 2

3.5. Các trường của Fernet token.

3.6. Quá trình tạo fernet token.

3.7.

Nguồn: https://docs.openstack.org/keystone/stein/admin/tokens.html https://github.com/doedoe12/Internship/blob/master/Openstack/02.Keystone/02.Token.md