sqredirect
Redirection and filtering Source Engine game traffic in a bundle with sqproxy
How it Works?
sqredirect attach eBPF filter(s) to network interface and manipulate with traffic targeting to game ports
eBPF is more efficient way to check/accept/drop packets in Linux
Firewall
As redirection and filtering processed before any firewall rules applied, you also need ensure target (redirect) ports are accessable from external network. If your server placed behind NAT and all rules live in router, you do not need do anything.
Requirements
- Linux
- Kernel version >= 4.4, check your by command: uname -r
- python2 or python3
Installation
TODO: Split into Ubuntu/Debian/Others like in bcc-tools README
Step 1: Install bcc-tools
- bcc-tools >= 0.10.0 (depends on Kernel version, see https://github.com/iovisor/bcc/releases)
- Install instruction (non-Debian 10)
- Install instruction (Debian 10)
- You can check the current version via
python -c 'import bcc; print(bcc.__version__);'
Step 2: Install sqredirect
python -m pip install sqredirect
https://pypi.org/project/sqredirect/
Usage
Automatically
Only by SQProxy
Non-root running
bcc-tools can't be used w/o root, see https://github.com/iovisor/bcc/issues/1166
But you can use this snippet to restrict usage only to specified user/group:
TL;DR: move python redirect.py $@ to command and add permissions in /etc/sudoers
-
Copy content of this folder to
/usr/src/sqredirect -
Create file in
/usr/local/bin/sqredirectwith content:#!/bin/bash cd /usr/src/sqredirect exec python2 /usr/src/sqredirect/redirect.py $@
-
chmod +x /usr/local/bin/sqredirect -
Create group network and add user to group
addgroup network usermod -aG network <user-which-should-it-run>
-
Allow run
sqredirectcommand w/o root privilegesecho "%network ALL=(root) NOPASSWD: /usr/local/bin/sqredirect" > /etc/sudoers.d/network
More about sudoers: https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file
Troubleshooting
Problem: I can't reach my server through network
Solution: Rollback any changes at network level, run in console (if you have access):
tc qdisc del dev eth0 root
replace eth0 with your interface name
Metadata
Release files for sqredirect 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqredirect-1.2.2.tar.gz | 19.8 kB | Without provenance | Details for sqredirect-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqredirect-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for sqredirect-1.2.2-py3-none-any.whl |
Total release size: 40.0 kB
Release files / sqredirect-1.2.2.tar.gz
| Download URL | sqredirect-1.2.2.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b6c92920085dfd55dca3cb9f615ca40af6906da5ac8de2c04b1c029b329127df
|
|
BLAKE2b-256 checksum How to use checksums |
3e7c5508959d9f6a8a97645328d8e4ed8db653ac985d2c7527178a74d4eee421
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.1 Darwin/21.2.0
|
Release files / sqredirect-1.2.2-py3-none-any.whl
| Download URL | sqredirect-1.2.2-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86cc85cd3ce23cde882adcb6524be784ce2a1fe63f8ff754ef0bc91e79123ffc
|
|
BLAKE2b-256 checksum How to use checksums |
1a58b207d7ea700bf86fa12bbca00ae9e2f30e1d7e1611ff7aeb649a8de339aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.1 Darwin/21.2.0
|
Security for sqredirect 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.