diff --git a/content/posts/torrent.md b/content/posts/torrent.md new file mode 100644 index 0000000..b75ce14 --- /dev/null +++ b/content/posts/torrent.md @@ -0,0 +1,113 @@ ++++ +title = "qBittornt web via VPN" +date = "2023-08-25" +description = "Installing qBittornt web and VPN only download" + +[taxonomies] +tags = ["linux", "torrent", "network", "selfhosting"] + +[extra] +author = { name = "@ultradesu", social= "https://github.com/house-of-vanity" } ++++ + +## Requirements +* Ubuntu Linux server (tested on 18.04 and 20.04) +* NGINX +* Wireguard VPN config (easy to change to any other vpn) +--- + +## Installing + +Install `qbittorrent-nox` for headless qBittorent package: +```sh +sudo apt install -y qbittorrent-nox +``` + +## Configuring VPN Network Namespace +Create `/usr/bin/torrent_ns` script and make it exucutable. It configures Network Namespace for qBittorent. +```sh +VPN_CFG_NAME=torrent +VPN_COMMAND="wg-quick up ${VPN_CFG_NAME}" +export SCRIPT=$(cat <<-END +#!/bin/bash +ip netns del torrent +sleep 2 +ip netns add torrent +ip link add veth0 type veth peer name veth1 +ip link set veth1 netns torrent +ip address add 10.99.99.1/24 dev veth0 +ip netns exec torrent ip address add 10.99.99.2/24 dev veth1 +ip link set dev veth0 up +ip netns exec torrent ip link set dev veth1 up +ip netns exec torrent ip route add default via 10.99.99.1 +mkdir -p /etc/netns/torrent +echo nameserver 8.8.8.8 > /etc/netns/torrent/resolv.conf +sleep 3 +ip netns exec torrent ${VPN_COMMAND} +sleep 3 +ip netns exec torrent sudo -u ${USER} qbittorrent-nox +END +) + +sudo -E -E bash -c 'cat > /usr/bin/torrent_ns << EOF +${SCRIPT} +EOF +' + +sudo chmod +x /usr/bin/torrent_ns +``` + +## Systemd Autostart +Systemd unit to enable autostart: +```sh +export SERVICE=$(cat <<-END +[Unit] +Description=qBittorrent via vpn +After=network.target +StartLimitIntervalSec=0 + +[Service] +Type=simple +Restart=always +RestartSec=1 +User=root +ExecStart=/usr/bin/torrent_ns +ExecStop=/usr/bin/ip netns del torrent +END +) + +sudo -E bash -c 'cat > /etc/systemd/system/qbittorrent.service << EOF +${SERVICE} +EOF +' + +sudo systemctl enable --now qbittorrent.service +``` + +## Nginx Reverse Proxy + +```js +# /etc/nginx/sites-enabled/tr.hexor.cy.conf +server { + listen 443 ssl http2; + server_name tr.hexor.ru; + include ssl.conf; # my own ssl config + location / { + proxy_pass http://10.99.99.2:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_hide_header Referer; + proxy_hide_header Origin; + proxy_set_header Referer ''; + proxy_set_header Origin ''; + } +} +server { + listen 80; + server_name tr.hexor.cy; + listen [::]:80; + return 302 https://$host$request_uri; +} +``` diff --git a/public/404.html b/public/404.html deleted file mode 100644 index f8414f0..0000000 --- a/public/404.html +++ /dev/null @@ -1,3 +0,0 @@ - -404 Not Found -

404 Not Found

diff --git a/public/about/index.html b/public/about/index.html deleted file mode 100644 index 0d68a39..0000000 --- a/public/about/index.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - - - - About - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - -
-
-
-

About

-
- - on 2023-08-25 - - -
-
- - - -
-

Curriculum Vitae

-

Alexandr Bogomyakov

-

In love with GNU/Linux, Python and Rust.

-

Site Reliability Engineer (SRE) at Criteo

-

Limassol, Cyprus 🇨🇾

-
-

Me

-

Contacts

- -
-

Education

