Synchronizing directories that contain feeds (DMZ scenario)

April 11, 2024

ID 268321

For synchronizing feeds on both the local host and DMZ host, you can use the RSync utility. On a computer running Windows, the RSync utility can be run by using Cygwin.

All Linux commands below are run on Windows computers by using Cygwin.

To install the RSync utility on a Windows computer:

  1. Install the default set of packages from the Cygwin distribution.
  2. Install the following utilities: OpenSSH, OpenSSL, and RSync.
  3. On the DMZ host, configure the OpenSSH components as follows:
    1. Run the following command as root:

      ssh-host-config

      You can answer Yes every time. The important point is to run the sshd daemon as a service.

    2. Run the following command:

      net start sygsshd

The sshd daemon will start automatically.

To configure synchronization on the local host:

  1. Create a private key and a corresponding public key.

    For this purpose, run the following command on the local host:

    ssh-keygen -t rsa -q -N '' -f /home/<user>/.ssh/dmz_rsa_key

    Specify the user login instead of <user>. The keys will be created without a password.

  2. Copy the public key from the local host to the DMZ host by running the following command:

    ssh-copy-id -i /home/<user>/.ssh/dmz_rsa_key <DMZ_user>@<DMZ_host>

    When you run this command, you will be asked for the password to <DMZ_user>@<DMZ_host>.

  3. Test the synchronization of the contents of directories that contain feeds by running the following command on the local host:

    rsync -a --delete-before --delay-updates -e "ssh -i /home/<user>/.ssh/dmz_rsa_key" <DMZ_user>@<DMZ_host>:/<Path_to_feeds>/ /<Path_to_feeds_on_Local>/

    In this command, <Path_to_feeds_on_Local> is the path to the folder containing feeds on the local host (namely, %service_dir%/feeds), and <Path_to_feeds> is the path to the folder on which updated feeds are stored on the DMZ host.

    To pass the synchronization test, the contents of the <Path_to_feeds_on_Local> folder on the Local computer must be the same as the contents of the <Path_to_feeds> folder on the DMZ host.

When testing Rsync by using Cygwin, there can be problems related to space characters in a path, so it is recommended to do the following:

  1. Specify the path to the directory on the DMZ host enclosed in quotation marks and escape the space character ("\ ").
  2. Escape the space character ("\ ") in the path to the directory on the local host.

To reach the directory on the C:\ drive by using Cygwin, specify the path /cygdrive/c/, and then the usual path (/cygdrive/c/Users/...).

Did you find this article helpful?
What can we do better?
Thank you for your feedback! You're helping us improve.
Thank you for your feedback! You're helping us improve.