Merge "[REFACTOR]Added support X.509 auth between MySQL and Cinder"
diff --git a/aodh/server/cluster.yml b/aodh/server/cluster.yml
index fb8f747..db6b39b 100644
--- a/aodh/server/cluster.yml
+++ b/aodh/server/cluster.yml
@@ -1,5 +1,6 @@
 classes:
 - service.aodh.server.cluster
+- system.salt.minion.cert.mysql.clients.openstack.aodh
 - service.haproxy.proxy.single
 - system.haproxy.proxy.listen.openstack.aodh
 - system.keepalived.cluster.instance.openstack_telemetry_vip
@@ -8,6 +9,8 @@
     openstack_event_alarm_topic: alarm.all
     # Keep alarm history in database for 30 days
     aodh_alarm_history_ttl: 2592000
+    openstack_mysql_x509_enabled: False
+    galera_ssl_enabled: False
   linux:
     system:
       cron:
@@ -32,6 +35,13 @@
         name: aodh
         user: aodh
         password: ${_param:mysql_aodh_password}
+        x509:
+          enabled: ${_param:openstack_mysql_x509_enabled}
+          ca_file: ${_param:mysql_aodh_ssl_ca_file}
+          key_file: ${_param:mysql_aodh_client_ssl_key_file}
+          cert_file: ${_param:mysql_aodh_client_ssl_cert_file}
+        ssl:
+          enabled: ${_param:galera_ssl_enabled}
       bind:
         host: ${_param:cluster_local_address}
         port: 8042
diff --git a/aodh/server/single.yml b/aodh/server/single.yml
index 8442a2d..f20195f 100644
--- a/aodh/server/single.yml
+++ b/aodh/server/single.yml
@@ -1,10 +1,13 @@
 classes:
 - service.aodh.server.single
+- system.salt.minion.cert.mysql.clients.openstack.aodh
 parameters:
   _param:
     openstack_event_alarm_topic: alarm.all
     # Keep alarm history in database for 30 days
     aodh_alarm_history_ttl: 2592000
+    openstack_mysql_x509_enabled: False
+    galera_ssl_enabled: False
   linux:
     system:
       cron:
@@ -13,6 +16,14 @@
             enabled: true
   aodh:
     server:
+      database:
+        x509:
+          enabled: ${_param:openstack_mysql_x509_enabled}
+          ca_file: ${_param:mysql_aodh_ssl_ca_file}
+          key_file: ${_param:mysql_aodh_client_ssl_key_file}
+          cert_file: ${_param:mysql_aodh_client_ssl_cert_file}
+        ssl:
+          enabled: ${_param:galera_ssl_enabled}
       ttl: ${_param:aodh_alarm_history_ttl}
       role: ${_param:openstack_node_role}
       region: ${_param:openstack_region}
