Create additional users with SO-MariaDB 45/68745/2
authorRamesh Parthasarathy <rp6768@att.com>
Mon, 24 Sep 2018 22:20:24 +0000 (15:20 -0700)
committerRamesh Parthasarathy <rp6768@att.com>
Tue, 25 Sep 2018 14:57:46 +0000 (14:57 +0000)
Create a regular and admin user  with SO-MariaDB to be used by the containers

Change-Id: I8c32496816adf6a1845eb392cbe2b06e246129ad
Issue-ID: SO-1086
Signed-off-by: Ramesh Parthasarathy(rp6768)<rp6768@att.com>
volumes/mariadb/docker-entrypoint-initdb.d/04-create-so-user.sh [new file with mode: 0644]
volumes/mariadb/docker-entrypoint-initdb.d/05-create-so-admin.sh [new file with mode: 0644]

diff --git a/volumes/mariadb/docker-entrypoint-initdb.d/04-create-so-user.sh b/volumes/mariadb/docker-entrypoint-initdb.d/04-create-so-user.sh
new file mode 100644 (file)
index 0000000..d6d1c20
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+#
+# ECOMP and OpenECOMP are trademarks
+# and service marks of AT&T Intellectual Property.
+#
+
+echo "Creating so user . . ."
+
+mysql -uroot -p$MYSQL_ROOT_PASSWORD << 'EOF' || exit 1
+DELETE FROM mysql.user WHERE User='so_user';
+CREATE USER 'so_user';
+GRANT USAGE ON *.* TO 'so_user'@'%' IDENTIFIED BY 'so_User123';
+GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, SHOW VIEW ON `requestdb`.* TO 'so_user'@'%';
+GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, SHOW VIEW ON `catalogdb`.* TO 'so_user'@'%';
+GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, SHOW VIEW ON `camundabpmn`.* TO 'so_user'@'%';
+FLUSH PRIVILEGES;
+EOF
diff --git a/volumes/mariadb/docker-entrypoint-initdb.d/05-create-so-admin.sh b/volumes/mariadb/docker-entrypoint-initdb.d/05-create-so-admin.sh
new file mode 100644 (file)
index 0000000..6a42d97
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# ============LICENSE_START==========================================
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+#
+# ECOMP and OpenECOMP are trademarks
+# and service marks of AT&T Intellectual Property.
+#
+
+echo "Creating so admin user . . ."
+
+mysql -uroot -p$MYSQL_ROOT_PASSWORD << 'EOF' || exit 1
+DELETE FROM mysql.user WHERE User='so_admin';
+CREATE USER 'so_admin';
+GRANT USAGE ON *.* TO 'so_admin'@'%' IDENTIFIED BY 'so_Admin123';
+GRANT ALL PRIVILEGES ON `camundabpmn`.* TO 'so_admin'@'%' WITH GRANT OPTION;
+GRANT ALL PRIVILEGES ON `requestdb`.* TO 'so_admin'@'%' WITH GRANT OPTION;
+GRANT ALL PRIVILEGES ON `catalogdb`.* TO 'so_admin'@'%' WITH GRANT OPTION;
+FLUSH PRIVILEGES;
+EOF