Author: timopollmeier
Date: 2016-09-15 10:21:18 +0200 (Thu, 15 Sep 2016)
New Revision: 26232

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/tools/greenbone-certdata-sync.in
   trunk/openvas-manager/tools/greenbone-scapdata-sync.in
Log:
        * tools/greenbone-certdata-sync.in, tools/greenbone-scapdata-sync.in:
        Get customer id with hostname instead of customer id only when using
        an access key and use it to replace the hardcoded hostname.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog     2016-09-15 08:13:46 UTC (rev 26231)
+++ trunk/openvas-manager/ChangeLog     2016-09-15 08:21:18 UTC (rev 26232)
@@ -1,3 +1,9 @@
+2016-09-15  Timo Pollmeier <timo.pollme...@greenbone.net>
+
+       * tools/greenbone-certdata-sync.in, tools/greenbone-scapdata-sync.in:
+       Get customer id with hostname instead of customer id only when using
+       an access key and use it to replace the hardcoded hostname.
+
 2016-09-14  Matthew Mundell <matthew.mund...@greenbone.net>
 
        * src/manage_migrators.c (migrate_176_to_177): Add alias for Postgres.

Modified: trunk/openvas-manager/tools/greenbone-certdata-sync.in
===================================================================
--- trunk/openvas-manager/tools/greenbone-certdata-sync.in      2016-09-15 
08:13:46 UTC (rev 26231)
+++ trunk/openvas-manager/tools/greenbone-certdata-sync.in      2016-09-15 
08:21:18 UTC (rev 26232)
@@ -344,13 +344,15 @@
     if [ -e $ACCESSKEY ]
     then
       read feeduser < $ACCESSKEY
-      custid=`head -1 $ACCESSKEY | cut -d @ -f 1`
-      if [ -z "$feeduser" ] || [ -z "$custid" ]
+      custid_at_host=`head -1 $ACCESSKEY | cut -d : -f 1`
+
+      if [ -z "$feeduser" ] || [ -z "$custid_at_host" ]
       then
         log_err "CERT synchronization: Could not determine credentials, 
aborting synchronization."
         rm -rf "$FEED_INFO_TEMP_DIR"
         exit 1
       fi
+      echo "custid_at_host = '$custid_at_host'"
 
       gsmproxy=$(get_value proxy_feed | sed -r -e 's/^.*\/\///' -e 
's/:([0-9]+)$/ \1/')
       syncport=$(get_value syncport)
@@ -371,7 +373,7 @@
         fi
       fi
       create_tmp_key
-      rsync -e "ssh $RSYNC_SSH_OPTS $RSYNC_SSH_PROXY_CMD -p $PORT -i 
$TMPACCESSKEY" -ltvrP --protocol=29 --chmod=D+x $RSYNC_DELETE $RSYNC_COMPRESS 
$cus...@feed.greenbone.net:/cert-data/timestamp "$FEED_INFO_TEMP_DIR"
+      rsync -e "ssh $RSYNC_SSH_OPTS $RSYNC_SSH_PROXY_CMD -p $PORT -i 
$TMPACCESSKEY" -ltvrP --protocol=29 --chmod=D+x $RSYNC_DELETE $RSYNC_COMPRESS 
$custid_at_host:/cert-data/timestamp "$FEED_INFO_TEMP_DIR"
       if [ $? -ne 0 ]
       then
         log_err "rsync failed, aborting synchronization."
@@ -866,8 +868,8 @@
 
       mkdir -p "$CERT_DIR"
       read feeduser < $ACCESSKEY
-      custid=`head -1 $ACCESSKEY | cut -d @ -f 1`
-      if [ -z "$feeduser" ] || [ -z "$custid" ]
+      custid_at_host=`head -1 $ACCESSKEY | cut -d : -f 1`
+      if [ -z "$feeduser" ] || [ -z "$custid_at_host" ]
       then
         log_err "Could not determine credentials, aborting synchronization."
         exit 1
@@ -895,7 +897,7 @@
           fi
         fi
         create_tmp_key
