4 Replies Latest reply on Oct 1, 2010 1:30 AM by mcafee-com-user

    ww6.8.7 Automatic Backup KB68022

    mcafee-com-user

      Hello,

       

      we tried to automate backup with the hints in KB68022. We are running in a failure. Can anyone help us?

       

      [wwbackup@dmz-webgw1 bin]$ sh wwbackup.sh
      wwbackup.sh: line 14: ${UNAME.EN_US}${TIMESTAMP.EN_US}.backup: bad substitution
      wwbackup.sh: line 30:  ${BUPROTO.EN_US}${BUUSER.EN_US}${BUPASSWORD.EN_US}${BUSERVER.EN_US}${BUPORT.EN_ US}${BUDIRECTORY.EN_US}/${BUFILENAME.EN_US}:  bad substitution
      wwbackup.sh: line 31: backup ${BUURL.EN_US}: bad substitution
      wwbackup.sh: line 34: ${SSHUSER.EN_US}@localhost: bad substitution
      [wwbackup@dmz-webgw1 bin]$

       

       

      wwbackup.sh

      #!/bin/sh
      # ver. 1.0 - 04/17/2007 - erik_elsasser@securecomputing.com - e²
      # wwbackup.sh - Provides a scripted method of backing up the Webwasher appliance configuration
      # This script is invoked either from the command line or via a scheduled cron job
      # It is dependent on Webwasher's SSH administration being setup for public key authentication.
      # This script has very basic functionality. I'm not getting fancy about error checking,
      # parsing fields or putting any significant intelligence in. Adjust to taste.
      # uname: used for backup file naming
      uname=`uname -n`
      # timestamp: used for unique filenames
      timestamp=`date +%y%m%d%H%M`
      # BUfilename: used as a destination filename.
      # default will look something like: wwapp0704171400.backup
      BUfilename="${UNAME.EN_US}${TIMESTAMP.EN_US}.backup"
      ##########
      # EDIT THESE VALUES FOR YOUR ENVIRONMENT
      BUproto="ftp://" # Possible values of (ftp|http|https)
      BUuser="anonymous:" # note the trailing ':' this is for [username:password] separation
      BUpassword="FTPpasswd@" # Note the trailing '@'. This is for [username:password@]server separation
      BUserver="192.168.56.4" # Enter address of the destination server
      BUport=":21" # default for FTP
      BUdirectory="/webwasherbackup" # The destination directory. Note the leading '/'. This is for [/path]
      SSHuser="wwbackup" # Should be the CLI Administrative Account
      SSHport="9092" # Default: 9092
      #
      ##########
      # The resultant target URL that the configuration is pushed to should be in the format:
      # "(ftp|http|https)://[FTPuser:FTPpasswd@]server[:port][/path]/filename"
      # and Filesystem URLs like "[/path]/filename" are supported.
      BUurl="${BUPROTO.EN_US}${BUUSER.EN_US}${BUPASSWORD.EN_US}${BUSERVER.EN_US}${BUPO RT.EN_US}${BUDIRECTORY.EN_US}/${BUFILENAME.EN_US}"
      SSHrun="backup ${BUURL.EN_US}"
      # Full ssh command line should look something like this:
      # ssh wwbackup@localhost -p 9092 "backup ftp://FTPuser:FTPpasswd@server:port/path/wwapp0704171400.backup"
      ssh ${SSHUSER.EN_US}@localhost -p ${SSHPORT.EN_US} "${SSHRUN.EN_US}"
      #### end of script[wwbackup@dmz-webgw1 bin]$

        • 1. Re: ww6.8.7 Automatic Backup KB68022

          All of youre variable names in the commands have been renamed. They are not exactly as they are defined.

           

          All of these variables:

          BUproto=

          BUuser=

          BUpassword=

          BUserver=

          BUport=

          BUdirectory=

          SSHuser=

          SSHport=

           

          Go into these locations:

          BUurl="${BUPROTO.EN_US}${BUUSER.EN_US}${BUPASSWORD.EN_US}${BUSERVER.EN_US}${BUPO RT.EN_US}${BUDIRECTORY.EN_US}/${BUFILENAME.EN_US}"

           

           

          But in your script, the names are not the same. Somehow, you changed the names in the commands.

          The

           

          BUurl="${BUproto}${BUuser}${BUpassword}${BUserver}${BUport}${BUdirectory}/${BUfi lename}"

           

          Change all the ${NAMES.EN_US} to the proper variable names.

          • 2. Re: ww6.8.7 Automatic Backup KB68022
            mcafee-com-user

            Thanks for your help, maybe KB68022 should be corrected too.


            But now we have another problem when starting the script:


            [wwbackup@dmz-webgw1 bin]$ sh wwbackup.sh
            backup: Failed to upload file 'ftp://192.168.56.4:21/webwasherbackup/dmz-webgw1.lh.hannover-stadt.de%0D10093015 05%0D.bup%0D%0D%0D%0D': FTP Error 500 "Syntax error, command unrecognized." for command "STOR webwash.bup301505mz-webgw1.lh.hannover-stadt.de
            "


            When running all the commands of the script in the shell the backup runs and the ftp transfer works. Maybe you can give us further help?


            #!/bin/sh
            # ver. 1.0 - 04/17/2007 - erik_elsasser@securecomputing.com - e²
            # wwbackup.sh - Provides a scripted method of backing up the Webwasher appliance configuration
            # This script is invoked either from the command line or via a scheduled cron job
            # It is dependent on Webwasher's SSH administration being setup for public key authentication.
            # This script has very basic functionality. I'm not getting fancy about error checking,
            # parsing fields or putting any significant intelligence in. Adjust to taste.
            # uname: used for backup file naming
            uname=`uname -n`
            # timestamp: used for unique filenames
            timestamp=`date +%y%m%d%H%M`
            # BUfilename: used as a destination filename.
            # default will look something like: wwapp0704171400.backup
            BUfilename="${uname}${timestamp}.bup"
            ##########
            # EDIT THESE VALUES FOR YOUR ENVIRONMENT
            BUproto="ftp://" # Possible values of (ftp|http|https)
            BUuser="anonymous:" # note the trailing ':' this is for [username:password] separation
            BUpassword="FTPpasswd@" # Note the trailing '@'. This is for [username:password@]server separation
            BUserver="192.168.56.4" # Enter address of the destination server
            BUport=":21" # default for FTP
            BUdirectory="/webwasherbackup" # The destination directory. Note the leading '/'. This is for [/path]
            SSHuser="wwbackup" # Should be the CLI Administrative Account
            SSHport="9092" # Default: 9092
            #
            ##########
            # The resultant target URL that the configuration is pushed to should be in the format:
            # "(ftp|http|https)://[FTPuser:FTPpasswd@]server[:port][/path]/filename"
            # and Filesystem URLs like "[/path]/filename" are supported.
            BUurl="${BUproto}${BUuser}${BUpassword}${BUserver}${BUport}${BUdirectory}/${BUfi lename}"
            SSHrun="backup ${BUurl}"
            # Full ssh command line should look something like this:
            # ssh wwbackup@localhost -p 9092 "backup ftp://FTPuser:FTPpasswd@server:port/path/wwapp0704171400.backup"
            ssh ${SSHuser}@localhost -p ${SSHport} "${SSHrun}"
            #### end of script

             

             

            on 30.09.10 15:09:46 MESZ
            • 3. Re: ww6.8.7 Automatic Backup KB68022

              Here is what I'm worried about, the %0D in the responses.

               

                %0D1009301505%0D.bup%0D%0D%0D%0D

               

              These are linefeed characters and I don't know if you are seeing them explicitly in the output on your screen or if they are somehow being introduced only on this forum because of some strange pasting when you copy them to here?

               

              Do you see the actual %0D on your system? If so, then you have some linefeeds in your script that you do not see, probably because of word wrap in your editor.

               

              The linefeeds could be hidden and you cannot see them properly for many reasons. They could be artifacts of you pasting them from a PDF file. They could be hidden unicode characters somehow. I don't know.

               

              When I copy a short script to a unix box like this, I open it all up in Notepad++ (sourceforge) and view hidden characters.

              Then I copy it to buffer,

              open putty,

              Go to the directory I want to save it,

              # cat >wwbackup.sh

              (paste the buffer)

              Ctrl-D to quit.

               

              Then open it in vi just to make sure it took correctly.

               

              ...but that's just me. I've been doin *nix for 25 years.

              • 4. Re: ww6.8.7 Automatic Backup KB68022
                mcafee-com-user

                Thank you very much for your help.

                 

                Using the method you described with "cat > wwbackup.sh" and copy from clipboard the script runs.

                 

                When transfering the same script with Winscp to the appliance the error still occurs. So it seems there is a translation error when copying with Winscp...

                 

                Best regards!