- - - -
YearsDegree
2009-2014Bachelor in EconomicsPacific National University, Khabarovsk, Russia
2005-2019Bachelor in Computer ScienceBauman Moscow State Technical University, Moscow, Russia
-
-

Experience

-

Criteo - Senior Site Reliability Engineer

-

May 2022 - Present Cyprus, Limassol (former Iponweb)

-
-

Pioneers in applying machine learning to solving digital advertising’s biggest challenges, offer world-leading technology solutions for building and operating scalable, algorithmically complex media trading systems for innovative companies across the advertising spectrum.

-
-
    -
  • Cassandra
  • -
  • Kubernetes
  • -
  • Google cloud platform
  • -
  • AWS
  • -
  • Terraform
  • -
  • Puppet
  • -
  • Python
  • -
  • Linux
  • -
-

VK Group - Senior Site Reliability Engineer

-

May 2021 - May 2022 Russia, Moscow

-
-

Mail.ru Group, LLC is a Russian internet company. It was started in 1998 as an e-mail service and went on to become a major corporate figure in the Russian-speaking segment of the Internet. As of 2013 according to comScore, websites owned by Mail.ru collectively had the largest audience in Russia and captured the most screen time. Mail.ru's sites reach approximately 86% of Russian Internet users on a monthly basis and the company is in the top 5 of largest Internet companies, based on the number of total pages viewed.

-
-
    -
  • Maintain Kubernetes on bare metal
  • -
  • Puppet
  • -
  • Python
  • -
  • Linux
  • -
-

EPAM - DevOps

-

Sep 2020 - May 2021 Russia, Moscow

-
-

EPAM Systems, Inc. is an American company that specializes in product development, digital platform engineering, and digital and product design. The world's largest manufacturer of custom software, consulting specialist, resident of the Belarusian High Technologies Park. Its branches are represented in more than 30 countries of the world.

-
-
    -
  • Maintain infrastructure in clouds using Ansible, Terraform.
  • -
  • Develop and maintain automation tools.
  • -
  • Build CI/CD pipelines with Jenkins Pipelines.
  • -
  • Service containerization expirience with AWS ECS Fargate.
  • -
-

IPONWEB - Operations Engineer

-

Nov 2016 - Sep 2020 Russia, Moscow

-
-

IPONWEB is a pioneer and global leader in the engineering of advanced programmatic, RTB, and media trading platforms across digital, TV, DOOH, and audio. Founded in the UK, IPONWEB has nearly 400 employees spread across the US, UK, Germany, Japan, Asia and Russia.

-
- -
- - - -
-
- - - - - - - - - -
- - - diff --git a/public/index.html b/public/index.html deleted file mode 100644 index c5e3afc..0000000 --- a/public/index.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - btwiusearch.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - -
-
- -

My own small public place

- - -
- - -
- - - - - - - - - - - - - -
- - - diff --git a/public/page/1/index.html b/public/page/1/index.html deleted file mode 100644 index 27f1d23..0000000 --- a/public/page/1/index.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - -Redirect -

Click here to be redirected.

diff --git a/public/posts/arch-repo/index.html b/public/posts/arch-repo/index.html deleted file mode 100644 index 64b3a17..0000000 --- a/public/posts/arch-repo/index.html +++ /dev/null @@ -1,253 +0,0 @@ - - - - - - - - - - - Own Arch Linux Repository - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - -
-
-
-

Own Arch Linux Repository

-
- - Published by @ultradesu - - on 2020-07-14 - - -
-
- - - -
-

Prerequisites

-
    -
  • Ubuntu Server with Nginx and Docker
  • -
-
-

Creating repository

-

Repository database is managed via repo-add script bundled with Arch Linux pacman package manager. Since pacman is not available in Ubuntu repository I use docker archlinux image for managing repository. This guide assumes that repository located in /srv/arch-repo. First of all move all your packages into /srv/arch-repo. Following command will create or update repository database.

