sgarbuz | c4b6ed9 | 2019-01-15 11:53:08 +0200 | [diff] [blame] | 1 | ssl_enabled = attribute("ssl", default: false) |
| 2 | |
| 3 | keystone_default_ssl = { |
| 4 | 'transport_url' => 'rabbit://openstack:password@127.0.0.1:5671//openstack', |
| 5 | 'log_config_append' => '/etc/keystone/logging.conf', |
| 6 | 'debug' => 'false', |
| 7 | 'notification_format' => 'cadf', |
| 8 | 'admin_token' => 'RANDOMSTRINGTOKEN', |
| 9 | 'log_dir' => '/var/log/keystone', |
| 10 | 'secure_proxy_ssl_header' => 'HTTP_X_FORWARDED_PROTO', |
| 11 | 'verbose' => 'true', |
| 12 | } |
| 13 | |
| 14 | keystone_default = { |
| 15 | 'transport_url' => 'rabbit://openstack:password@127.0.0.1:5672//openstack', |
| 16 | 'log_config_append' => '/etc/keystone/logging.conf', |
| 17 | 'debug' => 'false', |
| 18 | 'notification_format' => 'cadf', |
| 19 | 'admin_token' => 'RANDOMSTRINGTOKEN', |
| 20 | 'log_dir' => '/var/log/keystone', |
| 21 | 'secure_proxy_ssl_header' => 'HTTP_X_FORWARDED_PROTO', |
| 22 | 'verbose' => 'true', |
| 23 | } |
| 24 | |
| 25 | keystone_assignment = { |
| 26 | 'driver' => 'sql' |
| 27 | } |
| 28 | |
| 29 | keystone_auth = { |
| 30 | 'methods' => 'password,token', |
| 31 | 'oidc' => 'keystone.auth.plugins.mapped.Mapped', |
| 32 | 'saml2' => 'keystone.auth.plugins.mapped.Mapped', |
| 33 | } |
| 34 | |
| 35 | keystone_catalog = { |
| 36 | 'template_file' => 'default_catalog.templates', |
| 37 | 'driver' => 'sql', |
| 38 | } |
| 39 | |
| 40 | keystone_credential = { |
| 41 | 'key_repository' => '/var/lib/keystone/credential-keys' |
| 42 | } |
| 43 | |
| 44 | keystone_fernet_tokens = { |
| 45 | 'key_repository' => '/etc/keystone/fernet-keys/', |
| 46 | 'max_active_keys' => '3', |
| 47 | } |
| 48 | |
| 49 | keystone_identity = { |
| 50 | 'driver' => 'sql', |
| 51 | } |
| 52 | |
| 53 | keystone_token = { |
| 54 | 'expiration' => '86400', |
| 55 | 'provider' => 'fernet', |
| 56 | 'caching' => 'false', |
| 57 | 'hash_algorithm' => 'sha256', |
| 58 | 'driver' => 'keystone.token.persistence.backends.memcache_pool.Token', |
| 59 | 'revoke_by_id' => 'False', |
| 60 | } |
| 61 | |
| 62 | keystone_cache = { |
| 63 | 'backend' => 'oslo_cache.memcache_pool', |
| 64 | 'enabled' => 'True', |
| 65 | 'memcache_servers' => '127.0.0.1:11211', |
| 66 | } |
| 67 | |
| 68 | keystone_oslo_messaging_rabbit = { |
| 69 | 'heartbeat_timeout_threshold' => '0', |
| 70 | 'heartbeat_rate' => '2', |
| 71 | } |
| 72 | |
| 73 | keystone_oslo_messaging_rabbit_ssl = { |
| 74 | 'rabbit_use_ssl' => 'true', |
| 75 | 'kombu_ssl_version' => 'TLSv1_2', |
| 76 | 'kombu_ssl_ca_certs' => '/etc/keystone/ssl/mysql/ca-cert.pem', |
| 77 | } |
| 78 | |
| 79 | keystone_database = { |
| 80 | 'connection' => 'mysql+pymysql://keystone:passw0rd@127.0.0.1/keystone?charset=utf8', |
| 81 | 'max_pool_size' => '10', |
| 82 | 'max_retries' => '-1', |
| 83 | 'max_overflow' => '30', |
| 84 | 'idle_timeout' => '3600', |
| 85 | } |
| 86 | |
| 87 | keystone_database_ssl = { |
| 88 | 'connection' => 'mysql+pymysql://keystone:passw0rd@127.0.0.1/keystone?charset=utf8&ssl_ca=/etc/keystone/ssl/mysql/ca-cert.pem&ssl_cert=/etc/keystone/ssl/mysql/client-cert.pem&ssl_key=/etc/keystone/ssl/mysql/client-key.pem', |
| 89 | 'max_pool_size' => '10', |
| 90 | 'max_retries' => '-1', |
| 91 | 'max_overflow' => '30', |
| 92 | 'idle_timeout' => '3600', |
| 93 | } |
| 94 | |
| 95 | keystone_oslo_middleware = { |
| 96 | 'max_request_body_size' => '114688', |
| 97 | 'enable_proxy_headers_parsing' => 'True', |
| 98 | } |
| 99 | |
| 100 | keystone_cors = { |
| 101 | 'allowed_origin' => 'https://horizon.example.com', |
| 102 | 'allow_credentials' => 'True', |
| 103 | 'expose_headers' => 'X-Auth-Token,X-Openstack-Request-Id,X-Subject-Token', |
| 104 | 'max_age' => '3600', |
| 105 | 'allow_methods' => 'GET,PUT,POST,DELETE,PATCH', |
| 106 | 'allow_headers' => 'X-Auth-Token,X-Openstack-Request-Id,X-Subject-Token,X-Project-Id,X-Project-Name,X-Project-Domain-Id,X-Project-Domain-Name,X-Domain-Id,X-Domain-Name', |
| 107 | } |
| 108 | |
| 109 | keystone_profiler = { |
| 110 | 'enabled' => 'True', |
| 111 | } |
| 112 | |
| 113 | keystone_oidc = { |
| 114 | 'remote_id_attribute' => 'HTTP_OIDC_ISS' |
| 115 | } |
| 116 | |
| 117 | keystone_saml2 = { |
| 118 | 'remote_id_attribute' => 'HTTP_OIDC_ISS' |
| 119 | } |
| 120 | |
Oleksandr Shyshko | 004f17b | 2019-02-21 12:51:25 +0000 | [diff] [blame] | 121 | keystone_security_compliance = { |
| 122 | 'disable_user_account_days_inactive' => '90', |
Oleksandr Shyshko | 3d95b71 | 2019-04-19 11:50:49 +0300 | [diff] [blame] | 123 | 'lockout_failure_attempts' => '60', |
Oleksandr Shyshko | 004f17b | 2019-02-21 12:51:25 +0000 | [diff] [blame] | 124 | 'lockout_duration' => '600', |
Oleksandr Shyshko | 3d95b71 | 2019-04-19 11:50:49 +0300 | [diff] [blame] | 125 | 'password_expires_days' => '730', |
| 126 | 'unique_last_password_count' => '5', |
Oleksandr Shyshko | 004f17b | 2019-02-21 12:51:25 +0000 | [diff] [blame] | 127 | 'minimum_password_age' => '0', |
Oleksandr Shyshko | 3d95b71 | 2019-04-19 11:50:49 +0300 | [diff] [blame] | 128 | 'password_regex' => '^[a-zA-Z0-9]{32,}$$', |
| 129 | 'password_regex_description' => 'Your password could contains capital letters, lowercase letters, digits and have a minimum length of 32 characters', |
| 130 | 'change_password_upon_first_use' => 'False', |
Oleksandr Shyshko | 004f17b | 2019-02-21 12:51:25 +0000 | [diff] [blame] | 131 | } |
| 132 | |
sgarbuz | c4b6ed9 | 2019-01-15 11:53:08 +0200 | [diff] [blame] | 133 | keystone_federation = { |
| 134 | 'cache_group_membership_in_db' => 'True', |
| 135 | } |
| 136 | |
| 137 | keystone_resource = { |
| 138 | 'admin_project_domain_name' => 'project', |
| 139 | 'admin_project_name' => 'projectname', |
| 140 | } |
| 141 | |
| 142 | keystone_extra_headers = { |
| 143 | 'Distribution' => 'Ubuntu', |
| 144 | } |
| 145 | |
| 146 | control 'Keystone' do |
| 147 | |
| 148 | describe parse_config_file('/etc/keystone/keystone.conf') do |
| 149 | |
| 150 | describe 'Keystone messaging' do |
| 151 | |
| 152 | if ssl_enabled |
| 153 | keystone_oslo_messaging_rabbit.merge!(keystone_oslo_messaging_rabbit_ssl) |
| 154 | keystone_default.merge!(keystone_default_ssl) |
| 155 | describe 'SSL' do |
| 156 | its('DEFAULT') { |
| 157 | should include(keystone_default) |
| 158 | } |
| 159 | its('oslo_messaging_rabbit') { |
| 160 | should include(keystone_oslo_messaging_rabbit) |
| 161 | } |
| 162 | end |
| 163 | else |
| 164 | describe 'non SSL' do |
| 165 | its('DEFAULT') { |
| 166 | should include(keystone_default) |
| 167 | } |
| 168 | its('oslo_messaging_rabbit') { |
| 169 | should include(keystone_oslo_messaging_rabbit) |
| 170 | } |
| 171 | end |
| 172 | end |
| 173 | |
| 174 | end |
| 175 | |
| 176 | describe 'Keystone database' do |
| 177 | |
| 178 | if ssl_enabled |
| 179 | keystone_database.merge!(keystone_database_ssl) |
| 180 | describe 'SSL' do |
| 181 | its('database') { |
| 182 | should include(keystone_database) |
| 183 | } |
| 184 | end |
| 185 | else |
| 186 | describe 'non SSL' do |
| 187 | its('database') { |
| 188 | should include(keystone_database) |
| 189 | } |
| 190 | end |
| 191 | end |
| 192 | |
| 193 | end |
| 194 | |
| 195 | describe 'Keystone config' do |
| 196 | |
| 197 | its('DEFAULT') { |
| 198 | should include(keystone_default) |
| 199 | } |
| 200 | its('assignment') { |
| 201 | should include(keystone_assignment) |
| 202 | } |
| 203 | its('auth') { |
| 204 | should include(keystone_auth) |
| 205 | } |
| 206 | its('catalog') { |
| 207 | should include(keystone_catalog) |
| 208 | } |
| 209 | its('credential') { |
| 210 | should include(keystone_credential) |
| 211 | } |
| 212 | its('fernet_tokens') { |
| 213 | should include(keystone_fernet_tokens) |
| 214 | } |
| 215 | its('identity') { |
| 216 | should include(keystone_identity) |
| 217 | } |
| 218 | its('token') { |
| 219 | should include(keystone_token) |
| 220 | } |
| 221 | its('cors') { |
| 222 | should include(keystone_cors) |
| 223 | } |
| 224 | its('oidc') { |
| 225 | should include(keystone_oidc) |
| 226 | } |
| 227 | its('saml2') { |
| 228 | should include(keystone_saml2) |
| 229 | } |
Oleksandr Shyshko | 004f17b | 2019-02-21 12:51:25 +0000 | [diff] [blame] | 230 | its('security_compliance') { |
| 231 | should include(keystone_security_compliance) |
| 232 | } |
sgarbuz | c4b6ed9 | 2019-01-15 11:53:08 +0200 | [diff] [blame] | 233 | its('federation') { |
| 234 | should include(keystone_federation) |
| 235 | } |
| 236 | its('resource') { |
| 237 | should include(keystone_resource) |
| 238 | } |
| 239 | its('extra_headers') { |
| 240 | should include(keystone_extra_headers) |
| 241 | } |
| 242 | |
| 243 | end |
| 244 | end |
| 245 | end |