-        rsync -e "ssh $RSYNC_SSH_OPTS $RSYNC_SSH_PROXY_CMD -p $PORT -i 
$ACCESSKEY" -ltvrP --protocol=29 --chmod=D+x $RSYNC_DELETE $RSYNC_COMPRESS 
$cus...@feed.greenbone.net:/cert-data/ $CERT_DIR
+        rsync -e "ssh $RSYNC_SSH_OPTS $RSYNC_SSH_PROXY_CMD -p $PORT -i 
$ACCESSKEY" -ltvrP --protocol=29 --chmod=D+x $RSYNC_DELETE $RSYNC_COMPRESS 
$custid_at_host:/cert-data/ $CERT_DIR
         if [ 0 -ne "$?" ] ; then
           log_err "rsync failed, aborting synchronization."
           remove_tmp_key

Modified: trunk/openvas-manager/tools/greenbone-scapdata-sync.in
===================================================================
--- trunk/openvas-manager/tools/greenbone-scapdata-sync.in      2016-09-15 
08:13:46 UTC (rev 26231)
+++ trunk/openvas-manager/tools/greenbone-scapdata-sync.in      2016-09-15 
08:21:18 UTC (rev 26232)
@@ -361,8 +361,8 @@
     if [ -e $ACCESSKEY ]
     then
       read feeduser < $ACCESSKEY
-      custid=`head -1 $ACCESSKEY | cut -d @ -f 1`
-      if [ -z $feeduser ] || [ -z $custid ]
+      custid_at_host=`head -1 $ACCESSKEY | cut -d : -f 1`
+      if [ -z $feeduser ] || [ -z $custid_at_host ]
       then
         log_err "Could not determine credentials, aborting synchronization."
         rm -rf $FEED_INFO_TEMP_DIR
@@ -388,7 +388,7 @@
         fi
       fi
       create_tmp_key
-      rsync -e "ssh $RSYNC_SSH_OPTS $RSYNC_SSH_PROXY_CMD -p $PORT -i 
$TMPACCESSKEY" -ltvrP --protocol=29 --chmod=D+x $RSYNC_DELETE $RSYNC_COMPRESS 
$cus...@feed.greenbone.net:/scap-data/timestamp $FEED_INFO_TEMP_DIR
+      rsync -e "ssh $RSYNC_SSH_OPTS $RSYNC_SSH_PROXY_CMD -p $PORT -i 
$TMPACCESSKEY" -ltvrP --protocol=29 --chmod=D+x $RSYNC_DELETE $RSYNC_COMPRESS 
$custid_at_host:/scap-data/timestamp $FEED_INFO_TEMP_DIR
       if [ $? -ne 0 ]
       then
         log_err "rsync failed, aborting synchronization."
@@ -1446,8 +1446,8 @@
 
       mkdir -p "$SCAP_DIR"
       read feeduser < $ACCESSKEY
-      custid=`head -1 $ACCESSKEY | cut -d @ -f 1`
-      if [ -z "$feeduser" ] || [ -z "$custid" ]
+      custid_at_host=`head -1 $ACCESSKEY | cut -d : -f 1`
+      if [ -z "$feeduser" ] || [ -z "$custid_at_host" ]
       then
         log_err "Could not determine credentials, aborting synchronization."
         exit 1
@@ -1475,7 +1475,7 @@
           fi
         fi
         create_tmp_key
-        rsync -e "ssh $RSYNC_SSH_OPTS $RSYNC_SSH_PROXY_CMD -p $PORT -i 
$ACCESSKEY" -ltvrP --protocol=29 --chmod=D+x $RSYNC_DELETE $RSYNC_COMPRESS 
$cus...@feed.greenbone.net:/scap-data/ $SCAP_DIR
+        rsync -e "ssh $RSYNC_SSH_OPTS $RSYNC_SSH_PROXY_CMD -p $PORT -i 
$ACCESSKEY" -ltvrP --protocol=29 --chmod=D+x $RSYNC_DELETE $RSYNC_COMPRESS 
$custid_at_host:/scap-data/ $SCAP_DIR
         if [ 0 != "$?" ] ; then
           log_err "rsync failed, aborting synchronization."
           remove_tmp_key

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits

Reply via email to