diff --git a/galera/server/database/ssl/aodh.yml b/galera/server/database/ssl/aodh.yml
new file mode 100644
index 0000000..e68e0fa
--- /dev/null
+++ b/galera/server/database/ssl/aodh.yml
@@ -0,0 +1,4 @@
+parameters:
+  _param:
+    mysql_aodh_ssl_option:
+      - SSL: True
\ No newline at end of file
diff --git a/galera/server/database/ssl/keystone.yml b/galera/server/database/ssl/keystone.yml
new file mode 100644
index 0000000..bcaec18
--- /dev/null
+++ b/galera/server/database/ssl/keystone.yml
@@ -0,0 +1,4 @@
+parameters:
+  _param:
+    mysql_keystone_ssl_option:
+      - SSL: True
\ No newline at end of file
diff --git a/galera/server/database/ssl/neutron.yml b/galera/server/database/ssl/neutron.yml
new file mode 100644
index 0000000..c8f3761
--- /dev/null
+++ b/galera/server/database/ssl/neutron.yml
@@ -0,0 +1,4 @@
+parameters:
+  _param:
+    mysql_neutron_ssl_option:
+      - SSL: True
\ No newline at end of file
diff --git a/galera/server/database/x509/aodh.yml b/galera/server/database/x509/aodh.yml
new file mode 100644
index 0000000..d90d17e
--- /dev/null
+++ b/galera/server/database/x509/aodh.yml
@@ -0,0 +1,7 @@
+parameters:
+  _param:
+    mysql_aodh_client_ssl_x509_subject: '/C=cz/CN=mysql-aodh-client/L=Prague/O=Mirantis'
+    mysql_aodh_client_ssl_x509_issuer: '/C=cz/CN=Salt Master CA/L=Prague/O=Mirantis'
+    mysql_aodh_ssl_option:
+      - SUBJECT: ${_param:mysql_aodh_client_ssl_x509_subject}
+      - ISSUER: ${_param:mysql_aodh_client_ssl_x509_issuer}
\ No newline at end of file
diff --git a/galera/server/database/x509/keystone.yml b/galera/server/database/x509/keystone.yml
new file mode 100644
index 0000000..0a790e7
--- /dev/null
+++ b/galera/server/database/x509/keystone.yml
@@ -0,0 +1,7 @@
+parameters:
+  _param:
+    mysql_keystone_client_ssl_x509_subject: '/C=cz/CN=mysql-keystone-client/L=Prague/O=Mirantis'
+    mysql_keystone_client_ssl_x509_issuer: '/C=cz/CN=Salt Master CA/L=Prague/O=Mirantis'
+    mysql_keystone_ssl_option:
+      - SUBJECT: ${_param:mysql_keystone_client_ssl_x509_subject}
+      - ISSUER: ${_param:mysql_keystone_client_ssl_x509_issuer}
\ No newline at end of file
diff --git a/galera/server/database/x509/neutron.yml b/galera/server/database/x509/neutron.yml
new file mode 100644
index 0000000..2c07e05
--- /dev/null
+++ b/galera/server/database/x509/neutron.yml
@@ -0,0 +1,7 @@
+parameters:
+  _param:
+    mysql_neutron_client_ssl_x509_subject: '/C=cz/CN=mysql-neutron-client/L=Prague/O=Mirantis'
+    mysql_neutron_client_ssl_x509_issuer: '/C=cz/CN=Salt Master CA/L=Prague/O=Mirantis'
+    mysql_neutron_ssl_option:
+      - SUBJECT: ${_param:mysql_neutron_client_ssl_x509_subject}
+      - ISSUER: ${_param:mysql_neutron_client_ssl_x509_issuer}
\ No newline at end of file
diff --git a/jenkins/client/job/oscore/qa.yml b/jenkins/client/job/oscore/qa.yml
index f076a78..331bd7e 100644
--- a/jenkins/client/job/oscore/qa.yml
+++ b/jenkins/client/job/oscore/qa.yml
@@ -71,7 +71,11 @@
                   mcp/{{oscore-qa-project}}:
                     branches:
                       - master
+                      - queens
                       - pike
+                      - ocata
+                      - newton
+                      - mitaka
                 event:
                   patchset:
                     - created
diff --git a/keystone/server/cluster.yml b/keystone/server/cluster.yml
index c9642bd..24840fe 100644
--- a/keystone/server/cluster.yml
+++ b/keystone/server/cluster.yml
@@ -5,10 +5,13 @@
 - system.haproxy.proxy.listen.openstack.keystone.standalone
 - system.linux.system.users.keystone
 - system.keystone.server.fernet_rotation.cluster
+- system.salt.minion.cert.mysql.clients.openstack.keystone
 parameters:
   _param:
     keystone_tokens_expiration: 3600
     openstack_node_role: primary
+    openstack_mysql_x509_enabled: False
+    galera_ssl_enabled: False
   linux:
     system:
       package:
@@ -42,6 +45,13 @@
         name: keystone
         password: ${_param:mysql_keystone_password}
         user: keystone
+        x509:
+          enabled: ${_param:openstack_mysql_x509_enabled}
+          ca_file: ${_param:mysql_keystone_ssl_ca_file}
+          key_file: ${_param:mysql_keystone_client_ssl_key_file}
+          cert_file: ${_param:mysql_keystone_client_ssl_cert_file}
+        ssl:
+          enabled: ${_param:galera_ssl_enabled}
       tokens:
         engine: fernet
         expiration: ${_param:keystone_tokens_expiration}
