summaryrefslogtreecommitdiffstats
path: root/server/bin/setserveraddr
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2013-03-11 13:36:33 +0000
committerramon <ramongomez@us.es>2013-03-11 13:36:33 +0000
commit69fc529a7867053019dea4897c21005e5a290ba6 (patch)
tree695228584de5219386f54a38c1239f54f7cd9d8c /server/bin/setserveraddr
parent4ea07d1a61db9cfbcd88df65d37e8a14c00f7355 (diff)
#586: Aplicar seguridad de acceso a MySQL al script {{{setserveraddr}}}.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@3678 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'server/bin/setserveraddr')
-rwxr-xr-xserver/bin/setserveraddr12
1 files changed, 11 insertions, 1 deletions
diff --git a/server/bin/setserveraddr b/server/bin/setserveraddr
index 44da0c7b..5a0c6e77 100755
--- a/server/bin/setserveraddr
+++ b/server/bin/setserveraddr
@@ -62,8 +62,18 @@ if [ $FOUND == 1 ]; then
if [ $CHANGE == 1 ]; then
/etc/init.d/opengnsys restart
source $OPENGNSYS/etc/ogAdmServer.cfg
- mysql -u "$USUARIO" -p"$PASSWORD" -D "$CATALOG" -N -e \
+ # Componer fichero con credenciales de conexión.
+ touch $MYCNF
+ chmod 600 $MYCNF
+ cat << EOT > $MYCNF
+[client]
+user=$USUARIO
+password=$PASSWORD
+EOT
+ # Ejecutar actualización y borrar fichero de credenciales.
+ mysql --defaults-file=$MYCNF -D "$CATALOG" -e \
"UPDATE entornos SET ipserveradm='$ServidorAdm' WHERE identorno=1"
+ rm -f $MYCNF
echo "Default server interface set to: $1 ($ServidorAdm)"
else
echo "Don't change the default interface: $1"