-
REPO_URL=repo.sun.hexor.ru
-REPO_PATH=/srv/arch-repo
-docker run -v ${REPO_PATH}:/repo --rm archlinux \
-bash -c "repo-add /repo/${REPO_URL}.db.tar.gz /repo/*pkg.tar.zst"
-
-

Important aspect

-
    -
  • Name of the database should be REPO_URL.db.tar.gz, in this case REPO_URL is repo.sun.hexor.ru.
  • -
-
-

Periodically database repo update

-

I use systemd:

-
# Service unit
-# /etc/systemd/system/update-arch-repo.service
-[Unit]
-Description=Updating arch linux repository database for %I
-Requires=docker.service
-
-[Service]
-ExecStart=/usr/bin/docker run -v /srv/arch-repo:/repo --rm archlinux bash -c "repo-add /repo/%i.db.tar.gz /repo/*pkg.tar.zst"
-
-[Install]
-WantedBy=multi-user.target
-
-
# Timer unit
-# /etc/systemd/system/update-arch-repo.timer
-[Unit]
-Description=Schedule arch repo database update for %I
-
-[Timer]
-# every 15 minutes
-OnCalendar=*:0/15
-
-[Install]
-WantedBy=timers.target
-
-

Activate timer:

-
REPO_URL=repo.sun.hexor.ru
-systemctl enable update-arch-repo@${REPO_URL}.timer
-
-

Reverse proxy for HTTPS access

-

I use NGINX

-
server {
-    server_name repo.sun.hexor.ru;
-    listen [::]:443 ssl;
-    listen 443 ssl;
-    include security.conf; # my security options
-    include letsencrypt.conf; # my ssl config. 
-    root /srv/arch-repo;
-    location / {
-        autoindex on;
-        try_files $uri $uri/ =404;
-    }
-    access_log /var/log/nginx/logs/repo.sun.hexor.ru.access.log custom;
-    error_log /var/log/nginx/logs/repo.sun.hexor.ru.error.log;
-}
-
-

Configure repo on your machines

-

Add your repo to /etc/pacman.conf:

-
[repo.sun.hexor.ru]
-Server = https://repo.sun.hexor.ru
-
- -
- - - - - -
-
- - - - - - - - - -
- - - diff --git a/public/posts/htpasswd/index.html b/public/posts/htpasswd/index.html deleted file mode 100644 index 1e62e1c..0000000 --- a/public/posts/htpasswd/index.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - .htpasswd one-liner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - -
-
-
-

.htpasswd one-liner

-
- - Published by @ultradesu - - on 2020-07-13 - - -
-
- - - -
-

It's annoying when you need apache2-utils just for creating password hash for Basic auth. So here is Shell one-liner doing it using openssl.

-
user=ab
-pass=pwd
-printf "${user}:$(openssl passwd -apr1 ${pass})\n"
-
-
- -
- - - - - -
-
- - - - - - - - - -
- - - diff --git a/public/posts/index.html b/public/posts/index.html deleted file mode 100644 index 4fecb34..0000000 --- a/public/posts/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - btwiusearch.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - - - -

All articles

- - - - - - - - - - - - -
- - - diff --git a/public/posts/qemu/index.html b/public/posts/qemu/index.html deleted file mode 100644 index 45ace0d..0000000 --- a/public/posts/qemu/index.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - KVM/QEMU self hosted hypervisor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - -
-
-
-

KVM/QEMU self hosted hypervisor

-
- - Published by @ultradesu - - on 2020-07-14 - - -
-
- - - -
-

Requirements

-
    -
  • Ubuntu Linux server (tested on 18.04 and 20.04)
  • -
  • CPU with virtualisation enabled
  • -
-
-

Installing

-

Installing VT staff

-
sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils
-
-

I'd like to assign IPs for my VMs in the same network as server.

-

Here is netplan config:

-
# /etc/netplan/00-installer-config.yaml
-network:
-  ethernets:
-    enp2s0f0:
-      dhcp4: false
-      dhcp6: false
-  bridges:
-    br0:
-      interfaces: [enp2s0f0]
-      dhcp4: true
-      dhcp6: true
-  version: 2
-
-

