LP2017941 Propagate bus passwords at EG install time user/berick/lp2017941-opensrf-on-redis-v1
authorBill Erickson <berickxx@gmail.com>
Mon, 1 May 2023 16:27:39 +0000 (12:27 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 15 May 2023 14:48:51 +0000 (10:48 -0400)
Copy Redis passwords into EG's opensrf_core.xml.example file at
build/install time, so it all Just Works.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/examples/opensrf_core.xml.example
Open-ILS/src/Makefile.am
configure.ac

index ede4e42..3537e30 100644 (file)
@@ -56,7 +56,7 @@ Example OpenSRF bootstrap configuration file for Evergreen
     <!-- Our domain should match that of the private router -->
     <domain>private.localhost</domain>
     <username>opensrf</username>
-    <passwd>password</passwd>
+    <passwd>OPENSRF_BUS_PASSWORD</passwd>
     <port>6379</port>
 
     <!-- 
@@ -101,7 +101,7 @@ Example OpenSRF bootstrap configuration file for Evergreen
 
     <!-- jabber login info -->
     <username>gateway</username>
-    <passwd>password</passwd>
+    <passwd>GATEWAY_BUS_PASSWORD</passwd>
     <port>6379</port>
     <loglevel>3</loglevel>
     <logfile>LOCALSTATEDIR/log/gateway.log</logfile>
@@ -135,7 +135,7 @@ Example OpenSRF bootstrap configuration file for Evergreen
         <port>6379</port>
         <unixpath>LOCALSTATEDIR/sock/unix_sock</unixpath>
         <username>router</username>
-        <password>password</password>
+        <password>ROUTER_BUS_PASSWORD</password>
         <resource>router</resource>
         <connect_timeout>10</connect_timeout>
         <max_reconnect_attempts>5</max_reconnect_attempts>
@@ -160,7 +160,7 @@ Example OpenSRF bootstrap configuration file for Evergreen
         <server>private.localhost</server>
         <port>6379</port>
         <username>router</username>
-        <password>password</password>
+        <password>ROUTER_BUS_PASSWORD</password>
         <resource>router</resource>
         <connect_timeout>10</connect_timeout>
         <max_reconnect_attempts>5</max_reconnect_attempts>
index 36ea466..653668e 100644 (file)
@@ -262,6 +262,9 @@ ilscore-install:
        sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
        sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
        sed -i 's|LIBDIR|@libdir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
+       sed -i 's|OPENSRF_BUS_PASSWORD|@OPENSRF_BUS_PASSWORD@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
+       sed -i 's|GATEWAY_BUS_PASSWORD|@GATEWAY_BUS_PASSWORD@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
+       sed -i 's|ROUTER_BUS_PASSWORD|@ROUTER_BUS_PASSWORD@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
        sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
        sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/opensrf_core.xml.example'
        sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/opensrf.xml.example'
index d1b7ce6..f5e53b4 100644 (file)
@@ -190,7 +190,7 @@ AC_SUBST([LIBXML2_HEADERS])
 PKG_CHECK_MODULES([DBI], [dbi])
 
 AC_ARG_WITH([hiredis],
-[  --with-hiredis=path               location of the hiredis headers (default is /usr/include/hiredis/))],
+[  --with-hiredis=path         location of the hiredis headers (default is /usr/include/hiredis/))],
 [HIREDIS_HEADERS=${withval}],
 [HIREDIS_HEADERS=/usr/include/hiredis/])
 AC_SUBST([HIREDIS_HEADERS])
@@ -206,6 +206,20 @@ AC_ARG_WITH([perlbase],
 [PERL_BASE=x])
 AC_SUBST([PERL_BASE])
 
+AC_ARG_WITH([redis-accounts],
+[  --with-redis-accounts=path  location of the redis accounts file (default is $sysconfdir/redis-accounts.txt)],
+[REDIS_ACCOUNTS=${withval}],
+[REDIS_ACCOUNTS=$sysconfdir/redis-accounts.txt])
+AC_SUBST([REDIS_ACCOUNTS])
+
+OPENSRF_BUS_PASSWORD=$(grep 'ACL SETUSER opensrf on >' ${REDIS_ACCOUNTS} | cut -d'>' -f2)
+GATEWAY_BUS_PASSWORD=$(grep 'ACL SETUSER gateway on >' ${REDIS_ACCOUNTS} | cut -d'>' -f2)
+ROUTER_BUS_PASSWORD=$(grep 'ACL SETUSER router on >' ${REDIS_ACCOUNTS} | cut -d'>' -f2)
+
+AC_SUBST([OPENSRF_BUS_PASSWORD])
+AC_SUBST([GATEWAY_BUS_PASSWORD])
+AC_SUBST([ROUTER_BUS_PASSWORD])
+
 AM_CONDITIONAL(CHECK_TESTS, test x$enable_tests = xyes)
 
 if test "x$openils_core" = "xtrue"; then
@@ -415,6 +429,8 @@ AC_MSG_RESULT(OpenSRF headers location:                 ${OPENSRF_HEADERS})
 AC_MSG_RESULT(OpenSRF libraries location:               ${OPENSRF_LIBS})
 AC_MSG_RESULT(libhiredis headers location:              ${HIREDIS_HEADERS})
 
+AC_MSG_RESULT(REDIS: ${REDIS_ACCOUNTS})
+AC_MSG_RESULT(PASS: ${OPENSRF_BUS_PASS})
 
 AC_MSG_RESULT([----------------------------------------------------------------------])