قالب وردپرس درنا توس
Home / Tips and Tricks / How to synchronize files between two machines with Syncthing securely «Null Byte :: WonderHowTo

How to synchronize files between two machines with Syncthing securely «Null Byte :: WonderHowTo



Transferring hundreds of screenshots, webcam recordings, keystroke logs, and audio recordings between your VPS and a local Kali computer can be tricky. Services like Dropbox do not always have the best privacy policies and suffer from privacy breaches like any other website. To mitigate these risks, we use a secure, open source and decentralized alternative.

Syncthing, created by Jakob Borg is a cross-platform, private, lightweight file synchronization (Dropbox). Alternative. With Syncthing, your data is not stored anywhere else than on your computer. There is no central server that could be compromised (legal or illegal). Essentially, they remove the middleman (Dropbox) and synchronize sensitive files directly between your computers.

Using Syncting is not limited to this scenario. Between a local Windows machine and a MacBook, we can securely sync browser bookmarks, password manager files, operating system backups, media, and more.

Step 1
: Installing Syncting in Kali & Ubuntu

The installation process for Kali (19659005) Debian) and an Ubuntu VPS are about the same. The only variation is in step 2, where I make a note of the difference. Otherwise, Kali and Ubuntu users can literally follow.

First, make sure that the package apt-transport-https is installed with the following command: apt-get . This will allow you to safely retrieve packages and updates from Syncthing developers.

  apt-get update && apt-get install apt-transport-https -V

Hit: 2 http://archive-7.kali.org/kali kali-rolling InRelease
Read package lists ... Done
Create dependency structure
Read status information ... Done
apt-transport-https is already the latest version (1.6.3).
0 updated, 0 reinstalled, 0 removed, and 406 not updated 

Then import the synchronization PGP keys. These are used to securely sign the packets and prevent attackers from manipulating the syncting packets.

  curl -s https://syncthing.net/release-key.txt | add sudo apt-key -

OK 

Add the syncthing repository to your APT sources using the command echo

  echo # htt https://apt.syncthing.net/ synchhing stable & # 39; >> / etc / apt / sources add .list 

Kali's repositories provide an older version of Syncthing. To ensure that the syncthing.net packages are always used when installing and updating Syncthing, create the following pin priority in the /etc/apt/preferences.d/ directory. Copy the entire command to a terminal and press Enter .

  echo & # 39; package: *
Pin: Origin apt.syncthing.net
Pin-Priority: 1001 & # 39;> /etc/apt/preferences.d/syncthing

Last Update APT and Install Syncthing

  apt-get update && apt-get install synchhing

1 hit: 1 https://apt.syncthing.net synchronize in InRelease
2 results: 2 http://kali.mirror.garr.it/mirrors/kali kali-rolling InRelease
Read 3 package lists ... Done
Read 4 package lists ... Done
5 Build up a dependency structure
6 Read status information ... Done
7 The following NEW packages will be installed:
8 Synchronization (0.14.48)
9 0 updated, 1 reinstalled, 0 remove and 406 not updated.
10 Need 6,824 kB of archives.
11 After this process, 15.7 MB of additional memory is allocated.
12 Obtained: 1 https://apt.syncthing.net synthing / stable amd64 synthing amd64 0.14.48 [6,824 kB]
13 recalled 6,824 kB in 15s (459 kB / s)
14 Select the previously unselected packet sync.
15 (Reading the database ... 183744 Files and directories are currently installed.)
16 Preparing to unpack ... / syncthing_0.14.48_amd64.deb ...
17 Unpacking (0.14.48) ...
18 Setting up synchronization (0.14.48) ...
19 Processing Triggers for man-db (2.8.3-2) ... 

Note: In line 12, the syncthing package was downloaded from the synching.net domain and not from a potash mirror. This means that Syncting has been successfully installed.

Step 2: Start Synchronization

After installing Syncthing, we can start the background process with systemctl

  systemctl --user synching.service [19659009] This command does not produce any output. Navigate to  http://127.0.0.1:8384/  using a web browser to view the Synchronization interface in Kali. 

Here the installation process varies slightly. Users attempting to access their VPS on port 8384 must take an extra step. Open a new terminal and SSH in the VPS with argument -L to enable port forwarding.

  ssh -L 9999: 127.0.0.1: 8384 -p 22 users @ YOUR-VPS-IP-ADDRESS 

Then open a new browser tab on your local computer and navigate to http: //127.0 .0.1: 9999 . This essentially creates a secure tunnel that allows remote users to access a service (Syncthing) running on the VPS loopback address (127.0.0.1).

This is what you need to install Syncthing in a Kali and Ubuntu VPS.

Step 3: Configure Synchronization

After we install Syncting and run it on our Kali and VPS machines, we can start configuring the settings. Before we can synchronize directories, we first need to connect the two syncthing servers together.

From the VPS, navigate to the Actions menu and select Show ID. Copy the ID with 56 characters to your clipboard

On the local potash machine, click the "Add Remote Device" button to the device add open] menu. Insert the device ID, name the device, manually enter your VPS IP address, and select the Default Folder option at the bottom. When entering your VPS IP address, be sure to attach port : 22000 to the IP address - this is the default sync port.

Press the "Save" button for the settings to take effect. After a few seconds, Syncting running on the VPS will indicate that a new device is trying to connect. Click the "Add Device" button to accept it.

That's it! All files stored in / root / Sync / in Kali or / home / / Sync / on the VPS are automatically synchronized between the devices. Syncing will let you know when a file transfer is taking place and when the directory is up to date.

Step 4: Automatically Synchronizing at Startup (optional)

It may be desirable for Syncting to start automatically when Kali or VPS is turned on. Create a new "syncthing.service" file in the directory / etc / systemd / system with nano .

  nano /etc/systemd/system/syncthing.service

Add the following lines to save and terminate nano by using ctrl + X then Y then Enter .

  [Unit]
Description = Synchhting - Open Source continuous file synchronization
Documentation = man: synchhting (1)

[Service]
ExecStart = / usr / bin / synthing -no-browser-no-restart -logflags = 0
Restart = at failure
SuccessExitStatus = 3 4
RestartForceExitStatus = 3 4

[Install]
WantedBy = default.target 

Use the systemctl command to enable syncing on every startup.

  systemctl --user enables synchhting

Created symlink /root/.config/systemd/user/default.target.wants/syncthing.service → /usr/lib/systemd/user/syncthing.service.

Add Devices and Synchronize Multiple Directories (Conclusion)

Syncting is a secure and private alternative to proprietary file synchronization solutions. It might be a bit intimidating at first, but with each added device and directory, syncthing becomes more useful. We can sync metasploit loot directories, bookmarks between devices, password manager files, confidential work files, encrypted backups and more.

Readers are encouraged to take and explore all syncthings settings. The documentation and support forum are great places for users who have questions or need help. Readers who are looking for a technical understanding of how Syncting works can be found on the developer's blog.

Do not Miss: The White Hat Guide to Choosing a Virtual Private Server

Title image by Luis Gomes / PEXELS; Screenshots of tokyoneon / Null Byte




Source link