Generate and apply network config:

-
sudo netplan generate
-sudo netplan --debug apply
-
-# Check bridge
-sudo networkctl
-IDX LINK       TYPE     OPERATIONAL SETUP
-  1 lo         loopback carrier     unmanaged
-  2 enp2s0f0   ether    enslaved    configured
-  3 br0        bridge   routable    configured
-  4 virbr0     bridge   no-carrier  unmanaged
-  5 virbr0-nic ether    off         unmanaged
-
-# Check DHCP lease on new bridge
-sudo ip a 
-2: enp2s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
-    link/ether xxx brd ff:ff:ff:ff:ff:ff
-4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
-    link/ether xxx brd ff:ff:ff:ff:ff:ff
-    inet 192.168.88.28/24 brd 192.168.88.255 scope global dynamic br0
-       valid_lft 535sec preferred_lft 535sec
-
-
-

Managing VMs

-

Grant permissions to use virtmanager to your user on server:

-
sudo adduser $USER libvirt-qemu
-sudo adduser $USER libvirt
-
-

Use virt-manager GUI utility on client or virsh CLI tool for managing VMs and data pools.

- -
- - - - - -
-
- - - - - - - - - -
- - - diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index 302a59c..0000000 --- a/public/robots.txt +++ /dev/null @@ -1,4 +0,0 @@ -User-agent: * -Disallow: -Allow: / -Sitemap: //btwiusearch.net/sitemap.xml diff --git a/public/sitemap.xml b/public/sitemap.xml deleted file mode 100644 index d86ef26..0000000 --- a/public/sitemap.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - //btwiusearch.net/ - - - //btwiusearch.net/about/ - 2023-08-25 - - - //btwiusearch.net/page/1/ - - - //btwiusearch.net/posts/ - - - //btwiusearch.net/posts/arch-repo/ - 2020-07-14 - - - //btwiusearch.net/posts/htpasswd/ - 2020-07-13 - - - //btwiusearch.net/posts/qemu/ - 2020-07-14 - - - //btwiusearch.net/tags/ - - - //btwiusearch.net/tags/kvm/ - - - //btwiusearch.net/tags/linux/ - - - //btwiusearch.net/tags/nginx/ - - - //btwiusearch.net/tags/selfhosting/ - - - //btwiusearch.net/tags/tools/ - - diff --git a/public/tags/index.html b/public/tags/index.html deleted file mode 100644 index f5a0c53..0000000 --- a/public/tags/index.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - btwiusearch.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - -

All tags

- -
- -
- - - - - - - - - -
- - - diff --git a/public/tags/kvm/index.html b/public/tags/kvm/index.html deleted file mode 100644 index 48e2b62..0000000 --- a/public/tags/kvm/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - btwiusearch.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - - - -

Entries tagged - "kvm"

- - - - - - - - - - - - - -
- - - diff --git a/public/tags/linux/index.html b/public/tags/linux/index.html deleted file mode 100644 index 6ef1b6e..0000000 --- a/public/tags/linux/index.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - btwiusearch.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - - - -

Entries tagged - "linux"

- - - - - - - - - - - - - -
- - - diff --git a/public/tags/nginx/index.html b/public/tags/nginx/index.html deleted file mode 100644 index c0d844f..0000000 --- a/public/tags/nginx/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - btwiusearch.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - - - -

Entries tagged - "nginx"

- - - - - - - - - - - - - -
- - - diff --git a/public/tags/selfhosting/index.html b/public/tags/selfhosting/index.html deleted file mode 100644 index 30a44f1..0000000 --- a/public/tags/selfhosting/index.html +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - btwiusearch.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - - - -

Entries tagged - "selfhosting"

- - - - - - - - - - - - - -
- - - diff --git a/public/tags/tools/index.html b/public/tags/tools/index.html deleted file mode 100644 index 6f33d3b..0000000 --- a/public/tags/tools/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - btwiusearch.net - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - - - - -

Entries tagged - "tools"

- - - - - - - - - - - - - -
- - -