diff --git a/keystone/server/single.yml b/keystone/server/single.yml
index e1131c0..d926c0d 100644
--- a/keystone/server/single.yml
+++ b/keystone/server/single.yml
@@ -2,6 +2,7 @@
 - service.keystone.server.single
 - system.linux.system.users.keystone
 - system.keystone.server.fernet_rotation.single
+- system.salt.minion.cert.mysql.clients.openstack.keystone
 parameters:
   _param:
     keystone_service_token: token
@@ -11,6 +12,8 @@
     mysql_keystone_password: password
     keystone_tokens_expiration: 3600
     openstack_node_role: primary
+    openstack_mysql_x509_enabled: False
+    galera_ssl_enabled: False
   linux:
     system:
       package:
@@ -41,6 +44,13 @@
         name: keystone
         password: ${_param:mysql_keystone_password}
         user: keystone
+        x509:
+          enabled: ${_param:openstack_mysql_x509_enabled}
+          ca_file: ${_param:mysql_keystone_ssl_ca_file}
+          key_file: ${_param:mysql_keystone_client_ssl_key_file}
+          cert_file: ${_param:mysql_keystone_client_ssl_cert_file}
+        ssl:
+          enabled: ${_param:galera_ssl_enabled}
       tokens:
         engine: fernet
         expiration: ${_param:keystone_tokens_expiration}
diff --git a/kubernetes/control/opencontrail.yml b/kubernetes/control/opencontrail.yml
index 6b23781..d72892d 100644
--- a/kubernetes/control/opencontrail.yml
+++ b/kubernetes/control/opencontrail.yml
@@ -26,7 +26,7 @@
           identity:
             auth_user: ${_param:opencontrail_identity_user}
             auth_password: ${_param:opencontrail_identity_password}
-            auth_tenant: ${_param:kubernetes_opencontrail_identity_tenant}
+            auth_tenant: ${_param:opencontrail_identity_tenant}
           message_queue:
             host: ${_param:single_address}
           database:
diff --git a/neutron/control/cluster.yml b/neutron/control/cluster.yml
index 703f196..12baf43 100644
--- a/neutron/control/cluster.yml
+++ b/neutron/control/cluster.yml
@@ -4,9 +4,12 @@
 - service.neutron.control.cluster
 - system.haproxy.proxy.listen.openstack.neutron
 - system.galera.server.database.neutron
+- system.salt.minion.cert.mysql.clients.openstack.neutron
 parameters:
   _param:
     cluster_internal_protocol: 'http'
+    openstack_mysql_x509_enabled: False
+    galera_ssl_enabled: False
   linux:
     system:
       package:
@@ -37,6 +40,14 @@
             params: check inter 10s fastinter 2s downinter 3s rise 3 fall 3
   neutron:
     server:
+      database:
+        x509:
+          enabled: ${_param:openstack_mysql_x509_enabled}
+          ca_file: ${_param:mysql_neutron_ssl_ca_file}
+          key_file: ${_param:mysql_neutron_client_ssl_key_file}
+          cert_file: ${_param:mysql_neutron_client_ssl_cert_file}
+        ssl:
+          enabled: ${_param:galera_ssl_enabled}
       role: ${_param:openstack_node_role}
       plugin: contrail
     identity:
diff --git a/neutron/control/single.yml b/neutron/control/single.yml
index 6196c0a..6ced2f1 100644
--- a/neutron/control/single.yml
+++ b/neutron/control/single.yml
@@ -1,9 +1,12 @@
 classes:
 - service.neutron.control.single
 - system.galera.server.database.neutron
+- system.salt.minion.cert.mysql.clients.openstack.neutron
 parameters:
   _param:
     internal_protocol: 'http'
+    openstack_mysql_x509_enabled: False
+    galera_ssl_enabled: False
   linux:
     system:
       package:
@@ -15,5 +18,12 @@
       role: ${_param:openstack_node_role}
       database:
         host: ${_param:single_address}
