Download and Install OpenVPN Client on Windows 10

1) Download and install OpenVPN client from here: https://openvpn.net/community-downloads/ For example: OpenVPN-2.5.0-I601-amd64.msi * During installation it will download .NET Framework 4 * You will need to enable Windows Updates else .NET Framework 4 installation will fail 2) Download and install TAP-Windows drivers from here: https://build.openvpn.net/downloads/releases/latest/ For example: tap-windows-latest-stable.exe 3) Check that TAP-Windows has been successfully […]

How to List INPUT, FORWARD, OUTPUT Iptables Rules

To view INPUT, FORWARD, OUTPUT iptables rules just use: iptables -Siptables -S Here is an example output: -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -A INPUT -i tun0 -j ACCEPT -A INPUT -i ens2 -p udp -m udp –dport 1194 -j ACCEPT -A FORWARD -i tun0 -o ens2 -j ACCEPT -A FORWARD -i […]

How to List All Iptables NAT Rules

Use this iptables command-line to view all NAT rules: iptables -t nat -Siptables -t nat -S Here is an example output: -P PREROUTING ACCEPT -P INPUT ACCEPT -P POSTROUTING ACCEPT -P OUTPUT ACCEPT -A POSTROUTING -s 10.8.0.0/24 -o ens2 -j MASQUERADE-P PREROUTING ACCEPT -P INPUT ACCEPT -P POSTROUTING ACCEPT -P OUTPUT ACCEPT -A POSTROUTING -s […]

Parse or Split FTP URL in Delphi XE using TIdURI

Given an FTP URL, you can parse it using TidURI: uses … IdFTP, IdFTPCommon, IdURI …   procedure TForm1.btnDownloadFileClick(Sender: TObject); var URL: string; Uri: TIdURI; begin URL := Trim(edURL.Text); Uri := TIdURI.Create(URL);   try IdFTP1.Host := Uri.Host;   if Uri.Port <> ” then IdFTP1.Port := StrToInt(Uri.Port) else IdFTP1.Port := 21;   IdFTP1.ConnectTimeout := 5000;   […]

How to Download a File via FTP in Delphi XE

A quick example to download a fila via FTP using Indy (IdFTP): uses … IdFTP, IdFTPCommon …   procedure TForm1.Button1Click(Sender: TObject); begin IdFTP1.Host := ‘test.rebex.net’; IdFTP1.Port := 21; IdFTP1.ConnectTimeout := 5000; IdFTP1.Username := ‘demo’; IdFTP1.Password := ‘password’; IdFTP1.TransferType := IdFTPCommon.TIdFTPTransferType.ftBinary; IdFTP1.Passive := True;   try IdFTP1.Connect; try IdFTP1.Get(‘/pub/example/pop3-browser.png’, ExtractFilePath(ParamStr(0)) + ‘pop3-browser.png’, True, False); finally IdFTP1.Disconnect; […]

Public FTP Server to Test Upload and Download

For anonymous FTP server you can use this: ftp://speedtest.tele2.net/ftp://speedtest.tele2.net/ For username:password FTP server you can use this: ftp://demo:password@test.rebex.net/ftp://demo:password@test.rebex.net/

How to Parse Command-Line Arguments in Bash

Need to parse command-line arguments in a bash script? Personally I always use this method: #!/bin/bash   while [[ "$#" -gt 0 ]]; do case $1 in -d|–deploy) deploy="$2"; shift ;; -u|–uglify) uglify=1 ;; *) echo "Unknown parameter passed: $1"; exit 1 ;; esac shift done   echo "Should deploy? $deploy" echo "Should uglify? $uglify"#!/bin/bash […]

How to Make Iptables Rules Persistent

There is Debian package named “iptables-persistent”. iptables-persistent makes sure iptables rules survive a reboot. To install it just type this command: apt-get -y install iptables-persistentapt-get -y install iptables-persistent To install it in an automated way check this: Bash Install Iptables-Persistent Automatically Other useful info can be found here: https://wiki.debian.org/iptables

Bash Install Iptables-Persistent Automatically

Check if iptables-persistent is installed, else install it: if [[ $(dpkg -s iptables-persistent) != *"Status: install ok installed"* ]]; then echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections apt-get -y install iptables-persistent fiif [[ $(dpkg -s iptables-persistent) != *"Status: install ok installed"* ]]; then echo iptables-persistent iptables-persistent/autosave_v4 […]

Route OpenVPN Connections Through Floating IP

Assuming you have a Hetzner VPS with a floating IP address: How to Configure a Floating IP in a VPS (Hetzner) Let’s say the floating IP address is 44.44.44.44 as example. And that you have installed OpenVPN via this guide: How to Install OpenVPN in Debian 10 Buster 1) Edit /etc/openvpn/server.conf and add: local 44.44.44.44local […]