From: Ramesh Parthasarathy Date: Mon, 24 Sep 2018 22:20:24 +0000 (-0700) Subject: Create additional users with SO-MariaDB X-Git-Tag: 3.0.0-ONAP~14 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=d93db5e52f19ca27a62953a45d3b0b3ecbf7a27e;p=so%2Fdocker-config.git Create additional users with SO-MariaDB 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) --- 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 index 0000000..d6d1c20 --- /dev/null +++ b/volumes/mariadb/docker-entrypoint-initdb.d/04-create-so-user.sh @@ -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 index 0000000..6a42d97 --- /dev/null +++ b/volumes/mariadb/docker-entrypoint-initdb.d/05-create-so-admin.sh @@ -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