+        x509:
+          enabled: ${_param:openstack_mysql_x509_enabled}
+          ca_file: ${_param:mysql_neutron_ssl_ca_file}
+          key_file: ${_param:mysql_neutron_client_ssl_key_file}
+          cert_file: ${_param:mysql_neutron_client_ssl_cert_file}
+        ssl:
+          enabled: ${_param:galera_ssl_enabled}
       identity:
         protocol: ${_param:internal_protocol}
diff --git a/openssh/server/team/members/mshalamov.yml b/openssh/server/team/members/mshalamov.yml
new file mode 100644
index 0000000..5294f99
--- /dev/null
+++ b/openssh/server/team/members/mshalamov.yml
@@ -0,0 +1,20 @@
+parameters:
+  linux:
+    system:
+      user:
+        pshchelo:
+          enabled: true
+          name: mshalamov
+          sudo: ${_param:linux_system_user_sudo}
+          full_name: Maksym Shalamov
+          home: /home/mshalamov
+          email: mshalamov@mirantis.com
+  openssh:
+    server:
+      enabled: true
+      user:
+        mshalamov:
+          enabled: true
+          public_keys:
+            - key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzGhXA8t3nWeeM8+L3drG+4ACt9pOS1CVAAsW634Q6EtbxSzpsdp3NEJ3X8jKmfiwGZmqUiJ0G0lzS+vHdQ4vJ58M9f7YpXYYah8/557YLvIgg+F/3cltS7PHSE3jqNZgQBHG0f4SRwiBq4zhWhDOCXtzHmsT4EUj+9K6EOlPk7SjrOQAZA0XcPl//lw8g5zHAAC6phNa+WzHLzQSyWAZZhIKyvbXTHpSAUAww5rIlquucxVMbnbqlSOD4FTikSOLQa9iq4Nx10c3ZZTD3xTMuissSj5XJU5LaO7qlraOBsKTlkO0T+VS1aMnfJ943QSI2wu6epKWWHAFXV7Z2nsTL mshalamov@mirantis.com
+          user: ${linux:system:user:mshalamov}
\ No newline at end of file
diff --git a/salt/control/cluster/openstack_manila_cluster.yml b/salt/control/cluster/openstack_manila_cluster.yml
new file mode 100644
index 0000000..feb1d4f
--- /dev/null
+++ b/salt/control/cluster/openstack_manila_cluster.yml
@@ -0,0 +1,29 @@
+parameters:
+  salt:
+    control:
+      size:
+        openstack.manila:
+          cpu: 1
+          ram: 2048
+          disk_profile: large
+          net_profile: default
+      cluster:
+        internal:
+          domain: ${_param:cluster_domain}
+          engine: virt
+          node:
+            share01:
+              name: ${_param:openstack_share_node01_hostname}
+              provider: ${_param:infra_kvm_node01_hostname}.${_param:cluster_domain}
+              image: ${_param:salt_control_xenial_image}
+              size: openstack.manila
+            share02:
+              name: ${_param:openstack_share_node02_hostname}
+              provider: ${_param:infra_kvm_node02_hostname}.${_param:cluster_domain}
+              image: ${_param:salt_control_xenial_image}
+              size: openstack.manila
+            share03:
+              name: ${_param:openstack_share_node03_hostname}
+              provider: ${_param:infra_kvm_node03_hostname}.${_param:cluster_domain}
+              image: ${_param:salt_control_xenial_image}
+              size: openstack.manila
diff --git a/salt/minion/cert/mysql/clients/openstack/aodh.yml b/salt/minion/cert/mysql/clients/openstack/aodh.yml
new file mode 100644
index 0000000..ba5ef52
--- /dev/null
+++ b/salt/minion/cert/mysql/clients/openstack/aodh.yml
@@ -0,0 +1,27 @@
+parameters:
+  _param:
+    salt_minion_ca_host: cfg01.${_param:cluster_domain}
+    salt_minion_ca_authority: salt_master_ca
+    mysql_aodh_client_ssl_key_file: /etc/aodh/ssl/mysql/client-key.pem
+    mysql_aodh_client_ssl_cert_file: /etc/aodh/ssl/mysql/client-cert.pem
+    mysql_aodh_ssl_ca_file: /etc/aodh/ssl/mysql/ca-cert.pem
+  salt:
+    minion:
+      cert:
+        mysql-aodh-client:
+          host: ${_param:salt_minion_ca_host}
+          authority: ${_param:salt_minion_ca_authority}
+          common_name: mysql-aodh-client
+          signing_policy: cert_client
+          alternative_names: >
+            IP:${_param:cluster_local_address},
+            DNS:${_param:cluster_local_address},
+            DNS:${linux:system:name},
+            DNS:${linux:network:fqdn}
+          key_usage: "digitalSignature,nonRepudiation,keyEncipherment"
+          key_file: ${_param:mysql_aodh_client_ssl_key_file}
+          cert_file: ${_param:mysql_aodh_client_ssl_cert_file}
+          ca_file: ${_param:mysql_aodh_ssl_ca_file}
+          user: aodh
+          group: aodh
+          mode: 640
diff --git a/salt/minion/cert/mysql/clients/openstack/keystone.yml b/salt/minion/cert/mysql/clients/openstack/keystone.yml
new file mode 100644
index 0000000..c0fe71d
--- /dev/null
+++ b/salt/minion/cert/mysql/clients/openstack/keystone.yml
@@ -0,0 +1,27 @@
+parameters:
+  _param:
+    salt_minion_ca_host: cfg01.${_param:cluster_domain}
+    salt_minion_ca_authority: salt_master_ca
+    mysql_keystone_client_ssl_key_file: /etc/keystone/ssl/mysql/client-key.pem
+    mysql_keystone_client_ssl_cert_file: /etc/keystone/ssl/mysql/client-cert.pem
+    mysql_keystone_ssl_ca_file: /etc/keystone/ssl/mysql/ca-cert.pem
+  salt:
+    minion:
+      cert:
+        mysql-keystone-client:
+          host: ${_param:salt_minion_ca_host}
+          authority: ${_param:salt_minion_ca_authority}
+          common_name: mysql-keystone-client
+          signing_policy: cert_client
+          alternative_names: >
+            IP:${_param:cluster_local_address},
+            DNS:${_param:cluster_local_address},
+            DNS:${linux:system:name},
+            DNS:${linux:network:fqdn}
+          key_usage: "digitalSignature,nonRepudiation,keyEncipherment"
+          key_file: ${_param:mysql_keystone_client_ssl_key_file}
+          cert_file: ${_param:mysql_keystone_client_ssl_cert_file}
+          ca_file: ${_param:mysql_keystone_ssl_ca_file}
+          user: keystone
+          group: keystone
+          mode: 640
diff --git a/salt/minion/cert/mysql/clients/openstack/neutron.yml b/salt/minion/cert/mysql/clients/openstack/neutron.yml
new file mode 100644
index 0000000..d5b1cd8
--- /dev/null
+++ b/salt/minion/cert/mysql/clients/openstack/neutron.yml
@@ -0,0 +1,27 @@
+parameters:
+  _param:
+    salt_minion_ca_host: cfg01.${_param:cluster_domain}
+    salt_minion_ca_authority: salt_master_ca
+    mysql_neutron_client_ssl_key_file: /etc/neutron/ssl/mysql/client-key.pem
+    mysql_neutron_client_ssl_cert_file: /etc/neutron/ssl/mysql/client-cert.pem
+    mysql_neutron_ssl_ca_file: /etc/neutron/ssl/mysql/ca-cert.pem
+  salt:
+    minion:
+      cert:
+        mysql-neutron-client:
+          host: ${_param:salt_minion_ca_host}
+          authority: ${_param:salt_minion_ca_authority}
+          common_name: mysql-neutron-client
+          signing_policy: cert_client
+          alternative_names: >
+            IP:${_param:cluster_local_address},
+            DNS:${_param:cluster_local_address},
+            DNS:${linux:system:name},
+            DNS:${linux:network:fqdn}
+          key_usage: "digitalSignature,nonRepudiation,keyEncipherment"
+          key_file: ${_param:mysql_neutron_client_ssl_key_file}
+          cert_file: ${_param:mysql_neutron_client_ssl_cert_file}
+          ca_file: ${_param:mysql_neutron_ssl_ca_file}
+          user: neutron
+          group: neutron
+          mode: 640