mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-26 23:59:41 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef70f3223f | ||
|
|
001e2874c5 | ||
|
|
72a32eecd5 | ||
|
|
9a4602872d | ||
|
|
615fa9b5fc | ||
|
|
3081a05cf7 | ||
|
|
e13c8d518f | ||
|
|
99795d8dfe | ||
|
|
94a83d126f | ||
|
|
4edb94d09e | ||
|
|
4a90c65a6a | ||
|
|
364286d6d9 | ||
|
|
07bedfa64c | ||
|
|
ef4969da19 | ||
|
|
36ac6e673b | ||
|
|
292a855f34 | ||
|
|
9651848bf1 | ||
|
|
c89a7b14c7 | ||
|
|
41edaa9757 | ||
|
|
84dd84a993 | ||
|
|
993c1ef95e | ||
|
|
5bc60d8bb3 | ||
|
|
1a66393b25 | ||
|
|
b5e9459d64 | ||
|
|
206c923d6c | ||
|
|
6a3cb4128d | ||
|
|
94fc4a7116 | ||
|
|
89d2131094 | ||
|
|
b00e3b9a9c | ||
|
|
ee5a7588f8 | ||
|
|
30ffaff182 | ||
|
|
5c78d1a342 | ||
|
|
1cea4fef4b | ||
|
|
24ac413fc5 | ||
|
|
c6e290b8e6 | ||
|
|
77f8870c5d | ||
|
|
d4eaf5acc8 | ||
|
|
f271a57238 | ||
|
|
dded867ede | ||
|
|
fad5acea9a | ||
|
|
a0ea1b3e7d | ||
|
|
5e71f7daff | ||
|
|
36ae10ad16 | ||
|
|
f52dc0f0b9 | ||
|
|
ffa1a05009 | ||
|
|
6f02ec2747 | ||
|
|
ca4667c035 | ||
|
|
41a08c11be | ||
|
|
6c4663a045 | ||
|
|
83139bc2e8 | ||
|
|
2dc4a422c5 | ||
|
|
d0ec7687db | ||
|
|
b8e5853b6b | ||
|
|
ad6e151b7c | ||
|
|
16ac797008 | ||
|
|
48d72538e1 | ||
|
|
2b8845f65a | ||
|
|
f265ea0b52 | ||
|
|
5400d53cef | ||
|
|
da2b8b3c1a | ||
|
|
ee0de3613a | ||
|
|
8971fcf991 | ||
|
|
9529a1dfcf | ||
|
|
ea4b2cc3a2 | ||
|
|
6915ea126f | ||
|
|
efa6f6560c | ||
|
|
3ff0f8b7ab | ||
|
|
382e7915f0 | ||
|
|
da66016c7f | ||
|
|
69c6ddc8c4 | ||
|
|
c0c51357d9 | ||
|
|
8582b33f8e | ||
|
|
daa0e36e41 | ||
|
|
cfc3c2bd7d | ||
|
|
fdd303ee32 | ||
|
|
cdbd47dc5b | ||
|
|
fc544c4dff | ||
|
|
e8d6aa555a | ||
|
|
488317da1d | ||
|
|
527f0704a4 | ||
|
|
facc35e287 | ||
|
|
7011e78ece | ||
|
|
137ff3beea | ||
|
|
e78c1d2c07 | ||
|
|
cb9effab9b | ||
|
|
a0ae86957f | ||
|
|
73fbf9d262 | ||
|
|
7f430ccc79 | ||
|
|
307e6d2c49 | ||
|
|
3526759e59 | ||
|
|
a3b40e6176 | ||
|
|
6ca4a2686d | ||
|
|
1565c67c13 | ||
|
|
9921ccbe47 | ||
|
|
40d3bf636e | ||
|
|
2cbdc6e845 | ||
|
|
f6963ea302 | ||
|
|
cf7749b320 | ||
|
|
f599c3239c | ||
|
|
984366ce3e | ||
|
|
22c7dfe0e1 | ||
|
|
4b48311d82 | ||
|
|
3dcd83e6d6 | ||
|
|
7a80a6ceb8 | ||
|
|
33b2a31180 | ||
|
|
fb2d1c0442 | ||
|
|
7e1ddf2e84 | ||
|
|
5908695b0f | ||
|
|
7807faa71b | ||
|
|
d2fa99fbd4 | ||
|
|
1e019bad0e | ||
|
|
86ad7263a6 | ||
|
|
55761128b3 | ||
|
|
b68887b6f9 | ||
|
|
e9b8f37053 | ||
|
|
21346cb2ce | ||
|
|
fa43cafd58 | ||
|
|
8f62e42e7d | ||
|
|
f4ad34c35a | ||
|
|
ff3398c6a9 | ||
|
|
4fb5c95704 | ||
|
|
13a57812e5 | ||
|
|
a43c95023d | ||
|
|
75021a2003 | ||
|
|
bebc3894e2 | ||
|
|
ddb74a111c | ||
|
|
1e47e74c49 | ||
|
|
eca362af81 | ||
|
|
c31fe8367f | ||
|
|
f480c9dfe8 | ||
|
|
8de2be3b3b | ||
|
|
aea9ff8c94 | ||
|
|
e7bc76da73 | ||
|
|
207ddb7f02 | ||
|
|
f5ff81d0bc | ||
|
|
8c2ad56665 | ||
|
|
a986ed7a07 | ||
|
|
eceb5a22df | ||
|
|
7eba73fc8f | ||
|
|
122ca26249 | ||
|
|
6369fe966e | ||
|
|
cb27ca5223 | ||
|
|
932c4e3fd9 | ||
|
|
6818872f63 | ||
|
|
81a4e5bae3 | ||
|
|
0ae2754c1e | ||
|
|
05f83896bf | ||
|
|
f668a34910 | ||
|
|
763e21e053 | ||
|
|
7b85f6a684 | ||
|
|
92d3b08dd2 | ||
|
|
4877b39f2c | ||
|
|
44c47ee7d9 | ||
|
|
5f1ed7363b | ||
|
|
c370635fc4 | ||
|
|
3bfabb29f8 | ||
|
|
e4a5a7252c | ||
|
|
5f542a505a | ||
|
|
5b7446ba8f | ||
|
|
4af02c9268 | ||
|
|
ed5103d176 | ||
|
|
75dedeff28 | ||
|
|
c60af54c98 | ||
|
|
01f85cf755 | ||
|
|
305f9932ac | ||
|
|
c94766dff7 | ||
|
|
87fc8ae4ee | ||
|
|
9ab2e820b5 | ||
|
|
7798f78137 | ||
|
|
d60ac723a5 | ||
|
|
afb2ec0696 | ||
|
|
f18a751f89 | ||
|
|
8de071aa87 | ||
|
|
f173f8860d | ||
|
|
3a66c0a4c0 | ||
|
|
66ee250e5c | ||
|
|
c893e866bd | ||
|
|
fbc0953d5c | ||
|
|
37b1ab8169 | ||
|
|
b7769d05af | ||
|
|
fdda69c1f4 | ||
|
|
a757fae617 | ||
|
|
1c9577b9a9 | ||
|
|
b59c044663 | ||
|
|
de5acb2abd | ||
|
|
d6dea13a6f | ||
|
|
a04cd67eaa |
No files matched your search
@@ -0,0 +1,73 @@
|
|||||||
|
# Exclude top-level dirs not needed for build
|
||||||
|
/bin/
|
||||||
|
/bin64/
|
||||||
|
/build/
|
||||||
|
/cfg/
|
||||||
|
/cmake/
|
||||||
|
/CMakeFiles/
|
||||||
|
/debian/
|
||||||
|
/doc/
|
||||||
|
/man/
|
||||||
|
|
||||||
|
# Build artifacts
|
||||||
|
**/*.o
|
||||||
|
**/*.obj
|
||||||
|
**/*.so
|
||||||
|
**/*.dll
|
||||||
|
**/*.exe
|
||||||
|
**/*.exp
|
||||||
|
**/*.lib
|
||||||
|
**/*.pdb
|
||||||
|
**/*.ilk
|
||||||
|
**/*.idb
|
||||||
|
**/*.err
|
||||||
|
**/*.ld.so
|
||||||
|
**/*.dSYM
|
||||||
|
**/*.var
|
||||||
|
build*/
|
||||||
|
buildlinux.sh
|
||||||
|
tmp/
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Editor / IDE
|
||||||
|
**/*.swp
|
||||||
|
**/*.swo
|
||||||
|
**/*~
|
||||||
|
**/*.bak
|
||||||
|
**/*.tmp
|
||||||
|
**/*.log
|
||||||
|
.project
|
||||||
|
.cproject
|
||||||
|
.classpath
|
||||||
|
.settings/
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Git
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
# Claude / docs
|
||||||
|
CLAUDE.md
|
||||||
|
.claude/
|
||||||
|
|
||||||
|
# Generated version files
|
||||||
|
version
|
||||||
|
version.c
|
||||||
|
version.sh
|
||||||
|
verfile.sh
|
||||||
|
|
||||||
|
# Local config / keys
|
||||||
|
**/*.key
|
||||||
|
**/*.pem
|
||||||
|
**/*.pfx
|
||||||
|
3proxy.cfg
|
||||||
|
3proxy-ssl.cfg
|
||||||
|
3proxy-pcre.cfg
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
res
|
||||||
|
3proxy.res
|
||||||
|
copytgz.sh
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
name: OpenWrt ipk build
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
env:
|
||||||
|
OPENWRT_RELEASE: 24.10.0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ipk:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
name: "${{ matrix.arch }}"
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- target: ramips/mt7621
|
||||||
|
arch: mipsel_24kc
|
||||||
|
- target: ath79/generic
|
||||||
|
arch: mips_24kc
|
||||||
|
- target: ipq40xx/generic
|
||||||
|
arch: arm_cortex-a7_neon-vfpv4
|
||||||
|
- target: mediatek/filogic
|
||||||
|
arch: aarch64_cortex-a53
|
||||||
|
# 26.04: the OpenWrt SDK refuses its non-GNU install
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: env
|
||||||
|
run: echo "RELEASE=$(tr -d ' \t\r\n' < RELEASE)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Install build dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y build-essential libncurses-dev zlib1g-dev gawk git \
|
||||||
|
gettext libssl-dev xsltproc wget unzip python3 rsync file zstd
|
||||||
|
|
||||||
|
- name: Fetch SDK
|
||||||
|
run: |
|
||||||
|
BASE="https://downloads.openwrt.org/releases/$OPENWRT_RELEASE/targets/${{ matrix.target }}"
|
||||||
|
# The SDK file name carries the toolchain flavour, which differs between
|
||||||
|
# targets (musl vs musl_eabi), so take it from the directory listing.
|
||||||
|
NAME=$(curl -fsSL "$BASE/" | grep -oE 'openwrt-sdk-[^"]*\.tar\.zst' | head -1)
|
||||||
|
if [ -z "$NAME" ]; then echo "no SDK for ${{ matrix.target }}"; exit 1; fi
|
||||||
|
echo "fetching $NAME"
|
||||||
|
curl -fsSL "$BASE/$NAME" -o sdk.tar.zst
|
||||||
|
tar --zstd -xf sdk.tar.zst
|
||||||
|
mv "${NAME%.tar.zst}" sdk
|
||||||
|
rm sdk.tar.zst
|
||||||
|
|
||||||
|
- name: Stage the package
|
||||||
|
run: |
|
||||||
|
mkdir -p sdk/package/3proxy sdk/dl
|
||||||
|
cp -a scripts/openwrt/. sdk/package/3proxy/
|
||||||
|
# Build the checkout rather than a published tarball, so the workflow
|
||||||
|
# does not depend on the release archive existing yet.
|
||||||
|
git archive --format=tar.gz --prefix="3proxy-$RELEASE/" -o "sdk/dl/3proxy-$RELEASE.tar.gz" HEAD
|
||||||
|
HASH=$(sha256sum "sdk/dl/3proxy-$RELEASE.tar.gz" | cut -d' ' -f1)
|
||||||
|
sed -i "s|^PKG_VERSION:=.*|PKG_VERSION:=$RELEASE|" sdk/package/3proxy/Makefile
|
||||||
|
sed -i "s|^PKG_HASH:=.*|PKG_HASH:=$HASH|" sdk/package/3proxy/Makefile
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
cd sdk
|
||||||
|
./scripts/feeds update base packages
|
||||||
|
./scripts/feeds install libopenssl libpcre2
|
||||||
|
echo CONFIG_PACKAGE_3proxy=m >> .config
|
||||||
|
make defconfig
|
||||||
|
make package/3proxy/compile -j$(nproc)
|
||||||
|
|
||||||
|
- name: Collect
|
||||||
|
run: |
|
||||||
|
find sdk/bin -name '3proxy_*.ipk' -exec cp {} . \;
|
||||||
|
ls -l *.ipk
|
||||||
|
for f in *.ipk; do echo "$f"; done
|
||||||
|
|
||||||
|
- name: Get artifact ipk
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: "3proxy-${{ env.RELEASE }}-${{ matrix.arch }}.ipk"
|
||||||
|
path: "*.ipk"
|
||||||
|
|
||||||
|
- name: Import signing key
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$GPG_PRIVATE_KEY" ]; then echo "GPG_PRIVATE_KEY is not set"; exit 1; fi
|
||||||
|
mkdir -p ~/.gnupg && chmod 700 ~/.gnupg
|
||||||
|
printf 'allow-loopback-pinentry\ndefault-cache-ttl 7200\nmax-cache-ttl 7200\n' > ~/.gnupg/gpg-agent.conf
|
||||||
|
gpgconf --kill gpg-agent || true
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||||
|
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print $5; exit}')
|
||||||
|
echo "GPG_KEYID=$KEYID" >> $GITHUB_ENV
|
||||||
|
echo prime > /tmp/prime.txt
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$KEYID" --detach-sign -o /dev/null /tmp/prime.txt
|
||||||
|
rm -f /tmp/prime.txt
|
||||||
|
|
||||||
|
- name: Checksums and detached signatures
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
# opkg verifies the signature of a feed index, never of a package file,
|
||||||
|
# so the checksums and their signature are what a manual install can be
|
||||||
|
# checked against.
|
||||||
|
sha256sum *.ipk > SHA256SUMS-openwrt-${{ matrix.arch }}
|
||||||
|
for f in *.ipk SHA256SUMS-openwrt-${{ matrix.arch }}; do
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$GPG_KEYID" --armor --detach-sign "$f"
|
||||||
|
done
|
||||||
|
sha256sum -c SHA256SUMS-openwrt-${{ matrix.arch }}
|
||||||
|
gpg --verify SHA256SUMS-openwrt-${{ matrix.arch }}.asc SHA256SUMS-openwrt-${{ matrix.arch }}
|
||||||
|
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.ipk
|
||||||
|
|
||||||
|
- name: Upload to release
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
|
run: |
|
||||||
|
gh release upload "$TAG" *.ipk *.ipk.asc \
|
||||||
|
SHA256SUMS-openwrt-${{ matrix.arch }} SHA256SUMS-openwrt-${{ matrix.arch }}.asc
|
||||||
@@ -6,10 +6,14 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
name: "${{ matrix.target }}"
|
name: "${{ matrix.target }}"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -22,12 +26,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pwd
|
pwd
|
||||||
echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV
|
echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV
|
||||||
echo "VERSION=$(date +%y%m%d%H%M%S)" >> $GITHUB_ENV
|
BUILDDATE=$(sed -n 's/^#define BUILDDATE "\(.*\)"$/\1/p' src/version.h)
|
||||||
echo "MAJOR=$(cat RELEASE | cut -d "-" -f 1)" >> $GITHUB_ENV
|
[ -n "$BUILDDATE" ] || BUILDDATE=$(date -u +%y%m%d%H%M%S)
|
||||||
echo "SUBMAJOR=$(cat RELEASE | cut -d "-" -f 2)" >> $GITHUB_ENV
|
echo "VERSION=$BUILDDATE" >> $GITHUB_ENV
|
||||||
echo "MINOR=$(cat RELEASE | cut -d "-" -f 3)" >> $GITHUB_ENV
|
SOURCE_DATE_EPOCH=$(date -u -d "20${BUILDDATE:0:2}-${BUILDDATE:2:2}-${BUILDDATE:4:2} ${BUILDDATE:6:2}:${BUILDDATE:8:2}:${BUILDDATE:10:2}" +%s)
|
||||||
|
echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" >> $GITHUB_ENV
|
||||||
- name: echo env
|
- name: echo env
|
||||||
run: echo "release $RELEASE version $VERSION major $MAJOR submajor $SUBMAJOR minor $MINOR"
|
run: echo "release $RELEASE version $VERSION"
|
||||||
- name: Linux libraries
|
- name: Linux libraries
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -42,45 +47,142 @@ jobs:
|
|||||||
cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz
|
cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz
|
||||||
- name: rpmbuild
|
- name: rpmbuild
|
||||||
run: |
|
run: |
|
||||||
ret=`pwd`
|
mkdir -p rpmout
|
||||||
|
for EL in 8 9 10; do
|
||||||
|
docker run --rm \
|
||||||
|
-v "$HOME/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz:/src.tar.gz:ro" \
|
||||||
|
-v "$PWD/scripts/rh/3proxy.spec:/3proxy.spec:ro" \
|
||||||
|
-v "$PWD/rpmout:/out" \
|
||||||
|
-e RELEASE="$RELEASE" -e HOSTUID="$(id -u)" -e HOSTGID="$(id -g)" \
|
||||||
|
-e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
|
||||||
|
"almalinux:$EL" bash -c '
|
||||||
|
set -e
|
||||||
|
dnf -y install rpm-build gcc make openssl-devel pcre2-devel pam-devel tar gzip
|
||||||
|
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
|
cp /src.tar.gz ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz
|
||||||
|
ln -sf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz
|
||||||
|
cp /3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec
|
||||||
cd ~/rpmbuild/SPECS
|
cd ~/rpmbuild/SPECS
|
||||||
rpmbuild -ba 3proxy-$RELEASE.spec
|
rpmbuild -ba \
|
||||||
cd $ret
|
--define "use_source_date_epoch_as_buildtime 1" \
|
||||||
mv ~/rpmbuild/RPMS/aarch64/3proxy-$RELEASE-1.aarch64.rpm 3proxy-$RELEASE.arm64.rpm
|
--define "clamp_mtime_to_source_date_epoch 1" \
|
||||||
|
--define "_buildhost 3proxy.org" \
|
||||||
|
3proxy-$RELEASE.spec
|
||||||
|
cp ~/rpmbuild/RPMS/*/*.rpm /out/
|
||||||
|
chown "$HOSTUID:$HOSTGID" /out/*.rpm || chmod 0666 /out/*.rpm'
|
||||||
|
done
|
||||||
|
for f in rpmout/*.rpm; do
|
||||||
|
dist=$(rpm -qp --qf '%{RELEASE}' "$f" | sed 's/^1\.//')
|
||||||
|
arch=$(rpm -qp --qf '%{ARCH}' "$f")
|
||||||
|
mv "$f" "3proxy-$RELEASE.$dist.$arch.rpm"
|
||||||
|
done
|
||||||
|
rmdir rpmout
|
||||||
|
ls -l *.rpm
|
||||||
- name: Get artifact rpm
|
- name: Get artifact rpm
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: "3proxy-${{ env.RELEASE }}-arm64.rpm"
|
name: "3proxy-${{ env.RELEASE }}-arm64.rpm"
|
||||||
path: "*.rpm"
|
path: "*.rpm"
|
||||||
- name: Upload rpm to release
|
|
||||||
if: github.event_name == 'release'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm64.rpm
|
|
||||||
- name: debbuild
|
- name: debbuild
|
||||||
run: |
|
run: |
|
||||||
ret=`pwd`
|
docker run --rm \
|
||||||
cd ~/debian/
|
-v "$HOME/debian:/debian" \
|
||||||
|
-e RELEASE="$RELEASE" -e VERSION="$VERSION" \
|
||||||
|
-e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
|
||||||
|
ubuntu:22.04 bash -c '
|
||||||
|
set -e
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y build-essential debhelper fakeroot libssl-dev libpcre2-dev libpam0g-dev
|
||||||
|
cd /debian
|
||||||
tar xzf 3proxy_$RELEASE.orig.tar.gz
|
tar xzf 3proxy_$RELEASE.orig.tar.gz
|
||||||
cd 3proxy-$RELEASE
|
cd 3proxy-$RELEASE
|
||||||
echo "3proxy ($RELEASE-$VERSION) buster; urgency=medium" >debian/changelog
|
{ echo "3proxy ($RELEASE-$VERSION) buster; urgency=medium"
|
||||||
echo " " >>debian/changelog
|
echo " "
|
||||||
echo " *3proxy $RELEASE build" >>debian/changelog
|
echo " *3proxy $RELEASE build"
|
||||||
echo " " >>debian/changelog
|
echo " "
|
||||||
echo " -- z3APA3A <3apa3a@3proxy.org> "`date "+%a, %d %b %Y %H:%M:%S %z"` >>debian/changelog
|
echo " -- z3APA3A <3apa3a@3proxy.org> $(date -R -u -d @$SOURCE_DATE_EPOCH)"
|
||||||
echo "">>debian/changelog
|
echo ""
|
||||||
dpkg-buildpackage
|
} > debian/changelog
|
||||||
cd $ret
|
dpkg-buildpackage'
|
||||||
cp ~/debian/3proxy_$RELEASE-"$VERSION"_arm64.deb ./3proxy-$RELEASE.arm64.deb
|
cp ~/debian/3proxy_$RELEASE-"$VERSION"_arm64.deb ./3proxy-$RELEASE.arm64.deb
|
||||||
- name: Get artifact deb
|
- name: Get artifact deb
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: "3proxy-${{ env.RELEASE }}-arm64.deb"
|
name: "3proxy-${{ env.RELEASE }}-arm64.deb"
|
||||||
path: "*.deb"
|
path: "*.deb"
|
||||||
- name: Upload deb to release
|
- name: Import signing key
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$GPG_PRIVATE_KEY" ]; then echo "GPG_PRIVATE_KEY is not set"; exit 1; fi
|
||||||
|
mkdir -p ~/.gnupg && chmod 700 ~/.gnupg
|
||||||
|
printf 'allow-loopback-pinentry\ndefault-cache-ttl 7200\nmax-cache-ttl 7200\n' > ~/.gnupg/gpg-agent.conf
|
||||||
|
gpgconf --kill gpg-agent || true
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||||
|
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print $5; exit}')
|
||||||
|
echo "GPG_KEYID=$KEYID" >> $GITHUB_ENV
|
||||||
|
echo prime > /tmp/prime.txt
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$KEYID" --detach-sign -o /dev/null /tmp/prime.txt
|
||||||
|
rm -f /tmp/prime.txt
|
||||||
|
- name: Sign rpm
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
GPGBIN=$(command -v gpg)
|
||||||
|
if [ -z "$GPGBIN" ]; then echo "gpg not found"; exit 1; fi
|
||||||
|
umask 077
|
||||||
|
printf '%s' "$GPG_PASSPHRASE" > /tmp/gpgpass
|
||||||
|
echo test > /tmp/signtest
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase-file /tmp/gpgpass \
|
||||||
|
-u "$GPG_KEYID" --detach-sign -o /tmp/signtest.sig /tmp/signtest
|
||||||
|
echo "key can sign"
|
||||||
|
{ echo "%_gpg_name $GPG_KEYID"
|
||||||
|
echo "%__gpg $GPGBIN"
|
||||||
|
echo '%__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --pinentry-mode loopback --passphrase-file /tmp/gpgpass --no-secmem-warning --digest-algo sha256 -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}'
|
||||||
|
} > ~/.rpmmacros
|
||||||
|
rpm --addsign *.rpm
|
||||||
|
rm -f /tmp/gpgpass /tmp/signtest /tmp/signtest.sig
|
||||||
|
for f in *.rpm; do
|
||||||
|
sig=$(rpm -qp --qf '%{RSAHEADER:pgpsig}' "$f" 2>/dev/null)
|
||||||
|
case "$sig" in ""|"(none)")
|
||||||
|
sig=$(rpm -qp --qf '%{DSAHEADER:pgpsig}' "$f" 2>/dev/null) ;;
|
||||||
|
esac
|
||||||
|
case "$sig" in ""|"(none)")
|
||||||
|
echo "$f is not signed"
|
||||||
|
echo "--- rpm version ---"; rpm --version
|
||||||
|
echo "--- sign cmd ---"; rpm --eval '%{__gpg_sign_cmd}'
|
||||||
|
echo "--- secret keys ---"; gpg --list-secret-keys --with-colons | grep -E '^(sec|ssb):' || true
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
echo "$f: $sig"
|
||||||
|
done
|
||||||
|
- name: Checksums and detached signatures
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
sha256sum *.rpm *.deb > SHA256SUMS-arm64
|
||||||
|
for f in *.deb SHA256SUMS-arm64; do
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$GPG_KEYID" --armor --detach-sign "$f"
|
||||||
|
done
|
||||||
|
sha256sum -c SHA256SUMS-arm64
|
||||||
|
gpg --verify SHA256SUMS-arm64.asc SHA256SUMS-arm64
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.rpm
|
||||||
|
*.deb
|
||||||
|
- name: Upload to release
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm64.deb
|
run: gh release upload "$TAG" *.rpm *.deb *.deb.asc SHA256SUMS-arm64 SHA256SUMS-arm64.asc
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: RPM/DEB build armhf
|
name: DEB build armhf
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
@@ -6,10 +6,14 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
name: "${{ matrix.target }}"
|
name: "${{ matrix.target }}"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -22,38 +26,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pwd
|
pwd
|
||||||
echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV
|
echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV
|
||||||
echo "VERSION=$(date +%y%m%d%H%M%S)" >> $GITHUB_ENV
|
BUILDDATE=$(sed -n 's/^#define BUILDDATE "\(.*\)"$/\1/p' src/version.h)
|
||||||
echo "MAJOR=$(cat RELEASE | cut -d "-" -f 1)" >> $GITHUB_ENV
|
[ -n "$BUILDDATE" ] || BUILDDATE=$(date -u +%y%m%d%H%M%S)
|
||||||
echo "SUBMAJOR=$(cat RELEASE | cut -d "-" -f 2)" >> $GITHUB_ENV
|
echo "VERSION=$BUILDDATE" >> $GITHUB_ENV
|
||||||
echo "MINOR=$(cat RELEASE | cut -d "-" -f 3)" >> $GITHUB_ENV
|
SOURCE_DATE_EPOCH=$(date -u -d "20${BUILDDATE:0:2}-${BUILDDATE:2:2}-${BUILDDATE:4:2} ${BUILDDATE:6:2}:${BUILDDATE:8:2}:${BUILDDATE:10:2}" +%s)
|
||||||
- name: Linux libraries
|
echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" >> $GITHUB_ENV
|
||||||
run: |
|
- name: configure deb env
|
||||||
sudo apt update
|
|
||||||
sudo dpkg --add-architecture armhf
|
|
||||||
echo "Types: deb" > ~/ubuntu.sources
|
|
||||||
echo "URIs: http://archive.ubuntu.com/ubuntu/" >> ~/ubuntu.sources
|
|
||||||
echo "Suites: noble noble-updates noble-backports" >> ~/ubuntu.sources
|
|
||||||
echo "Components: main restricted universe multiverse" >> ~/ubuntu.sources
|
|
||||||
echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> ~/ubuntu.sources
|
|
||||||
echo "Architectures: amd64" >> ~/ubuntu.sources
|
|
||||||
echo "" >> ~/ubuntu.sources
|
|
||||||
echo "Types: deb" >> ~/ubuntu.sources
|
|
||||||
echo "URIs: http://security.ubuntu.com/ubuntu/" >> ~/ubuntu.sources
|
|
||||||
echo "Suites: noble-security" >> ~/ubuntu.sources
|
|
||||||
echo "Components: main restricted universe multiverse" >> ~/ubuntu.sources
|
|
||||||
echo "Architectures: amd64" >> ~/ubuntu.sources
|
|
||||||
echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> ~/ubuntu.sources
|
|
||||||
echo "" >> ~/ubuntu.sources
|
|
||||||
echo "Types: deb" >>~/ubuntu.sources
|
|
||||||
echo "URIs: http://ports.ubuntu.com/ubuntu-ports/" >>~/ubuntu.sources
|
|
||||||
echo "Suites: noble noble-updates" >>~/ubuntu.sources
|
|
||||||
echo "Components: main restricted universe multiverse" >>~/ubuntu.sources
|
|
||||||
echo "Architectures: armhf" >>~/ubuntu.sources
|
|
||||||
echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >>~/ubuntu.sources
|
|
||||||
sudo cp ~/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install libssl3t64:armhf openssl:armhf libssl-dev:armhf libpam0g:armhf libpam0g-dev:armhf libpcre2-dev:armhf rpm crossbuild-essential-armhf build-essential debhelper
|
|
||||||
- name: configure rpm env
|
|
||||||
run: |
|
run: |
|
||||||
mkdir ~/debian
|
mkdir ~/debian
|
||||||
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
@@ -61,59 +39,81 @@ jobs:
|
|||||||
ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz
|
ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz
|
||||||
cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec
|
cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec
|
||||||
cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz
|
cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz
|
||||||
- name: rpmbuild
|
|
||||||
run: |
|
|
||||||
ret=`pwd`
|
|
||||||
cd ~/rpmbuild/SPECS
|
|
||||||
PATH=/usr/arm-linux-gnueabihf/bin:$PATH
|
|
||||||
export PATH=$PATH
|
|
||||||
CC=arm-linux-gnueabihf-gcc
|
|
||||||
export CC=$CC
|
|
||||||
export RPATH=/usr/arm-linux-gnueabihf/lib:$RPATH
|
|
||||||
export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib:$LD_LIBRARY_PATH
|
|
||||||
rpmbuild -ba --define "PAMLIB pam0g" --define "_arch arm" --define "cross yes" --target=arm-linux-gnueabihf 3proxy-$RELEASE.spec
|
|
||||||
cd $ret
|
|
||||||
mv ~/rpmbuild/RPMS/arm/3proxy-$RELEASE-1.arm.rpm 3proxy-$RELEASE.arm.rpm
|
|
||||||
- name: Get artifact rpm
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
|
||||||
name: "3proxy-${{ env.RELEASE }}-arm.rpm"
|
|
||||||
path: "*.rpm"
|
|
||||||
- name: Upload rpm to release
|
|
||||||
if: github.event_name == 'release'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm.rpm
|
|
||||||
- name: debbuild
|
- name: debbuild
|
||||||
run: |
|
run: |
|
||||||
ret=`pwd`
|
docker run --rm \
|
||||||
cd ~/debian/
|
-v "$HOME/debian:/debian" \
|
||||||
|
-e RELEASE="$RELEASE" -e VERSION="$VERSION" \
|
||||||
|
-e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
|
||||||
|
ubuntu:22.04 bash -c '
|
||||||
|
set -e
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
dpkg --add-architecture armhf
|
||||||
|
sed -i "s|^deb |deb [arch=amd64] |" /etc/apt/sources.list
|
||||||
|
{ echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse"
|
||||||
|
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted universe multiverse"
|
||||||
|
} >> /etc/apt/sources.list
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y crossbuild-essential-armhf build-essential debhelper fakeroot \
|
||||||
|
libssl-dev:armhf libpcre2-dev:armhf libpam0g-dev:armhf
|
||||||
|
cd /debian
|
||||||
tar xzf 3proxy_$RELEASE.orig.tar.gz
|
tar xzf 3proxy_$RELEASE.orig.tar.gz
|
||||||
cd 3proxy-$RELEASE
|
cd 3proxy-$RELEASE
|
||||||
echo "3proxy ($RELEASE-$VERSION) buster; urgency=medium" >debian/changelog
|
{ echo "3proxy ($RELEASE-$VERSION) buster; urgency=medium"
|
||||||
echo " " >>debian/changelog
|
echo " "
|
||||||
echo " *3proxy $RELEASE build" >>debian/changelog
|
echo " *3proxy $RELEASE build"
|
||||||
echo " " >>debian/changelog
|
echo " "
|
||||||
echo " -- z3APA3A <3apa3a@3proxy.org> "`date "+%a, %d %b %Y %H:%M:%S %z"` >>debian/changelog
|
echo " -- z3APA3A <3apa3a@3proxy.org> $(date -R -u -d @$SOURCE_DATE_EPOCH)"
|
||||||
echo "">>debian/changelog
|
echo ""
|
||||||
PATH=/usr/arm-linux-gnueabihf/bin:$PATH
|
} > debian/changelog
|
||||||
export PATH=$PATH
|
export PATH=/usr/arm-linux-gnueabihf/bin:$PATH
|
||||||
CC=arm-linux-gnueabihf-gcc
|
export CC=arm-linux-gnueabihf-gcc
|
||||||
export CC=$CC
|
|
||||||
export RPATH=/usr/arm-linux-gnueabihf/lib:$RPATH
|
|
||||||
export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib:$LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib:$LD_LIBRARY_PATH
|
||||||
dpkg-buildpackage
|
dpkg-buildpackage'
|
||||||
cd $ret
|
|
||||||
cp ~/debian/3proxy_$RELEASE-"$VERSION"_armhf.deb ./3proxy-$RELEASE.arm.deb
|
cp ~/debian/3proxy_$RELEASE-"$VERSION"_armhf.deb ./3proxy-$RELEASE.arm.deb
|
||||||
- name: Get artifact deb
|
- name: Get artifact deb
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: "3proxy-${{ env.RELEASE }}-arm.deb"
|
name: "3proxy-${{ env.RELEASE }}-arm.deb"
|
||||||
path: "*.deb"
|
path: "*.deb"
|
||||||
- name: Upload deb to release
|
- name: Import signing key
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$GPG_PRIVATE_KEY" ]; then echo "GPG_PRIVATE_KEY is not set"; exit 1; fi
|
||||||
|
mkdir -p ~/.gnupg && chmod 700 ~/.gnupg
|
||||||
|
printf 'allow-loopback-pinentry\ndefault-cache-ttl 7200\nmax-cache-ttl 7200\n' > ~/.gnupg/gpg-agent.conf
|
||||||
|
gpgconf --kill gpg-agent || true
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||||
|
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print $5; exit}')
|
||||||
|
echo "GPG_KEYID=$KEYID" >> $GITHUB_ENV
|
||||||
|
echo prime > /tmp/prime.txt
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$KEYID" --detach-sign -o /dev/null /tmp/prime.txt
|
||||||
|
rm -f /tmp/prime.txt
|
||||||
|
- name: Checksums and detached signatures
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
sha256sum *.deb > SHA256SUMS-arm
|
||||||
|
for f in *.deb SHA256SUMS-arm; do
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$GPG_KEYID" --armor --detach-sign "$f"
|
||||||
|
done
|
||||||
|
sha256sum -c SHA256SUMS-arm
|
||||||
|
gpg --verify SHA256SUMS-arm.asc SHA256SUMS-arm
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.deb
|
||||||
|
- name: Upload to release
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.arm.deb
|
run: gh release upload "$TAG" *.deb *.deb.asc SHA256SUMS-arm SHA256SUMS-arm.asc
|
||||||
@@ -6,15 +6,20 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
name: "${{ matrix.target }}"
|
name: "${{ matrix.target }}"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target:
|
target:
|
||||||
- ubuntu-latest
|
# 26.04: rpm 6 runs %__gpg_sign_cmd differently, signing fails
|
||||||
|
- ubuntu-24.04
|
||||||
runs-on: ${{ matrix.target }}
|
runs-on: ${{ matrix.target }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v7
|
||||||
@@ -22,12 +27,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pwd
|
pwd
|
||||||
echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV
|
echo "RELEASE=$(cat RELEASE)" >> $GITHUB_ENV
|
||||||
echo "VERSION=$(date +%y%m%d%H%M%S)" >> $GITHUB_ENV
|
BUILDDATE=$(sed -n 's/^#define BUILDDATE "\(.*\)"$/\1/p' src/version.h)
|
||||||
echo "MAJOR=$(cat RELEASE | cut -d "-" -f 1)" >> $GITHUB_ENV
|
[ -n "$BUILDDATE" ] || BUILDDATE=$(date -u +%y%m%d%H%M%S)
|
||||||
echo "SUBMAJOR=$(cat RELEASE | cut -d "-" -f 2)" >> $GITHUB_ENV
|
echo "VERSION=$BUILDDATE" >> $GITHUB_ENV
|
||||||
echo "MINOR=$(cat RELEASE | cut -d "-" -f 3)" >> $GITHUB_ENV
|
SOURCE_DATE_EPOCH=$(date -u -d "20${BUILDDATE:0:2}-${BUILDDATE:2:2}-${BUILDDATE:4:2} ${BUILDDATE:6:2}:${BUILDDATE:8:2}:${BUILDDATE:10:2}" +%s)
|
||||||
|
echo "SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH" >> $GITHUB_ENV
|
||||||
- name: echo env
|
- name: echo env
|
||||||
run: echo "release $RELEASE version $VERSION major $MAJOR submajor $SUBMAJOR minor $MINOR"
|
run: echo "release $RELEASE version $VERSION"
|
||||||
- name: Linux libraries
|
- name: Linux libraries
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -42,46 +48,143 @@ jobs:
|
|||||||
cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz
|
cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz
|
||||||
- name: rpmbuild
|
- name: rpmbuild
|
||||||
run: |
|
run: |
|
||||||
ret=`pwd`
|
mkdir -p rpmout
|
||||||
|
for EL in 8 9 10; do
|
||||||
|
docker run --rm \
|
||||||
|
-v "$HOME/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz:/src.tar.gz:ro" \
|
||||||
|
-v "$PWD/scripts/rh/3proxy.spec:/3proxy.spec:ro" \
|
||||||
|
-v "$PWD/rpmout:/out" \
|
||||||
|
-e RELEASE="$RELEASE" -e HOSTUID="$(id -u)" -e HOSTGID="$(id -g)" \
|
||||||
|
-e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
|
||||||
|
"almalinux:$EL" bash -c '
|
||||||
|
set -e
|
||||||
|
dnf -y install rpm-build gcc make openssl-devel pcre2-devel pam-devel tar gzip
|
||||||
|
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
||||||
|
cp /src.tar.gz ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz
|
||||||
|
ln -sf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz
|
||||||
|
cp /3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec
|
||||||
cd ~/rpmbuild/SPECS
|
cd ~/rpmbuild/SPECS
|
||||||
rpmbuild -ba 3proxy-$RELEASE.spec
|
rpmbuild -ba \
|
||||||
cd $ret
|
--define "use_source_date_epoch_as_buildtime 1" \
|
||||||
mv ~/rpmbuild/RPMS/x86_64/3proxy-$RELEASE-1.x86_64.rpm 3proxy-$RELEASE.x86_64.rpm
|
--define "clamp_mtime_to_source_date_epoch 1" \
|
||||||
|
--define "_buildhost 3proxy.org" \
|
||||||
|
3proxy-$RELEASE.spec
|
||||||
|
cp ~/rpmbuild/RPMS/*/*.rpm /out/
|
||||||
|
chown "$HOSTUID:$HOSTGID" /out/*.rpm || chmod 0666 /out/*.rpm'
|
||||||
|
done
|
||||||
|
for f in rpmout/*.rpm; do
|
||||||
|
dist=$(rpm -qp --qf '%{RELEASE}' "$f" | sed 's/^1\.//')
|
||||||
|
arch=$(rpm -qp --qf '%{ARCH}' "$f")
|
||||||
|
mv "$f" "3proxy-$RELEASE.$dist.$arch.rpm"
|
||||||
|
done
|
||||||
|
rmdir rpmout
|
||||||
|
ls -l *.rpm
|
||||||
- name: Get artifact rpm
|
- name: Get artifact rpm
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: "3proxy-${{ env.RELEASE }}-x86_64.rpm"
|
name: "3proxy-${{ env.RELEASE }}-x86_64.rpm"
|
||||||
path: "*.rpm"
|
path: "*.rpm"
|
||||||
- name: Upload rpm to release
|
|
||||||
if: github.event_name == 'release'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.x86_64.rpm
|
|
||||||
- name: debbuild
|
- name: debbuild
|
||||||
run: |
|
run: |
|
||||||
ret=`pwd`
|
docker run --rm \
|
||||||
cd ~/debian/
|
-v "$HOME/debian:/debian" \
|
||||||
|
-e RELEASE="$RELEASE" -e VERSION="$VERSION" \
|
||||||
|
-e SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" \
|
||||||
|
ubuntu:22.04 bash -c '
|
||||||
|
set -e
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y build-essential debhelper fakeroot libssl-dev libpcre2-dev libpam0g-dev
|
||||||
|
cd /debian
|
||||||
tar xzf 3proxy_$RELEASE.orig.tar.gz
|
tar xzf 3proxy_$RELEASE.orig.tar.gz
|
||||||
cd 3proxy-$RELEASE
|
cd 3proxy-$RELEASE
|
||||||
echo "3proxy ($RELEASE-$VERSION) buster; urgency=medium" >debian/changelog
|
{ echo "3proxy ($RELEASE-$VERSION) buster; urgency=medium"
|
||||||
echo " " >>debian/changelog
|
echo " "
|
||||||
echo " *3proxy $RELEASE build" >>debian/changelog
|
echo " *3proxy $RELEASE build"
|
||||||
echo " " >>debian/changelog
|
echo " "
|
||||||
echo " -- z3APA3A <3apa3a@3proxy.org> "`date "+%a, %d %b %Y %H:%M:%S %z"` >>debian/changelog
|
echo " -- z3APA3A <3apa3a@3proxy.org> $(date -R -u -d @$SOURCE_DATE_EPOCH)"
|
||||||
echo "">>debian/changelog
|
echo ""
|
||||||
dpkg-buildpackage
|
} > debian/changelog
|
||||||
cd $ret
|
dpkg-buildpackage'
|
||||||
cp ~/debian/3proxy_$RELEASE-"$VERSION"_amd64.deb ./3proxy-$RELEASE.x86_64.deb
|
cp ~/debian/3proxy_$RELEASE-"$VERSION"_amd64.deb ./3proxy-$RELEASE.x86_64.deb
|
||||||
- name: Get artifact deb
|
- name: Get artifact deb
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: "3proxy-${{ env.RELEASE }}-x86_64.deb"
|
name: "3proxy-${{ env.RELEASE }}-x86_64.deb"
|
||||||
path: "*.deb"
|
path: "*.deb"
|
||||||
- name: Upload deb to release
|
|
||||||
|
- name: Import signing key
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$GPG_PRIVATE_KEY" ]; then echo "GPG_PRIVATE_KEY is not set"; exit 1; fi
|
||||||
|
mkdir -p ~/.gnupg && chmod 700 ~/.gnupg
|
||||||
|
printf 'allow-loopback-pinentry\ndefault-cache-ttl 7200\nmax-cache-ttl 7200\n' > ~/.gnupg/gpg-agent.conf
|
||||||
|
gpgconf --kill gpg-agent || true
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||||
|
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print $5; exit}')
|
||||||
|
echo "GPG_KEYID=$KEYID" >> $GITHUB_ENV
|
||||||
|
echo prime > /tmp/prime.txt
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$KEYID" --detach-sign -o /dev/null /tmp/prime.txt
|
||||||
|
rm -f /tmp/prime.txt
|
||||||
|
- name: Sign rpm
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
GPGBIN=$(command -v gpg)
|
||||||
|
if [ -z "$GPGBIN" ]; then echo "gpg not found"; exit 1; fi
|
||||||
|
umask 077
|
||||||
|
printf '%s' "$GPG_PASSPHRASE" > /tmp/gpgpass
|
||||||
|
echo test > /tmp/signtest
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase-file /tmp/gpgpass \
|
||||||
|
-u "$GPG_KEYID" --detach-sign -o /tmp/signtest.sig /tmp/signtest
|
||||||
|
echo "key can sign"
|
||||||
|
{ echo "%_gpg_name $GPG_KEYID"
|
||||||
|
echo "%__gpg $GPGBIN"
|
||||||
|
echo '%__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --pinentry-mode loopback --passphrase-file /tmp/gpgpass --no-secmem-warning --digest-algo sha256 -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}'
|
||||||
|
} > ~/.rpmmacros
|
||||||
|
rpm --addsign *.rpm
|
||||||
|
rm -f /tmp/gpgpass /tmp/signtest /tmp/signtest.sig
|
||||||
|
for f in *.rpm; do
|
||||||
|
sig=$(rpm -qp --qf '%{RSAHEADER:pgpsig}' "$f" 2>/dev/null)
|
||||||
|
case "$sig" in ""|"(none)")
|
||||||
|
sig=$(rpm -qp --qf '%{DSAHEADER:pgpsig}' "$f" 2>/dev/null) ;;
|
||||||
|
esac
|
||||||
|
case "$sig" in ""|"(none)")
|
||||||
|
echo "$f is not signed"
|
||||||
|
echo "--- rpm version ---"; rpm --version
|
||||||
|
echo "--- sign cmd ---"; rpm --eval '%{__gpg_sign_cmd}'
|
||||||
|
echo "--- secret keys ---"; gpg --list-secret-keys --with-colons | grep -E '^(sec|ssb):' || true
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
echo "$f: $sig"
|
||||||
|
done
|
||||||
|
- name: Checksums and detached signatures
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
sha256sum *.rpm *.deb > SHA256SUMS-x86_64
|
||||||
|
for f in *.deb SHA256SUMS-x86_64; do
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$GPG_KEYID" --armor --detach-sign "$f"
|
||||||
|
done
|
||||||
|
sha256sum -c SHA256SUMS-x86_64
|
||||||
|
gpg --verify SHA256SUMS-x86_64.asc SHA256SUMS-x86_64
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.rpm
|
||||||
|
*.deb
|
||||||
|
- name: Upload to release
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}.x86_64.deb
|
run: gh release upload "$TAG" *.rpm *.deb *.deb.asc SHA256SUMS-x86_64 SHA256SUMS-x86_64.asc
|
||||||
|
|
||||||
@@ -6,10 +6,14 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
name: "${{ matrix.target }}"
|
name: "${{ matrix.target }}"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -34,19 +38,10 @@ jobs:
|
|||||||
- name: make Watcom
|
- name: make Watcom
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c
|
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\n^";" >>src/3proxy.c
|
||||||
nmake /F Makefile.watcom
|
nmake /F Makefile.watcom
|
||||||
- name: Decode Certificate
|
if errorlevel 1 exit /b 1
|
||||||
shell: pwsh
|
if not exist bin\3proxy.exe (echo bin\3proxy.exe was not built & exit /b 1)
|
||||||
run: |
|
|
||||||
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}")
|
|
||||||
[System.IO.File]::WriteAllBytes("${{ github.workspace }}\cert.pfx", $pfx_cert_byte)
|
|
||||||
- name: Sign
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
$signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { [version]$_.Directory.Parent.Name } -Descending | Select-Object -First 1).FullName
|
|
||||||
& $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy.exe"
|
|
||||||
& $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}" /tr http://timestamp.digicert.com /td sha256 /fd sha256 "bin\3proxy_crypt.exe"
|
|
||||||
- name: make dist dir
|
- name: make dist dir
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
@@ -86,9 +81,30 @@ jobs:
|
|||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-lite.zip
|
run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-lite.zip
|
||||||
|
- name: Checksums and detached signature
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$GPG_PRIVATE_KEY" ]; then echo "GPG_PRIVATE_KEY is not set"; exit 1; fi
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||||
|
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print $5; exit}')
|
||||||
|
sha256sum *.zip > SHA256SUMS-win-lite
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$KEYID" --armor --detach-sign SHA256SUMS-win-lite
|
||||||
|
sha256sum -c SHA256SUMS-win-lite
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.zip
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-lite.zip
|
run: gh release upload "$TAG" *.zip SHA256SUMS-win-lite SHA256SUMS-win-lite.asc
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
name: Build 3proxy with MSYS2 UCRT64
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
name: "msys2-ucrt64"
|
||||||
|
runs-on: windows-2022
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
- name: Setup MSYS2 (UCRT64)
|
||||||
|
uses: msys2/setup-msys2@v2
|
||||||
|
with:
|
||||||
|
msystem: UCRT64
|
||||||
|
update: true
|
||||||
|
install: >-
|
||||||
|
make
|
||||||
|
mingw-w64-ucrt-x86_64-gcc
|
||||||
|
mingw-w64-ucrt-x86_64-pcre2
|
||||||
|
mingw-w64-ucrt-x86_64-openssl
|
||||||
|
mingw-w64-ucrt-x86_64-zlib
|
||||||
|
- name: set date
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$NOW = Get-Date -Format "yyMMddHHmmss"
|
||||||
|
$RELEASE = Get-Content -Path "RELEASE" -Raw
|
||||||
|
echo "NOW=$NOW" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
|
echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
|
- name: make Windows (Makefile.win)
|
||||||
|
shell: msys2 {0}
|
||||||
|
env:
|
||||||
|
LIBSTATIC: 'true'
|
||||||
|
run: make -f Makefile.win
|
||||||
|
- name: make dist dir
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
mkdir dist
|
||||||
|
mkdir dist\3proxy
|
||||||
|
mkdir dist\3proxy\bin
|
||||||
|
mkdir dist\3proxy\cfg
|
||||||
|
mkdir dist\3proxy\cfg\sql
|
||||||
|
mkdir dist\3proxy\doc
|
||||||
|
mkdir dist\3proxy\doc\ru
|
||||||
|
mkdir dist\3proxy\doc\html
|
||||||
|
mkdir dist\3proxy\doc\html\plugins
|
||||||
|
mkdir dist\3proxy\doc\html\man5
|
||||||
|
mkdir dist\3proxy\doc\html\man8
|
||||||
|
mkdir dist\3proxy\doc\html\devel
|
||||||
|
copy bin\3proxy.exe dist\3proxy\bin\
|
||||||
|
copy bin\*.dll dist\3proxy\bin\
|
||||||
|
copy bin\3proxy_crypt.exe dist\3proxy\bin\
|
||||||
|
copy cfg\*.* dist\3proxy\cfg\
|
||||||
|
copy cfg\sql\*.* dist\3proxy\cfg\sql\
|
||||||
|
copy doc\ru\*.* dist\3proxy\doc\ru\
|
||||||
|
copy doc\html\*.* dist\3proxy\doc\html\
|
||||||
|
copy doc\html\plugins\*.* dist\3proxy\doc\html\plugins\
|
||||||
|
copy doc\html\man8\*.* dist\3proxy\doc\html\man8\
|
||||||
|
copy doc\html\man5\*.* dist\3proxy\doc\html\man5\
|
||||||
|
copy doc\html\devel\*.* dist\3proxy\doc\html\devel\
|
||||||
|
copy copying dist\3proxy\
|
||||||
|
copy authors dist\3proxy\
|
||||||
|
copy README.md dist\3proxy\
|
||||||
|
copy rus.3ps dist\3proxy\
|
||||||
|
- name: Get artifact
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: "3proxy-${{ env.RELEASE }}-msys2-ucrt64"
|
||||||
|
path: dist/
|
||||||
@@ -6,10 +6,14 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
name: "${{ matrix.target }}"
|
name: "${{ matrix.target }}"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -28,7 +32,7 @@ jobs:
|
|||||||
echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
- name: install packages
|
- name: install packages
|
||||||
run: vcpkg install pcre2:x86-windows-static openssl:x86-windows-static
|
run: vcpkg install pcre2:x86-windows-static wolfssl:x86-windows-static
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
uses: microsoft/setup-msbuild@v3
|
uses: microsoft/setup-msbuild@v3
|
||||||
- name: make Windows MSVC
|
- name: make Windows MSVC
|
||||||
@@ -40,27 +44,8 @@ jobs:
|
|||||||
cd "D:/a/3proxy/3proxy"
|
cd "D:/a/3proxy/3proxy"
|
||||||
set "LIB=%LIB%;c:/vcpkg/installed/x86-windows-static/lib"
|
set "LIB=%LIB%;c:/vcpkg/installed/x86-windows-static/lib"
|
||||||
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x86-windows-static/include"
|
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x86-windows-static/include"
|
||||||
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c
|
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\n^";" >>src/3proxy.c
|
||||||
nmake /F Makefile.msvc
|
nmake /F Makefile.msvc WOLFSSL=1
|
||||||
- name: Decode Certificate
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}")
|
|
||||||
[System.IO.File]::WriteAllBytes("${{ github.workspace }}\cert.pfx", $pfx_cert_byte)
|
|
||||||
- name: Extract public certificate
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
CERT_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("${{ github.workspace }}\cert.pfx", "$env:CERT_PASSWORD")
|
|
||||||
[System.IO.File]::WriteAllBytes("${{ github.workspace }}\3proxy.crt", $cert.Export("Cert"))
|
|
||||||
- name: Sign
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
CERT_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
$signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { [version]$_.Directory.Parent.Name } -Descending | Select-Object -First 1).FullName
|
|
||||||
Get-ChildItem bin\*.exe, bin\*.dll | ForEach-Object { & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "$env:CERT_PASSWORD" /tr http://timestamp.digicert.com /td sha256 /fd sha256 $_.FullName }
|
|
||||||
- name: make dist dir
|
- name: make dist dir
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
@@ -91,19 +76,39 @@ jobs:
|
|||||||
copy authors dist\3proxy\
|
copy authors dist\3proxy\
|
||||||
copy README.md dist\3proxy\
|
copy README.md dist\3proxy\
|
||||||
copy rus.3ps dist\3proxy\
|
copy rus.3ps dist\3proxy\
|
||||||
copy 3proxy.crt dist\3proxy\
|
|
||||||
- name: Get artifact
|
- name: Get artifact
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: "3proxy-${{ env.RELEASE }}"
|
name: "3proxy-${{ env.RELEASE }}-x86"
|
||||||
path: dist/
|
path: dist/
|
||||||
- name: Create zip
|
- name: Create zip
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-x86.zip
|
run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-x86.zip
|
||||||
|
- name: Checksums and detached signature
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$GPG_PRIVATE_KEY" ]; then echo "GPG_PRIVATE_KEY is not set"; exit 1; fi
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||||
|
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print $5; exit}')
|
||||||
|
sha256sum *.zip > SHA256SUMS-win-x86
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$KEYID" --armor --detach-sign SHA256SUMS-win-x86
|
||||||
|
sha256sum -c SHA256SUMS-win-x86
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.zip
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-x86.zip
|
run: gh release upload "$TAG" *.zip SHA256SUMS-win-x86 SHA256SUMS-win-x86.asc
|
||||||
@@ -6,10 +6,14 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
name: "${{ matrix.target }}"
|
name: "${{ matrix.target }}"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -29,7 +33,7 @@ jobs:
|
|||||||
echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
- name: install packages
|
- name: install packages
|
||||||
run: vcpkg install pcre2:x64-windows-static openssl:x64-windows-static
|
run: vcpkg install pcre2:x64-windows-static wolfssl:x64-windows-static
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
uses: microsoft/setup-msbuild@v3
|
uses: microsoft/setup-msbuild@v3
|
||||||
- name: make Windows MSVC
|
- name: make Windows MSVC
|
||||||
@@ -40,28 +44,9 @@ jobs:
|
|||||||
cd "D:/a/3proxy/3proxy"
|
cd "D:/a/3proxy/3proxy"
|
||||||
set "LIB=%LIB%;c:/vcpkg/installed/x64-windows-static/lib"
|
set "LIB=%LIB%;c:/vcpkg/installed/x64-windows-static/lib"
|
||||||
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x64-windows-static/include"
|
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x64-windows-static/include"
|
||||||
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c
|
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\n^";" >>src/3proxy.c
|
||||||
echo %NOW% / %RELEASE% / %BUILDDATE% / %VERSION%
|
echo %NOW% / %RELEASE% / %BUILDDATE% / %VERSION%
|
||||||
nmake /F Makefile.msvc
|
nmake /F Makefile.msvc WOLFSSL=1
|
||||||
- name: Decode Certificate
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}")
|
|
||||||
[System.IO.File]::WriteAllBytes("${{ github.workspace }}\cert.pfx", $pfx_cert_byte)
|
|
||||||
- name: Extract public certificate
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
CERT_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("${{ github.workspace }}\cert.pfx", "$env:CERT_PASSWORD")
|
|
||||||
[System.IO.File]::WriteAllBytes("${{ github.workspace }}\3proxy.crt", $cert.Export("Cert"))
|
|
||||||
- name: Sign
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
CERT_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
$signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { [version]$_.Directory.Parent.Name } -Descending | Select-Object -First 1).FullName
|
|
||||||
Get-ChildItem bin\*.exe, bin\*.dll | ForEach-Object { & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "$env:CERT_PASSWORD" /tr http://timestamp.digicert.com /td sha256 /fd sha256 $_.FullName }
|
|
||||||
- name: make dist dir
|
- name: make dist dir
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
@@ -92,7 +77,6 @@ jobs:
|
|||||||
copy authors dist\3proxy\
|
copy authors dist\3proxy\
|
||||||
copy README.md dist\3proxy\
|
copy README.md dist\3proxy\
|
||||||
copy rus.3ps dist\3proxy\
|
copy rus.3ps dist\3proxy\
|
||||||
copy 3proxy.crt dist\3proxy\
|
|
||||||
- name: Get artifact
|
- name: Get artifact
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
@@ -102,9 +86,30 @@ jobs:
|
|||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-x64.zip
|
run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-x64.zip
|
||||||
|
- name: Checksums and detached signature
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$GPG_PRIVATE_KEY" ]; then echo "GPG_PRIVATE_KEY is not set"; exit 1; fi
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||||
|
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print $5; exit}')
|
||||||
|
sha256sum *.zip > SHA256SUMS-win-x64
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$KEYID" --armor --detach-sign SHA256SUMS-win-x64
|
||||||
|
sha256sum -c SHA256SUMS-win-x64
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.zip
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-x64.zip
|
run: gh release upload "$TAG" *.zip SHA256SUMS-win-x64 SHA256SUMS-win-x64.asc
|
||||||
@@ -6,10 +6,14 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
name: "${{ matrix.target }}"
|
name: "${{ matrix.target }}"
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -28,7 +32,7 @@ jobs:
|
|||||||
echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
- name: install packages
|
- name: install packages
|
||||||
run: vcpkg install pcre2:arm64-windows-static openssl:arm64-windows-static
|
run: vcpkg install pcre2:arm64-windows-static wolfssl:arm64-windows-static
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
uses: microsoft/setup-msbuild@v3
|
uses: microsoft/setup-msbuild@v3
|
||||||
- name: make Windows MSVC
|
- name: make Windows MSVC
|
||||||
@@ -40,27 +44,8 @@ jobs:
|
|||||||
cd "D:/a/3proxy/3proxy"
|
cd "D:/a/3proxy/3proxy"
|
||||||
set "LIB=%LIB%;c:/vcpkg/installed/arm64-windows-static/lib"
|
set "LIB=%LIB%;c:/vcpkg/installed/arm64-windows-static/lib"
|
||||||
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/arm64-windows-static/include"
|
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/arm64-windows-static/include"
|
||||||
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c
|
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\n^";" >>src/3proxy.c
|
||||||
nmake /F Makefile.msvc
|
nmake /F Makefile.msvc WOLFSSL=1
|
||||||
- name: Decode Certificate
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.WINDOWS_CERTIFICATE }}")
|
|
||||||
[System.IO.File]::WriteAllBytes("${{ github.workspace }}\cert.pfx", $pfx_cert_byte)
|
|
||||||
- name: Extract public certificate
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
CERT_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("${{ github.workspace }}\cert.pfx", "$env:CERT_PASSWORD")
|
|
||||||
[System.IO.File]::WriteAllBytes("${{ github.workspace }}\3proxy.crt", $cert.Export("Cert"))
|
|
||||||
- name: Sign
|
|
||||||
shell: pwsh
|
|
||||||
env:
|
|
||||||
CERT_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
$signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { [version]$_.Directory.Parent.Name } -Descending | Select-Object -First 1).FullName
|
|
||||||
Get-ChildItem bin\*.exe, bin\*.dll | ForEach-Object { & $signtool sign /f "${{ github.workspace }}\cert.pfx" /p "$env:CERT_PASSWORD" /tr http://timestamp.digicert.com /td sha256 /fd sha256 $_.FullName }
|
|
||||||
- name: make dist dir
|
- name: make dist dir
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
@@ -91,7 +76,6 @@ jobs:
|
|||||||
copy authors dist\3proxy\
|
copy authors dist\3proxy\
|
||||||
copy README.md dist\3proxy\
|
copy README.md dist\3proxy\
|
||||||
copy rus.3ps dist\3proxy\
|
copy rus.3ps dist\3proxy\
|
||||||
copy 3proxy.crt dist\3proxy\
|
|
||||||
- name: Get artifact
|
- name: Get artifact
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
@@ -101,9 +85,30 @@ jobs:
|
|||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-arm64.zip
|
run: Compress-Archive -Path dist/* -DestinationPath 3proxy-${{ env.RELEASE }}-arm64.zip
|
||||||
|
- name: Checksums and detached signature
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$GPG_PRIVATE_KEY" ]; then echo "GPG_PRIVATE_KEY is not set"; exit 1; fi
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||||
|
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print $5; exit}')
|
||||||
|
sha256sum *.zip > SHA256SUMS-win-arm64
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$KEYID" --armor --detach-sign SHA256SUMS-win-arm64
|
||||||
|
sha256sum -c SHA256SUMS-win-arm64
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.zip
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
TAG: ${{ github.event.release.tag_name }}
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
run: gh release upload "$TAG" 3proxy-${{ env.RELEASE }}-arm64.zip
|
run: gh release upload "$TAG" *.zip SHA256SUMS-win-arm64 SHA256SUMS-win-arm64.asc
|
||||||
@@ -2,9 +2,9 @@ name: C/C++ CI Linux
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths: [ '**.c', '**.h', 'Makefile.Linux', '.github/configs', '.github/workflows/c-cpp-Linux.yml' ]
|
paths: [ '**.c', '**.h', 'Makefile.Linux', 'tests/**', '.github/configs', '.github/workflows/c-cpp-Linux.yml' ]
|
||||||
pull_request:
|
pull_request:
|
||||||
paths: [ "**.c", "**.h", "Makefile.Linux", ".github/configs", ".github/workflows/c-cpp-Linux.yml" ]
|
paths: [ "**.c", "**.h", "Makefile.Linux", "tests/**", ".github/configs", ".github/workflows/c-cpp-Linux.yml" ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -25,9 +25,11 @@ jobs:
|
|||||||
# run: ./configure
|
# run: ./configure
|
||||||
- name: Linux libraries
|
- name: Linux libraries
|
||||||
if: ${{ startsWith(matrix.target, 'ubuntu') }}
|
if: ${{ startsWith(matrix.target, 'ubuntu') }}
|
||||||
run: sudo apt install libssl-dev libpam-dev libpcre2-dev
|
run: sudo apt-get update && sudo apt-get install -y libssl-dev libpam-dev libpcre2-dev
|
||||||
- name: make
|
- name: make
|
||||||
run: make -f Makefile.Linux
|
run: make -f Makefile.Linux MAILPROXY=true FTP=true
|
||||||
|
- name: regression tests
|
||||||
|
run: python3 tests/run.py
|
||||||
- name: mkdir
|
- name: mkdir
|
||||||
run: mkdir ~/3proxy
|
run: mkdir ~/3proxy
|
||||||
- name: make install
|
- name: make install
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ name: C/C++ CI MacOS
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths: [ '**.c', '**.h', 'Makefile.FreeBSD', '.github/configs', '.github/workflows/c-cpp-MacOS.yml' ]
|
paths: [ '**.c', '**.h', 'Makefile.FreeBSD', 'tests/**', '.github/configs', '.github/workflows/c-cpp-MacOS.yml' ]
|
||||||
pull_request:
|
pull_request:
|
||||||
paths: [ "**.c", "**.h", "Makefile.FreeBSD", ".github/configs", ".github/workflows/c-cpp-MacOS.yml" ]
|
paths: [ "**.c", "**.h", "Makefile.FreeBSD", "tests/**", ".github/configs", ".github/workflows/c-cpp-MacOS.yml" ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -29,5 +29,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
LDFLAGS: "-L/usr/local/lib -L/opt/homebrew/lib -L/opt/homebrew/opt/openssl/lib"
|
LDFLAGS: "-L/usr/local/lib -L/opt/homebrew/lib -L/opt/homebrew/opt/openssl/lib"
|
||||||
CFLAGS: "-I/usr/local/include -I/opt/homebrew/include -I/usr/local/opt/openssl/include -I/opt/homebrew/opt/openssl/include"
|
CFLAGS: "-I/usr/local/include -I/opt/homebrew/include -I/usr/local/opt/openssl/include -I/opt/homebrew/opt/openssl/include"
|
||||||
|
- name: regression tests
|
||||||
|
run: python3 tests/run.py
|
||||||
- name: make clean MacOS
|
- name: make clean MacOS
|
||||||
run: make -f Makefile.FreeBSD clean
|
run: make -f Makefile.FreeBSD clean
|
||||||
@@ -2,9 +2,9 @@ name: C/C++ CI Windows
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths: [ '**.c', '**.h', 'Makefile.msvc', '.github/configs', '.github/workflows/c-cpp-Windows.yml' ]
|
paths: [ '**.c', '**.h', 'Makefile.msvc', 'tests/**', '.github/configs', '.github/workflows/c-cpp-Windows.yml' ]
|
||||||
pull_request:
|
pull_request:
|
||||||
paths: [ "**.c", "**.h", "Makefile.msvc", ".github/configs", ".github/workflows/c-cpp-Windows.yml" ]
|
paths: [ "**.c", "**.h", "Makefile.msvc", "tests/**", ".github/configs", ".github/workflows/c-cpp-Windows.yml" ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -21,12 +21,16 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v7
|
||||||
- name: install Windows libraries
|
- name: install Windows libraries
|
||||||
run: vcpkg install pcre2:x64-windows && c:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-x86_64-pcre2 mingw-w64-x86_64-openssl
|
run: vcpkg install pcre2:x64-windows wolfssl:x64-windows-static && c:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-x86_64-pcre2 mingw-w64-x86_64-wolfssl
|
||||||
- name: make Windows
|
- name: make Windows
|
||||||
run: make -f Makefile.win
|
run: make -f Makefile.win
|
||||||
env:
|
env:
|
||||||
LDFLAGS: '-L "c:/msys64/mingw64/lib"'
|
LDFLAGS: '-L "c:/msys64/mingw64/lib"'
|
||||||
CFLAGS: '-I "c:/msys64/mingw64/include"'
|
CFLAGS: '-I "c:/msys64/mingw64/include"'
|
||||||
|
- name: regression tests (MinGW)
|
||||||
|
run: |
|
||||||
|
$env:PATH = "c:\msys64\mingw64\bin;$env:PATH"
|
||||||
|
python tests\run.py --bin bin\3proxy.exe
|
||||||
- name: make clean Windows
|
- name: make clean Windows
|
||||||
run: make -f Makefile.win clean
|
run: make -f Makefile.win clean
|
||||||
- name: Add msbuild to PATH
|
- name: Add msbuild to PATH
|
||||||
@@ -37,7 +41,9 @@ jobs:
|
|||||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
D:
|
D:
|
||||||
cd "D:/a/3proxy/3proxy"
|
cd "D:/a/3proxy/3proxy"
|
||||||
set "LIB=%LIB%;c:/program files/openssl/lib/VC/x64/MT;c:/vcpkg/installed/x64-windows/lib"
|
set "LIB=%LIB%;c:/vcpkg/installed/x64-windows-static/lib;c:/vcpkg/installed/x64-windows/lib"
|
||||||
set "INCLUDE=%INCLUDE%;c:/program files/openssl/include;c:/vcpkg/installed/x64-windows/include"
|
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x64-windows-static/include;c:/vcpkg/installed/x64-windows/include"
|
||||||
nmake /F Makefile.msvc
|
nmake /F Makefile.msvc WOLFSSL=1 || exit /b 1
|
||||||
|
set "PATH=%PATH%;c:/vcpkg/installed/x64-windows/bin"
|
||||||
|
python tests\run.py --bin bin\3proxy.exe || exit /b 1
|
||||||
nmake /F Makefile.msvc clean
|
nmake /F Makefile.msvc clean
|
||||||
@@ -2,9 +2,9 @@ name: C/C++ CI cmake
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths: [ '**.c', '**.h', '**.cmake', 'CMakeLists.txt', '.github/configs', '.github/workflows/c-cpp-cmake.yml' ]
|
paths: [ '**.c', '**.h', '**.cmake', 'CMakeLists.txt', 'tests/**', '.github/configs', '.github/workflows/c-cpp-cmake.yml' ]
|
||||||
pull_request:
|
pull_request:
|
||||||
paths: [ "**.c", "**.h", "**.cmake", "CMakeLists.txt", ".github/configs", ".github/workflows/c-cpp-cmake.yml" ]
|
paths: [ "**.c", "**.h", "**.cmake", "CMakeLists.txt", "tests/**", ".github/configs", ".github/workflows/c-cpp-cmake.yml" ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -27,7 +27,7 @@ jobs:
|
|||||||
# run: ./configure
|
# run: ./configure
|
||||||
- name: Linux libraries
|
- name: Linux libraries
|
||||||
if: ${{ startsWith(matrix.target, 'ubuntu') }}
|
if: ${{ startsWith(matrix.target, 'ubuntu') }}
|
||||||
run: sudo apt install libssl-dev libpam-dev libpcre2-dev
|
run: sudo apt-get update && sudo apt-get install -y libssl-dev libpam-dev libpcre2-dev
|
||||||
- name: Mac libraries
|
- name: Mac libraries
|
||||||
if: ${{ startsWith(matrix.target, 'macos') }}
|
if: ${{ startsWith(matrix.target, 'macos') }}
|
||||||
run: brew install pcre2
|
run: brew install pcre2
|
||||||
@@ -43,7 +43,9 @@ jobs:
|
|||||||
cmake --build .
|
cmake --build .
|
||||||
mkdir ~/3proxy
|
mkdir ~/3proxy
|
||||||
DESTDIR=~/3proxy cmake --install .
|
DESTDIR=~/3proxy cmake --install .
|
||||||
cd .. && rm -rf build/
|
cd ..
|
||||||
|
python3 tests/run.py --bin build/bin/3proxy
|
||||||
|
rm -rf build/
|
||||||
- name: make with CMake Win
|
- name: make with CMake Win
|
||||||
if: ${{ startsWith(matrix.target, 'windows') }}
|
if: ${{ startsWith(matrix.target, 'windows') }}
|
||||||
shell: cmd
|
shell: cmd
|
||||||
@@ -56,4 +58,23 @@ jobs:
|
|||||||
dir
|
dir
|
||||||
cmake --build .
|
cmake --build .
|
||||||
cd ..
|
cd ..
|
||||||
|
set "PATH=%PATH%;c:/vcpkg/installed/x64-windows/bin"
|
||||||
|
python tests\run.py || exit /b 1
|
||||||
rmdir /s /q build
|
rmdir /s /q build
|
||||||
|
|
||||||
|
wolfssl:
|
||||||
|
name: "ubuntu-latest (wolfSSL)"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
- name: Install wolfSSL
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y libwolfssl-dev
|
||||||
|
- name: make with CMake (wolfSSL preferred)
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
cmake --build .
|
||||||
|
cd ..
|
||||||
|
python3 tests/run.py --bin build/bin/3proxy
|
||||||
|
rm -rf build/
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
name: Build Docker images (GHCR)
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build and push Docker images
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v7
|
|
||||||
|
|
||||||
- name: Determine tags
|
|
||||||
id: tags
|
|
||||||
env:
|
|
||||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
|
||||||
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
run: |
|
|
||||||
if [[ "$RELEASE_TAG" != "" ]]; then
|
|
||||||
RELEASE="${RELEASE_TAG#v}"
|
|
||||||
echo "minimal=${IMAGE}:${RELEASE}.minimal,${IMAGE}:minimal" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "busybox=${IMAGE}:${RELEASE}.busybox,${IMAGE}:busybox" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "full=${IMAGE}:${RELEASE},${IMAGE}:latest" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
DATETIME=$(date +%d%m%y%H%M%S)
|
|
||||||
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr "/" "-")
|
|
||||||
echo "minimal=${IMAGE}:${DATETIME}-${BRANCH}.minimal,${IMAGE}:${BRANCH}.minimal" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "busybox=${IMAGE}:${DATETIME}-${BRANCH}.busybox,${IMAGE}:${BRANCH}.busybox" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "full=${IMAGE}:${DATETIME}-${BRANCH},${IMAGE}:${BRANCH}" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v4
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v4
|
|
||||||
|
|
||||||
- name: Install cosign
|
|
||||||
uses: sigstore/cosign-installer@v3
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push minimal
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile.minimal
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.minimal }}
|
|
||||||
|
|
||||||
- name: Build and push busybox
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile.busybox
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.busybox }}
|
|
||||||
|
|
||||||
- name: Build and push full
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile.full
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.full }}
|
|
||||||
|
|
||||||
- name: Sign images
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
env:
|
|
||||||
TAGS_MINIMAL: ${{ steps.tags.outputs.minimal }}
|
|
||||||
TAGS_BUSYBOX: ${{ steps.tags.outputs.busybox }}
|
|
||||||
TAGS_FULL: ${{ steps.tags.outputs.full }}
|
|
||||||
run: |
|
|
||||||
IFS=',' read -ra TAGS <<< "$TAGS_MINIMAL,$TAGS_BUSYBOX,$TAGS_FULL"
|
|
||||||
for tag in "${TAGS[@]}"; do
|
|
||||||
cosign sign --yes "$tag"
|
|
||||||
done
|
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
name: Build Docker images (test, no publish)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build ${{ matrix.file }} (${{ matrix.platform }})
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
file: [Dockerfile.minimal, Dockerfile.busybox, Dockerfile.full]
|
||||||
|
platform: [linux/amd64, linux/arm64]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ${{ matrix.file }}
|
||||||
|
platforms: ${{ matrix.platform }}
|
||||||
|
push: false
|
||||||
|
load: ${{ matrix.platform == 'linux/amd64' }}
|
||||||
+152
-54
@@ -1,4 +1,4 @@
|
|||||||
name: Build Docker images (Docker Hub)
|
name: Build Docker images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
@@ -7,89 +7,187 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.io
|
DOCKERHUB_IMAGE: docker.io/3proxy/3proxy
|
||||||
IMAGE_NAME: 3proxy/3proxy
|
GHCR_IMAGE: ghcr.io/3proxy/3proxy
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build and push Docker images
|
name: ${{ matrix.image }} ${{ matrix.platform }}
|
||||||
runs-on: ubuntu-latest
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
image: [full, busybox, minimal]
|
||||||
|
platform: [linux/amd64, linux/arm64, linux/arm/v7]
|
||||||
|
include:
|
||||||
|
- platform: linux/amd64
|
||||||
|
runner: ubuntu-latest
|
||||||
|
- platform: linux/arm64
|
||||||
|
runner: ubuntu-24.04-arm
|
||||||
|
- platform: linux/arm/v7
|
||||||
|
runner: ubuntu-24.04-arm
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v7
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
- name: Determine tags
|
- name: Platform name
|
||||||
id: tags
|
id: platform
|
||||||
env:
|
run: echo "pair=$(echo '${{ matrix.platform }}' | tr / -)" >> "$GITHUB_OUTPUT"
|
||||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
|
||||||
run: |
|
|
||||||
if [[ "$RELEASE_TAG" != "" ]]; then
|
|
||||||
RELEASE="${RELEASE_TAG#v}"
|
|
||||||
echo "minimal=${REGISTRY}/${IMAGE_NAME}:${RELEASE}.minimal,${REGISTRY}/${IMAGE_NAME}:minimal" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "busybox=${REGISTRY}/${IMAGE_NAME}:${RELEASE}.busybox,${REGISTRY}/${IMAGE_NAME}:busybox" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "full=${REGISTRY}/${IMAGE_NAME}:${RELEASE},${REGISTRY}/${IMAGE_NAME}:latest" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
DATETIME=$(date +%d%m%y%H%M%S)
|
|
||||||
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr "/" "-")
|
|
||||||
echo "minimal=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-${BRANCH}.minimal,${REGISTRY}/${IMAGE_NAME}:${BRANCH}.minimal" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "busybox=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-${BRANCH}.busybox,${REGISTRY}/${IMAGE_NAME}:${BRANCH}.busybox" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "full=${REGISTRY}/${IMAGE_NAME}:${DATETIME}-${BRANCH},${REGISTRY}/${IMAGE_NAME}:${BRANCH}" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
|
if: matrix.platform == 'linux/arm/v7'
|
||||||
uses: docker/setup-qemu-action@v4
|
uses: docker/setup-qemu-action@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push by digest
|
||||||
|
id: build
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile.${{ matrix.image }}
|
||||||
|
platforms: ${{ matrix.platform }}
|
||||||
|
provenance: false
|
||||||
|
sbom: false
|
||||||
|
outputs: type=image,name=${{ env.GHCR_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||||
|
|
||||||
|
- name: Export digest
|
||||||
|
env:
|
||||||
|
DIGEST: ${{ steps.build.outputs.digest }}
|
||||||
|
run: |
|
||||||
|
mkdir -p /tmp/digests
|
||||||
|
touch "/tmp/digests/${DIGEST#sha256:}"
|
||||||
|
|
||||||
|
- name: Upload digest
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: digests-${{ matrix.image }}-${{ steps.platform.outputs.pair }}
|
||||||
|
path: /tmp/digests/*
|
||||||
|
if-no-files-found: error
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
publish:
|
||||||
|
name: Publish ${{ matrix.image }}
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- image: full
|
||||||
|
suffix: ''
|
||||||
|
floating: latest
|
||||||
|
- image: busybox
|
||||||
|
suffix: .busybox
|
||||||
|
floating: busybox
|
||||||
|
- image: minimal
|
||||||
|
suffix: .minimal
|
||||||
|
floating: minimal
|
||||||
|
steps:
|
||||||
|
- name: Download digests
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
with:
|
||||||
|
path: /tmp/digests
|
||||||
|
pattern: digests-${{ matrix.image }}-*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
- name: Install cosign
|
- name: Install cosign
|
||||||
uses: sigstore/cosign-installer@v3
|
uses: sigstore/cosign-installer@v3
|
||||||
|
with:
|
||||||
|
cosign-release: v2.4.3
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: docker/login-action@v4
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push minimal
|
- name: Login to GHCR
|
||||||
uses: docker/build-push-action@v7
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
registry: ghcr.io
|
||||||
file: Dockerfile.minimal
|
username: ${{ github.actor }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.minimal }}
|
|
||||||
|
|
||||||
- name: Build and push busybox
|
- name: Determine tags
|
||||||
uses: docker/build-push-action@v7
|
id: tags
|
||||||
with:
|
env:
|
||||||
context: .
|
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||||
file: Dockerfile.busybox
|
SUFFIX: ${{ matrix.suffix }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
FLOATING: ${{ matrix.floating }}
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
run: |
|
||||||
tags: ${{ steps.tags.outputs.busybox }}
|
if [[ "$RELEASE_TAG" != "" ]]; then
|
||||||
|
RELEASE="${RELEASE_TAG#v}"
|
||||||
|
echo "versioned=${RELEASE}${SUFFIX}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "moving=${FLOATING}" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
DATETIME=$(date +%d%m%y%H%M%S)
|
||||||
|
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | tr "/" "-")
|
||||||
|
echo "versioned=${DATETIME}-${BRANCH}${SUFFIX}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "moving=${BRANCH}${SUFFIX}" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Build and push full
|
- name: Create manifest list and push
|
||||||
uses: docker/build-push-action@v7
|
working-directory: /tmp/digests
|
||||||
|
env:
|
||||||
|
VERSIONED: ${{ steps.tags.outputs.versioned }}
|
||||||
|
MOVING: ${{ steps.tags.outputs.moving }}
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools create \
|
||||||
|
-t "${DOCKERHUB_IMAGE}:${VERSIONED}" \
|
||||||
|
-t "${DOCKERHUB_IMAGE}:${MOVING}" \
|
||||||
|
-t "${GHCR_IMAGE}:${VERSIONED}" \
|
||||||
|
-t "${GHCR_IMAGE}:${MOVING}" \
|
||||||
|
$(printf "${GHCR_IMAGE}@sha256:%s " *)
|
||||||
|
|
||||||
|
- name: Get pushed digest
|
||||||
|
id: digest
|
||||||
|
env:
|
||||||
|
VERSIONED: ${{ steps.tags.outputs.versioned }}
|
||||||
|
run: |
|
||||||
|
DIGEST=$(docker buildx imagetools inspect "${DOCKERHUB_IMAGE}:${VERSIONED}" \
|
||||||
|
--format '{{json .Manifest}}' | jq -r .digest)
|
||||||
|
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Attest Docker Hub image
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
subject-name: ${{ env.DOCKERHUB_IMAGE }}
|
||||||
file: Dockerfile.full
|
subject-digest: ${{ steps.digest.outputs.digest }}
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,ppc64le
|
push-to-registry: false
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
|
||||||
tags: ${{ steps.tags.outputs.full }}
|
- name: Attest GHCR image
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-name: ${{ env.GHCR_IMAGE }}
|
||||||
|
subject-digest: ${{ steps.digest.outputs.digest }}
|
||||||
|
push-to-registry: false
|
||||||
|
|
||||||
- name: Sign images
|
- name: Sign images
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
env:
|
env:
|
||||||
TAGS_MINIMAL: ${{ steps.tags.outputs.minimal }}
|
DIGEST: ${{ steps.digest.outputs.digest }}
|
||||||
TAGS_BUSYBOX: ${{ steps.tags.outputs.busybox }}
|
|
||||||
TAGS_FULL: ${{ steps.tags.outputs.full }}
|
|
||||||
run: |
|
run: |
|
||||||
IFS=',' read -ra TAGS <<< "$TAGS_MINIMAL,$TAGS_BUSYBOX,$TAGS_FULL"
|
cosign sign --yes "${DOCKERHUB_IMAGE}@${DIGEST}"
|
||||||
for tag in "${TAGS[@]}"; do
|
cosign sign --yes "${GHCR_IMAGE}@${DIGEST}"
|
||||||
cosign sign --yes "$tag"
|
|
||||||
done
|
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
name: Release source tarball
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tarball:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
|
attestations: write
|
||||||
|
name: "source tarball"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: env
|
||||||
|
run: |
|
||||||
|
if [ -f RELEASE ]; then
|
||||||
|
RELEASE=$(tr -d ' \t\r\n' < RELEASE)
|
||||||
|
else
|
||||||
|
RELEASE=$(tr -d ' \t\r\n' < DEVEL)
|
||||||
|
fi
|
||||||
|
echo "RELEASE=$RELEASE" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Create tarball
|
||||||
|
run: |
|
||||||
|
# git archive is reproducible from the tag: anyone can regenerate the
|
||||||
|
# tarball and compare it against the published checksum.
|
||||||
|
git archive --format=tar.gz -9 \
|
||||||
|
--prefix="3proxy-${{ env.RELEASE }}/" \
|
||||||
|
-o "3proxy-${{ env.RELEASE }}.tar.gz" HEAD
|
||||||
|
tar tzf "3proxy-${{ env.RELEASE }}.tar.gz" >/dev/null
|
||||||
|
ls -l *.tar.gz
|
||||||
|
|
||||||
|
- name: Get artifact
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: "3proxy-${{ env.RELEASE }}-src"
|
||||||
|
path: "*.tar.gz"
|
||||||
|
|
||||||
|
- name: Import signing key
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$GPG_PRIVATE_KEY" ]; then echo "GPG_PRIVATE_KEY is not set"; exit 1; fi
|
||||||
|
mkdir -p ~/.gnupg && chmod 700 ~/.gnupg
|
||||||
|
printf 'allow-loopback-pinentry\n' > ~/.gnupg/gpg-agent.conf
|
||||||
|
gpgconf --kill gpg-agent || true
|
||||||
|
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
|
||||||
|
KEYID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/{print $5; exit}')
|
||||||
|
echo "GPG_KEYID=$KEYID" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Checksums and detached signatures
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
sha256sum *.tar.gz > SHA256SUMS-src
|
||||||
|
for f in *.tar.gz SHA256SUMS-src; do
|
||||||
|
gpg --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
|
||||||
|
-u "$GPG_KEYID" --armor --detach-sign "$f"
|
||||||
|
done
|
||||||
|
sha256sum -c SHA256SUMS-src
|
||||||
|
gpg --verify SHA256SUMS-src.asc SHA256SUMS-src
|
||||||
|
|
||||||
|
- name: Attest build provenance
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
uses: actions/attest-build-provenance@v4
|
||||||
|
with:
|
||||||
|
subject-path: |
|
||||||
|
*.tar.gz
|
||||||
|
|
||||||
|
- name: Upload to release
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
TAG: ${{ github.event.release.tag_name }}
|
||||||
|
run: gh release upload "$TAG" *.tar.gz *.tar.gz.asc SHA256SUMS-src SHA256SUMS-src.asc
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
name: Update HTML documentation
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
paths:
|
||||||
|
- 'man/**'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docs:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: Install groff
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y groff
|
||||||
|
|
||||||
|
- name: Generate HTML from man pages
|
||||||
|
run: |
|
||||||
|
mkdir -p doc/html/man5 doc/html/man8
|
||||||
|
echo \<html\>\<title\>3proxy documentation\</title\>\<body\>\<h2\>3proxy documentation\</h2\> >doc/html/index.html
|
||||||
|
echo \<a href=\"securityen.html\"\>Security recommendations\</a\>\<br\> >>doc/html/index.html
|
||||||
|
echo \<a href=\"highload.html\"\>Optimizing 3proxy for high loads\</a\>\<br\> >>doc/html/index.html
|
||||||
|
echo \<a href=\"howtoe.html\"\>How To \(English, very incomplete\)\</a\>\<br\> >>doc/html/index.html
|
||||||
|
echo \<a href=\"howtor.html\"\>How To \(Russian\)\</a\>\<br\> >>doc/html/index.html
|
||||||
|
echo \<a href=\"devref.html\"\>Developer reference\</a\>\<br\> >>doc/html/index.html
|
||||||
|
echo \<h3\>Man pages:\</h3\> >>doc/html/index.html
|
||||||
|
cd man
|
||||||
|
for i in *.8; do ((bash -c "groff -mandoc -Thtml $i | grep -v DOCTYPE| grep -v text/css| grep -v 'meta ' | grep -v /style | grep -v { | grep -v /title | grep -v www.w3.org | grep -v CreationDate" > ../doc/html/man8/$i.html ) && echo \<br\>\<A HREF=\"man8/$i.html\"\>$i\</A\> >> ../doc/html/index.html); done
|
||||||
|
for i in *.5; do ((bash -c "groff -mandoc -Thtml $i | grep -v DOCTYPE| grep -v text/css| grep -v 'meta ' | grep -v /style | grep -v { | grep -v /title | grep -v www.w3.org | grep -v CreationDate" > ../doc/html/man5/$i.html ) && echo \<br\>\<A HREF=\"man5/$i.html\"\>$i\</A\> >> ../doc/html/index.html); done
|
||||||
|
cd ..
|
||||||
|
echo \</body\>\</html\> >>doc/html/index.html
|
||||||
|
|
||||||
|
- name: Commit
|
||||||
|
run: |
|
||||||
|
if [ -z "$(git status --porcelain doc/html)" ]; then
|
||||||
|
echo "documentation already up to date"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add doc/html
|
||||||
|
git commit -m "Update HTML documentation from man pages"
|
||||||
|
git push
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
name: Update version files
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- RELEASE
|
||||||
|
- DEVEL
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
version:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: Regenerate version files
|
||||||
|
run: |
|
||||||
|
# A release branch carries RELEASE, a development branch DEVEL, whose
|
||||||
|
# version may have a suffix such as 2.0.0-devel.
|
||||||
|
if [ -f RELEASE ]; then VERFILE=RELEASE
|
||||||
|
elif [ -f DEVEL ]; then VERFILE=DEVEL
|
||||||
|
else echo "neither RELEASE nor DEVEL is present"; exit 1
|
||||||
|
fi
|
||||||
|
RELEASE=$(tr -d ' \t\r\n' < "$VERFILE")
|
||||||
|
if [ -z "$RELEASE" ]; then echo "$VERFILE is empty"; exit 1; fi
|
||||||
|
|
||||||
|
# the numbered fields take the numeric part, the strings keep all of it
|
||||||
|
NUMBERS=${RELEASE%%[!0-9.]*}
|
||||||
|
NUMBERS=${NUMBERS%.}
|
||||||
|
if [ -z "$NUMBERS" ]; then echo "no version number in '$RELEASE'"; exit 1; fi
|
||||||
|
MAJOR=$(echo "$NUMBERS" | cut -d . -f 1)
|
||||||
|
SUBMAJOR=$(echo "$NUMBERS" | cut -d . -f 2)
|
||||||
|
MINOR=$(echo "$NUMBERS" | cut -d . -f 3)
|
||||||
|
SUBMINOR=$(echo "$NUMBERS" | cut -d . -f 4)
|
||||||
|
[ -n "$SUBMAJOR" ] || SUBMAJOR=0
|
||||||
|
[ -n "$MINOR" ] || MINOR=0
|
||||||
|
[ -n "$SUBMINOR" ] || SUBMINOR=0
|
||||||
|
|
||||||
|
# The build date is minted once per release and then carried in
|
||||||
|
# version.h, so that rebuilding the same commit yields the same
|
||||||
|
# version string and the same package names.
|
||||||
|
OLDRELEASE=$(sed -n 's/^#define VERSION "3proxy-\(.*\)"$/\1/p' src/version.h 2>/dev/null)
|
||||||
|
OLDBUILDDATE=$(sed -n 's/^#define BUILDDATE "\(.*\)"$/\1/p' src/version.h 2>/dev/null)
|
||||||
|
if [ "$OLDRELEASE" = "$RELEASE" ] && [ -n "$OLDBUILDDATE" ]; then
|
||||||
|
BUILDDATE="$OLDBUILDDATE"
|
||||||
|
else
|
||||||
|
BUILDDATE=$(date -u +%y%m%d%H%M%S)
|
||||||
|
fi
|
||||||
|
# rpm refuses a hyphen in Version, so a suffix becomes a tilde, which
|
||||||
|
# also sorts before the release of the same number
|
||||||
|
RPMVERSION=$(echo "$RELEASE" | tr '-' '~')
|
||||||
|
echo "$VERFILE $RELEASE -> $MAJOR $SUBMAJOR $MINOR $SUBMINOR, rpm $RPMVERSION, build date $BUILDDATE"
|
||||||
|
SOURCE_DATE_EPOCH=$(date -u -d "20${BUILDDATE:0:2}-${BUILDDATE:2:2}-${BUILDDATE:4:2} ${BUILDDATE:6:2}:${BUILDDATE:8:2}:${BUILDDATE:10:2}" +%s)
|
||||||
|
YEAR=$(date -u -d @$SOURCE_DATE_EPOCH +%Y)
|
||||||
|
|
||||||
|
DEBVERSION=$(head -1 debian/changelog | cut -d "(" -f 2 | cut -d ")" -f 1)
|
||||||
|
if [ "$DEBVERSION" != "$RELEASE-1" ]; then
|
||||||
|
mv debian/changelog debian/changelog.old
|
||||||
|
{ echo "3proxy ($RELEASE-1) buster; urgency=medium"
|
||||||
|
echo ""
|
||||||
|
echo " *3proxy $RELEASE initial build"
|
||||||
|
echo ""
|
||||||
|
echo " -- z3APA3A <3apa3a@3proxy.org> $(date -R -u -d @$SOURCE_DATE_EPOCH)"
|
||||||
|
echo ""
|
||||||
|
cat debian/changelog.old
|
||||||
|
} > debian/changelog
|
||||||
|
rm -f debian/changelog.old
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv scripts/rh/3proxy.spec scripts/rh/3proxy.spec.old
|
||||||
|
{ echo "Name: 3proxy"
|
||||||
|
echo "Version: $RPMVERSION"
|
||||||
|
echo "Release: 1%{?dist}"
|
||||||
|
tail --lines=+4 scripts/rh/3proxy.spec.old
|
||||||
|
} > scripts/rh/3proxy.spec
|
||||||
|
rm -f scripts/rh/3proxy.spec.old
|
||||||
|
|
||||||
|
{ echo "#ifndef VERSION"
|
||||||
|
echo "#define VERSION \"3proxy-$RELEASE\""
|
||||||
|
echo "#endif"
|
||||||
|
echo "#ifndef BUILDDATE"
|
||||||
|
echo "#define BUILDDATE \"$BUILDDATE\""
|
||||||
|
echo "#endif"
|
||||||
|
echo "#define MAJOR3PROXY $MAJOR"
|
||||||
|
echo "#define SUBMAJOR3PROXY $SUBMAJOR"
|
||||||
|
echo "#define MINOR3PROXY $MINOR"
|
||||||
|
echo "#define SUBMINOR3PROXY $SUBMINOR"
|
||||||
|
echo "#define RELEASE3PROXY \"3proxy-$RELEASE(\" BUILDDATE \")\\0\""
|
||||||
|
echo "#ifndef YEAR3PROXY"
|
||||||
|
echo "#define YEAR3PROXY \"$YEAR\""
|
||||||
|
echo "#endif"
|
||||||
|
} > src/version.h
|
||||||
|
|
||||||
|
- name: Commit
|
||||||
|
run: |
|
||||||
|
if [ -z "$(git status --porcelain debian/changelog scripts/rh/3proxy.spec src/version.h)" ]; then
|
||||||
|
echo "version files already up to date"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add debian/changelog scripts/rh/3proxy.spec src/version.h
|
||||||
|
git commit -m "Update version files for $(tr -d ' \t\r\n' < $(test -f RELEASE && echo RELEASE || echo DEVEL))"
|
||||||
|
git push
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
name: Update wiki
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
paths:
|
||||||
|
- 'doc/html/**'
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Update HTML documentation"]
|
||||||
|
types: [completed]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: update-wiki
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
wiki:
|
||||||
|
# the wiki mirrors master, so a run started by anything else is not for it
|
||||||
|
if: github.event_name != 'workflow_run' || github.event.workflow_run.head_branch == 'master'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
ref: master
|
||||||
|
|
||||||
|
- name: Clone wiki
|
||||||
|
run: |
|
||||||
|
git clone --quiet \
|
||||||
|
"https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.wiki.git" wiki
|
||||||
|
|
||||||
|
- name: Copy documentation
|
||||||
|
run: |
|
||||||
|
cp -f doc/html/man8/3proxy.8.html wiki/3proxy.md
|
||||||
|
cp -f doc/html/man8/3proxy_crypt.8.html wiki/3proxy_crypt.md
|
||||||
|
cp -f doc/html/man8/ftppr.8.html wiki/ftppr.md
|
||||||
|
cp -f doc/html/man8/pop3p.8.html wiki/pop3p.md
|
||||||
|
cp -f doc/html/man8/imapp.8.html wiki/imapp.md
|
||||||
|
cp -f doc/html/man8/proxy.8.html wiki/proxy.md
|
||||||
|
cp -f doc/html/man8/smtpp.8.html wiki/smtpp.md
|
||||||
|
cp -f doc/html/man8/socks.8.html wiki/socks.md
|
||||||
|
cp -f doc/html/man8/tlspr.8.html wiki/tlspr.md
|
||||||
|
cp -f doc/html/man8/tcppm.8.html wiki/tcppm.md
|
||||||
|
cp -f doc/html/man8/udppm.8.html wiki/udppm.md
|
||||||
|
cp -f doc/html/man5/3proxy.cfg.5.html wiki/3proxy.cfg.md
|
||||||
|
cp -f doc/html/highload.html wiki/High-Load.md
|
||||||
|
cp -f doc/html/howtoe.html wiki/How-To.md
|
||||||
|
cp -f doc/html/howtor.html "wiki/How-To-(русский).md"
|
||||||
|
cp -f doc/html/securityen.html wiki/Security-recommendations.md
|
||||||
|
cp -f doc/html/devel/devref.html wiki/DevelopeReference.md
|
||||||
|
cp -f doc/html/plugins/TransparentPlugin.html wiki/TransparentPlugin.md
|
||||||
|
cp -f doc/html/plugins/StringsPlugin.html wiki/StringsPlugin.md
|
||||||
|
cp -f doc/html/plugins/TrafficPlugin.html wiki/TrafficPlugin.md
|
||||||
|
cp -f doc/html/plugins/WindowsAuthentication.html wiki/WindowsAuthentication.md
|
||||||
|
cp -f doc/html/plugins/TransparentPlugin.ru.html "wiki/TransparentPlugin-(русский).md"
|
||||||
|
cp -f doc/html/plugins/StringsPlugin.ru.html "wiki/StringsPlugin-(русский).md"
|
||||||
|
cp -f doc/html/plugins/TrafficPlugin.ru.html "wiki/TrafficPlugin-(русский).md"
|
||||||
|
cp -f doc/html/plugins/WindowsAuthentication.ru.html "wiki/WindowsAuthentication-(русский).md"
|
||||||
|
|
||||||
|
- name: Commit
|
||||||
|
run: |
|
||||||
|
cd wiki
|
||||||
|
if [ -z "$(git status --porcelain)" ]; then
|
||||||
|
echo "wiki already up to date"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
git status --short
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Update documentation from master"
|
||||||
|
git push
|
||||||
@@ -18,6 +18,7 @@ bin/socks
|
|||||||
bin/tcppm
|
bin/tcppm
|
||||||
bin/udppm
|
bin/udppm
|
||||||
bin/pop3p
|
bin/pop3p
|
||||||
|
bin/imapp
|
||||||
bin/smtpp
|
bin/smtpp
|
||||||
bin/ftppr
|
bin/ftppr
|
||||||
bin/mycrypt
|
bin/mycrypt
|
||||||
@@ -45,6 +46,7 @@ src/socks
|
|||||||
src/tcppm
|
src/tcppm
|
||||||
src/udppm
|
src/udppm
|
||||||
src/pop3p
|
src/pop3p
|
||||||
|
src/imapp
|
||||||
src/smtpp
|
src/smtpp
|
||||||
src/ftppr
|
src/ftppr
|
||||||
src/icqpr
|
src/icqpr
|
||||||
@@ -261,6 +263,7 @@ CLAUDE.md
|
|||||||
bin/3proxy_crypt
|
bin/3proxy_crypt
|
||||||
bin/3proxy_ftppr
|
bin/3proxy_ftppr
|
||||||
bin/3proxy_pop3p
|
bin/3proxy_pop3p
|
||||||
|
bin/3proxy_imapp
|
||||||
bin/3proxy_proxy
|
bin/3proxy_proxy
|
||||||
bin/3proxy_smtpp
|
bin/3proxy_smtpp
|
||||||
bin/3proxy_socks
|
bin/3proxy_socks
|
||||||
@@ -268,3 +271,6 @@ bin/3proxy_tcppm
|
|||||||
bin/3proxy_tlspr
|
bin/3proxy_tlspr
|
||||||
bin/3proxy_udppm
|
bin/3proxy_udppm
|
||||||
build*/*
|
build*/*
|
||||||
|
testcerts/
|
||||||
|
/.claude
|
||||||
|
bench/mix/mix-linux-*
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
mQINBGqIZCIBEADF3zxdMo2dvUGAlQm3aIcQiqmpLMHucvLfSK3fHtwagO8f03CO
|
||||||
|
bEx9EfIK/U6BzLwEJ0CxyClzfvgo9COVpi5EjES9sI2LXzcgc4hGaYO0Q4Unj//0
|
||||||
|
W/G8aarDaLF2NRKMLf07eaYGBRJjqHnmeHgOHdr+SnN0JtMSadWMHoliB8esnabz
|
||||||
|
5CO4JabTrhwoez3DMLSgJNIod7wL6PJJv/2BeRahwNr2CjaXmzZKr/j7fc1MKLij
|
||||||
|
bsvJ5OmLmngZr6CHDa9cBhVhiH+7RgWLCsRlEGxEv7w0afp/T0xDwNAPkGzk5ObC
|
||||||
|
BrdXvypTAbNyUoVT8qSVJwkneZ4S0Ts4rRRNfNpaus4tsCmgyGKzsrbxvbiBOTPW
|
||||||
|
jB/fjkgr6X9M/AQ3yGpXrwXRJrM/nSfjUyOEHXttTC9HpGt41NH/mpC4mDWa1Kxi
|
||||||
|
FMxuo1+dw2kpDKl0Bp78IGdCo5akHwftFr8aHgmfZoGXAGJRHPAWbJGjC2ARy8yp
|
||||||
|
QOpxba0S3VlCU6bs8MDKl6cpWItnlXcl/GD/Qc55bjLXjFv1pbn2RUSYZS+n9wDX
|
||||||
|
64syZf3dZ/N5U4ydmybWfiLFUXqKQLtdO8QAWQGt4TSwKptTmI581/MMCTQ8qWZL
|
||||||
|
zgFj6C/8K0SZ4lMOv+5zfc2+QOoWw7E2Ws3stEKTyWjOMm/QMJAGumqvqwARAQAB
|
||||||
|
tCozcHJveHkgcmVsZWFzZSBzaWduaW5nIDwzcHJveHlAM3Byb3h5Lm9yZz6JAm0E
|
||||||
|
EwEIAFcWIQT8EiFEmfzHuhz/bNwDEjhOOnOUCwUCaohkIhsUgAAAAAAEAA5tYW51
|
||||||
|
MiwyLjUrMS4xMiwwLDMCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQ
|
||||||
|
AxI4TjpzlAsCwRAAtH3OO42yCd2B8Od4yS1yBDkaIFwEm8hF68eou6uaSDkKG8YZ
|
||||||
|
C3DUH7qk0nXEMQu/5J6RWZKlW1C8D3AkUR9A1g54o6mUg4IL5196XsrQRdVu64YF
|
||||||
|
nLCk17Piku1lMk+Re6bZ6uJv5UlSv8d0dvxmAYzjusyPyBC2VXy7B0CoDif6AmXt
|
||||||
|
aw2/V6m0dRrfFo4W9mJKUqTAJcdBOKzEiQb7qLnzuwy4CB5qsvnEQTqymoCXFXzg
|
||||||
|
VDCSKRLXnbDPbIs0TvsCmthn/w1hCgftPq4W0s7EUJBOhbrjF59+AuTb+U1wIXNR
|
||||||
|
1+DPF+V+5RlwWjOWMlsOVGk2jaxjVY8wuaD3rE6ISJkt1pRv/WVdY984rT7Eu94J
|
||||||
|
ZHnxPjFrb2ohFKjoBCt60kbgZbuQ6yvEma5lAF9K63gwMNNyGZvq6QWl58iouzuS
|
||||||
|
3B9t7EwGwFstJfaXVhn/rnIHoExgxVZMbbsmXiGJyE2KcfVmlZcEi0MIyqEeBSDD
|
||||||
|
gjpE4yVO6StBtJKfXra8rMwtsbWBw9MptPhcLvdWtN6TG0CxDyTHhdL1pSLNcwX1
|
||||||
|
CTVpwi6+WmGogcv0WFNn5caQUpu9le/v/5qLRK08KWOH8inMJmTfpJg/9869YJuF
|
||||||
|
vDKdzJd6jug5YQRfV/7YVC2hdSOBLvBuDpRINePrj9CKJ34qG+jRSJ5xwYk=
|
||||||
|
=IS3Y
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||||||
@@ -1,25 +1,25 @@
|
|||||||
3proxy-0.9.7 Released July, 4 2026
|
3proxy-1.0.2 Released October, 24 2026
|
||||||
|
|
||||||
+ PCRE2 and SSL/TLS code moved from plugins into main 3proxy binary; dynamic linking with ssl/pcre by default, STATIC/LIBSTATIC options for static linking
|
! Fix: dnspr relayed to the client whatever came first to the socket it asked the name server from, from any address and under any id, so a forged answer could be passed on; the query now goes out under a random id, and only an answer from the name server asked, with that id and the same question, is relayed
|
||||||
+ Unix sockets support for parent proxies, tcppm, internal listeners and -i option; abstract (fileless) unix sockets on Linux
|
! Fix: a client sending a part of a TLS record and then nothing kept a thread taking all of a CPU, and the read never timed out
|
||||||
+ ssl_client_mode = 3 to use 'secure' parent types: https, tcps, socks5s, connect+s, etc.
|
! Fix: without -Ne, the reply to SOCKS CONNECT and BIND gave the address of the client's connection to the proxy instead of the socket towards the destination: a BIND client was told the proxy's own port and the peer could never reach it (since 0.9.6)
|
||||||
+ New authcache types: cacheacl, dstaddr, dstport, dsthost, dstoper, srvaddr, srvport; authcache is now configurable per service
|
! Fix: a client which shut down its sending side (half-close) could get the answer cut short, megabytes short with large answers; likewise an upload after the server half-closed
|
||||||
+ Hashtables for password lists and authcache, faster password lookups
|
! Fix: with chroot every local time was UTC and every syslog message was lost: the time zone is loaded and syslog connected before chroot; the chroot entry of 3proxy.cfg(5) lists what PAM, LDAP and ODBC still need inside the chroot
|
||||||
+ 3proxy_crypt: new internal password hashing replacing mycrypt
|
! Fix: the HTTP proxy closed the server connection of a kept-alive client and opened another one when only the request method changed (a POST after a GET to the same host)
|
||||||
+ udppm switched to hashtables and supports multiple connections
|
! Fix: the last ssl_client_mode in the configuration applied to every service, and a reload changed it for the services still running
|
||||||
+ SOCKSv5 UDP parent support; -Ne/-Ni NAT options
|
! Fix: memory leaks: on every refused configuration reload, on every failed TLS handshake, the server CA paths of every TLS service, compiled pcre: / regex: host names of access rules and patterns of httpsrv rules
|
||||||
+ Docker images for more platforms, signed; DLLs signed; public cert added to build
|
! Fix: Unix sockets: on Linux a proxy listening on a Unix socket relayed only the first bytes of an answer (result 95); an abstract socket (unix:@NAME) was bound under a name padded with zeros, which clients did not reach; tcppm refused port 0 for a unix: target, as given in the manual's example; on a reload the socket file of a listening service was removed
|
||||||
+ Grace sleep and linger on connection close; correctly process half-closed connections
|
! Fix: SIGPIPE could kill 3proxy when a client was gone while services were starting, and standalone services (proxy, socks, ...) at any time; sends use MSG_NOSIGNAL where the system has it
|
||||||
+ Allow setting internal/external network namespaces on Linux
|
! Fix: TLS MitM failed for every connection with wolfSSL built with WOLFSSL_QT (wolfSSL 5.9.1 of Ubuntu 26.04): the source certificate's serial number could not be copied; a serial number made from the hash of the source certificate is used then
|
||||||
- icqpr/OSCAR code removed
|
! Fix: Windows: closing a connection could leave its socket open (SO_LINGER on a non-blocking socket) or reset it while the peer still sent, so the end of an answer could be lost
|
||||||
! Fix: invalid error in SSL server handshake could break service state
|
! Fix: httpsrv: the body of a request answered without being read (for example when authentication is required) was read as the next request; a client still sending when a connection without keep-alive closed could get a reset instead of the answer
|
||||||
! Fix: invalid offset in datafilters
|
! Fix: httpsrv on Windows: UNC paths (\\server\share) did not work
|
||||||
! Fix: invalid socket in poll() could break sockmap() on Windows
|
! Fix: httpsrv and admin services and their clients were named ZOMBIE on the admin services page, in %N of logs and in RADIUS
|
||||||
! Fix: deadlock in ftppr
|
! Fix: the Watcom (lite) build did not compile, 1.0.1 had no binaries for it
|
||||||
! Fix: crash on standalone services
|
+ -s (splice) per direction: -s1 splices what the server sends (downloads), -s2 what the client sends (uploads), -s3 both; -s alone splices only where it pays (large bodies, long streams); pipes are kept with the connection for its next requests. splice() is built by default on Linux again and is used only by services given -s
|
||||||
! Fix: non-initialized mutex crash under Windows
|
+ Socket options (-oc, -os, -ol, -or, -oR) take NAME=VALUE; NAME=0 turns an option off, also one set by default; an unknown name or a value which is not a number is an error
|
||||||
! Fix: socks v5 parent with no auth
|
+ The HTTP proxy frees its 64 KB request buffer while a CONNECT tunnel relays data and while a kept-alive connection waits for its next request: 2000 tunnels take 213 MB instead of 339 MB
|
||||||
! Fix: hanging connections in sockmap; unneeded poll in sockmap
|
+ TLS records are read ahead with OpenSSL 1.1.0 and later: decrypting takes 9-14% less CPU
|
||||||
! Fix: symbols collision with OpenSSL could lead to crash
|
+ Faster service stop and configuration reload, no fixed delays; a connection waiting for a free maxconn slot gets it at once
|
||||||
! Fix: compatibility with older SSL versions and older Windows (7 and below)
|
- TCP_NODELAY is set by default on proxy-to-client and proxy-to-server sockets; -ocTCP_NODELAY=0 / -osTCP_NODELAY=0 turns it off
|
||||||
! Multiple minor bugfixes and code cleanup
|
- The HTTP proxy fetches ftp:// URLs only when the service is given the new -Xftp option (in a build with FTP=true)
|
||||||
+24
-24
@@ -1,25 +1,25 @@
|
|||||||
3proxy-0.9.7 Вышел 4 Июля 2026
|
3proxy-1.0.2 Вышел 24 Октября 2026
|
||||||
|
|
||||||
+ Код PCRE2 и SSL/TLS перенесён из плагинов в основной бинарный файл 3proxy; по умолчанию динамическое связывание с ssl/pcre, опции STATIC/LIBSTATIC для статического связывания
|
! Исправление: dnspr передавал клиенту то, что первым пришло на сокет, с которого он обращался к серверу имён, с любого адреса и с любым id, так что поддельный ответ мог быть передан клиенту; теперь запрос отправляется со случайным id, и передаётся только ответ от того сервера имён, к которому обращались, с этим id и тем же вопросом
|
||||||
+ Поддержка unix-сокетов для родительских прокси, tcppm, внутренних слушателей и опции -i; абстрактные (безфайловые) unix-сокеты в Linux
|
! Исправление: клиент, отправивший часть записи TLS и затем ничего, занимал поток на всё процессорное время, и чтение не завершалось по таймауту
|
||||||
+ ssl_client_mode = 3 для использования «безопасных» типов родителя: https, tcps, socks5s, connect+s и т.д.
|
! Исправление: без -Ne ответ на SOCKS CONNECT и BIND содержал адрес соединения клиента с прокси вместо адреса сокета в сторону назначения: клиенту BIND сообщался собственный порт прокси, и удалённая сторона не могла к нему подключиться (с 0.9.6)
|
||||||
+ Новые типы authcache: cacheacl, dstaddr, dstport, dsthost, dstoper, srvaddr, srvport; authcache настраивается для каждого сервиса
|
! Исправление: клиент, закрывший свою сторону передачи (half-close), мог получить ответ не полностью, на больших ответах без нескольких мегабайт; так же обрезалась загрузка на сервер после того, как сервер закрыл свою сторону
|
||||||
+ Хеш-таблицы для списков паролей и authcache, более быстрый поиск паролей
|
! Исправление: при chroot всё местное время становилось UTC и все сообщения syslog терялись: часовой пояс теперь загружается, а syslog подключается до chroot; в описании chroot в 3proxy.cfg(5) перечислено, что ещё нужно внутри chroot для PAM, LDAP и ODBC
|
||||||
+ 3proxy_crypt: новое внутреннее хеширование паролей, заменяющее mycrypt
|
! Исправление: HTTP прокси закрывал соединение с сервером для клиента с keep-alive и открывал новое, когда менялся только метод запроса (POST после GET к тому же хосту)
|
||||||
+ udppm переведён на хеш-таблицы и поддерживает множество соединений
|
! Исправление: последний ssl_client_mode в конфигурации действовал для всех служб, а перезагрузка конфигурации меняла его для уже работающих служб
|
||||||
+ Поддержка UDP-родителя для SOCKSv5; опции NAT -Ne/-Ni
|
! Исправление: утечки памяти: при каждой отвергнутой перезагрузке конфигурации, при каждом неудачном согласовании TLS, пути CA сервера каждой службы с TLS, скомпилированные имена хостов pcre: / regex: в правилах доступа и шаблоны правил httpsrv
|
||||||
+ Docker-образы для большего числа платформ, подписанные; подписанные DLL; публичный сертификат добавлен в сборку
|
! Исправление: сокеты Unix: в Linux прокси, слушающий на сокете Unix, передавал только первые байты ответа (результат 95); абстрактный сокет (unix:@NAME) привязывался к имени, дополненному нулями, до которого клиенты не доходили; tcppm отвергал порт 0 для цели unix:, как в примере из документации; при перезагрузке конфигурации файл сокета слушающей службы удалялся
|
||||||
+ Grace sleep и linger при закрытии соединения; корректная обработка полузакрытых соединений
|
! Исправление: SIGPIPE мог завершить 3proxy, если клиент отключался во время запуска служб, а отдельные службы (proxy, socks, ...) — в любой момент; отправка данных использует MSG_NOSIGNAL там, где система его поддерживает
|
||||||
+ Разрешено задавать внутренние/внешние сетевые пространства имён (network namespaces) в Linux
|
! Исправление: TLS MitM не работал ни для одного соединения с wolfSSL, собранным с WOLFSSL_QT (wolfSSL 5.9.1 в Ubuntu 26.04): не удавалось скопировать серийный номер исходного сертификата; в этом случае используется серийный номер, полученный из хеша исходного сертификата
|
||||||
- Код icqpr/OSCAR удалён
|
! Исправление: Windows: при закрытии соединения сокет мог остаться открытым (SO_LINGER на неблокирующем сокете) или соединение сбрасывалось, пока другая сторона ещё передавала данные, так что конец ответа мог потеряться
|
||||||
! Исправление: некорректная ошибка в SSL server handshake могла ломать состояние сервиса
|
! Исправление: httpsrv: тело запроса, на который ответ дан без его чтения (например, когда требуется аутентификация), читалось как следующий запрос; клиент, ещё передающий данные при закрытии соединения без keep-alive, мог получить сброс соединения вместо ответа
|
||||||
! Исправление: некорректное смещение в datafilters
|
! Исправление: httpsrv в Windows: не работали пути UNC (\\server\share)
|
||||||
! Исправление: некорректный сокет в poll() мог ломать sockmap() в Windows
|
! Исправление: службы httpsrv и admin и их клиенты назывались ZOMBIE на странице служб admin, в %N журнала и в RADIUS
|
||||||
! Исправление: взаимоблокировка (deadlock) в ftppr
|
! Исправление: сборка Watcom (lite) не компилировалась, в 1.0.1 для неё не было двоичных файлов
|
||||||
! Исправление: падение на standalone-сервисах
|
+ -s (splice) по направлениям: -s1 — то, что передаёт сервер (скачивание), -s2 — то, что передаёт клиент (загрузка), -s3 — оба; -s без числа использует splice только там, где это выгодно (большие тела, длинные потоки); каналы (pipe) сохраняются с соединением для следующих запросов. splice() снова собирается по умолчанию в Linux и используется только службами с -s
|
||||||
! Исправление: падение из-за неинициализированного mutex в Windows
|
+ Опции сокетов (-oc, -os, -ol, -or, -oR) принимают ИМЯ=ЗНАЧЕНИЕ; ИМЯ=0 выключает опцию, в том числе установленную по умолчанию; неизвестное имя или значение, не являющееся числом, — ошибка
|
||||||
! Исправление: родитель socks v5 без аутентификации
|
+ HTTP прокси освобождает буфер запроса размером 64 КБ, пока туннель CONNECT передаёт данные и пока соединение с keep-alive ждёт следующего запроса: 2000 туннелей занимают 213 МБ вместо 339 МБ
|
||||||
! Исправление: зависающие соединения в sockmap; лишний poll в sockmap
|
+ Записи TLS читаются с упреждением (read-ahead) с OpenSSL 1.1.0 и новее: расшифровка занимает на 9-14% меньше процессорного времени
|
||||||
! Исправление: конфликт символов с OpenSSL мог приводить к падению
|
+ Более быстрая остановка служб и перезагрузка конфигурации, без фиксированных задержек; соединение, ожидающее свободного места в maxconn, получает его сразу
|
||||||
! Исправление: совместимость со старыми версиями SSL и старыми версиями Windows (7 и ниже)
|
- TCP_NODELAY устанавливается по умолчанию на сокетах прокси-клиент и прокси-сервер; -ocTCP_NODELAY=0 / -osTCP_NODELAY=0 выключает его
|
||||||
! Множество мелких исправлений и очистка кода
|
- HTTP прокси обрабатывает адреса ftp:// только если службе задана новая опция -Xftp (в сборке с FTP=true)
|
||||||
+208
-54
@@ -4,8 +4,20 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
# Read version from RELEASE file
|
# Read the version. A release branch carries RELEASE, a development branch
|
||||||
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/RELEASE" PROJECT_VERSION LIMIT_COUNT 1)
|
# DEVEL, whose version may have a suffix that project() will not take.
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/RELEASE")
|
||||||
|
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/RELEASE" PROJECT_VERSION_FULL LIMIT_COUNT 1)
|
||||||
|
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/DEVEL")
|
||||||
|
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/DEVEL" PROJECT_VERSION_FULL LIMIT_COUNT 1)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Neither RELEASE nor DEVEL found: cannot tell the version")
|
||||||
|
endif()
|
||||||
|
string(STRIP "${PROJECT_VERSION_FULL}" PROJECT_VERSION_FULL)
|
||||||
|
string(REGEX MATCH "^[0-9]+(\\.[0-9]+)*" PROJECT_VERSION "${PROJECT_VERSION_FULL}")
|
||||||
|
if(NOT PROJECT_VERSION)
|
||||||
|
message(FATAL_ERROR "No version number in '${PROJECT_VERSION_FULL}'")
|
||||||
|
endif()
|
||||||
|
|
||||||
project(3proxy
|
project(3proxy
|
||||||
VERSION ${PROJECT_VERSION}
|
VERSION ${PROJECT_VERSION}
|
||||||
@@ -46,15 +58,20 @@ endif()
|
|||||||
|
|
||||||
# Options
|
# Options
|
||||||
option(3PROXY_BUILD_SHARED "Build shared libraries for plugins" ON)
|
option(3PROXY_BUILD_SHARED "Build shared libraries for plugins" ON)
|
||||||
option(3PROXY_USE_OPENSSL "Enable TLS/SSL support (requires OpenSSL)" ON)
|
option(3PROXY_USE_WOLFSSL "Enable TLS/SSL support via wolfSSL (preferred when detected)" ON)
|
||||||
|
option(3PROXY_USE_OPENSSL "Enable TLS/SSL support via OpenSSL (fallback when wolfSSL unavailable)" ON)
|
||||||
option(3PROXY_USE_PCRE2 "Enable PCRE2 regex filtering" ON)
|
option(3PROXY_USE_PCRE2 "Enable PCRE2 regex filtering" ON)
|
||||||
option(3PROXY_USE_PAM "Enable PAM/PamAuth" ON)
|
option(3PROXY_USE_PAM "Enable PAM/PamAuth" ON)
|
||||||
option(3PROXY_USE_ODBC "Enable ODBC support (Unix only, always ON on Windows)" OFF)
|
option(3PROXY_USE_ODBC "Enable ODBC support (Unix only, always ON on Windows)" OFF)
|
||||||
option(3PROXY_USE_SPLICE "Use Linux splice() for zero-copy (Linux only)" ON)
|
option(3PROXY_USE_SPLICE "Build Linux splice() support, used by services given -s (Linux only)" ON)
|
||||||
option(3PROXY_USE_POLL "Use poll() instead of select() (Unix only)" ON)
|
option(3PROXY_USE_POLL "Use poll() instead of select() (Unix only)" ON)
|
||||||
option(3PROXY_USE_WSAPOLL "Use WSAPoll instead of select() (Windows only)" ON)
|
option(3PROXY_USE_WSAPOLL "Use WSAPoll instead of select() (Windows only)" ON)
|
||||||
option(3PROXY_USE_NETFILTER "Enable Linux netfilter support (Linux only)" ON)
|
option(3PROXY_USE_NETFILTER "Enable Linux netfilter support (Linux only)" ON)
|
||||||
|
option(3PROXY_USE_TRANSPARENT "Build transparent proxying support (Linux and BSD only)" ON)
|
||||||
option(3PROXY_USE_UNIX_SOCKETS "Enable Unix domain socket support (Unix only)" ON)
|
option(3PROXY_USE_UNIX_SOCKETS "Enable Unix domain socket support (Unix only)" ON)
|
||||||
|
option(3PROXY_USE_HTTPSRV "Build the HTTP server and the admin interface on top of it" ON)
|
||||||
|
option(3PROXY_USE_MAILPROXY "Build the pop3p, imapp and smtpp proxies" OFF)
|
||||||
|
option(3PROXY_USE_FTP "Build FTP support: the ftppr service and ftp:// in the HTTP proxy" OFF)
|
||||||
|
|
||||||
if(NOT WIN32 AND NOT APPLE)
|
if(NOT WIN32 AND NOT APPLE)
|
||||||
option(3PROXY_STATIC_LINK "Statically link libraries using -Wl,-Bstatic (Linux/Unix only)" OFF)
|
option(3PROXY_STATIC_LINK "Statically link libraries using -Wl,-Bstatic (Linux/Unix only)" OFF)
|
||||||
@@ -68,15 +85,19 @@ set(3PROXY_BINARY_PREFIX "3proxy_" CACHE STRING "Prefix for standalone module an
|
|||||||
option(3PROXY_BUILD_NONE "Do not build standalone binaries" OFF)
|
option(3PROXY_BUILD_NONE "Do not build standalone binaries" OFF)
|
||||||
option(3PROXY_BUILD_PROXY "Build standalone proxy binary" ON)
|
option(3PROXY_BUILD_PROXY "Build standalone proxy binary" ON)
|
||||||
option(3PROXY_BUILD_SOCKS "Build standalone socks binary" ON)
|
option(3PROXY_BUILD_SOCKS "Build standalone socks binary" ON)
|
||||||
option(3PROXY_BUILD_POP3P "Build standalone pop3p binary" ON)
|
# The mail proxies and FTP are asked for rather than assumed: without them
|
||||||
option(3PROXY_BUILD_SMTPP "Build standalone smtpp binary" ON)
|
# pop3p, imapp and smtpp are the STARTTLS proxy under those names, and ftp
|
||||||
option(3PROXY_BUILD_FTPPR "Build standalone ftppr binary" ON)
|
# is not spoken at all. A standalone binary needs the support it is made of.
|
||||||
|
option(3PROXY_BUILD_POP3P "Build standalone pop3p binary" OFF)
|
||||||
|
option(3PROXY_BUILD_IMAPP "Build standalone imapp binary" OFF)
|
||||||
|
option(3PROXY_BUILD_SMTPP "Build standalone smtpp binary" OFF)
|
||||||
|
option(3PROXY_BUILD_FTPPR "Build standalone ftppr binary" OFF)
|
||||||
option(3PROXY_BUILD_TCPPM "Build standalone tcppm binary" ON)
|
option(3PROXY_BUILD_TCPPM "Build standalone tcppm binary" ON)
|
||||||
option(3PROXY_BUILD_UDPPM "Build standalone udppm binary" ON)
|
option(3PROXY_BUILD_UDPPM "Build standalone udppm binary" ON)
|
||||||
option(3PROXY_BUILD_TLSPR "Build standalone tlspr binary" ON)
|
option(3PROXY_BUILD_TLSPR "Build standalone tlspr binary" ON)
|
||||||
|
|
||||||
if(3PROXY_BUILD_NONE)
|
if(3PROXY_BUILD_NONE)
|
||||||
foreach(_M PROXY SOCKS POP3P SMTPP FTPPR TCPPM UDPPM TLSPR)
|
foreach(_M PROXY SOCKS POP3P IMAPP SMTPP FTPPR TCPPM UDPPM TLSPR)
|
||||||
set(3PROXY_BUILD_${_M} OFF)
|
set(3PROXY_BUILD_${_M} OFF)
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
@@ -99,6 +120,9 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
# Windows-specific configuration
|
# Windows-specific configuration
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
|
# Windows does not take a recv and a send on one socket from two
|
||||||
|
# threads, so a UDP service answers from a socket of its own
|
||||||
|
NO_SHARE_UDP_SOCKET
|
||||||
WIN32
|
WIN32
|
||||||
_WIN32
|
_WIN32
|
||||||
_MBCS
|
_MBCS
|
||||||
@@ -150,7 +174,7 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Windows libraries
|
# Windows libraries
|
||||||
set(WINDOWS_LIBS ws2_32 advapi32 user32 kernel32 gdi32 crypt32)
|
set(WINDOWS_LIBS ws2_32 mswsock advapi32 user32 kernel32 gdi32 crypt32)
|
||||||
|
|
||||||
# Windows plugins (always built)
|
# Windows plugins (always built)
|
||||||
set(DEFAULT_PLUGINS
|
set(DEFAULT_PLUGINS
|
||||||
@@ -190,7 +214,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||||||
set(DEFAULT_PLUGINS
|
set(DEFAULT_PLUGINS
|
||||||
StringsPlugin
|
StringsPlugin
|
||||||
TrafficPlugin
|
TrafficPlugin
|
||||||
TransparentPlugin
|
|
||||||
FilePlugin
|
FilePlugin
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -212,7 +235,6 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD|Darwin|OpenBSD|NetBSD")
|
|||||||
set(DEFAULT_PLUGINS
|
set(DEFAULT_PLUGINS
|
||||||
StringsPlugin
|
StringsPlugin
|
||||||
TrafficPlugin
|
TrafficPlugin
|
||||||
TransparentPlugin
|
|
||||||
FilePlugin
|
FilePlugin
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -229,11 +251,47 @@ else()
|
|||||||
set(DEFAULT_PLUGINS
|
set(DEFAULT_PLUGINS
|
||||||
StringsPlugin
|
StringsPlugin
|
||||||
TrafficPlugin
|
TrafficPlugin
|
||||||
TransparentPlugin
|
|
||||||
FilePlugin
|
FilePlugin
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(3PROXY_USE_MAILPROXY)
|
||||||
|
add_compile_definitions(WITH_POP3P WITH_IMAPP WITH_SMTPP)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(3PROXY_USE_FTP)
|
||||||
|
add_compile_definitions(WITH_FTP)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(3PROXY_USE_HTTPSRV)
|
||||||
|
add_compile_definitions(WITH_HTTPSRV)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Transparent proxying needs a redirection that leaves the original
|
||||||
|
# destination where 3proxy reads it: the kernel on Linux, the socket on the
|
||||||
|
# BSDs. That means netfilter, OpenBSD divert-to or FreeBSD ipfw fwd. NetBSD
|
||||||
|
# and macOS rewrite the destination instead and are left out.
|
||||||
|
if(3PROXY_USE_TRANSPARENT AND (CMAKE_SYSTEM_NAME STREQUAL "Linux"
|
||||||
|
OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD|OpenBSD|NetBSD"))
|
||||||
|
add_compile_definitions(WITH_TRANSPARENT)
|
||||||
|
set(3PROXY_TRANSPARENT_BUILT ON)
|
||||||
|
# pf keeps the original destination in its state table, which is read
|
||||||
|
# through /dev/pf. macOS has the device but ships no header for it.
|
||||||
|
include(CheckIncludeFiles)
|
||||||
|
check_include_files("sys/types.h;sys/socket.h;net/if.h;net/pfvar.h" HAVE_PFVAR_H)
|
||||||
|
if(HAVE_PFVAR_H)
|
||||||
|
add_compile_definitions(WITH_PF)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(3PROXY_TRANSPARENT_BUILT OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Unix domain sockets off: NO_UN also undefines WITH_UN if it arrives from
|
||||||
|
# elsewhere, e.g. CFLAGS
|
||||||
|
if(NOT 3PROXY_USE_UNIX_SOCKETS)
|
||||||
|
add_compile_definitions(NO_UN)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Common definitions
|
# Common definitions
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# Windows: use WSAPOLL
|
# Windows: use WSAPOLL
|
||||||
@@ -253,17 +311,38 @@ endif()
|
|||||||
|
|
||||||
# Find dependencies
|
# Find dependencies
|
||||||
|
|
||||||
# OpenSSL
|
# TLS/SSL backend: prefer wolfSSL when detected, fall back to OpenSSL.
|
||||||
|
set(3PROXY_SSL_ENABLED FALSE)
|
||||||
|
set(3PROXY_SSL_WOLFSSL FALSE)
|
||||||
set(OPENSSL_FOUND FALSE)
|
set(OPENSSL_FOUND FALSE)
|
||||||
if(3PROXY_USE_OPENSSL)
|
set(WOLFSSL_FOUND FALSE)
|
||||||
|
|
||||||
|
if(3PROXY_USE_WOLFSSL)
|
||||||
|
find_path(WOLFSSL_INCLUDE_DIR NAMES wolfssl/options.h wolfssl/ssl.h)
|
||||||
|
find_library(WOLFSSL_LIBRARIES NAMES wolfssl)
|
||||||
|
if(WOLFSSL_INCLUDE_DIR AND WOLFSSL_LIBRARIES)
|
||||||
|
set(WOLFSSL_FOUND TRUE)
|
||||||
|
set(3PROXY_SSL_ENABLED TRUE)
|
||||||
|
set(3PROXY_SSL_WOLFSSL TRUE)
|
||||||
|
add_compile_definitions(WITH_SSL WITH_WOLFSSL)
|
||||||
|
message(STATUS "wolfSSL found: ${WOLFSSL_LIBRARIES} (preferred backend)")
|
||||||
|
else()
|
||||||
|
message(STATUS "wolfSSL not found, falling back to OpenSSL if enabled")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT 3PROXY_SSL_ENABLED AND 3PROXY_USE_OPENSSL)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
if(OpenSSL_FOUND)
|
if(OpenSSL_FOUND)
|
||||||
set(OPENSSL_FOUND TRUE)
|
set(OPENSSL_FOUND TRUE)
|
||||||
|
set(3PROXY_SSL_ENABLED TRUE)
|
||||||
add_compile_definitions(WITH_SSL)
|
add_compile_definitions(WITH_SSL)
|
||||||
message(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
|
message(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
else()
|
elseif(NOT 3PROXY_SSL_ENABLED)
|
||||||
message(STATUS "OpenSSL disabled by user request")
|
message(STATUS "SSL disabled (neither wolfSSL nor OpenSSL enabled/found)")
|
||||||
|
elseif(3PROXY_SSL_WOLFSSL)
|
||||||
|
message(STATUS "OpenSSL skipped (wolfSSL in use)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# PCRE2
|
# PCRE2
|
||||||
@@ -305,8 +384,9 @@ if(ODBC_FOUND)
|
|||||||
add_compile_definitions(WITH_ODBC)
|
add_compile_definitions(WITH_ODBC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set NORADIUS if OpenSSL is not available (RADIUS requires MD5 from OpenSSL)
|
# Set NORADIUS if no SSL backend is available (RADIUS MD5 uses bundled md5, but
|
||||||
if(NOT OPENSSL_FOUND)
|
# keep the historical gate tied to SSL availability).
|
||||||
|
if(NOT 3PROXY_SSL_ENABLED)
|
||||||
add_compile_definitions(NORADIUS)
|
add_compile_definitions(NORADIUS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -328,20 +408,19 @@ set(3PROXY_CORE_SOURCES
|
|||||||
src/stringtable.c
|
src/stringtable.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# BLAKE2 source for 3proxy_crypt
|
# Bundled hash implementations (md4.c, md5.c, blake2b-ref.c) self-disable
|
||||||
set(MD_SOURCES
|
# via preprocessor guards when wolfSSL provides them natively.
|
||||||
src/libs/blake2b-ref.c
|
|
||||||
)
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Object libraries for common sources (shared between executables)
|
# Object libraries for common sources (shared between executables)
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
# Common object library (sockmap, sockgetchar, common, log)
|
# Common object library (sockmap, sockgetchar, common, sem, log)
|
||||||
add_library(common_obj OBJECT
|
add_library(common_obj OBJECT
|
||||||
src/sockmap.c
|
src/sockmap.c
|
||||||
src/sockgetchar.c
|
src/sockgetchar.c
|
||||||
src/common.c
|
src/common.c
|
||||||
|
src/sem.c
|
||||||
src/log.c
|
src/log.c
|
||||||
)
|
)
|
||||||
target_include_directories(common_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
target_include_directories(common_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
@@ -350,6 +429,14 @@ target_include_directories(common_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|||||||
add_library(base64_obj OBJECT src/base64.c)
|
add_library(base64_obj OBJECT src/base64.c)
|
||||||
target_include_directories(base64_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
target_include_directories(base64_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
|
# mdhash object library. md4.c/md5.c self-disable via NO_MD4/NO_MD5 guards
|
||||||
|
# when wolfSSL provides them; always compiled for fallback.
|
||||||
|
add_library(mdhash_obj OBJECT src/mdhash.c src/libs/md4.c src/libs/md5.c src/libs/blake2b-ref.c)
|
||||||
|
target_include_directories(mdhash_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
|
if(3PROXY_SSL_WOLFSSL)
|
||||||
|
target_include_directories(mdhash_obj PRIVATE ${WOLFSSL_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Object libraries for 3proxy (compiled WITHOUT WITHMAIN)
|
# Object libraries for 3proxy (compiled WITHOUT WITHMAIN)
|
||||||
# These are used by the main 3proxy executable
|
# These are used by the main 3proxy executable
|
||||||
@@ -359,6 +446,7 @@ target_include_directories(base64_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|||||||
add_library(srv_modules OBJECT
|
add_library(srv_modules OBJECT
|
||||||
src/proxy.c
|
src/proxy.c
|
||||||
src/pop3p.c
|
src/pop3p.c
|
||||||
|
src/imapp.c
|
||||||
src/smtpp.c
|
src/smtpp.c
|
||||||
src/ftppr.c
|
src/ftppr.c
|
||||||
src/tcppm.c
|
src/tcppm.c
|
||||||
@@ -366,6 +454,7 @@ add_library(srv_modules OBJECT
|
|||||||
src/auto.c
|
src/auto.c
|
||||||
src/socks.c
|
src/socks.c
|
||||||
src/webadmin.c
|
src/webadmin.c
|
||||||
|
src/httpsrv.c
|
||||||
src/dnspr.c
|
src/dnspr.c
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -394,8 +483,12 @@ target_include_directories(ftp_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|||||||
# 3proxy_crypt object for 3proxy (without WITHMAIN)
|
# 3proxy_crypt object for 3proxy (without WITHMAIN)
|
||||||
add_library(3proxy_crypt_obj OBJECT src/3proxy_crypt.c)
|
add_library(3proxy_crypt_obj OBJECT src/3proxy_crypt.c)
|
||||||
target_include_directories(3proxy_crypt_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
target_include_directories(3proxy_crypt_obj PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
if(OpenSSL_FOUND)
|
if(3PROXY_SSL_ENABLED)
|
||||||
|
if(3PROXY_SSL_WOLFSSL)
|
||||||
|
target_include_directories(3proxy_crypt_obj PRIVATE ${WOLFSSL_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
target_include_directories(3proxy_crypt_obj PRIVATE ${OPENSSL_INCLUDE_DIR})
|
target_include_directories(3proxy_crypt_obj PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
@@ -411,12 +504,12 @@ add_executable(3proxy
|
|||||||
$<TARGET_OBJECTS:common_obj>
|
$<TARGET_OBJECTS:common_obj>
|
||||||
$<TARGET_OBJECTS:udpsockmap_obj>
|
$<TARGET_OBJECTS:udpsockmap_obj>
|
||||||
$<TARGET_OBJECTS:base64_obj>
|
$<TARGET_OBJECTS:base64_obj>
|
||||||
|
$<TARGET_OBJECTS:mdhash_obj>
|
||||||
$<TARGET_OBJECTS:ftp_obj>
|
$<TARGET_OBJECTS:ftp_obj>
|
||||||
$<TARGET_OBJECTS:3proxy_crypt_obj>
|
$<TARGET_OBJECTS:3proxy_crypt_obj>
|
||||||
)
|
)
|
||||||
target_sources(3proxy PRIVATE ${MD_SOURCES})
|
|
||||||
|
|
||||||
if(OpenSSL_FOUND)
|
if(3PROXY_SSL_ENABLED)
|
||||||
target_sources(3proxy PRIVATE src/ssllib.c src/ssl.c)
|
target_sources(3proxy PRIVATE src/ssllib.c src/ssl.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -424,12 +517,20 @@ if(PCRE2_FOUND)
|
|||||||
target_sources(3proxy PRIVATE src/pcre.c)
|
target_sources(3proxy PRIVATE src/pcre.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(3PROXY_TRANSPARENT_BUILT)
|
||||||
|
target_sources(3proxy PRIVATE src/transparent.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(3proxy PRIVATE
|
target_include_directories(3proxy PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/libs
|
${CMAKE_CURRENT_SOURCE_DIR}/src/libs
|
||||||
)
|
)
|
||||||
if(OpenSSL_FOUND)
|
if(3PROXY_SSL_ENABLED)
|
||||||
|
if(3PROXY_SSL_WOLFSSL)
|
||||||
|
target_include_directories(3proxy PRIVATE ${WOLFSSL_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
target_include_directories(3proxy PRIVATE ${OPENSSL_INCLUDE_DIR})
|
target_include_directories(3proxy PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(PCRE2_FOUND)
|
if(PCRE2_FOUND)
|
||||||
target_include_directories(3proxy PRIVATE ${PCRE2_INCLUDE_DIRS})
|
target_include_directories(3proxy PRIVATE ${PCRE2_INCLUDE_DIRS})
|
||||||
@@ -445,10 +546,16 @@ if(ODBC_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# OpenSSL linking
|
# SSL linking
|
||||||
if(OpenSSL_FOUND)
|
if(3PROXY_SSL_ENABLED)
|
||||||
|
if(3PROXY_SSL_WOLFSSL)
|
||||||
if(3PROXY_STATIC_LINK)
|
if(3PROXY_STATIC_LINK)
|
||||||
# Will be linked statically below (if static libraries are found)
|
# Will be linked statically below (if static library is found)
|
||||||
|
else()
|
||||||
|
target_link_libraries(3proxy PRIVATE ${WOLFSSL_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
elseif(3PROXY_STATIC_LINK)
|
||||||
|
# OpenSSL static linking handled below
|
||||||
else()
|
else()
|
||||||
target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
endif()
|
endif()
|
||||||
@@ -465,14 +572,19 @@ if(PCRE2_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Static linking of OpenSSL and PCRE2 (when option is enabled)
|
# Static linking of SSL backend and PCRE2 (when option is enabled)
|
||||||
if(3PROXY_STATIC_LINK AND (OpenSSL_FOUND OR PCRE2_FOUND))
|
if(3PROXY_STATIC_LINK AND ((3PROXY_SSL_ENABLED AND NOT 3PROXY_SSL_WOLFSSL) OR (3PROXY_SSL_WOLFSSL) OR PCRE2_FOUND))
|
||||||
set(_saved_cmake_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
set(_saved_cmake_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
|
||||||
set(_static_libs "")
|
set(_static_libs "")
|
||||||
|
|
||||||
if(OpenSSL_FOUND)
|
if(3PROXY_SSL_WOLFSSL)
|
||||||
|
find_library(_wolfssl_static_lib NAMES wolfssl)
|
||||||
|
if(_wolfssl_static_lib)
|
||||||
|
list(APPEND _static_libs ${_wolfssl_static_lib})
|
||||||
|
endif()
|
||||||
|
elseif(OpenSSL_FOUND)
|
||||||
find_library(_ssl_static_lib ssl)
|
find_library(_ssl_static_lib ssl)
|
||||||
find_library(_crypto_static_lib crypto)
|
find_library(_crypto_static_lib crypto)
|
||||||
if(_ssl_static_lib AND _crypto_static_lib)
|
if(_ssl_static_lib AND _crypto_static_lib)
|
||||||
@@ -491,10 +603,12 @@ if(3PROXY_STATIC_LINK AND (OpenSSL_FOUND OR PCRE2_FOUND))
|
|||||||
|
|
||||||
if(_static_libs)
|
if(_static_libs)
|
||||||
target_link_libraries(3proxy PRIVATE -Wl,-Bstatic ${_static_libs} -Wl,-Bdynamic)
|
target_link_libraries(3proxy PRIVATE -Wl,-Bstatic ${_static_libs} -Wl,-Bdynamic)
|
||||||
message(STATUS "Static linking enabled for OpenSSL/PCRE2")
|
message(STATUS "Static linking enabled for SSL backend/PCRE2")
|
||||||
else()
|
else()
|
||||||
message(WARNING "3PROXY_STATIC_LINK is ON but static libraries not found, falling back to dynamic")
|
message(WARNING "3PROXY_STATIC_LINK is ON but static libraries not found, falling back to dynamic")
|
||||||
if(OpenSSL_FOUND)
|
if(3PROXY_SSL_WOLFSSL)
|
||||||
|
target_link_libraries(3proxy PRIVATE ${WOLFSSL_LIBRARIES})
|
||||||
|
elseif(OpenSSL_FOUND)
|
||||||
target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
endif()
|
endif()
|
||||||
if(PCRE2_FOUND)
|
if(PCRE2_FOUND)
|
||||||
@@ -520,18 +634,39 @@ endif()
|
|||||||
add_executable(3proxy_crypt
|
add_executable(3proxy_crypt
|
||||||
src/3proxy_crypt.c
|
src/3proxy_crypt.c
|
||||||
$<TARGET_OBJECTS:base64_obj>
|
$<TARGET_OBJECTS:base64_obj>
|
||||||
|
$<TARGET_OBJECTS:mdhash_obj>
|
||||||
)
|
)
|
||||||
target_sources(3proxy_crypt PRIVATE ${MD_SOURCES})
|
|
||||||
target_compile_definitions(3proxy_crypt PRIVATE WITHMAIN)
|
target_compile_definitions(3proxy_crypt PRIVATE WITHMAIN)
|
||||||
target_include_directories(3proxy_crypt PRIVATE
|
target_include_directories(3proxy_crypt PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/libs
|
${CMAKE_CURRENT_SOURCE_DIR}/src/libs
|
||||||
)
|
)
|
||||||
if(OpenSSL_FOUND)
|
if(3PROXY_SSL_ENABLED)
|
||||||
|
if(3PROXY_SSL_WOLFSSL)
|
||||||
|
target_include_directories(3proxy_crypt PRIVATE ${WOLFSSL_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
target_include_directories(3proxy_crypt PRIVATE ${OPENSSL_INCLUDE_DIR})
|
target_include_directories(3proxy_crypt PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(3proxy_crypt PRIVATE Threads::Threads)
|
target_link_libraries(3proxy_crypt PRIVATE Threads::Threads)
|
||||||
if(OpenSSL_FOUND)
|
if(3PROXY_SSL_ENABLED)
|
||||||
|
if(3PROXY_SSL_WOLFSSL)
|
||||||
|
if(3PROXY_STATIC_LINK)
|
||||||
|
set(_saved_cmake_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
find_library(_wolfssl_static_lib_c NAMES wolfssl)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_saved_cmake_find_library_suffixes})
|
||||||
|
if(_wolfssl_static_lib_c)
|
||||||
|
target_link_libraries(3proxy_crypt PRIVATE -Wl,-Bstatic ${_wolfssl_static_lib_c} -Wl,-Bdynamic)
|
||||||
|
message(STATUS "3proxy_crypt: static wolfSSL")
|
||||||
|
else()
|
||||||
|
message(WARNING "3PROXY_STATIC_LINK is ON but static wolfSSL not found, using dynamic")
|
||||||
|
target_link_libraries(3proxy_crypt PRIVATE ${WOLFSSL_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
target_link_libraries(3proxy_crypt PRIVATE ${WOLFSSL_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
if(3PROXY_STATIC_LINK)
|
if(3PROXY_STATIC_LINK)
|
||||||
set(_saved_cmake_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
set(_saved_cmake_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
@@ -548,6 +683,7 @@ if(OpenSSL_FOUND)
|
|||||||
else()
|
else()
|
||||||
target_link_libraries(3proxy_crypt PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
target_link_libraries(3proxy_crypt PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if("${3PROXY_BINARY_PREFIX}" STREQUAL "")
|
if("${3PROXY_BINARY_PREFIX}" STREQUAL "")
|
||||||
set_target_properties(3proxy_crypt PROPERTIES OUTPUT_NAME "mycrypt")
|
set_target_properties(3proxy_crypt PROPERTIES OUTPUT_NAME "mycrypt")
|
||||||
@@ -556,12 +692,21 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build standalone proxy executables
|
# Build standalone proxy executables
|
||||||
foreach(PROXY_NAME proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
|
foreach(PROXY_NAME proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr)
|
||||||
string(TOUPPER "${PROXY_NAME}" _MODULE_OPT)
|
string(TOUPPER "${PROXY_NAME}" _MODULE_OPT)
|
||||||
if(NOT 3PROXY_BUILD_${_MODULE_OPT})
|
if(NOT 3PROXY_BUILD_${_MODULE_OPT})
|
||||||
continue()
|
continue()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# A binary of nothing: without the support built, these files hold the
|
||||||
|
# stand-in the main binary uses and no service of their own.
|
||||||
|
if(NOT 3PROXY_USE_MAILPROXY AND PROXY_NAME MATCHES "^(pop3p|imapp|smtpp)$")
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
if(NOT 3PROXY_USE_FTP AND PROXY_NAME STREQUAL "ftppr")
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(PROXY_NAME STREQUAL "ftppr" OR PROXY_NAME STREQUAL "proxy")
|
if(PROXY_NAME STREQUAL "ftppr" OR PROXY_NAME STREQUAL "proxy")
|
||||||
# ftppr and proxy use ftp_obj
|
# ftppr and proxy use ftp_obj
|
||||||
add_executable(${PROXY_NAME}
|
add_executable(${PROXY_NAME}
|
||||||
@@ -584,12 +729,12 @@ foreach(PROXY_NAME proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(${PROXY_NAME} PRIVATE
|
target_compile_definitions(${PROXY_NAME} PRIVATE WITHMAIN)
|
||||||
WITHMAIN
|
|
||||||
NOPORTMAP
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT PROXY_NAME STREQUAL "udppm")
|
# each takes the main loop of its kind only: udppm UDP, the others TCP
|
||||||
|
if(PROXY_NAME STREQUAL "udppm")
|
||||||
|
target_compile_definitions(${PROXY_NAME} PRIVATE NOTCPMAIN)
|
||||||
|
else()
|
||||||
target_compile_definitions(${PROXY_NAME} PRIVATE NOUDPMAIN)
|
target_compile_definitions(${PROXY_NAME} PRIVATE NOUDPMAIN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -599,15 +744,19 @@ foreach(PROXY_NAME proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
|
|||||||
target_compile_definitions(${PROXY_NAME} PRIVATE ANONYMOUS)
|
target_compile_definitions(${PROXY_NAME} PRIVATE ANONYMOUS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# port mappers take port, host and port as arguments, the others options
|
||||||
|
# only; one of the two is defined, as in src/Makefile.inc
|
||||||
if(PROXY_NAME STREQUAL "tcppm" OR PROXY_NAME STREQUAL "udppm" OR PROXY_NAME STREQUAL "tlspr")
|
if(PROXY_NAME STREQUAL "tcppm" OR PROXY_NAME STREQUAL "udppm" OR PROXY_NAME STREQUAL "tlspr")
|
||||||
target_compile_definitions(${PROXY_NAME} PRIVATE PORTMAP)
|
target_compile_definitions(${PROXY_NAME} PRIVATE PORTMAP)
|
||||||
|
else()
|
||||||
|
target_compile_definitions(${PROXY_NAME} PRIVATE NOPORTMAP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(${PROXY_NAME} PRIVATE ${WINDOWS_LIBS})
|
target_link_libraries(${PROXY_NAME} PRIVATE ${WINDOWS_LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PROXY_NAME STREQUAL "proxy" OR PROXY_NAME STREQUAL "smtpp")
|
if(PROXY_NAME STREQUAL "proxy" OR PROXY_NAME STREQUAL "smtpp" OR PROXY_NAME STREQUAL "imapp")
|
||||||
target_sources(${PROXY_NAME} PRIVATE $<TARGET_OBJECTS:base64_obj>)
|
target_sources(${PROXY_NAME} PRIVATE $<TARGET_OBJECTS:base64_obj>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -651,7 +800,7 @@ install(TARGETS 3proxy 3proxy_crypt
|
|||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(PROXY_NAME proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
|
foreach(PROXY_NAME proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr)
|
||||||
string(TOUPPER "${PROXY_NAME}" _MODULE_OPT)
|
string(TOUPPER "${PROXY_NAME}" _MODULE_OPT)
|
||||||
if(3PROXY_BUILD_${_MODULE_OPT})
|
if(3PROXY_BUILD_${_MODULE_OPT})
|
||||||
install(TARGETS ${PROXY_NAME}
|
install(TARGETS ${PROXY_NAME}
|
||||||
@@ -661,16 +810,18 @@ foreach(PROXY_NAME proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Install plugins
|
# Install plugins
|
||||||
file(GLOB PLUGINFILES "${PLUGIN_OUTPUT_DIR}/*${PLUGIN_SUFFIX}")
|
# Use install(DIRECTORY ... FILES_MATCHING) so the glob resolves at install
|
||||||
|
# time, after plugin targets have been built. A configure-time file(GLOB)
|
||||||
|
# would run before any plugin exists and install nothing.
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
install(FILES
|
install(DIRECTORY ${PLUGIN_OUTPUT_DIR}/
|
||||||
${PLUGINFILES}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
FILES_MATCHING PATTERN "*${PLUGIN_SUFFIX}"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
install(FILES
|
install(DIRECTORY ${PLUGIN_OUTPUT_DIR}/
|
||||||
${PLUGINFILES}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/3proxy
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/3proxy
|
||||||
|
FILES_MATCHING PATTERN "*${PLUGIN_SUFFIX}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -812,7 +963,7 @@ if(NOT WIN32)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
# Module man pages — installed with binary prefix only if module is built
|
# Module man pages — installed with binary prefix only if module is built
|
||||||
foreach(_MAN proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
|
foreach(_MAN proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr)
|
||||||
string(TOUPPER "${_MAN}" _MODULE_OPT)
|
string(TOUPPER "${_MAN}" _MODULE_OPT)
|
||||||
if(3PROXY_BUILD_${_MODULE_OPT})
|
if(3PROXY_BUILD_${_MODULE_OPT})
|
||||||
set(_MAN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/man/${_MAN}.8")
|
set(_MAN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/man/${_MAN}.8")
|
||||||
@@ -829,15 +980,17 @@ endif()
|
|||||||
# Summary
|
# Summary
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS "3proxy configuration summary:")
|
message(STATUS "3proxy configuration summary:")
|
||||||
message(STATUS " Version: ${PROJECT_VERSION}")
|
message(STATUS " Version: ${PROJECT_VERSION_FULL}")
|
||||||
message(STATUS " Platform: ${CMAKE_SYSTEM_NAME}")
|
message(STATUS " Platform: ${CMAKE_SYSTEM_NAME}")
|
||||||
message(STATUS " Compiler: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
|
message(STATUS " Compiler: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
|
||||||
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
|
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS " Options:")
|
message(STATUS " Options:")
|
||||||
message(STATUS " BUILD_SHARED: ${3PROXY_BUILD_SHARED}")
|
message(STATUS " BUILD_SHARED: ${3PROXY_BUILD_SHARED}")
|
||||||
|
message(STATUS " USE_WOLFSSL: ${3PROXY_USE_WOLFSSL}")
|
||||||
message(STATUS " USE_OPENSSL: ${3PROXY_USE_OPENSSL}")
|
message(STATUS " USE_OPENSSL: ${3PROXY_USE_OPENSSL}")
|
||||||
message(STATUS " USE_PCRE2: ${3PROXY_USE_PCRE2}")
|
message(STATUS " USE_PCRE2: ${3PROXY_USE_PCRE2}")
|
||||||
|
message(STATUS " TRANSPARENT: ${3PROXY_TRANSPARENT_BUILT}")
|
||||||
message(STATUS " USE_PAM: ${3PROXY_USE_PAM}")
|
message(STATUS " USE_PAM: ${3PROXY_USE_PAM}")
|
||||||
message(STATUS " USE_ODBC: ${3PROXY_USE_ODBC}")
|
message(STATUS " USE_ODBC: ${3PROXY_USE_ODBC}")
|
||||||
message(STATUS " USE_POLL: ${3PROXY_USE_POLL}")
|
message(STATUS " USE_POLL: ${3PROXY_USE_POLL}")
|
||||||
@@ -853,6 +1006,7 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS " Libraries found:")
|
message(STATUS " Libraries found:")
|
||||||
|
message(STATUS " wolfSSL: ${WOLFSSL_FOUND}")
|
||||||
message(STATUS " OpenSSL: ${OPENSSL_FOUND}")
|
message(STATUS " OpenSSL: ${OPENSSL_FOUND}")
|
||||||
message(STATUS " PCRE2: ${PCRE2_FOUND}")
|
message(STATUS " PCRE2: ${PCRE2_FOUND}")
|
||||||
message(STATUS " PAM: ${PAM_FOUND}")
|
message(STATUS " PAM: ${PAM_FOUND}")
|
||||||
@@ -862,7 +1016,7 @@ message(STATUS " Plugins to build: ${ALL_PLUGINS}")
|
|||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS " Standalone modules:")
|
message(STATUS " Standalone modules:")
|
||||||
message(STATUS " Binary prefix: \"${3PROXY_BINARY_PREFIX}\"")
|
message(STATUS " Binary prefix: \"${3PROXY_BINARY_PREFIX}\"")
|
||||||
foreach(_M proxy socks pop3p smtpp ftppr tcppm udppm tlspr)
|
foreach(_M proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr)
|
||||||
string(TOUPPER "${_M}" _MO)
|
string(TOUPPER "${_M}" _MO)
|
||||||
message(STATUS " BUILD_${_MO}: ${3PROXY_BUILD_${_MO}}")
|
message(STATUS " BUILD_${_MO}: ${3PROXY_BUILD_${_MO}}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|||||||
+25
-10
@@ -1,4 +1,5 @@
|
|||||||
# 3proxy.full is fully functional 3proxy build based on busybox:glibc
|
# 3proxy.busybox is fully functional 3proxy build based on busybox:musl
|
||||||
|
# built against wolfSSL and PCRE2.
|
||||||
#
|
#
|
||||||
# Examples are for podman, for docker change 'podman' to 'docker'
|
# Examples are for podman, for docker change 'podman' to 'docker'
|
||||||
#
|
#
|
||||||
@@ -19,11 +20,27 @@
|
|||||||
# configuration is supported for compatibility only.
|
# configuration is supported for compatibility only.
|
||||||
|
|
||||||
|
|
||||||
FROM docker.io/gcc AS buildenv
|
FROM docker.io/alpine:latest AS wolfssl
|
||||||
|
RUN apk add --no-cache build-base curl autoconf automake libtool linux-headers
|
||||||
|
RUN TAG=$(curl -s https://api.github.com/repos/wolfSSL/wolfssl/releases/latest \
|
||||||
|
| sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p') && \
|
||||||
|
echo "wolfssl tag: $TAG" && \
|
||||||
|
curl -sL https://api.github.com/repos/wolfSSL/wolfssl/tarball/$TAG -o /tmp/w.tar.gz && \
|
||||||
|
mkdir /src && tar -xzf /tmp/w.tar.gz -C /src --strip-components=1 && \
|
||||||
|
cd /src && \
|
||||||
|
autoreconf -i && \
|
||||||
|
./configure --enable-opensslextra --enable-certgen \
|
||||||
|
--enable-tls13 --enable-sni --enable-session-ticket \
|
||||||
|
--enable-static --disable-shared --prefix=/usr/local && \
|
||||||
|
make -j$(nproc) && make install
|
||||||
|
|
||||||
|
FROM docker.io/alpine:latest AS buildenv
|
||||||
|
RUN apk add --no-cache gcc make musl-dev linux-headers pcre2-dev
|
||||||
|
COPY --from=wolfssl /usr/local /usr/local
|
||||||
COPY . 3proxy
|
COPY . 3proxy
|
||||||
RUN cd 3proxy &&\
|
RUN cd 3proxy && mkdir -p bin &&\
|
||||||
apt --assume-yes update && apt --assume-yes install libssl-dev libpcre2-dev &&\
|
make -f Makefile.Linux LIBSTATIC=true PAM_CHECK=false WOLFSSL_CHECK=true \
|
||||||
make -f Makefile.Linux LIBSTATIC=true PAM_CHECK=false &&\
|
EXTRA_LDFLAGS="-L/usr/local/lib" &&\
|
||||||
strip bin/3proxy &&\
|
strip bin/3proxy &&\
|
||||||
strip bin/*so &&\
|
strip bin/*so &&\
|
||||||
mkdir /dist &&\
|
mkdir /dist &&\
|
||||||
@@ -42,11 +59,9 @@ RUN cd /dist &&\
|
|||||||
ln -s /lib lib64 &&\
|
ln -s /lib lib64 &&\
|
||||||
ln -s /lib usr/lib &&\
|
ln -s /lib usr/lib &&\
|
||||||
ln -s /lib usr/lib64
|
ln -s /lib usr/lib64
|
||||||
RUN cp /lib/ld-*.so.* /dist/usr/local/3proxy/libexec || true
|
RUN cp /lib/ld-musl-*.so.* /dist/usr/local/3proxy/libexec || true
|
||||||
RUN cp /lib64/ld-*.so.* /dist/usr/local/3proxy/libexec || true
|
|
||||||
RUN cp "/lib/`gcc -dumpmachine`"/libdl.so.* /dist/usr/local/3proxy/libexec
|
|
||||||
|
|
||||||
FROM docker.io/busybox:glibc
|
FROM docker.io/busybox:musl
|
||||||
COPY --from=buildenv /dist /
|
COPY --from=buildenv /dist /
|
||||||
RUN ln -sf /usr/local/3proxy/libexec/* /lib/ && cd /usr/local/3proxy/ && ln -s libexec lib && ln -s libexec lib64 && mkdir usr && ln -s libexec usr/lib && ln -s libexec usr//lib64
|
RUN mkdir -p /lib /lib64 && ln -sf /usr/local/3proxy/libexec/* /lib/ && cd /usr/local/3proxy/ && ln -s libexec lib && ln -s libexec lib64 && mkdir usr && ln -s libexec usr/lib && ln -s libexec usr/lib64
|
||||||
CMD ["/bin/3proxy", "/etc/3proxy/3proxy.cfg"]
|
CMD ["/bin/3proxy", "/etc/3proxy/3proxy.cfg"]
|
||||||
@@ -23,6 +23,7 @@ FROM docker.io/gcc AS buildenv
|
|||||||
COPY . 3proxy
|
COPY . 3proxy
|
||||||
RUN cd 3proxy &&\
|
RUN cd 3proxy &&\
|
||||||
apt --assume-yes update && apt --assume-yes install libssl-dev libpcre2-dev &&\
|
apt --assume-yes update && apt --assume-yes install libssl-dev libpcre2-dev &&\
|
||||||
|
mkdir -p bin &&\
|
||||||
make -f Makefile.Linux LIBSTATIC=true PAM_CHECK=false &&\
|
make -f Makefile.Linux LIBSTATIC=true PAM_CHECK=false &&\
|
||||||
strip bin/3proxy &&\
|
strip bin/3proxy &&\
|
||||||
mkdir /dist &&\
|
mkdir /dist &&\
|
||||||
|
|||||||
+22
-4
@@ -3,7 +3,8 @@
|
|||||||
#
|
#
|
||||||
# Examples are for podman. For docker change 'podman' to 'docker'.
|
# Examples are for podman. For docker change 'podman' to 'docker'.
|
||||||
#
|
#
|
||||||
# This is busybox based docker with only 3proxy static executable.
|
# This is a scratch-based docker with statically linked 3proxy executable
|
||||||
|
# built against musl and wolfSSL.
|
||||||
#
|
#
|
||||||
# Limitations for minimal version:
|
# Limitations for minimal version:
|
||||||
# no support for plugins and system resolver.
|
# no support for plugins and system resolver.
|
||||||
@@ -25,10 +26,27 @@
|
|||||||
#<end
|
#<end
|
||||||
#
|
#
|
||||||
|
|
||||||
FROM docker.io/gcc AS buildenv
|
FROM docker.io/alpine:latest AS wolfssl
|
||||||
|
RUN apk add --no-cache build-base curl autoconf automake libtool linux-headers
|
||||||
|
RUN TAG=$(curl -s https://api.github.com/repos/wolfSSL/wolfssl/releases/latest \
|
||||||
|
| sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p') && \
|
||||||
|
echo "wolfssl tag: $TAG" && \
|
||||||
|
curl -sL https://api.github.com/repos/wolfSSL/wolfssl/tarball/$TAG -o /tmp/w.tar.gz && \
|
||||||
|
mkdir /src && tar -xzf /tmp/w.tar.gz -C /src --strip-components=1 && \
|
||||||
|
cd /src && \
|
||||||
|
autoreconf -i && \
|
||||||
|
./configure --enable-opensslextra --enable-certgen \
|
||||||
|
--enable-tls13 --enable-sni --enable-session-ticket \
|
||||||
|
--enable-static --disable-shared --prefix=/usr/local && \
|
||||||
|
make -j$(nproc) && make install
|
||||||
|
|
||||||
|
FROM docker.io/alpine:latest AS buildenv
|
||||||
|
RUN apk add --no-cache gcc make musl-dev linux-headers
|
||||||
|
COPY --from=wolfssl /usr/local /usr/local
|
||||||
COPY . 3proxy
|
COPY . 3proxy
|
||||||
RUN cd 3proxy &&\
|
RUN cd 3proxy && mkdir -p bin &&\
|
||||||
make -f Makefile.Linux STATIC=true &&\
|
make -f Makefile.Linux STATIC=true WOLFSSL_CHECK=true \
|
||||||
|
EXTRA_LDFLAGS="-L/usr/local/lib" &&\
|
||||||
strip bin/3proxy
|
strip bin/3proxy
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
|
|||||||
+48
-7
@@ -16,9 +16,29 @@ COUT = -o
|
|||||||
LN ?= ${CC}
|
LN ?= ${CC}
|
||||||
LDFLAGS ?= -O3 -flto
|
LDFLAGS ?= -O3 -flto
|
||||||
LDFLAGS += -pthread -fno-strict-aliasing
|
LDFLAGS += -pthread -fno-strict-aliasing
|
||||||
|
# Use EXTRA_CFLAGS/EXTRA_LDFLAGS to add flags from the make command line.
|
||||||
|
# Setting CFLAGS or LDFLAGS there instead overrides every assignment in this
|
||||||
|
# makefile, including the += above and the STATIC/LIBSTATIC handling below.
|
||||||
|
CFLAGS += $(EXTRA_CFLAGS)
|
||||||
|
LDFLAGS += $(EXTRA_LDFLAGS)
|
||||||
# -lpthreads may be reuiured on some platforms instead of -pthreads
|
# -lpthreads may be reuiured on some platforms instead of -pthreads
|
||||||
# -ldl or -lld may be required for some platforms
|
# -ldl or -lld may be required for some platforms
|
||||||
DCFLAGS ?= -fPIC
|
DCFLAGS ?= -fPIC
|
||||||
|
MAILPROXY ?= false
|
||||||
|
ifeq ($(MAILPROXY),true)
|
||||||
|
CFLAGS += -DWITH_POP3P -DWITH_IMAPP -DWITH_SMTPP
|
||||||
|
MAIL_EXES = $(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS) $(BUILDDIR)$(PREFIX)imapp$(EXESUFFICS) $(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
FTP ?= false
|
||||||
|
ifeq ($(FTP),true)
|
||||||
|
CFLAGS += -DWITH_FTP
|
||||||
|
FTP_EXES = $(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
HTTPSRV ?= true
|
||||||
|
ifeq ($(HTTPSRV),true)
|
||||||
|
CFLAGS += -DWITH_HTTPSRV
|
||||||
|
HTTPSRV_OBJS = srvhttpsrv$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS)
|
||||||
|
endif
|
||||||
DLFLAGS ?= -shared
|
DLFLAGS ?= -shared
|
||||||
DLSUFFICS = .so
|
DLSUFFICS = .so
|
||||||
LIBS ?=
|
LIBS ?=
|
||||||
@@ -34,7 +54,20 @@ AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Mak
|
|||||||
TYPECOMMAND = cat
|
TYPECOMMAND = cat
|
||||||
COMPATLIBS =
|
COMPATLIBS =
|
||||||
MAKEFILE = Makefile.FreeBSD
|
MAKEFILE = Makefile.FreeBSD
|
||||||
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin FilePlugin
|
PLUGINS ?= StringsPlugin TrafficPlugin FilePlugin
|
||||||
|
|
||||||
|
# Transparent proxying, built in. The destination of a redirected connection
|
||||||
|
# comes from pf where its headers are available, and from the socket where a
|
||||||
|
# redirection leaves it there (OpenBSD divert-to, FreeBSD ipfw fwd). macOS
|
||||||
|
# has /dev/pf but ships no pfvar.h, so only the socket route is built there
|
||||||
|
# and no macOS redirection leaves the address on the socket.
|
||||||
|
CFLAGS += -DWITH_TRANSPARENT
|
||||||
|
TRANSPARENT_OBJS = transparent$(OBJSUFFICS)
|
||||||
|
|
||||||
|
PF_CHECK ?= $(shell printf "\#include <sys/types.h>\\n\#include <sys/socket.h>\\n\#include <net/if.h>\\n\#include <net/pfvar.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpf.o -c - 2>/dev/null && rm testpf.o && echo true||echo false)
|
||||||
|
ifeq ($(PF_CHECK), true)
|
||||||
|
CFLAGS += -DWITH_PF
|
||||||
|
endif
|
||||||
ifeq ($(STATIC), true)
|
ifeq ($(STATIC), true)
|
||||||
LDFLAGS += -static
|
LDFLAGS += -static
|
||||||
CFLAGS += -DNOPLUGINS -DNOSTDRESOLVE -DNOCRYPT
|
CFLAGS += -DNOPLUGINS -DNOSTDRESOLVE -DNOCRYPT
|
||||||
@@ -47,7 +80,14 @@ ifeq ($(LIBSTATIC), true)
|
|||||||
STATIC_SUFFIX = -Wl,-Bdynamic
|
STATIC_SUFFIX = -Wl,-Bdynamic
|
||||||
ZLIB = -lz -lzstd
|
ZLIB = -lz -lzstd
|
||||||
endif
|
endif
|
||||||
OPENSSL_CHECK ?= $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false)
|
WOLFSSL_CHECK ?= $(shell printf "\#include <wolfssl/options.h>\\n\#include <wolfssl/openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestwssl testwssl.o $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) 2>/dev/null && rm testwssl testwssl.o && echo true||echo false)
|
||||||
|
ifeq ($(WOLFSSL_CHECK), true)
|
||||||
|
LIBS += $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX)
|
||||||
|
CFLAGS += -DWITH_SSL -DWITH_WOLFSSL
|
||||||
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||||
|
ZLIB :=
|
||||||
|
else
|
||||||
|
OPENSSL_CHECK ?= $(shell printf "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX)
|
LIBS += $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX)
|
||||||
CFLAGS += -DWITH_SSL
|
CFLAGS += -DWITH_SSL
|
||||||
@@ -55,13 +95,14 @@ ifeq ($(OPENSSL_CHECK), true)
|
|||||||
else
|
else
|
||||||
ZLIB :=
|
ZLIB :=
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK ?= $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -lpcre2-8 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
endif
|
||||||
|
PCRE_CHECK ?= $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -lpcre2-8 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
ifeq ($(PCRE_CHECK), true)
|
||||||
CFLAGS += -DWITH_PCRE
|
CFLAGS += -DWITH_PCRE
|
||||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||||
PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX)
|
PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX)
|
||||||
endif
|
endif
|
||||||
PAM_CHECK ?= $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false)
|
PAM_CHECK ?= $(shell printf "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false)
|
||||||
ifeq ($(PAM_CHECK), true)
|
ifeq ($(PAM_CHECK), true)
|
||||||
PLUGINS += PamAuth
|
PLUGINS += PamAuth
|
||||||
endif
|
endif
|
||||||
@@ -76,7 +117,7 @@ install: all
|
|||||||
if [ ! -d "$(DESTDIR)$(BINPREFIX)" ]; then mkdir -p $(DESTDIR)$(BINPREFIX)/; fi
|
if [ ! -d "$(DESTDIR)$(BINPREFIX)" ]; then mkdir -p $(DESTDIR)$(BINPREFIX)/; fi
|
||||||
install bin/3proxy $(DESTDIR)$(BINPREFIX)/3proxy
|
install bin/3proxy $(DESTDIR)$(BINPREFIX)/3proxy
|
||||||
install bin/$(CRYPT_PREFIX)crypt $(DESTDIR)$(BINPREFIX)/$(CRYPT_PREFIX)crypt
|
install bin/$(CRYPT_PREFIX)crypt $(DESTDIR)$(BINPREFIX)/$(CRYPT_PREFIX)crypt
|
||||||
for f in proxy socks pop3p smtpp ftppr tcppm udppm tlspr; do \
|
for f in proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr; do \
|
||||||
if [ -f bin/$(PREFIX)$$f ]; then install bin/$(PREFIX)$$f $(DESTDIR)$(BINPREFIX)/$(PREFIX)$$f; fi; \
|
if [ -f bin/$(PREFIX)$$f ]; then install bin/$(PREFIX)$$f $(DESTDIR)$(BINPREFIX)/$(PREFIX)$$f; fi; \
|
||||||
done
|
done
|
||||||
install -d $(DESTDIR)$(prefix)/etc/3proxy/conf
|
install -d $(DESTDIR)$(prefix)/etc/3proxy/conf
|
||||||
@@ -93,8 +134,8 @@ install: all
|
|||||||
touch $(DESTDIR)$(prefix)/etc/3proxy/conf/bandlimiters
|
touch $(DESTDIR)$(prefix)/etc/3proxy/conf/bandlimiters
|
||||||
install -d $(DESTDIR)$(MANDIR)/man8
|
install -d $(DESTDIR)$(MANDIR)/man8
|
||||||
install -m 644 man/3proxy.8 $(DESTDIR)$(MANDIR)/man8/3proxy.8
|
install -m 644 man/3proxy.8 $(DESTDIR)$(MANDIR)/man8/3proxy.8
|
||||||
for f in proxy socks pop3p smtpp ftppr tcppm udppm tlspr; do \
|
for f in proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr; do \
|
||||||
if [ -f man/$$f.8 ]; then install -m 644 man/$$f.8 $(DESTDIR)$(MANDIR)/man8/$(PREFIX)$$f.8; fi; \
|
if [ -f man/$$f.8 ] && [ -f bin/$(PREFIX)$$f ]; then install -m 644 man/$$f.8 $(DESTDIR)$(MANDIR)/man8/$(PREFIX)$$f.8; fi; \
|
||||||
done
|
done
|
||||||
install -m 644 man/3proxy_crypt.8 $(DESTDIR)$(MANDIR)/man8/$(CRYPT_PREFIX)crypt.8
|
install -m 644 man/3proxy_crypt.8 $(DESTDIR)$(MANDIR)/man8/$(CRYPT_PREFIX)crypt.8
|
||||||
install -d $(DESTDIR)$(MANDIR)/man5
|
install -d $(DESTDIR)$(MANDIR)/man5
|
||||||
|
|||||||
+55
-13
@@ -3,19 +3,45 @@
|
|||||||
#
|
#
|
||||||
# add -DWITH_ODBC to CFLAGS and -lodbc to LIBS to compile with ODBC
|
# add -DWITH_ODBC to CFLAGS and -lodbc to LIBS to compile with ODBC
|
||||||
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
|
||||||
|
#
|
||||||
|
# Linux splice() support is built, but used only by services given the -s
|
||||||
|
# option: it is faster for large transfers and slower for small requests.
|
||||||
|
# Remove -DWITHSPLICE from CFLAGS to build without it.
|
||||||
|
|
||||||
BUILDDIR = ../bin/
|
BUILDDIR = ../bin/
|
||||||
PREFIX ?= 3proxy_
|
PREFIX ?= 3proxy_
|
||||||
CRYPT_PREFIX ?= $(PREFIX)
|
CRYPT_PREFIX ?= $(PREFIX)
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
|
|
||||||
CFLAGS ?= -O3 -flto -fPIC
|
CFLAGS ?= -O3 -flto
|
||||||
CFLAGS += -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER -D WITH_UN
|
CFLAGS += -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER -D WITH_UN
|
||||||
COUT = -o
|
COUT = -o
|
||||||
LN ?= ${CC}
|
LN ?= ${CC}
|
||||||
DCFLAGS ?=
|
DCFLAGS ?= -fPIC
|
||||||
LDFLAGS ?= -O3 -flto -fPIC
|
LDFLAGS ?= -O3 -flto
|
||||||
LDFLAGS += -fno-strict-aliasing -pthread
|
LDFLAGS += -fno-strict-aliasing -pthread
|
||||||
|
# Use EXTRA_CFLAGS/EXTRA_LDFLAGS to add flags from the make command line.
|
||||||
|
# Setting CFLAGS or LDFLAGS there instead overrides every assignment in this
|
||||||
|
# makefile, including the += above and the STATIC/LIBSTATIC handling below.
|
||||||
|
CFLAGS += $(EXTRA_CFLAGS)
|
||||||
|
LDFLAGS += $(EXTRA_LDFLAGS)
|
||||||
|
# The HTTP server serves the endpoints declared by http lines. The admin
|
||||||
|
# interface is built on top of it, so turning it off removes both.
|
||||||
|
MAILPROXY ?= false
|
||||||
|
ifeq ($(MAILPROXY),true)
|
||||||
|
CFLAGS += -DWITH_POP3P -DWITH_IMAPP -DWITH_SMTPP
|
||||||
|
MAIL_EXES = $(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS) $(BUILDDIR)$(PREFIX)imapp$(EXESUFFICS) $(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
FTP ?= false
|
||||||
|
ifeq ($(FTP),true)
|
||||||
|
CFLAGS += -DWITH_FTP
|
||||||
|
FTP_EXES = $(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
HTTPSRV ?= true
|
||||||
|
ifeq ($(HTTPSRV),true)
|
||||||
|
CFLAGS += -DWITH_HTTPSRV
|
||||||
|
HTTPSRV_OBJS = srvhttpsrv$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS)
|
||||||
|
endif
|
||||||
DLFLAGS ?= -shared
|
DLFLAGS ?= -shared
|
||||||
DLSUFFICS = .ld.so
|
DLSUFFICS = .ld.so
|
||||||
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
||||||
@@ -34,8 +60,12 @@ MAKEFILE = Makefile.Linux
|
|||||||
# PamAuth requires libpam, you may require pam-devel package to be installed
|
# PamAuth requires libpam, you may require pam-devel package to be installed
|
||||||
# SSLPlugin requires -lcrypto -lssl
|
# SSLPlugin requires -lcrypto -lssl
|
||||||
#LIBS = -lcrypto -lssl -ldl
|
#LIBS = -lcrypto -lssl -ldl
|
||||||
#PLUGINS = SSLPlugin StringsPlugin TrafficPlugin PCREPlugin TransparentPlugin PamAuth
|
#PLUGINS = StringsPlugin TrafficPlugin PamAuth LdapPlugin
|
||||||
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin FilePlugin
|
PLUGINS ?= StringsPlugin TrafficPlugin FilePlugin
|
||||||
|
|
||||||
|
# Transparent proxying, built in: it needs the packet filter of the platform
|
||||||
|
CFLAGS += -DWITH_TRANSPARENT
|
||||||
|
TRANSPARENT_OBJS = transparent$(OBJSUFFICS)
|
||||||
ifeq ($(STATIC), true)
|
ifeq ($(STATIC), true)
|
||||||
LDFLAGS += -static
|
LDFLAGS += -static
|
||||||
CFLAGS += -DNOPLUGINS -DNOSTDRESOLVE -DNOCRYPT
|
CFLAGS += -DNOPLUGINS -DNOSTDRESOLVE -DNOCRYPT
|
||||||
@@ -51,7 +81,14 @@ ifeq ($(LIBSTATIC), true)
|
|||||||
ZLIB = -lz -lzstd
|
ZLIB = -lz -lzstd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OPENSSL_CHECK ?= $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false)
|
WOLFSSL_CHECK ?= $(shell printf "\#include <wolfssl/options.h>\\n\#include <wolfssl/openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestwssl testwssl.o $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) 2>/dev/null && rm testwssl testwssl.o && echo true||echo false)
|
||||||
|
ifeq ($(WOLFSSL_CHECK), true)
|
||||||
|
LIBS += $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX)
|
||||||
|
CFLAGS += -DWITH_SSL -DWITH_WOLFSSL
|
||||||
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||||
|
ZLIB :=
|
||||||
|
else
|
||||||
|
OPENSSL_CHECK ?= $(shell printf "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX)
|
LIBS += $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX)
|
||||||
CFLAGS += -DWITH_SSL
|
CFLAGS += -DWITH_SSL
|
||||||
@@ -59,13 +96,14 @@ ifeq ($(OPENSSL_CHECK), true)
|
|||||||
else
|
else
|
||||||
ZLIB :=
|
ZLIB :=
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK ?= $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
endif
|
||||||
|
PCRE_CHECK ?= $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
ifeq ($(PCRE_CHECK), true)
|
||||||
CFLAGS += -DWITH_PCRE
|
CFLAGS += -DWITH_PCRE
|
||||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||||
PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX)
|
PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX)
|
||||||
endif
|
endif
|
||||||
PAM_CHECK ?= $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false)
|
PAM_CHECK ?= $(shell printf "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false)
|
||||||
ifeq ($(PAM_CHECK), true)
|
ifeq ($(PAM_CHECK), true)
|
||||||
PLUGINS += PamAuth
|
PLUGINS += PamAuth
|
||||||
endif
|
endif
|
||||||
@@ -85,14 +123,18 @@ INSTALL_BIN = $(INSTALL) -m 755
|
|||||||
INSTALL_DATA = $(INSTALL) -m 644
|
INSTALL_DATA = $(INSTALL) -m 644
|
||||||
INSTALL_OBJS = bin/3proxy \
|
INSTALL_OBJS = bin/3proxy \
|
||||||
bin/$(CRYPT_PREFIX)crypt \
|
bin/$(CRYPT_PREFIX)crypt \
|
||||||
bin/$(PREFIX)ftppr \
|
|
||||||
bin/$(PREFIX)pop3p \
|
|
||||||
bin/$(PREFIX)proxy \
|
bin/$(PREFIX)proxy \
|
||||||
bin/$(PREFIX)smtpp \
|
|
||||||
bin/$(PREFIX)socks \
|
bin/$(PREFIX)socks \
|
||||||
bin/$(PREFIX)tcppm \
|
bin/$(PREFIX)tcppm \
|
||||||
bin/$(PREFIX)tlspr \
|
bin/$(PREFIX)tlspr \
|
||||||
bin/$(PREFIX)udppm
|
bin/$(PREFIX)udppm
|
||||||
|
# the mail proxies and ftppr are only there when they were built
|
||||||
|
ifeq ($(MAILPROXY),true)
|
||||||
|
INSTALL_OBJS += bin/$(PREFIX)imapp bin/$(PREFIX)pop3p bin/$(PREFIX)smtpp
|
||||||
|
endif
|
||||||
|
ifeq ($(FTP),true)
|
||||||
|
INSTALL_OBJS += bin/$(PREFIX)ftppr
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
INSTALL_CFG = scripts/3proxy.cfg.chroot
|
INSTALL_CFG = scripts/3proxy.cfg.chroot
|
||||||
@@ -149,8 +191,8 @@ install-man:
|
|||||||
$(INSTALL_BIN) -d $(MANDIR8)
|
$(INSTALL_BIN) -d $(MANDIR8)
|
||||||
$(INSTALL_DATA) man/3proxy.cfg.5 $(MANDIR5)
|
$(INSTALL_DATA) man/3proxy.cfg.5 $(MANDIR5)
|
||||||
$(INSTALL_DATA) man/3proxy.8 $(MANDIR8)
|
$(INSTALL_DATA) man/3proxy.8 $(MANDIR8)
|
||||||
for f in proxy socks pop3p smtpp ftppr tcppm udppm tlspr; do \
|
for f in proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr; do \
|
||||||
if [ -f man/$$f.8 ]; then $(INSTALL_DATA) man/$$f.8 $(MANDIR8)/$(PREFIX)$$f.8; fi; \
|
if [ -f man/$$f.8 ] && [ -f bin/$(PREFIX)$$f ]; then $(INSTALL_DATA) man/$$f.8 $(MANDIR8)/$(PREFIX)$$f.8; fi; \
|
||||||
done
|
done
|
||||||
$(INSTALL_DATA) man/3proxy_crypt.8 $(MANDIR8)/$(CRYPT_PREFIX)crypt.8
|
$(INSTALL_DATA) man/3proxy_crypt.8 $(MANDIR8)/$(CRYPT_PREFIX)crypt.8
|
||||||
|
|
||||||
|
|||||||
+25
-3
@@ -14,6 +14,21 @@ COUT = -o ./
|
|||||||
LN = $(CC)
|
LN = $(CC)
|
||||||
LDFLAGS = -xO3
|
LDFLAGS = -xO3
|
||||||
DCFLAGS = -fPIC
|
DCFLAGS = -fPIC
|
||||||
|
MAILPROXY ?= false
|
||||||
|
ifeq ($(MAILPROXY),true)
|
||||||
|
CFLAGS += -DWITH_POP3P -DWITH_IMAPP -DWITH_SMTPP
|
||||||
|
MAIL_EXES = $(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS) $(BUILDDIR)$(PREFIX)imapp$(EXESUFFICS) $(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
FTP ?= false
|
||||||
|
ifeq ($(FTP),true)
|
||||||
|
CFLAGS += -DWITH_FTP
|
||||||
|
FTP_EXES = $(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
HTTPSRV ?= true
|
||||||
|
ifeq ($(HTTPSRV),true)
|
||||||
|
CFLAGS += -DWITH_HTTPSRV
|
||||||
|
HTTPSRV_OBJS = srvhttpsrv$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS)
|
||||||
|
endif
|
||||||
DLFLAGS = -shared
|
DLFLAGS = -shared
|
||||||
DLSUFFICS = .ld.so
|
DLSUFFICS = .ld.so
|
||||||
LIBS = -lpthread -lsocket -lnsl -lresolv -ldl
|
LIBS = -lpthread -lsocket -lnsl -lresolv -ldl
|
||||||
@@ -29,15 +44,22 @@ AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Mak
|
|||||||
TYPECOMMAND = cat
|
TYPECOMMAND = cat
|
||||||
COMPATLIBS =
|
COMPATLIBS =
|
||||||
MAKEFILE = Makefile.Solaris
|
MAKEFILE = Makefile.Solaris
|
||||||
PLUGINS = StringsPlugin TrafficPlugin TransparentPlugin FilePlugin
|
PLUGINS = StringsPlugin TrafficPlugin FilePlugin
|
||||||
|
|
||||||
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testssl testssl.o -lcrypto -lssl 2>/dev/null && rm testssl testssl.o && echo true||echo false)
|
WOLFSSL_CHECK = $(shell printf "\#include <wolfssl/options.h>\\n\#include <wolfssl/openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testwssl testwssl.o -lwolfssl 2>/dev/null && rm testwssl testwssl.o && echo true||echo false)
|
||||||
|
ifeq ($(WOLFSSL_CHECK), true)
|
||||||
|
LIBS += -lwolfssl
|
||||||
|
CFLAGS += -DWITH_SSL -DWITH_WOLFSSL
|
||||||
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||||
|
else
|
||||||
|
OPENSSL_CHECK = $(shell printf "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testssl testssl.o -lcrypto -lssl 2>/dev/null && rm testssl testssl.o && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += -l crypto -l ssl
|
LIBS += -l crypto -l ssl
|
||||||
CFLAGS += -DWITH_SSL
|
CFLAGS += -DWITH_SSL
|
||||||
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
endif
|
||||||
|
PCRE_CHECK = $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) -Wl,-Bstatic -lpcre2-8 -Wl,-Bdynamic 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
ifeq ($(PCRE_CHECK), true)
|
||||||
CFLAGS += -DWITH_PCRE
|
CFLAGS += -DWITH_PCRE
|
||||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||||
|
|||||||
+10
-2
@@ -11,13 +11,20 @@ CRYPT_PREFIX = 3proxy_
|
|||||||
CC = cl
|
CC = cl
|
||||||
VERSION = $(VERSION)
|
VERSION = $(VERSION)
|
||||||
BUILDDATE = $(BUILDDATE)
|
BUILDDATE = $(BUILDDATE)
|
||||||
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "WITH_SSL" /D "WITH_PCRE" /D "WITH_ODBC" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /Fp"proxy.pch" /FD /c $(BUILDDATE) $(VERSION)
|
!IFDEF WOLFSSL
|
||||||
|
SSL_DEFS = /D "WITH_SSL" /D "WITH_WOLFSSL"
|
||||||
|
SSL_LIBS = wolfssl.lib
|
||||||
|
!ELSE
|
||||||
|
SSL_DEFS = /D "WITH_SSL"
|
||||||
|
SSL_LIBS = libcrypto.lib libssl.lib
|
||||||
|
!ENDIF
|
||||||
|
CFLAGS = /D "WITH_HTTPSRV" /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" $(SSL_DEFS) /D "WITH_PCRE" /D "WITH_ODBC" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "NO_SHARE_UDP_SOCKET" /Fp"proxy.pch" /FD /c $(BUILDDATE) $(VERSION)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no
|
LDFLAGS = /nologo /subsystem:console /incremental:no
|
||||||
DLFLAGS = /DLL
|
DLFLAGS = /DLL
|
||||||
DLSUFFICS = .dll
|
DLSUFFICS = .dll
|
||||||
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib Crypt32.lib libcrypto.lib libssl.lib pcre2-8.lib
|
LIBS = ws2_32.lib mswsock.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib Crypt32.lib $(SSL_LIBS) pcre2-8.lib
|
||||||
LIBSPREFIX =
|
LIBSPREFIX =
|
||||||
LIBSSUFFIX = .lib
|
LIBSSUFFIX = .lib
|
||||||
LIBEXT = .lib
|
LIBEXT = .lib
|
||||||
@@ -33,6 +40,7 @@ MAKEFILE = Makefile.msvc
|
|||||||
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin
|
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin
|
||||||
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||||
|
HTTPSRV_OBJS = srvhttpsrv$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS)
|
||||||
VERFILE = 3proxy.res $(VERFILE)
|
VERFILE = 3proxy.res $(VERFILE)
|
||||||
VERSIONDEP = 3proxy.res $(VERSIONDEP)
|
VERSIONDEP = 3proxy.res $(VERSIONDEP)
|
||||||
AFTERCLEAN = if exist src\*.res (del src\*.res) && if exist src\*.err (del src\*.err)
|
AFTERCLEAN = if exist src\*.res (del src\*.res) && if exist src\*.err (del src\*.err)
|
||||||
|
|||||||
+41
-7
@@ -18,9 +18,29 @@ COUT = -o
|
|||||||
LN ?= $(CC)
|
LN ?= $(CC)
|
||||||
LDFLAGS ?= -O3 -flto
|
LDFLAGS ?= -O3 -flto
|
||||||
LDFLAGS += -pthread -fno-strict-aliasing
|
LDFLAGS += -pthread -fno-strict-aliasing
|
||||||
|
# Use EXTRA_CFLAGS/EXTRA_LDFLAGS to add flags from the make command line.
|
||||||
|
# Setting CFLAGS or LDFLAGS there instead overrides every assignment in this
|
||||||
|
# makefile, including the += above and the STATIC/LIBSTATIC handling below.
|
||||||
|
CFLAGS += $(EXTRA_CFLAGS)
|
||||||
|
LDFLAGS += $(EXTRA_LDFLAGS)
|
||||||
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
||||||
# -ldl or -lld may be required for some platforms
|
# -ldl or -lld may be required for some platforms
|
||||||
DCFLAGS ?= -fPIC
|
DCFLAGS ?= -fPIC
|
||||||
|
MAILPROXY ?= false
|
||||||
|
ifeq ($(MAILPROXY),true)
|
||||||
|
CFLAGS += -DWITH_POP3P -DWITH_IMAPP -DWITH_SMTPP
|
||||||
|
MAIL_EXES = $(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS) $(BUILDDIR)$(PREFIX)imapp$(EXESUFFICS) $(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
FTP ?= false
|
||||||
|
ifeq ($(FTP),true)
|
||||||
|
CFLAGS += -DWITH_FTP
|
||||||
|
FTP_EXES = $(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
HTTPSRV ?= true
|
||||||
|
ifeq ($(HTTPSRV),true)
|
||||||
|
CFLAGS += -DWITH_HTTPSRV
|
||||||
|
HTTPSRV_OBJS = srvhttpsrv$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS)
|
||||||
|
endif
|
||||||
DLFLAGS ?= -shared
|
DLFLAGS ?= -shared
|
||||||
DLSUFFICS ?= .ld.so
|
DLSUFFICS ?= .ld.so
|
||||||
LIBS ?=
|
LIBS ?=
|
||||||
@@ -36,7 +56,13 @@ AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Mak
|
|||||||
TYPECOMMAND = cat
|
TYPECOMMAND = cat
|
||||||
COMPATLIBS =
|
COMPATLIBS =
|
||||||
MAKEFILE = Makefile.unix
|
MAKEFILE = Makefile.unix
|
||||||
PLUGINS ?= StringsPlugin TrafficPlugin TransparentPlugin FilePlugin
|
PLUGINS ?= StringsPlugin TrafficPlugin FilePlugin
|
||||||
|
|
||||||
|
# Transparent proxying is not built here: this makefile is for the systems
|
||||||
|
# without a redirection 3proxy can read the original destination from. Where
|
||||||
|
# the platform has one - OpenBSD divert-to is the case that fits - uncomment:
|
||||||
|
#CFLAGS += -DWITH_TRANSPARENT
|
||||||
|
#TRANSPARENT_OBJS = transparent$(OBJSUFFICS)
|
||||||
ifeq ($(STATIC), true)
|
ifeq ($(STATIC), true)
|
||||||
LDFLAGS += -static
|
LDFLAGS += -static
|
||||||
CFLAGS += -DNOPLUGINS -DNOSTDRESOLVE -DNOCRYPT
|
CFLAGS += -DNOPLUGINS -DNOSTDRESOLVE -DNOCRYPT
|
||||||
@@ -49,7 +75,14 @@ ifeq ($(LIBSTATIC), true)
|
|||||||
STATIC_SUFFIX = -Wl,-Bdynamic
|
STATIC_SUFFIX = -Wl,-Bdynamic
|
||||||
ZLIB = -lz -lzstd
|
ZLIB = -lz -lzstd
|
||||||
endif
|
endif
|
||||||
OPENSSL_CHECK ?= $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false)
|
WOLFSSL_CHECK ?= $(shell printf "\#include <wolfssl/options.h>\\n\#include <wolfssl/openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testwssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestwssl testwssl.o $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) 2>/dev/null && rm testwssl testwssl.o && echo true||echo false)
|
||||||
|
ifeq ($(WOLFSSL_CHECK), true)
|
||||||
|
LIBS += $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX)
|
||||||
|
CFLAGS += -DWITH_SSL -DWITH_WOLFSSL
|
||||||
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||||
|
ZLIB :=
|
||||||
|
else
|
||||||
|
OPENSSL_CHECK ?= $(shell printf "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testssl.o - 2>/dev/null && $(CC) $(LDFLAGS) -otestssl testssl.o $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX) 2>/dev/null && rm testssl testssl.o && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX)
|
LIBS += $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX)
|
||||||
CFLAGS += -DWITH_SSL
|
CFLAGS += -DWITH_SSL
|
||||||
@@ -57,13 +90,14 @@ ifeq ($(OPENSSL_CHECK), true)
|
|||||||
else
|
else
|
||||||
ZLIB :=
|
ZLIB :=
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK ?= $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
endif
|
||||||
|
PCRE_CHECK ?= $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n\#include <pcre2.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpcre.o - 2>/dev/null && $(CC) -o testpcre testpcre.o $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) 2>/dev/null && rm testpcre testpcre.o && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
ifeq ($(PCRE_CHECK), true)
|
||||||
CFLAGS += -DWITH_PCRE
|
CFLAGS += -DWITH_PCRE
|
||||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||||
PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX)
|
PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX)
|
||||||
endif
|
endif
|
||||||
PAM_CHECK ?= $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false)
|
PAM_CHECK ?= $(shell printf "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d \\\\ | $(CC) -x c $(CFLAGS) -o testpam.o - 2>/dev/null && $(CC) $(LDFLAGS) -o testpam testpam.o -lpam 2>/dev/null && rm testpam testpam.o && echo true||echo false)
|
||||||
ifeq ($(PAM_CHECK), true)
|
ifeq ($(PAM_CHECK), true)
|
||||||
PLUGINS += PamAuth
|
PLUGINS += PamAuth
|
||||||
endif
|
endif
|
||||||
@@ -78,7 +112,7 @@ install: all
|
|||||||
if [ ! -d "$(DESTDIR)$(BINPREFIX)" ]; then mkdir -p $(DESTDIR)$(BINPREFIX)/; fi
|
if [ ! -d "$(DESTDIR)$(BINPREFIX)" ]; then mkdir -p $(DESTDIR)$(BINPREFIX)/; fi
|
||||||
install bin/3proxy $(DESTDIR)$(BINPREFIX)/3proxy
|
install bin/3proxy $(DESTDIR)$(BINPREFIX)/3proxy
|
||||||
install bin/$(CRYPT_PREFIX)crypt $(DESTDIR)$(BINPREFIX)/$(CRYPT_PREFIX)crypt
|
install bin/$(CRYPT_PREFIX)crypt $(DESTDIR)$(BINPREFIX)/$(CRYPT_PREFIX)crypt
|
||||||
for f in proxy socks pop3p smtpp ftppr tcppm udppm tlspr; do \
|
for f in proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr; do \
|
||||||
if [ -f bin/$(PREFIX)$$f ]; then install bin/$(PREFIX)$$f $(DESTDIR)$(BINPREFIX)/$(PREFIX)$$f; fi; \
|
if [ -f bin/$(PREFIX)$$f ]; then install bin/$(PREFIX)$$f $(DESTDIR)$(BINPREFIX)/$(PREFIX)$$f; fi; \
|
||||||
done
|
done
|
||||||
install -d $(DESTDIR)$(prefix)/etc/3proxy/conf
|
install -d $(DESTDIR)$(prefix)/etc/3proxy/conf
|
||||||
@@ -95,8 +129,8 @@ install: all
|
|||||||
touch $(DESTDIR)$(prefix)/etc/3proxy/conf/bandlimiters
|
touch $(DESTDIR)$(prefix)/etc/3proxy/conf/bandlimiters
|
||||||
install -d $(DESTDIR)$(MANDIR)/man8
|
install -d $(DESTDIR)$(MANDIR)/man8
|
||||||
install -m 644 man/3proxy.8 $(DESTDIR)$(MANDIR)/man8/3proxy.8
|
install -m 644 man/3proxy.8 $(DESTDIR)$(MANDIR)/man8/3proxy.8
|
||||||
for f in proxy socks pop3p smtpp ftppr tcppm udppm tlspr; do \
|
for f in proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr; do \
|
||||||
if [ -f man/$$f.8 ]; then install -m 644 man/$$f.8 $(DESTDIR)$(MANDIR)/man8/$(PREFIX)$$f.8; fi; \
|
if [ -f man/$$f.8 ] && [ -f bin/$(PREFIX)$$f ]; then install -m 644 man/$$f.8 $(DESTDIR)$(MANDIR)/man8/$(PREFIX)$$f.8; fi; \
|
||||||
done
|
done
|
||||||
install -m 644 man/3proxy_crypt.8 $(DESTDIR)$(MANDIR)/man8/$(CRYPT_PREFIX)crypt.8
|
install -m 644 man/3proxy_crypt.8 $(DESTDIR)$(MANDIR)/man8/$(CRYPT_PREFIX)crypt.8
|
||||||
install -d $(DESTDIR)$(MANDIR)/man5
|
install -d $(DESTDIR)$(MANDIR)/man5
|
||||||
|
|||||||
+3
-2
@@ -8,19 +8,20 @@ BUILDDIR = ../bin/
|
|||||||
PREFIX = 3proxy_
|
PREFIX = 3proxy_
|
||||||
CRYPT_PREFIX = 3proxy_
|
CRYPT_PREFIX = 3proxy_
|
||||||
CC = cl
|
CC = cl
|
||||||
CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NORADIUS" /D"WATCOM" /D "MSVC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRId64=\"I64d\"" /D "PRIu64=\"I64u\"" /D "SCNu64=\"I64u\"" /D "SCNx64=\"I64x\"" /D "SCNd64=\"I64d\"" /D "PRIx64=\"I64x\"" /c $(VERSION) $(BUILDDATE)
|
CFLAGS = /D "WITH_HTTPSRV" /nologo /Ox /MT /D "NOIPV6" /D "NO_UN" /D "NODEBUG" /D "NORADIUS" /D"WATCOM" /D "NO_SHARE_UDP_SOCKET" /D "MSVC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRId64=\"I64d\"" /D "PRIu64=\"I64u\"" /D "SCNu64=\"I64u\"" /D "SCNx64=\"I64x\"" /D "SCNd64=\"I64d\"" /D "PRIx64=\"I64x\"" /c $(VERSION) $(BUILDDATE)
|
||||||
COUT = /Fo
|
COUT = /Fo
|
||||||
LN = link
|
LN = link
|
||||||
LDFLAGS = /nologo /subsystem:console /incremental:no
|
LDFLAGS = /nologo /subsystem:console /incremental:no
|
||||||
DLFLAGS = /DLL
|
DLFLAGS = /DLL
|
||||||
DLSUFFICS = .dll
|
DLSUFFICS = .dll
|
||||||
LIBS = ws2_32.lib advapi32.lib user32.lib kernel32.lib
|
LIBS = ws2_32.lib mswsock.lib advapi32.lib user32.lib kernel32.lib
|
||||||
LIBSPREFIX =
|
LIBSPREFIX =
|
||||||
LIBSSUFFIX = .lib
|
LIBSSUFFIX = .lib
|
||||||
LIBEXT = .lib
|
LIBEXT = .lib
|
||||||
LNOUT = /out:
|
LNOUT = /out:
|
||||||
EXESUFFICS = .exe
|
EXESUFFICS = .exe
|
||||||
OBJSUFFICS = .obj
|
OBJSUFFICS = .obj
|
||||||
|
HTTPSRV_OBJS = srvhttpsrv$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS)
|
||||||
DEFINEOPTION = /D
|
DEFINEOPTION = /D
|
||||||
COMPFILES = *.pch *.idb *.err
|
COMPFILES = *.pch *.idb *.err
|
||||||
REMOVECOMMAND = del 2>NUL >NUL
|
REMOVECOMMAND = del 2>NUL >NUL
|
||||||
|
|||||||
+44
-6
@@ -11,13 +11,36 @@ CRYPT_PREFIX ?= $(PREFIX)
|
|||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
CFLAGS ?= -O3 -flto
|
CFLAGS ?= -O3 -flto
|
||||||
CFLAGS += -fno-strict-aliasing -c -mthreads -DWITH_WSAPOLL -DWITH_ODBC
|
CFLAGS += -fno-strict-aliasing -c -mthreads -DWITH_WSAPOLL -DWITH_ODBC
|
||||||
|
# Windows does not take a recv and a send on one socket from two threads,
|
||||||
|
# so a UDP service answers from a socket of its own
|
||||||
|
CFLAGS += -DNO_SHARE_UDP_SOCKET
|
||||||
COUT = -o
|
COUT = -o
|
||||||
LN ?= $(CC)
|
LN ?= $(CC)
|
||||||
LDFLAGS ?= -O3 -flto
|
LDFLAGS ?= -O3 -flto
|
||||||
LDFLAGS += -fno-strict-aliasing -mthreads
|
LDFLAGS += -fno-strict-aliasing -mthreads
|
||||||
|
# Use EXTRA_CFLAGS/EXTRA_LDFLAGS to add flags from the make command line.
|
||||||
|
# Setting CFLAGS or LDFLAGS there instead overrides every assignment in this
|
||||||
|
# makefile, including the += above and the STATIC/LIBSTATIC handling below.
|
||||||
|
CFLAGS += $(EXTRA_CFLAGS)
|
||||||
|
LDFLAGS += $(EXTRA_LDFLAGS)
|
||||||
|
MAILPROXY ?= false
|
||||||
|
ifeq ($(MAILPROXY),true)
|
||||||
|
CFLAGS += -DWITH_POP3P -DWITH_IMAPP -DWITH_SMTPP
|
||||||
|
MAIL_EXES = $(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS) $(BUILDDIR)$(PREFIX)imapp$(EXESUFFICS) $(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
FTP ?= false
|
||||||
|
ifeq ($(FTP),true)
|
||||||
|
CFLAGS += -DWITH_FTP
|
||||||
|
FTP_EXES = $(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS)
|
||||||
|
endif
|
||||||
|
HTTPSRV ?= true
|
||||||
|
ifeq ($(HTTPSRV),true)
|
||||||
|
CFLAGS += -DWITH_HTTPSRV
|
||||||
|
HTTPSRV_OBJS = srvhttpsrv$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS)
|
||||||
|
endif
|
||||||
DLFLAGS ?= -shared
|
DLFLAGS ?= -shared
|
||||||
DLSUFFICS = .dll
|
DLSUFFICS = .dll
|
||||||
LIBS += -lws2_32 -lodbc32 -ladvapi32 -luser32 -lbcrypt
|
LIBS += -lws2_32 -lmswsock -lodbc32 -ladvapi32 -luser32 -lbcrypt
|
||||||
LIBSPREFIX = -l
|
LIBSPREFIX = -l
|
||||||
LIBSSUFFIX =
|
LIBSSUFFIX =
|
||||||
LNOUT = -o
|
LNOUT = -o
|
||||||
@@ -37,21 +60,36 @@ BUILDDATE := $(BUILDDATE)
|
|||||||
AFTERCLEAN = (find . -type f -name "*.o" -delete && find . -type f -name "*.res" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
|
AFTERCLEAN = (find . -type f -name "*.o" -delete && find . -type f -name "*.res" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
|
||||||
|
|
||||||
ifndef OPENSSL_CHECK
|
ifndef OPENSSL_CHECK
|
||||||
OPENSSL_CHECK = $(shell echo "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d '\\\\' | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
ifeq ($(LIBSTATIC), true)
|
||||||
|
STATIC_PREFIX = -Wl,-Bstatic
|
||||||
|
STATIC_SUFFIX = -Wl,-Bdynamic
|
||||||
|
ZLIB = -lz
|
||||||
|
endif
|
||||||
|
WOLFSSL_CHECK = $(shell printf "\#include <wolfssl/options.h>\\n\#include <wolfssl/openssl/ssl.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) -o testwssl - 2>/dev/null && rm testwssl && echo true||echo false)
|
||||||
|
ifeq ($(WOLFSSL_CHECK), true)
|
||||||
|
LIBS += $(STATIC_PREFIX) -lwolfssl $(STATIC_SUFFIX) -lws2_32
|
||||||
|
CFLAGS += -DWITH_SSL -DWITH_WOLFSSL
|
||||||
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||||
|
ZLIB :=
|
||||||
|
else
|
||||||
|
OPENSSL_CHECK = $(shell printf "\#include <openssl/ssl.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX) -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
|
||||||
ifeq ($(OPENSSL_CHECK), true)
|
ifeq ($(OPENSSL_CHECK), true)
|
||||||
LIBS += -l crypto -l ssl
|
LIBS += $(STATIC_PREFIX) $(ZLIB) -l crypto -l ssl $(STATIC_SUFFIX) -lcrypt32
|
||||||
CFLAGS += -DWITH_SSL
|
CFLAGS += -DWITH_SSL
|
||||||
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
||||||
|
else
|
||||||
|
ZLIB :=
|
||||||
endif
|
endif
|
||||||
PAM_CHECK = $(shell echo "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d '\\\\' | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
endif
|
||||||
|
PAM_CHECK = $(shell printf "\#include <security/pam_appl.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
|
||||||
ifeq ($(PAM_CHECK), true)
|
ifeq ($(PAM_CHECK), true)
|
||||||
PLUGINS += PamAuth
|
PLUGINS += PamAuth
|
||||||
endif
|
endif
|
||||||
PCRE_CHECK = $(shell echo "\#define PCRE2_CODE_UNIT_WIDTH 8\\n#include <pcre2.h>\\n int main(){return 0;}" | tr -d '\\\\' | cc -x c $(CFLAGS) $(LDFLAGS) -lpcre2-8 -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
PCRE_CHECK = $(shell printf "\#define PCRE2_CODE_UNIT_WIDTH 8\\n#include <pcre2.h>\\n int main(){return 0;}" | tr -d '\\\\' | $(CC) -x c $(CFLAGS) $(LDFLAGS) $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX) -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
|
||||||
ifeq ($(PCRE_CHECK), true)
|
ifeq ($(PCRE_CHECK), true)
|
||||||
CFLAGS += -DWITH_PCRE
|
CFLAGS += -DWITH_PCRE
|
||||||
PCRE_OBJS = pcre$(OBJSUFFICS)
|
PCRE_OBJS = pcre$(OBJSUFFICS)
|
||||||
PCRE_LIBS = -lpcre2-8
|
PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,52 @@
|
|||||||
|
|
||||||
### Branches
|
### Branches
|
||||||
|
|
||||||
- **Master** (stable) branch - 3proxy 0.9
|
- **Master** (current/latest) branch - 3proxy 1.0
|
||||||
- **Devel** branch - 3proxy 10 (don't use it)
|
- **0.9** (LTS) branch - 3proxy 0.9.9.x
|
||||||
|
- **Devel** branch - 3proxy 2.0-devel (don't use it)
|
||||||
|
|
||||||
### Binaries (deb / rpm / Windows zip)
|
### Binaries (deb / rpm / Windows zip)
|
||||||
|
|
||||||
https://github.com/3proxy/3proxy/releases
|
https://github.com/3proxy/3proxy/releases
|
||||||
|
|
||||||
|
### Package repository (apt / dnf)
|
||||||
|
|
||||||
|
Signed apt and dnf repositories are published at https://3proxy.org/repo/ in
|
||||||
|
two channels: `current` (master) and `lts` (0.9 branch).
|
||||||
|
|
||||||
|
Debian 12 and Ubuntu 22.04 or newer:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo curl -fsSL https://3proxy.org/repo/3proxy-release-key.asc \
|
||||||
|
-o /usr/share/keyrings/3proxy.asc
|
||||||
|
sudo tee /etc/apt/sources.list.d/3proxy.sources <<EOF
|
||||||
|
Types: deb
|
||||||
|
URIs: https://3proxy.org/repo/deb
|
||||||
|
Suites: current
|
||||||
|
Components: main
|
||||||
|
Signed-By: /usr/share/keyrings/3proxy.asc
|
||||||
|
EOF
|
||||||
|
sudo apt update && sudo apt install 3proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
AlmaLinux, RHEL, Rocky and CentOS Stream 8, 9 and 10:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo tee /etc/yum.repos.d/3proxy.repo <<EOF
|
||||||
|
[3proxy]
|
||||||
|
name=3proxy
|
||||||
|
baseurl=https://3proxy.org/repo/rpm/current/el\$releasever/\$basearch/
|
||||||
|
enabled=1
|
||||||
|
gpgcheck=1
|
||||||
|
repo_gpgcheck=1
|
||||||
|
gpgkey=https://3proxy.org/repo/3proxy-release-key.asc
|
||||||
|
EOF
|
||||||
|
sudo dnf install 3proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
Both the packages and the repository metadata are signed. See
|
||||||
|
https://3proxy.org/repo/ for the `lts` channel and for release key details.
|
||||||
|
|
||||||
### Docker images
|
### Docker images
|
||||||
|
|
||||||
https://hub.docker.com/r/3proxy/3proxy
|
https://hub.docker.com/r/3proxy/3proxy
|
||||||
@@ -29,7 +68,9 @@ Documentation (man pages and HTML) available with download, on https://3proxy.or
|
|||||||
|
|
||||||
## Docker images
|
## Docker images
|
||||||
|
|
||||||
3 docker configurations are provided, default (full) also tagged as `:latest`, `:busybox` and `:minimal`, all refer to newest stable version. Except busybox, images are distroless and contain only binaries, you can not sh inside the container. `:busybox` contains busybox shell.
|
3 docker configurations are provided, default (full) also tagged as `:latest`, `:busybox` and `:minimal`, all refer to newest stable version. Except busybox, images are distroless and contain only binaries, you can not sh inside the container. `:busybox` contains busybox shell. Images are based on current (master) branch.
|
||||||
|
|
||||||
|
Images marked as LTS (`:lts`, `:lts-busybox`, `:lts-minimal`) are built from LTS branch (0.9.9.x)
|
||||||
|
|
||||||
### Default image (`:latest`):
|
### Default image (`:latest`):
|
||||||
|
|
||||||
|
|||||||
+94
@@ -0,0 +1,94 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 0.9.9.x (LTS) | :white_check_mark: |
|
||||||
|
| 1.0.x (Main) | :white_check_mark: |
|
||||||
|
| <= 0.9.8 | :x: |
|
||||||
|
|
||||||
|
## Hardening a deployment
|
||||||
|
|
||||||
|
Configuration is where most of the risk lives. The security recommendations are
|
||||||
|
kept in [doc/html/securityen.html](doc/html/securityen.html), published at
|
||||||
|
<https://3proxy.org/securityen.html>: how to run the service, what the
|
||||||
|
ACLs have to cover, and the settings whose defaults are safe only until
|
||||||
|
something else is enabled alongside them.
|
||||||
|
|
||||||
|
Read it before exposing a service. Recurring points from it:
|
||||||
|
|
||||||
|
- Run unprivileged, never suid, and chroot where the platform allows.
|
||||||
|
- Name the internal and external interfaces explicitly, and limit sources and
|
||||||
|
destinations with ACLs rather than relying on defaults.
|
||||||
|
- Enabling IPv6 makes ACLs written in IPv4 incomplete: the same host is
|
||||||
|
reachable through an IPv4-mapped address, and the IPv6 loopback is an
|
||||||
|
address of its own.
|
||||||
|
- Anything that terminates or intercepts TLS holds key material and sees full
|
||||||
|
request URLs; both the key and the logs need protecting.
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
Report to 3proxy@3proxy.org or via [GitHub security reporting](https://github.com/3proxy/3proxy/security)
|
||||||
|
|
||||||
|
For High/Critical patched version is released within 2 weeks
|
||||||
|
|
||||||
|
## Verifying downloads
|
||||||
|
|
||||||
|
Release binaries and the source tarball are published with SHA256 checksums, an
|
||||||
|
OpenPGP signature and a GitHub build provenance attestation.
|
||||||
|
|
||||||
|
The release signing key is `3proxy-release-key.asc` in the root of this
|
||||||
|
repository, an RSA-4096 key:
|
||||||
|
|
||||||
|
```
|
||||||
|
pub rsa4096 2026-08-21 [SC]
|
||||||
|
FC12 2144 99FC C7BA 1CFF 6CDC 0312 384E 3A73 940B
|
||||||
|
uid 3proxy release signing <3proxy@3proxy.org>
|
||||||
|
```
|
||||||
|
|
||||||
|
Import it once:
|
||||||
|
|
||||||
|
```
|
||||||
|
gpg --import 3proxy-release-key.asc
|
||||||
|
```
|
||||||
|
|
||||||
|
Checksums and the checksum file signature:
|
||||||
|
|
||||||
|
```
|
||||||
|
gpg --verify SHA256SUMS-x86_64.asc SHA256SUMS-x86_64
|
||||||
|
sha256sum -c SHA256SUMS-x86_64
|
||||||
|
```
|
||||||
|
|
||||||
|
The source tarball published with each release is signed as well:
|
||||||
|
|
||||||
|
```
|
||||||
|
gpg --verify SHA256SUMS-src.asc SHA256SUMS-src
|
||||||
|
sha256sum -c SHA256SUMS-src
|
||||||
|
gpg --verify 3proxy-0.9.9.tar.gz.asc 3proxy-0.9.9.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
Prefer it over the `Source code (tar.gz)` link GitHub generates automatically:
|
||||||
|
only the published tarball is signed. It is produced with `git archive` from
|
||||||
|
the release tag, so it can be regenerated and compared byte for byte.
|
||||||
|
|
||||||
|
RPM packages are signed, the signature is checked by rpm itself:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo rpm --import 3proxy-release-key.asc
|
||||||
|
rpm -K 3proxy-0.9.9.x86_64.rpm
|
||||||
|
```
|
||||||
|
|
||||||
|
DEB packages are published with a detached signature:
|
||||||
|
|
||||||
|
```
|
||||||
|
gpg --verify 3proxy-0.9.9.x86_64.deb.asc 3proxy-0.9.9.x86_64.deb
|
||||||
|
```
|
||||||
|
|
||||||
|
Build provenance (which workflow, commit and runner produced the file) is
|
||||||
|
verified with the GitHub CLI:
|
||||||
|
|
||||||
|
```
|
||||||
|
gh attestation verify 3proxy-0.9.9.x86_64.rpm --owner 3proxy
|
||||||
|
gh attestation verify oci://docker.io/3proxy/3proxy:latest --owner 3proxy
|
||||||
|
```
|
||||||
Vendored
+30
@@ -1,3 +1,33 @@
|
|||||||
|
3proxy (1.0.2-1) buster; urgency=medium
|
||||||
|
|
||||||
|
*3proxy 1.0.2 initial build
|
||||||
|
|
||||||
|
-- z3APA3A <3apa3a@3proxy.org> Sat, 24 Oct 2026 11:21:40 +0000
|
||||||
|
|
||||||
|
3proxy (1.0.1-1) buster; urgency=medium
|
||||||
|
|
||||||
|
*3proxy 1.0.1 initial build
|
||||||
|
|
||||||
|
-- z3APA3A <3apa3a@3proxy.org> Sat, 10 Oct 2026 16:21:01 +0000
|
||||||
|
|
||||||
|
3proxy (1.0.0-1) buster; urgency=medium
|
||||||
|
|
||||||
|
*3proxy 1.0.0 initial build
|
||||||
|
|
||||||
|
-- z3APA3A <3apa3a@3proxy.org> Sat, 22 Aug 2026 12:13:00 +0000
|
||||||
|
|
||||||
|
3proxy (0.9.9-1) buster; urgency=medium
|
||||||
|
|
||||||
|
*3proxy 0.9.9 initial build
|
||||||
|
|
||||||
|
-- z3APA3A <3apa3a@3proxy.org> Thu, 20 Aug 2026 18:29:37 +0300
|
||||||
|
|
||||||
|
3proxy (0.9.8-1) buster; urgency=medium
|
||||||
|
|
||||||
|
*3proxy 0.9.8 initial build
|
||||||
|
|
||||||
|
-- z3APA3A <3apa3a@3proxy.org> Fri, 07 Aug 2026 17:44:30 +0300
|
||||||
|
|
||||||
3proxy (0.9.7-1) buster; urgency=medium
|
3proxy (0.9.7-1) buster; urgency=medium
|
||||||
|
|
||||||
*3proxy 0.9.7 initial build
|
*3proxy 0.9.7 initial build
|
||||||
|
|||||||
Vendored
+1
-1
@@ -14,5 +14,5 @@ Depends: ${shlibs:Depends}, ${misc:Depends}
|
|||||||
Description: tiny free proxy server
|
Description: tiny free proxy server
|
||||||
3Proxy tiny free proxy server is really tiny freeware proxy servers set.
|
3Proxy tiny free proxy server is really tiny freeware proxy servers set.
|
||||||
It includes HTTP proxy with HTTPS and FTP support, SOCKSv4/SOCKSv4.5/SOCKSv5 proxy (socks/socks.exe), POP3 proxy, SMTP proxy, FTP proxy, caching DNS proxy, TCP and UDP portmappers.
|
It includes HTTP proxy with HTTPS and FTP support, SOCKSv4/SOCKSv4.5/SOCKSv5 proxy (socks/socks.exe), POP3 proxy, SMTP proxy, FTP proxy, caching DNS proxy, TCP and UDP portmappers.
|
||||||
You can use every proxy as a standalone program (socks, proxy, tcppm, udppm, pop3p) or use combined program (3proxy). Combined proxy additionally supports features like access control, bandwidth limiting, limiting daily/weekly/monthly traffic amount, proxy chaining, log rotation, syslog and ODBC logging, etc.
|
You can use every proxy as a standalone program (socks, proxy, tcppm, udppm, tlspr) or use combined program (3proxy). Combined proxy additionally supports features like access control, bandwidth limiting, limiting daily/weekly/monthly traffic amount, proxy chaining, log rotation, syslog and ODBC logging, etc.
|
||||||
It's created to be small, simple and yet very functional.
|
It's created to be small, simple and yet very functional.
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
!! Fix: use-after-free on the ftp:// request path in HTTP proxy, a request buffer reallocation left a stale pointer; heap corruption, requires authenticated access
|
||||||
|
!! Fix: buffer overflow in radsend() with an oversized request hostname; RADIUS is experimental, log radius or auth radius with fakeresolve is required to reach it
|
||||||
|
!! Fix: buffer overflow in smtpp when relaying AUTH LOGIN credentials to a server which offers AUTH PLAIN only; requires authorised access to smtpp
|
||||||
|
!! Fix: out-of-bounds read in tlspr on a malformed TLS ClientHello
|
||||||
|
!! Fix: LDAP injection and unsafe counter file names in LdapPlugin; the plugin is unsupported and is not built with 3proxy
|
||||||
|
!! Fix: password and hash comparison in strong authentication is constant-time now
|
||||||
|
!! Fix: bounds validation and match/depth limits in pcre filters
|
||||||
|
+ imapp: IMAPv4 proxy added, supports LOGIN command, AUTH PLAIN and AUTH LOGIN
|
||||||
|
+ STARTTLS support for smtpp, pop3p, imapp and tlspr, on both client and server side; -x option to disable
|
||||||
|
+ wolfSSL is supported as an alternative TLS backend, WOLFSSL_CHECK=true selects it (wolfSSL must be built with --enable-opensslextra)
|
||||||
|
+ Chunked Transfer-Encoding from client is supported by HTTP proxy
|
||||||
|
+ dnspr: -F option added, fake resolve to redirect traffic
|
||||||
|
+ ucrt64 build support; static libraries support in Makefile.win
|
||||||
|
+ minimal and busybox Docker images switched to musl + wolfSSL
|
||||||
|
- splice() support is not built by default anymore, it is slower than the read/write path for most traffic; add -DWITHSPLICE to build it
|
||||||
|
! Fix: hashtable item was added with wrong index on table grow; with large username/password tables it could cause a single record to be missing
|
||||||
|
! Fix: race conditions; stack overflow on FreeBSD
|
||||||
|
! Fix: generated certificates are X.509 v3 with basicConstraints CA:FALSE and extendedKeyUsage serverAuth, required by Apple TLS stack and by Chrome on macOS/iOS
|
||||||
|
! Fix: dnspr was broken since udppm rewrite
|
||||||
|
! Fix: short cleartext passwords failed authentication
|
||||||
|
! Fix: parent negotiation after sending PROXY protocol header
|
||||||
|
! Fix: maxchild dropped to 100 on config reload if not set explicitly
|
||||||
|
! Fix: getrandom() is not used with glibc below 2.25
|
||||||
|
! Fix: IPV6_BOUND_IF definition for legacy MacOS
|
||||||
|
! Fix: cmake build, arm64 Docker build, Makefile.win with UCRT
|
||||||
|
! Multiple minor bugfixes and code cleanup
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
! Fix: DNS replies are validated now: a reply from an address other than the nameserver the query was sent to, and a reply with a question section not matching the query, are dropped; both were accepted before
|
||||||
|
! Fix: socket leak with SOCKSv5 UDP ASSOCIATE through a parent proxy, sockets were accumulated in CLOSE_WAIT state until descriptors ran out
|
||||||
|
! Fix: file descriptor leak in HTTP proxy on the ftp:// request path
|
||||||
|
! Fix: crash with illegal instruction on some platforms (e.g. some musl based Linux builds), caused by a memcpy on overlapping buffers
|
||||||
|
! Fix: extip and ha (HAProxy PROXY protocol) parents are applied to SOCKSv5 UDP ASSOCIATE now
|
||||||
|
! Fix: only socks5 and socks5+ parents are tried for UDP ASSOCIATE, other parent types can not be used for UDP
|
||||||
|
! Fix: udppm through a SOCKSv5 parent did not work
|
||||||
|
! Fix: -Ne and -Ni options were never applied, the option letter was not parsed; -Ne is not applied to the UDP ASSOCIATE reply anymore, -Ni is applied to it
|
||||||
|
! Fix: -4 / -6 handling for UDP in socks; a single UDP association can use both IPv4 and IPv6 destinations now
|
||||||
|
! Fix: a datagram with a null destination address is dropped now
|
||||||
|
! Fix: DNS over TCP: a reply which did not fit a single read was never processed
|
||||||
|
! Documentation: "How to apply ACLs to UDP traffic" added to HOWTO; authentication cache, ACL and UDP notes added to "Optimizing 3proxy for High Load" and to security recommendations
|
||||||
|
+ SOCKSv5 UDP: the destination of every datagram is authorized, so ACLs limiting the destination address, host name or port apply to UDP traffic now; the parent proxy and the external address are selected for the destination of the datagram and not for the UDP ASSOCIATE request
|
||||||
|
+ socks: -U option to control what happens when the destination changes within an UDP association: log it, authorize it, both (default) or neither
|
||||||
|
+ -C option (for TCP services) to terminate the session as soon as any of the sides closes the connection; by default the session is kept until both sides close it (TCP half-close)
|
||||||
|
+ timeouts: LINGER value added (11th, default 5), used to deliver buffered data after one of the sides has closed its sending side and as SO_LINGER value on outgoing connections
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
No changes in 3proxy code, this release only changes how packages are built, signed and published.
|
||||||
|
|
||||||
|
! Fix: TLS, PCRE2 and PAM support was silently left out when 3proxy was built on a system whose /bin/sh is not dash, which is every RPM based distribution and macOS; the library checks built their test program with echo and escape sequences, which only dash expands, so every check failed and the features were dropped without a diagnostic
|
||||||
|
! Fix: rpm packages were built on Ubuntu and required glibc 2.38, libssl.so.3 and libpcre2-8, which no RPM based distribution provides, so they could not be installed anywhere; they are built against AlmaLinux 8, 9 and 10 now and carry an el8, el9 or el10 tag, covering RHEL, AlmaLinux, Rocky and CentOS Stream of the same version
|
||||||
|
! Fix: the rpm package depended on its own interpreter, /bin/3proxy, taken from the first line of the installed configuration file, and could not be installed on el9 or el10 because rpm resolves that dependency to /usr/bin/3proxy
|
||||||
|
! Fix: deb packages required glibc 2.38 and libssl3t64 and installed on Ubuntu 24.04 and newer only; they are built against Ubuntu 22.04 now and install on Ubuntu 22.04 and later as well as Debian 12 and later
|
||||||
|
+ Signed apt and dnf repositories are published at https://3proxy.org/repo/ in two channels: current, built from the master branch, and lts, built from the 0.9 branch; packages and repository metadata are both signed
|
||||||
|
+ Release binaries are published with SHA256 checksums, an OpenPGP signature and a GitHub build provenance attestation; docker images are signed and attested as well
|
||||||
|
+ The release signing key is an RSA-4096 key published as 3proxy-release-key.asc in the repository; rpm 4.14 and earlier can not import an Ed25519 key at all, which would leave RHEL 8 and its derivatives unable to verify anything
|
||||||
|
+ Packages are reproducible: rebuilding a release produces byte identical deb and rpm files, every timestamp is derived from the build date recorded for the release
|
||||||
|
- 32-bit ARM (armhf) is published as a deb package only, Enterprise Linux has no 32-bit ARM build
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
! Fix: crash (segmentation fault) on configuration reload (SIGUSR1) on a busy server: a closing session could still use its service after the reload had freed it; the race existed since 0.9.7, the 5 second linger added in 0.9.9 made it much more likely (#1278)
|
||||||
|
! Fix: -Di and -De (bind to interface) were not applied to SOCKSv5 UDP ASSOCIATE and BIND sockets, the FTP proxy data connection and connect back (#1277)
|
||||||
|
! Fix: SOCKSv5 UDP ASSOCIATE over IPv6: the source address of a datagram was truncated and the reply was sent to the wrong address (#1279)
|
||||||
|
! Fix: SOCKSv5 UDP ASSOCIATE: an access rule with host names matched any datagram sent to a literal address; the address is used as the host name now, as it is for TCP requests
|
||||||
|
! Fix: a request rewritten with pcre_rewrite was only logged and was sent unchanged to the server on a direct connection; the rewritten path and query are what the server receives now
|
||||||
|
! Fix: buffer could be insufficient for the headers the HTTP proxy adds after a pcre_rewrite had grown the request
|
||||||
|
! Fix: heap buffer overflow in pcre_rewrite: a $N reference to a group which did not match was written out as its digits, which the space allocated for the result did not count
|
||||||
|
! Fix: pcre_extend did nothing, the rules it appended were never consulted; the manual described an argument the command does not take
|
||||||
|
! Fix: certificates generated for TLS MitM (openssl) carried no subject and authority key identifiers and were refused by strict verifiers, including macOS clients, OpenSSL with x509_strict and Python 3.13
|
||||||
|
! Fix: null pointer dereference in ftppr on PASS without USER and in smtpp on a user name without a host
|
||||||
|
! Fix: no service started with wolfSSL on glibc: the default thread stack was too small for wolfSSL thread-local storage, pthread_create() failed and the failure was not reported
|
||||||
|
! Fix: dnspr did not work on Windows; Windows builds answer UDP from a socket of their own again
|
||||||
|
+ Built-in HTTP server: httpsrv service with http rules to serve files (cached or with sendfile / TransmitFile), redirects, rewrites, fixed replies and proxypass to forward requests as the proxy does, so one port can serve both a site and a proxy; admin is httpsrv with the administration pages
|
||||||
|
+ Host names in access rules may be regular expressions with a pcre: (or regex:) prefix
|
||||||
|
+ transparent / notransparent commands: transparent proxying is built in (netfilter on Linux, pf on BSD, socket for divert-to and ipfw fwd), TransparentPlugin is removed and a configuration loading it keeps working
|
||||||
|
+ parent: weight may be written as a fraction (.5) or a percentage (50%); weight 0 is a fallback parent used only when every weighted parent of its group has failed; a failed parent is left out of the next attempt of the same connection
|
||||||
|
+ parent extport / intport: range of local ports for outgoing connections and for sockets facing the client (UDP ASSOCIATE, FTP data)
|
||||||
|
+ A parent given by host name is resolved for each connection when nserver is used, instead of once on configuration load
|
||||||
|
+ $$ in the configuration stands for a single dollar sign, a dollar inside quotes is ordinary text
|
||||||
|
+ OpenWrt package (procd init script, UCI configuration) and OpenWrt builds for mipsel_24kc, mips_24kc, arm_cortex-a7_neon-vfpv4 and aarch64_cortex-a53
|
||||||
|
- pop3p, imapp, smtpp and ftppr are not in a default build: build with MAILPROXY=true and FTP=true (CMake: 3PROXY_USE_MAILPROXY, 3PROXY_USE_FTP); without them the mail proxies run as tlspr negotiating STARTTLS, and ftppr refuses clients
|
||||||
|
- FTP over HTTP proxy (ftp:// URLs) is not in a default build either and has to be enabled explicitly: build with FTP=true (CMake: 3PROXY_USE_FTP), without it the HTTP proxy does not fetch ftp:// URLs
|
||||||
|
- Windows binaries are no longer signed with a self-signed Authenticode certificate, it gave no trust and triggered antivirus false positives
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
! Fix: dnspr relayed to the client whatever came first to the socket it asked the name server from, from any address and under any id, so a forged answer could be passed on; the query now goes out under a random id, and only an answer from the name server asked, with that id and the same question, is relayed
|
||||||
|
! Fix: a client sending a part of a TLS record and then nothing kept a thread taking all of a CPU, and the read never timed out
|
||||||
|
! Fix: without -Ne, the reply to SOCKS CONNECT and BIND gave the address of the client's connection to the proxy instead of the socket towards the destination: a BIND client was told the proxy's own port and the peer could never reach it (since 0.9.6)
|
||||||
|
! Fix: a client which shut down its sending side (half-close) could get the answer cut short, megabytes short with large answers; likewise an upload after the server half-closed
|
||||||
|
! Fix: with chroot every local time was UTC and every syslog message was lost: the time zone is loaded and syslog connected before chroot; the chroot entry of 3proxy.cfg(5) lists what PAM, LDAP and ODBC still need inside the chroot
|
||||||
|
! Fix: the HTTP proxy closed the server connection of a kept-alive client and opened another one when only the request method changed (a POST after a GET to the same host)
|
||||||
|
! Fix: the last ssl_client_mode in the configuration applied to every service, and a reload changed it for the services still running
|
||||||
|
! Fix: memory leaks: on every refused configuration reload, on every failed TLS handshake, the server CA paths of every TLS service, compiled pcre: / regex: host names of access rules and patterns of httpsrv rules
|
||||||
|
! Fix: Unix sockets: on Linux a proxy listening on a Unix socket relayed only the first bytes of an answer (result 95); an abstract socket (unix:@NAME) was bound under a name padded with zeros, which clients did not reach; tcppm refused port 0 for a unix: target, as given in the manual's example; on a reload the socket file of a listening service was removed
|
||||||
|
! Fix: SIGPIPE could kill 3proxy when a client was gone while services were starting, and standalone services (proxy, socks, ...) at any time; sends use MSG_NOSIGNAL where the system has it
|
||||||
|
! Fix: TLS MitM failed for every connection with wolfSSL built with WOLFSSL_QT (wolfSSL 5.9.1 of Ubuntu 26.04): the source certificate's serial number could not be copied; a serial number made from the hash of the source certificate is used then
|
||||||
|
! Fix: Windows: closing a connection could leave its socket open (SO_LINGER on a non-blocking socket) or reset it while the peer still sent, so the end of an answer could be lost
|
||||||
|
! Fix: httpsrv: the body of a request answered without being read (for example when authentication is required) was read as the next request; a client still sending when a connection without keep-alive closed could get a reset instead of the answer
|
||||||
|
! Fix: httpsrv on Windows: UNC paths (\\server\share) did not work
|
||||||
|
! Fix: httpsrv and admin services and their clients were named ZOMBIE on the admin services page, in %N of logs and in RADIUS
|
||||||
|
! Fix: the Watcom (lite) build did not compile, 1.0.1 had no binaries for it
|
||||||
|
+ -s (splice) per direction: -s1 splices what the server sends (downloads), -s2 what the client sends (uploads), -s3 both; -s alone splices only where it pays (large bodies, long streams); pipes are kept with the connection for its next requests. splice() is built by default on Linux again and is used only by services given -s
|
||||||
|
+ Socket options (-oc, -os, -ol, -or, -oR) take NAME=VALUE; NAME=0 turns an option off, also one set by default; an unknown name or a value which is not a number is an error
|
||||||
|
+ The HTTP proxy frees its 64 KB request buffer while a CONNECT tunnel relays data and while a kept-alive connection waits for its next request: 2000 tunnels take 213 MB instead of 339 MB
|
||||||
|
+ TLS records are read ahead with OpenSSL 1.1.0 and later: decrypting takes 9-14% less CPU
|
||||||
|
+ Faster service stop and configuration reload, no fixed delays; a connection waiting for a free maxconn slot gets it at once
|
||||||
|
- TCP_NODELAY is set by default on proxy-to-client and proxy-to-server sockets; -ocTCP_NODELAY=0 / -osTCP_NODELAY=0 turns it off
|
||||||
|
- The HTTP proxy fetches ftp:// URLs only when the service is given the new -Xftp option (in a build with FTP=true)
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
|
|
||||||
<H2><A href="howtoe.html">See HowTo:</a></H2>
|
<H2><A href="howtoe.html">See HowTo:</a></h2>
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
|
|
||||||
<H2><A href="howtoe.html">См. HowTo</a></H2>
|
<H2><A href="howtoe.html">См. HowTo</a></h2>
|
||||||
+455
-60
@@ -5,8 +5,8 @@
|
|||||||
<h4>Configuring 'maxconn'</h4>
|
<h4>Configuring 'maxconn'</h4>
|
||||||
|
|
||||||
The number of simultaneous connections per service is limited by the 'maxconn' option.
|
The number of simultaneous connections per service is limited by the 'maxconn' option.
|
||||||
The default maxconn value since 3proxy 0.8 is 500. You may want to set 'maxconn'
|
The default maxconn value is 500. You may want to set 'maxconn'
|
||||||
to a higher value. Under this configuration:
|
to a higher value; it must be set before the services it should apply to. Under this configuration:
|
||||||
<pre>
|
<pre>
|
||||||
maxconn 1000
|
maxconn 1000
|
||||||
proxy -p3129
|
proxy -p3129
|
||||||
@@ -19,6 +19,10 @@ simultaneous connections to 3proxy.
|
|||||||
<p>Avoid setting 'maxconn' to an arbitrarily high value; it should be carefully
|
<p>Avoid setting 'maxconn' to an arbitrarily high value; it should be carefully
|
||||||
chosen to protect the system and proxy from resource exhaustion. Setting maxconn
|
chosen to protect the system and proxy from resource exhaustion. Setting maxconn
|
||||||
above available resources can lead to denial of service conditions.
|
above available resources can lead to denial of service conditions.
|
||||||
|
<p>'maxconn' is not reduced automatically to fit the open file limit. If the limit is
|
||||||
|
too low 3proxy only prints a warning at startup
|
||||||
|
("current open file ulimits are too low") and then fails to accept connections once
|
||||||
|
the limit is reached, so check for this warning after changing 'maxconn'.
|
||||||
<h4>Understanding Resource Requirements</h4>
|
<h4>Understanding Resource Requirements</h4>
|
||||||
Each running service requires:
|
Each running service requires:
|
||||||
<ul>
|
<ul>
|
||||||
@@ -30,10 +34,8 @@ Each connected client requires:
|
|||||||
<ul>
|
<ul>
|
||||||
<li>1 thread (process)
|
<li>1 thread (process)
|
||||||
<li>2 sockets (file descriptors). For FTP, 4 sockets are required.
|
<li>2 sockets (file descriptors). For FTP, 4 sockets are required.
|
||||||
<br>Under Linux since 0.9, splice() is used. It's much more efficient but requires
|
<br>With splice() (Linux, -s), a pipe (2 file descriptors) for each spliced direction: up to 4 more file descriptors, 6 for FTP.
|
||||||
<br>2 sockets (file descriptors) + 2 pipes (file descriptors) = 4 file descriptors.
|
<br>Up to 128K (up to 256K with splice()) of kernel buffer memory. This is the theoretical maximum; actual numbers depend on connection quality and traffic amount.
|
||||||
<br>For FTP with splice(), 4 sockets and 2 pipes are required.
|
|
||||||
<br>Up to 128K (up to 256K in the case of splice()) of kernel buffer memory. This is the theoretical maximum; actual numbers depend on connection quality and traffic amount.
|
|
||||||
<br>1 additional socket (file descriptor) during name resolution for non-cached names
|
<br>1 additional socket (file descriptor) during name resolution for non-cached names
|
||||||
<br>1 additional socket during authentication or logging for RADIUS authentication or logging.
|
<br>1 additional socket during authentication or logging for RADIUS authentication or logging.
|
||||||
<li>1 ephemeral port (3 ephemeral ports for FTP connections).
|
<li>1 ephemeral port (3 ephemeral ports for FTP connections).
|
||||||
@@ -59,19 +61,45 @@ system "ulimit -Sa >>/tmp/3proxy.ulim.soft"
|
|||||||
at the beginning (before the first service is started) and at the end of the config file.
|
at the beginning (before the first service is started) and at the end of the config file.
|
||||||
Perform both a hard restart (i.e., kill and start the 3proxy process) and a soft restart
|
Perform both a hard restart (i.e., kill and start the 3proxy process) and a soft restart
|
||||||
by sending SIGUSR1 to the 3proxy process; check that the ulimits recorded to files match your
|
by sending SIGUSR1 to the 3proxy process; check that the ulimits recorded to files match your
|
||||||
expectations. In systemd-based distros (e.g., latest Debian/Ubuntu), changing limits.conf
|
expectations. In systemd-based distros (e.g., latest Debian/Ubuntu) changing limits.conf is not
|
||||||
is not enough; limits must be adjusted in the systemd configuration, e.g., by setting:
|
enough for a service: limits must be set in the unit file. Set them in the 3proxy
|
||||||
|
unit itself rather than globally, so the rest of the system is unaffected. The
|
||||||
|
shipped 3proxy.service already contains:
|
||||||
<pre>
|
<pre>
|
||||||
DefaultLimitDATA=infinity
|
LimitNOFILE=1048576
|
||||||
DefaultLimitSTACK=infinity
|
LimitNPROC=infinity
|
||||||
DefaultLimitCORE=infinity
|
TasksMax=infinity
|
||||||
DefaultLimitRSS=infinity
|
</pre>
|
||||||
DefaultLimitNOFILE=102400
|
To change them on an installed system use an override instead of editing the unit:
|
||||||
DefaultLimitAS=infinity
|
<pre>
|
||||||
DefaultLimitNPROC=10240
|
systemctl edit 3proxy
|
||||||
DefaultLimitMEMLOCK=infinity
|
systemctl daemon-reload && systemctl restart 3proxy
|
||||||
|
systemctl show 3proxy -p LimitNOFILE -p LimitNPROC -p TasksMax
|
||||||
|
</pre>
|
||||||
|
<b>TasksMax is the one that is easy to miss.</b> It is the cgroup limit on the number
|
||||||
|
of threads, and if it is not set the unit inherits DefaultTasksMax, which is 15% of
|
||||||
|
kernel.threads-max (about 9000 on a typical host). Since 3proxy uses one thread per
|
||||||
|
connection, that caps concurrent connections at that number regardless of LimitNPROC
|
||||||
|
and maxconn, and the only symptom is "pthread_create()" errors in the log.
|
||||||
|
<p>On systemd older than 227, which has no TasksMax, and for limits that must apply to
|
||||||
|
several services, the same values can be set globally as DefaultLimitNOFILE /
|
||||||
|
DefaultLimitNPROC in /etc/systemd/system.conf, but prefer the per-unit settings.
|
||||||
|
|
||||||
|
<p>With SysV init the limits are not applied by limits.conf either, because
|
||||||
|
start-stop-daemon does not open a PAM session, so the daemon simply inherits the limits
|
||||||
|
of init. The shipped init script raises them itself before starting 3proxy:
|
||||||
|
<pre>
|
||||||
|
ulimit -n 65536
|
||||||
|
ulimit -u 32768
|
||||||
|
</pre>
|
||||||
|
adjust these values in the script to match 'maxconn'.
|
||||||
|
|
||||||
|
<p>On FreeBSD rc.subr applies limits(1) with the login class of the service (the
|
||||||
|
"daemon" class by default), so the limits can be set either in /etc/login.conf for that
|
||||||
|
class, or per service in rc.conf:
|
||||||
|
<pre>
|
||||||
|
3proxy_limits="-n 65536"
|
||||||
</pre>
|
</pre>
|
||||||
in user.conf / system.conf
|
|
||||||
|
|
||||||
<h4>Extending System Limitations</h4>
|
<h4>Extending System Limitations</h4>
|
||||||
|
|
||||||
@@ -86,19 +114,174 @@ proxy -olSO_REUSEADDR,SO_REUSEPORT -ocTCP_TIMESTAMPS,TCP_NODELAY -osTCP_NODELAY
|
|||||||
</pre>
|
</pre>
|
||||||
Available options are system-dependent.
|
Available options are system-dependent.
|
||||||
|
|
||||||
|
<h4>Linux Tuning Hints</h4>
|
||||||
|
|
||||||
|
Values below are examples, not recommendations: check the current value first
|
||||||
|
(<tt>sysctl NAME</tt>), change only what your workload actually hits, and make changes
|
||||||
|
persistent in <tt>/etc/sysctl.d/</tt>. Defaults given in parentheses are from a recent
|
||||||
|
(6.x) kernel and vary between distributions and versions.
|
||||||
|
|
||||||
|
<p><b>File descriptors.</b> 3proxy needs 2 descriptors per connection (4 for FTP), plus
|
||||||
|
one per service, plus temporary ones for name resolution and RADIUS.
|
||||||
|
<pre>
|
||||||
|
fs.nr_open = 1048576 # (1048576) upper bound for any process' RLIMIT_NOFILE
|
||||||
|
</pre>
|
||||||
|
<tt>ulimit -n</tt> (RLIMIT_NOFILE) is the limit that actually applies and is commonly
|
||||||
|
left at 1024; it must be raised for the 3proxy process itself, see "Setting ulimits"
|
||||||
|
above. <tt>fs.file-max</tt> is effectively unlimited on 64-bit kernels and rarely needs
|
||||||
|
changing.
|
||||||
|
|
||||||
|
<p><b>Threads.</b> Because of the "one connection - one thread" model these limits are
|
||||||
|
reached earlier with 3proxy than with event-driven servers. Each thread also consumes
|
||||||
|
one or two mappings, so <tt>vm.max_map_count</tt> matters too.
|
||||||
|
<pre>
|
||||||
|
kernel.threads-max = 200000 # (~60000 on a 16G host, scales with RAM)
|
||||||
|
kernel.pid_max = 4194304 # (4194304)
|
||||||
|
vm.max_map_count = 1048576 # (1048576)
|
||||||
|
</pre>
|
||||||
|
RLIMIT_NPROC (<tt>ulimit -u</tt>) limits threads per user and must be raised as well.
|
||||||
|
Check the actual thread count with <tt>grep Threads /proc/PID/status</tt>.
|
||||||
|
|
||||||
|
<p><b>Listen queue.</b> 3proxy uses a listen backlog of 1+(maxconn/8) unless the
|
||||||
|
'backlog' command is given, so a large 'maxconn' does not automatically give a large
|
||||||
|
queue, and the kernel caps it at somaxconn:
|
||||||
|
<pre>
|
||||||
|
net.core.somaxconn = 4096 # (4096)
|
||||||
|
net.ipv4.tcp_max_syn_backlog = 4096 # (512) raise for bursty connection rates
|
||||||
|
net.ipv4.tcp_syncookies = 1 # (1) keep enabled
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p><b>Ephemeral ports and TIME_WAIT.</b> See "Extending the Ephemeral Port Range" above
|
||||||
|
for the multi-IP case. The range gives about 28000 outgoing connections per
|
||||||
|
destination address by default:
|
||||||
|
<pre>
|
||||||
|
net.ipv4.ip_local_port_range = 10240 65535 # (32768 60999)
|
||||||
|
net.ipv4.tcp_tw_reuse = 2 # (2) reuse TIME_WAIT for outgoing connections
|
||||||
|
net.ipv4.tcp_fin_timeout = 30 # (60)
|
||||||
|
</pre>
|
||||||
|
Do not enable tcp_tw_recycle; it was removed in kernel 4.12 and breaks NAT clients.
|
||||||
|
|
||||||
|
<p><b>Socket buffers.</b> Autotuning is usually right. Buffer memory is per connection,
|
||||||
|
so raising the maximums with tens of thousands of connections costs a lot of RAM:
|
||||||
|
<pre>
|
||||||
|
net.core.rmem_max = 4194304 # (212992)
|
||||||
|
net.core.wmem_max = 4194304 # (212992)
|
||||||
|
net.ipv4.tcp_rmem = 4096 131072 6291456 # (same) min default max
|
||||||
|
net.ipv4.tcp_wmem = 4096 16384 4194304 # (same)
|
||||||
|
</pre>
|
||||||
|
Raise these only for high bandwidth-delay product links, and prefer raising the third
|
||||||
|
(max) value and leaving the default alone.
|
||||||
|
|
||||||
|
<p><b>Conntrack.</b> Only relevant if netfilter/nftables tracks the proxy's traffic. If
|
||||||
|
it does, the table is exhausted long before 3proxy's own limits, with
|
||||||
|
"nf_conntrack: table full, dropping packet" in dmesg:
|
||||||
|
<pre>
|
||||||
|
net.netfilter.nf_conntrack_max = 1048576
|
||||||
|
net.netfilter.nf_conntrack_buckets = 262144
|
||||||
|
net.netfilter.nf_conntrack_tcp_timeout_established = 3600 # (432000, i.e. 5 days)
|
||||||
|
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 30 # (120)
|
||||||
|
</pre>
|
||||||
|
nf_conntrack_max defaults to nf_conntrack_buckets, which itself is derived from the
|
||||||
|
amount of RAM, so it is often much lower than expected on small machines. Each
|
||||||
|
connection takes two entries (one per direction). The default established timeout of
|
||||||
|
5 days matters more than the table size with high connection churn: entries for
|
||||||
|
connections that are long gone keep occupying the table.
|
||||||
|
<p>If no rules need conntrack, not loading it at all is faster: the modules are loaded
|
||||||
|
on demand by the first rule that needs them ("-m state", "-m conntrack", any NAT
|
||||||
|
rule), so a ruleset without such rules keeps the proxy traffic untracked. If conntrack
|
||||||
|
is needed for other traffic but not for the proxy's, exempt the proxy's traffic
|
||||||
|
explicitly in the raw table:
|
||||||
|
<pre>
|
||||||
|
iptables -t raw -A PREROUTING -p tcp --dport 3128 -j CT --notrack
|
||||||
|
iptables -t raw -A OUTPUT -p tcp -m owner --uid-owner proxy -j CT --notrack
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p><b>Conntrack helpers (ALGs).</b> The helper modules - nf_conntrack_ftp,
|
||||||
|
nf_conntrack_sip, nf_conntrack_h323, nf_conntrack_pptp, nf_conntrack_irc,
|
||||||
|
nf_conntrack_tftp - inspect the payload of every matching packet and create additional
|
||||||
|
"expectation" entries, so they cost both CPU and table space, and they have a long
|
||||||
|
history of security issues. Unload and blacklist the ones you do not actually need:
|
||||||
|
<pre>
|
||||||
|
lsmod | grep nf_conntrack
|
||||||
|
modprobe -r nf_conntrack_sip nf_conntrack_h323 nf_conntrack_ftp nf_conntrack_pptp
|
||||||
|
echo "blacklist nf_conntrack_sip" >> /etc/modprobe.d/no-alg.conf
|
||||||
|
</pre>
|
||||||
|
On current kernels a helper only acts when it is attached explicitly
|
||||||
|
("-j CT --helper ftp"), so simply not attaching it is enough; automatic helper
|
||||||
|
assignment was deprecated and later removed. Older kernels, and most router firmware,
|
||||||
|
still enable them by default.
|
||||||
|
|
||||||
|
<p><b>Checking the result.</b> <tt>ss -s</tt> for socket state totals,
|
||||||
|
<tt>ss -lnt</tt> for listen queue overflow, <tt>nstat -az TcpExtListenOverflows
|
||||||
|
TcpExtListenDrops</tt> for accept queue drops, and
|
||||||
|
<tt>cat /proc/PID/limits</tt> for the limits actually applied to the running process.
|
||||||
|
|
||||||
|
<h4>Windows Tuning Hints</h4>
|
||||||
|
|
||||||
|
<p><b>Dynamic (ephemeral) port range.</b> Since Windows Vista / Server 2008 the default
|
||||||
|
range is 49152-65535, i.e. only 16384 outgoing connections per local address, which is
|
||||||
|
reached quickly by a busy proxy. Show and change it with:
|
||||||
|
<pre>
|
||||||
|
netsh int ipv4 show dynamicport tcp
|
||||||
|
netsh int ipv4 set dynamicport tcp start=10000 num=55535
|
||||||
|
</pre>
|
||||||
|
The minimum start port is 1025, the minimum size of the range is 255, and the end of
|
||||||
|
the range cannot exceed 65535. The range is set separately for TCP and UDP, and for
|
||||||
|
IPv4 and IPv6. On pre-Vista systems the equivalent is the MaxUserPort registry value
|
||||||
|
in HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters.
|
||||||
|
|
||||||
|
<p><b>Listening socket.</b> 3proxy sets SO_REUSEADDR on the listening socket by
|
||||||
|
default on Unix, but not on Windows: there it is not needed to rebind the port, and it
|
||||||
|
only allows another local process to bind the same address and port, with undefined
|
||||||
|
behaviour as to which of them receives the connections. If the machine is shared or
|
||||||
|
untrusted, harden the listening socket instead:
|
||||||
|
<pre>
|
||||||
|
proxy -olSO_EXCLUSIVEADDRUSE
|
||||||
|
</pre>
|
||||||
|
Note that a socket with SO_EXCLUSIVEADDRUSE may not be immediately rebindable after a
|
||||||
|
restart if accepted connections are still active, so test restarts before using it.
|
||||||
|
|
||||||
|
<p><b>Port reuse.</b> 3proxy always binds the outgoing socket before connecting, so
|
||||||
|
Windows does not apply its automatic ephemeral port reuse (which it does only for
|
||||||
|
connections with an implicit bind). Setting the option explicitly on the
|
||||||
|
proxy-to-server socket therefore helps against port exhaustion:
|
||||||
|
<pre>
|
||||||
|
proxy -osSO_REUSE_UNICASTPORT
|
||||||
|
</pre>
|
||||||
|
SO_REUSE_UNICASTPORT requires Windows 10 / Server 2019 or later. On older systems
|
||||||
|
(Windows 7 / Server 2008 and later) use SO_PORT_SCALABILITY instead; where both are
|
||||||
|
available Microsoft recommends SO_REUSE_UNICASTPORT. Note that SO_REUSEADDR has
|
||||||
|
different, weaker semantics on Windows than on Unix and allows another socket to bind
|
||||||
|
the same address and port, so do not use it on the listening socket as a substitute.
|
||||||
|
|
||||||
|
<p><b>TIME_WAIT.</b> Closed connections hold their port for the TcpTimedWaitDelay
|
||||||
|
period, set in
|
||||||
|
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters (DWORD, seconds). The
|
||||||
|
effective default differs between Windows versions (2 to 4 minutes); check the current
|
||||||
|
behaviour before changing it, and lower it only together with an extended port range.
|
||||||
|
Count the connections in that state with:
|
||||||
|
<pre>
|
||||||
|
netstat -ano -p tcp | find /c "TIME_WAIT"
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p><b>Threads and address space.</b> Windows has no ulimit equivalent, and the handle
|
||||||
|
count is not normally the limit. On 32-bit builds the 2 GB of user address space is:
|
||||||
|
each connection thread reserves its stack there, so a few thousand connections can
|
||||||
|
exhaust the address space while physical memory is still free. Use a 64-bit build for high load, and
|
||||||
|
see "Setting Stack Size" above.
|
||||||
|
|
||||||
|
<p><b>Filter drivers.</b> Antivirus, endpoint protection and other LSP/WFP filter
|
||||||
|
drivers inspect every connection and are frequently the actual bottleneck on Windows,
|
||||||
|
costing far more than any tuning above can recover. Exclude the 3proxy process and its
|
||||||
|
ports, or test with the protection temporarily disabled to see the difference before
|
||||||
|
tuning anything else.
|
||||||
|
|
||||||
<h4>Using 3proxy in a Virtual Environment</h4>
|
<h4>Using 3proxy in a Virtual Environment</h4>
|
||||||
|
|
||||||
If 3proxy is used in a VPS environment, there can be additional limitations.
|
If 3proxy is used in a VPS environment, there can be additional limitations.
|
||||||
For example, kernel resources, system CPU usage, and IOCTLs can be limited differently, and this can become a bottleneck.
|
For example, kernel resources, system CPU usage, and IOCTLs can be limited differently, and this can become a bottleneck.
|
||||||
Since 0.9-devel, 3proxy uses splice() by default on Linux. splice() prevents network traffic from being copied from
|
splice() (see below) moves work into the kernel, so where the hosting limits kernel resources
|
||||||
kernel space to the 3proxy process and generally increases throughput, especially in the case of high-volume traffic. This is especially
|
(seen as nearly 100% CPU usage without any real activity of the application) do not enable it.
|
||||||
true for virtual environments (it can improve throughput up to 10 times) unless there are additional kernel limitations.
|
|
||||||
Since some work is moved to the kernel, it requires up to 2 times more kernel resources in terms of CPU, memory, and IOCTLs.
|
|
||||||
If your hosting additionally limits kernel resources (you can see this as nearly 100% CPU usage without any real CPU activity for
|
|
||||||
any application performing IOCTLs), use the -s0 option to disable splice() usage for a given service, e.g.:
|
|
||||||
<pre>
|
|
||||||
socks -s0
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h4>Extending the Ephemeral Port Range</h4>
|
<h4>Extending the Ephemeral Port Range</h4>
|
||||||
|
|
||||||
@@ -160,10 +343,10 @@ Under the latest Linux versions, you can also start multiple services with diffe
|
|||||||
external addresses on a single port with SO_REUSEPORT on the listening socket to
|
external addresses on a single port with SO_REUSEPORT on the listening socket to
|
||||||
evenly distribute incoming connections between outgoing interfaces:
|
evenly distribute incoming connections between outgoing interfaces:
|
||||||
<pre>
|
<pre>
|
||||||
socks -olSO_REUSEPORT -p3128 -e 1.1.1.1
|
socks -olSO_REUSEPORT -p3128 -e1.1.1.1
|
||||||
socks -olSO_REUSEPORT -p3128 -e 2.2.2.2
|
socks -olSO_REUSEPORT -p3128 -e2.2.2.2
|
||||||
socks -olSO_REUSEPORT -p3128 -e 3.3.3.3
|
socks -olSO_REUSEPORT -p3128 -e3.3.3.3
|
||||||
socks -olSO_REUSEPORT -p3128 -e 4.4.4.4
|
socks -olSO_REUSEPORT -p3128 -e4.4.4.4
|
||||||
</pre>
|
</pre>
|
||||||
For web browsing, the last two examples are not recommended because the same client can get
|
For web browsing, the last two examples are not recommended because the same client can get
|
||||||
a different external address for different requests; you should choose the external
|
a different external address for different requests; you should choose the external
|
||||||
@@ -184,6 +367,39 @@ randomly fail due to IP+port pair collisions if the remote or local system
|
|||||||
doesn't support this trick.
|
doesn't support this trick.
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
<h4>NAT on the Path Must Be Tuned Too</h4>
|
||||||
|
|
||||||
|
Everything above tunes the machine 3proxy runs on. If the outgoing traffic passes
|
||||||
|
through NAT - a router, a firewall, a CGNAT of the provider, or a cloud NAT gateway -
|
||||||
|
that device keeps its own translation table and its own pool of source ports, and it
|
||||||
|
limits the number of connections independently of the proxy. Extending
|
||||||
|
ip_local_port_range on the 3proxy host changes nothing if the NAT device rewrites the
|
||||||
|
source port from its own, smaller pool.
|
||||||
|
|
||||||
|
<p>On a Linux based router the same knobs apply and have to be raised there as well:
|
||||||
|
nf_conntrack_max / nf_conntrack_buckets and the conntrack timeouts (see "Linux Tuning
|
||||||
|
Hints" above), plus the port range used for translation, which is ip_local_port_range
|
||||||
|
for MASQUERADE, or the explicit range if SNAT is configured with --to-ports. Note that
|
||||||
|
the range is per translated address: with a single public IP, all clients share it.
|
||||||
|
|
||||||
|
<p>Entry level and SOHO routers are the usual bottleneck here. They typically have a
|
||||||
|
small fixed NAT/conntrack table (a few thousand entries), aggressive or non-adjustable
|
||||||
|
timeouts, and no way to change either. Symptoms are seen on the proxy but caused by the
|
||||||
|
router: connections that fail or hang at random under load while the proxy is far from
|
||||||
|
its own limits, no error in the 3proxy log except a failed outgoing connect, and
|
||||||
|
recovery after a pause or a router reboot. Before tuning 3proxy further, check the
|
||||||
|
router's session/NAT table counters. For high load either give the proxy a public
|
||||||
|
address without NAT in the path, or use a router where the table size and timeouts are
|
||||||
|
configurable.
|
||||||
|
|
||||||
|
<p>On the router, also turn off the application layer gateways that are not actually
|
||||||
|
used - they usually appear in the web interface as "SIP ALG", "FTP ALG", "H.323 ALG",
|
||||||
|
"PPTP passthrough", "IPsec/VPN passthrough". They are commonly enabled by default, they
|
||||||
|
parse the payload of matching connections, and they consume additional session table
|
||||||
|
entries for the connections they expect. If nothing behind the proxy uses FTP, VoIP or
|
||||||
|
those VPN protocols, disabling them frees table space and CPU on exactly the device
|
||||||
|
that is the bottleneck.
|
||||||
|
|
||||||
<h4>Setting Stack Size</h4>
|
<h4>Setting Stack Size</h4>
|
||||||
|
|
||||||
'stacksize' is a size added to all stack allocations and can be both positive and
|
'stacksize' is a size added to all stack allocations and can be both positive and
|
||||||
@@ -199,7 +415,11 @@ the need to add additional physical memory,
|
|||||||
but it's system/libc dependent and requires additional testing under your
|
but it's system/libc dependent and requires additional testing under your
|
||||||
installation. Don't forget about memory-related ulimits.
|
installation. Don't forget about memory-related ulimits.
|
||||||
<p>For 32-bit systems, address space can be a bottleneck you should consider. If
|
<p>For 32-bit systems, address space can be a bottleneck you should consider. If
|
||||||
you're short on address space, you can try using a negative stack size.
|
you're short on address space, you can try using a negative stack size. The result is
|
||||||
|
never lowered below the system minimum (PTHREAD_STACK_MIN), so a large negative value
|
||||||
|
can not disable the thread stack. The base value the 'stacksize' is added to is 48K
|
||||||
|
(64K on FreeBSD/NetBSD/OpenBSD/DragonFly, where libc uses more stack, e.g. in
|
||||||
|
vfprintf() called by syslog()).
|
||||||
|
|
||||||
<h4>Known System Issues</h4>
|
<h4>Known System Issues</h4>
|
||||||
|
|
||||||
@@ -211,13 +431,181 @@ use 3proxy's built-in resolver (nserver / nscache / nscache6).
|
|||||||
Public resolvers like those from Google have rate limits. For a large number of
|
Public resolvers like those from Google have rate limits. For a large number of
|
||||||
requests, install a local caching recursor (ISC bind named, PowerDNS recursor, etc).
|
requests, install a local caching recursor (ISC bind named, PowerDNS recursor, etc).
|
||||||
|
|
||||||
<h4>Avoid Large Lists</h4>
|
<h4>Use the Authentication Cache</h4>
|
||||||
|
|
||||||
Currently, 3proxy is not optimized to use large ACLs, user lists, etc. All lists
|
Authentication and authorization are performed for every request. Password
|
||||||
are processed linearly. In the devel version, you can use RADIUS authentication to avoid
|
lookup itself is a hash lookup and is cheap, but the ACL is walked linearly,
|
||||||
user lists and ACLs in 3proxy itself. Also, RADIUS allows you to easily set an outgoing IP
|
and with RADIUS or plugin authentication every request costs a network round
|
||||||
on a per-user basis or implement more sophisticated logic.
|
trip. 'authcache' keeps the result of a successful authentication for a number
|
||||||
RADIUS is a new beta feature; test it before using it in production.
|
of seconds:
|
||||||
|
<pre>
|
||||||
|
authcache <cachetype> <cachetime> <cachesize>
|
||||||
|
</pre>
|
||||||
|
'cachetype' lists the fields the entry is keyed by, 'cachetime' is the lifetime
|
||||||
|
in seconds, and the optional 'cachesize' limits the number of entries. The
|
||||||
|
cached type must be placed before the real authentication type in the 'auth'
|
||||||
|
command: a cache miss falls through to the next type in the chain, and a hit
|
||||||
|
skips it.
|
||||||
|
|
||||||
|
<p>There are two cached types:
|
||||||
|
<ul>
|
||||||
|
<li>'cache' caches the authentication only; the ACL is still checked on every
|
||||||
|
request. Use it when ACLs must take effect immediately, or when the
|
||||||
|
authentication method returns per-user parameters that the authorization step
|
||||||
|
has to apply.
|
||||||
|
<li>'cacheacl' also caches the authorization result, so the ACL is not walked
|
||||||
|
at all on a hit. This is the one that helps with long ACLs, but the key must
|
||||||
|
cover every field the ACL limits, and it can not be used with redirections.
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p><b>'cacheacl' does not work with parent proxies.</b> Redirections are applied
|
||||||
|
while the ACL is walked, so on a 'cacheacl' hit no redirection happens at all:
|
||||||
|
the request is sent directly instead of through the 'parent' proxy of the
|
||||||
|
matching ACL entry, and nothing is reported. The first request for a given key
|
||||||
|
uses the parent and the rest do not, which makes it look intermittent. Use
|
||||||
|
'cache' with parent proxies:
|
||||||
|
<pre>
|
||||||
|
authcache user,pass 60
|
||||||
|
auth cache strong
|
||||||
|
allow user1
|
||||||
|
parent 1000 socks5 10.0.0.1 1080
|
||||||
|
proxy
|
||||||
|
</pre>
|
||||||
|
The one exception is 'parent ... extip': the external address is stored in the
|
||||||
|
cache entry and restored on a hit, but only if 'ext' is a part of the key:
|
||||||
|
<pre>
|
||||||
|
authcache user,pass,ext 60
|
||||||
|
auth cacheacl strong
|
||||||
|
allow user1
|
||||||
|
parent 1000 extip 1.2.3.4 0
|
||||||
|
proxy
|
||||||
|
</pre>
|
||||||
|
Without 'ext' in the key the external address falls back to the default one on
|
||||||
|
every cache hit.
|
||||||
|
|
||||||
|
<p><b>The key must match the ACL.</b> On a 'cacheacl' hit the cached result is
|
||||||
|
reused as is, so any field the ACL limits but the key does not contain makes
|
||||||
|
the cached result apply to a request it was not computed for. Use 'user' and
|
||||||
|
'pass' for the userlist, 'ip' for the sourcelist, 'dstaddr' and 'dsthost' for
|
||||||
|
the targetlist, 'dstport' for the targetportlist and 'dstoper' for the
|
||||||
|
operationlist. For this ACL:
|
||||||
|
<pre>
|
||||||
|
allow user1,user2 * * 80,443
|
||||||
|
deny *
|
||||||
|
</pre>
|
||||||
|
the key needs 'user', 'pass' and 'dstport':
|
||||||
|
<pre>
|
||||||
|
users $/etc/3proxy/passwd
|
||||||
|
authcache user,pass,dstport 60 65536
|
||||||
|
auth cacheacl strong
|
||||||
|
allow user1,user2 * * 80,443
|
||||||
|
deny *
|
||||||
|
proxy
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>With RADIUS the round trip is the expensive part, so cache by whatever
|
||||||
|
identifies the client:
|
||||||
|
<pre>
|
||||||
|
radius secret 1.2.3.4
|
||||||
|
authcache ip,user,pass 600
|
||||||
|
auth cache radius
|
||||||
|
proxy
|
||||||
|
</pre>
|
||||||
|
'cache' rather than 'cacheacl' is used here because RADIUS may return per-user
|
||||||
|
parameters such as the outgoing IP; add 'ext' to the key to cache the external
|
||||||
|
address returned by RADIUS as well.
|
||||||
|
|
||||||
|
<p>Choose 'cachetime' to balance the load against how quickly a password or ACL
|
||||||
|
change has to take effect. Cache entries are <b>not</b> invalidated by a
|
||||||
|
configuration reload, so a long lifetime keeps applying the old decision to
|
||||||
|
existing keys after the new configuration is loaded.
|
||||||
|
|
||||||
|
<p>Note that 'ip' alone, or 'ip,user' without 'pass', assigns every connection
|
||||||
|
from the same address to the same user for the lifetime of the entry without
|
||||||
|
checking the password. That is a deliberate trade-off for high load; do not use
|
||||||
|
it where clients share addresses.
|
||||||
|
|
||||||
|
<h4>Tune UDP Destination Handling with '-U'</h4>
|
||||||
|
|
||||||
|
Within a SOCKSv5 UDP association the destination is taken from every datagram,
|
||||||
|
so 3proxy authorizes and logs every new destination. One association can reach
|
||||||
|
any number of destinations: a DNS forwarder produces one record, but a
|
||||||
|
peer-to-peer or QUIC client can produce hundreds, each costing an authorization
|
||||||
|
(a network round trip with RADIUS or plugin authentication) and a log record.
|
||||||
|
The 'socks' service option '-U' controls this:
|
||||||
|
<pre>
|
||||||
|
socks -U3 # default: log and authorize every new destination
|
||||||
|
socks -U2 # authorize, do not log
|
||||||
|
socks -U1 # log, do not authorize
|
||||||
|
socks -U0 # neither (same as bare -U)
|
||||||
|
</pre>
|
||||||
|
The destination of the first datagram is always authorized and logged, so the
|
||||||
|
association as a whole is still subject to ACLs, authentication and the choice
|
||||||
|
of the parent proxy.
|
||||||
|
|
||||||
|
<p>Before reaching for the option, note that the cost is already avoided when no
|
||||||
|
ACL entry reachable by the client limits the destination: in that case the
|
||||||
|
result can not depend on the destination and no re-authorization is performed
|
||||||
|
whatever '-U' says. '-U' only matters for configurations that do limit the
|
||||||
|
destination.
|
||||||
|
|
||||||
|
<p>For high load:
|
||||||
|
<ul>
|
||||||
|
<li><b>'-U2'</b> is the safe one. Destination ACLs keep working, only the
|
||||||
|
per-destination log records are dropped. Use it when log volume, not CPU, is
|
||||||
|
the problem.
|
||||||
|
<li><b>'-U' ('-U0')</b> removes both costs and is the fastest, but destination
|
||||||
|
ACLs then apply only to the first destination of each association, and the
|
||||||
|
parent proxy and external address chosen for it are kept for the whole
|
||||||
|
association. Use it when UDP destinations are not restricted anyway, or when
|
||||||
|
the restriction is enforced elsewhere (a firewall, or the parent proxy).
|
||||||
|
<li>Keep the default '-U3' when destination ACLs are a security boundary, and
|
||||||
|
make the authorization itself cheap with 'authcache' instead, see "Use the
|
||||||
|
Authentication Cache" above.
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4>Avoid Large ACLs</h4>
|
||||||
|
|
||||||
|
Most of the large data structures are hash tables and scale to a large number of
|
||||||
|
records: the user list loaded by 'users' (including the '$/path/to/file' form),
|
||||||
|
the authentication cache ('authcache'), the DNS cache ('nscache'/'nscache6') and
|
||||||
|
the client table of the UDP portmapper. Their size is not a concern.
|
||||||
|
|
||||||
|
<p>The ACL is the exception and is still processed linearly. Every request walks
|
||||||
|
the access list entry by entry until one matches, and within an entry the
|
||||||
|
userlist, the sourcelist, the targetlist and the targetportlist are walked
|
||||||
|
linearly as well, so the cost is roughly the number of entries multiplied by the
|
||||||
|
size of the lists inside them. The 'bandlimin'/'bandlimout' and
|
||||||
|
'countin'/'countout' rules are separate lists of the same kind and are walked on
|
||||||
|
every request in addition to the access list.
|
||||||
|
|
||||||
|
<p>Two things follow from this:
|
||||||
|
<ul>
|
||||||
|
<li>Order matters. The walk stops at the first matching entry, so put the
|
||||||
|
entries that match most of the traffic first.
|
||||||
|
<li>Prefer fewer, wider entries over many narrow ones. One entry with a long
|
||||||
|
userlist is cheaper than one entry per user, because the outer walk is repeated
|
||||||
|
for every entry while the inner list is only walked for entries that got that
|
||||||
|
far.
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>With a large ACL, cache the authorization result instead of shortening the
|
||||||
|
list. 'cacheacl' walks the ACL once per cache entry rather than once per
|
||||||
|
request:
|
||||||
|
<pre>
|
||||||
|
users $/etc/3proxy/passwd
|
||||||
|
authcache user,pass,dstaddr,dstport 60 65536
|
||||||
|
auth cacheacl strong
|
||||||
|
</pre>
|
||||||
|
Both limitations from "Use the Authentication Cache" above apply: the cache key
|
||||||
|
must contain every field the ACL limits, and 'cacheacl' must not be used
|
||||||
|
together with parent proxies. Where a parent proxy is required, plain 'cache'
|
||||||
|
still removes the authentication cost but leaves the ACL walk on every request.
|
||||||
|
|
||||||
|
<p>RADIUS moves the user list and the ACLs out of 3proxy entirely, and also
|
||||||
|
allows you to set an outgoing IP on a per-user basis or to implement more
|
||||||
|
sophisticated logic. RADIUS is a new beta feature; test it before using it in
|
||||||
|
production.
|
||||||
|
|
||||||
<h4>Avoid Changing Configuration Too Often</h4>
|
<h4>Avoid Changing Configuration Too Often</h4>
|
||||||
|
|
||||||
@@ -256,35 +644,42 @@ monitor "/some/path/3proxy/3proxy.ver"
|
|||||||
e.g., with "touch /some/path/3proxy/3proxy.ver".
|
e.g., with "touch /some/path/3proxy/3proxy.ver".
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<h4>Use TCP_NODELAY to Speed Up Connections with Small Amounts of Data</h4>
|
<h4>TCP_NODELAY for Connections with Small Amounts of Data</h4>
|
||||||
|
|
||||||
If most requests require an exchange with a small amount of data in both directions
|
TCP_NODELAY is set by default on client (oc) and server (os)
|
||||||
without the need for bandwidth, e.g., messengers or small web requests,
|
connections: without it, Nagle's algorithm holds back a short write until the
|
||||||
you can eliminate Nagle's algorithm delay with the TCP_NODELAY flag. Usage example:
|
previous one is acknowledged, and a peer delays its acknowledgement, so a reply
|
||||||
|
written in more than one part (e.g. HTTP headers, then a short body) waits tens
|
||||||
|
of milliseconds. On slow connections with high delays, where the bandwidth is the
|
||||||
|
bottleneck and fewer packets matter more than latency, it can be turned off:
|
||||||
<pre>
|
<pre>
|
||||||
proxy -osTCP_NODELAY -ocTCP_NODELAY
|
proxy -osTCP_NODELAY=0 -ocTCP_NODELAY=0
|
||||||
</pre>
|
</pre>
|
||||||
sets TCP_NODELAY for client (oc) and server (os) connections.
|
|
||||||
<p>Do not use TCP_NODELAY on slow connections with high delays when
|
|
||||||
connection bandwidth is a bottleneck.
|
|
||||||
|
|
||||||
<h4>Use Splice to Speed Up Large Data Amount Transfers</h4>
|
<h4>Use Splice to Speed Up Large Data Transfers</h4>
|
||||||
|
|
||||||
splice() allows copying data between connections without copying to the process
|
On Linux, splice() passes data between the client and the server connections
|
||||||
address space. It can speed up the proxy on high-bandwidth connections if most
|
through a kernel pipe, without copying it into the 3proxy process. Linux builds
|
||||||
connections require large data transfers. Splice is enabled by default on Linux
|
include it, but a service uses it only when given the -s option:
|
||||||
since 0.9; "-s0" disables splice usage. Example:
|
|
||||||
<pre>
|
<pre>
|
||||||
proxy -s0
|
proxy -s
|
||||||
|
socks -s
|
||||||
|
tcppm -s3 8080 192.168.1.1 80
|
||||||
</pre>
|
</pre>
|
||||||
Splice is only available on Linux. Splice requires more system buffers and file descriptors
|
-s alone splices both directions where it pays: an HTTP body of known length if at
|
||||||
and produces more IOCTLs but reduces process memory and overall CPU usage.
|
least 16K of it is left to read, a stream (CONNECT, SOCKS, tcppm) once it carries
|
||||||
Disable splice if there are a lot of short-lived connections with no bandwidth
|
large reads, going back to copying when they turn small. -s1 always splices what the
|
||||||
requirements.
|
server sends to the client (downloads), -s2 what the client sends to the server
|
||||||
<p>Use splice only on high-speed connections (e.g., 10GbE) when the processor, memory speed, or
|
(uploads), -s3 both; -s5, -s6 and -s7 (the same as -s) do it for those directions
|
||||||
system bus are bottlenecks.
|
only where it pays. -s0, the default, turns it off. In builds without it (CMake option 3PROXY_USE_SPLICE=OFF,
|
||||||
<p>TCP_NODELAY and splice are not contrary to each other and should be combined on
|
or -DWITHSPLICE removed from the Makefile) -s is accepted and ignored.
|
||||||
high-speed connections.
|
<p>splice() pays off when most of the traffic is large transfers: in the
|
||||||
|
<a href="https://github.com/3proxy/3proxy/blob/devel/bench/RESULTS.md">benchmarks</a> it moved
|
||||||
|
1.3 to 2.1 times more data than the read/write path at 40-55% less CPU per gigabyte.
|
||||||
|
It does not help small requests and short connections, which go slower with it, and
|
||||||
|
every spliced direction needs a pipe (two file descriptors) and more kernel
|
||||||
|
buffer memory. Data filters are not applied to spliced data.
|
||||||
|
<p>TCP_NODELAY and splice() do not conflict and can be combined on high-speed connections.
|
||||||
|
|
||||||
<h4>Add Grace Delay to Reduce System Calls</h4>
|
<h4>Add Grace Delay to Reduce System Calls</h4>
|
||||||
|
|
||||||
@@ -296,5 +691,5 @@ The example above adds a 10-millisecond delay before reading data if the average
|
|||||||
polling size is below 8000 bytes and 3 read operations have been made in the same
|
polling size is below 8000 bytes and 3 read operations have been made in the same
|
||||||
direction. It's especially useful with splice. <pre>logdump 1 1</pre> is useful
|
direction. It's especially useful with splice. <pre>logdump 1 1</pre> is useful
|
||||||
to see how grace delays work; choose a delay value to avoid filling the read
|
to see how grace delays work; choose a delay value to avoid filling the read
|
||||||
pipe/buffer (typically 64K) but keep the request sizes close to the chosen average
|
buffer (typically 64K) but keep the request sizes close to the chosen average
|
||||||
on large file uploads/downloads.
|
on large file uploads/downloads.
|
||||||
+760
-121
File diff suppressed because it is too large.
Load diff
+677
-47
@@ -33,9 +33,12 @@
|
|||||||
<li><a href="#NAMES">Как разрешать имена на родительском прокси?</a></li>
|
<li><a href="#NAMES">Как разрешать имена на родительском прокси?</a></li>
|
||||||
<li><a href="#ISFTP">Как настроить FTP прокси?</a></li>
|
<li><a href="#ISFTP">Как настроить FTP прокси?</a></li>
|
||||||
<li><a href="#TLSPR">Как настроить SNI proxy (tlspr)</a></li>
|
<li><a href="#TLSPR">Как настроить SNI proxy (tlspr)</a></li>
|
||||||
|
<li><a href="#DNSPR">Как настроить DNS proxy (dnspr)</a></li>
|
||||||
|
<li><a href="#HTTPSRV">Как отдавать страницы встроенным HTTP-сервером (httpsrv)</a></li>
|
||||||
<li><a href="#SSLPLUGIN">Как настроить TLS/SSL (https прокси, mTLS)</a></li>
|
<li><a href="#SSLPLUGIN">Как настроить TLS/SSL (https прокси, mTLS)</a></li>
|
||||||
<li><a href="#CERTIFICATES">Как создать CA и сертификаты для SSL</a></li>
|
<li><a href="#CERTIFICATES">Как создать CA и сертификаты для SSL</a></li>
|
||||||
<li><a href="#PCRE">Как использовать PCRE-фильтрацию (регулярные выражения)</a></li>
|
<li><a href="#PCRE">Как использовать PCRE-фильтрацию (регулярные выражения)</a></li>
|
||||||
|
<li><a href="#TRANSPARENT">Как сделать транспарентный прокси</a></li>
|
||||||
<li><a href="#AUTH">Как ограничить доступ к службе</a>
|
<li><a href="#AUTH">Как ограничить доступ к службе</a>
|
||||||
<li><a href="#USERS">Как создать список пользователей</a>
|
<li><a href="#USERS">Как создать список пользователей</a>
|
||||||
<li><a href="#ACL">Как ограничить доступ пользователей к ресурсам</a>
|
<li><a href="#ACL">Как ограничить доступ пользователей к ресурсам</a>
|
||||||
@@ -209,16 +212,16 @@
|
|||||||
<b>Управление службой через launchd:</b>
|
<b>Управление службой через launchd:</b>
|
||||||
<br>После установки через cmake службой можно управлять с помощью launchctl:
|
<br>После установки через cmake службой можно управлять с помощью launchctl:
|
||||||
<pre>
|
<pre>
|
||||||
# Загрузить и запустить службу
|
# Загрузить и запустить службу
|
||||||
sudo launchctl load /Library/LaunchDaemons/org.3proxy.3proxy.plist
|
sudo launchctl load /Library/LaunchDaemons/org.3proxy.3proxy.plist
|
||||||
|
|
||||||
# Остановить службу
|
# Остановить службу
|
||||||
sudo launchctl stop org.3proxy.3proxy
|
sudo launchctl stop org.3proxy.3proxy
|
||||||
|
|
||||||
# Запустить службу
|
# Запустить службу
|
||||||
sudo launchctl start org.3proxy.3proxy
|
sudo launchctl start org.3proxy.3proxy
|
||||||
|
|
||||||
# Выгрузить и отключить службу
|
# Выгрузить и отключить службу
|
||||||
sudo launchctl unload /Library/LaunchDaemons/org.3proxy.3proxy.plist</pre>
|
sudo launchctl unload /Library/LaunchDaemons/org.3proxy.3proxy.plist</pre>
|
||||||
Служба запускается от имени пользователя <code>proxy</code> (создаётся при установке).
|
Служба запускается от имени пользователя <code>proxy</code> (создаётся при установке).
|
||||||
Файл конфигурации: <code>/etc/3proxy/3proxy.cfg</code>
|
Файл конфигурации: <code>/etc/3proxy/3proxy.cfg</code>
|
||||||
@@ -387,7 +390,7 @@
|
|||||||
-l@ident</pre>
|
-l@ident</pre>
|
||||||
соответствуют ведению журнала через syslog с идентификатором ident.
|
соответствуют ведению журнала через syslog с идентификатором ident.
|
||||||
<pre>
|
<pre>
|
||||||
log &connstring</pre>
|
log &connstring;</pre>
|
||||||
соответствует ведению журнала через ODBC, connstring задается в формате
|
соответствует ведению журнала через ODBC, connstring задается в формате
|
||||||
datasource,username,password (последние два параметра опциональны, если
|
datasource,username,password (последние два параметра опциональны, если
|
||||||
datasource не требует или уже содержит сведения для авторизации). При этом
|
datasource не требует или уже содержит сведения для авторизации). При этом
|
||||||
@@ -590,6 +593,7 @@
|
|||||||
Еще одна задача которую может решать модуль - требование наличия TLS или mTLS (mutual TLS).
|
Еще одна задача которую может решать модуль - требование наличия TLS или mTLS (mutual TLS).
|
||||||
Если tlspr используется как отдельный сервис без использования плагина Transparent, то необходимо задать порт назначения через опцию -P (по умолчанию 443),
|
Если tlspr используется как отдельный сервис без использования плагина Transparent, то необходимо задать порт назначения через опцию -P (по умолчанию 443),
|
||||||
т.к. TLS хендшейк не содержит информации о порте назначения.
|
т.к. TLS хендшейк не содержит информации о порте назначения.
|
||||||
|
Примечание: tlspr не поддерживает аутентификацию пользователей (в TLS-хендшейке нет учетных данных); используйте ACL по IP или родительский прокси с аутентификацией, если требуется контроль доступа.
|
||||||
</p><p>
|
</p><p>
|
||||||
<b>Опции:</b>
|
<b>Опции:</b>
|
||||||
</p><pre>
|
</p><pre>
|
||||||
@@ -600,8 +604,54 @@
|
|||||||
2 - требовать TLS, проверять наличие client и server HELLO
|
2 - требовать TLS, проверять наличие client и server HELLO
|
||||||
3 - требовать TLS, проверять наличие серверного сертификата (не совместим с TLS 1.3+)
|
3 - требовать TLS, проверять наличие серверного сертификата (не совместим с TLS 1.3+)
|
||||||
4 - требовать взаимный (mutual) TLS, проверять что сервер запрашивает сертификат и клиент его отправляет (не совместим с TLS 1.3+)
|
4 - требовать взаимный (mutual) TLS, проверять что сервер запрашивает сертификат и клиент его отправляет (не совместим с TLS 1.3+)
|
||||||
|
-Ximap | -Xpop3 | -Xsmtp - режим explicit TLS (STARTTLS): tlspr говорит с клиентом
|
||||||
|
на plaintext-протоколе (приветствие, команда STARTTLS), затем поднимает TLS с обеих сторон
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
|
<b>Implicit и explicit TLS:</b>
|
||||||
|
</p><p>
|
||||||
|
Implicit TLS означает TLS с первого байта соединения: https (443), imaps (993), SMTP submission secure (submissions) (465).
|
||||||
|
Explicit TLS означает, что соединение начинается в plaintext и поднимается до TLS командой STARTTLS/STLS: imap (143), SMTP submission (587), pop3 (110).
|
||||||
|
tlspr поддерживает оба варианта: для implicit TLS хост назначения берется из SNI, а порт из -P; для explicit TLS
|
||||||
|
опция -X заставляет tlspr говорить с клиентом на plaintext-фазе протокола (приветствие, команда STARTTLS) перед
|
||||||
|
поднятием TLS с обеих сторон. Пример:
|
||||||
|
</p><pre>
|
||||||
|
# https (implicit)
|
||||||
|
tlspr -p443 -P443 -c1
|
||||||
|
# imaps (implicit)
|
||||||
|
tlspr -p993 -P993 -c1
|
||||||
|
# submissions (implicit)
|
||||||
|
tlspr -p465 -P465 -c1
|
||||||
|
# imap STARTTLS (explicit)
|
||||||
|
tlspr -p143 -P143 -Ximap
|
||||||
|
# submission STARTTLS (explicit)
|
||||||
|
tlspr -p587 -P587 -Xsmtp
|
||||||
|
# pop3 STLS (explicit)
|
||||||
|
tlspr -p110 -P110 -Xpop3
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Примечание: для explicit TLS вместо tlspr -X можно использовать протокольные сервисы smtpp, imapp и pop3p; они
|
||||||
|
также поддерживают STARTTLS.
|
||||||
|
</p><p>
|
||||||
|
<b>Рекомендуемая конфигурация - перенаправление трафика:</b> наиболее универсальная конфигурация - перенаправлять
|
||||||
|
TLS-трафик (порты 443, 993, 465, 143, 587, 110) на tlspr правилами внешнего маршрутизатора или локальными
|
||||||
|
правилами (плагин Transparent). Исходные адрес и порт назначения сохраняются, -P и отдельные сервисы для каждого
|
||||||
|
порта не требуются, implicit и explicit TLS работают в рамках одной установки.
|
||||||
|
</p><pre>
|
||||||
|
auth iponly
|
||||||
|
allow *
|
||||||
|
tlspr -p1443 -c1
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
например, с iptables:
|
||||||
|
</p><pre>
|
||||||
|
iptables -t nat -A PREROUTING -p tcp -m multiport --dports 443,993,465 -j REDIRECT --to-port 1443
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Также, если клиенты используют dnspr в качестве DNS-резолвера, трафик можно перенаправлять через DNS —
|
||||||
|
см. <a href="#DNSPR">Как настроить DNS proxy (dnspr)</a>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<b>SNI Break (обход DPI):</b>
|
<b>SNI Break (обход DPI):</b>
|
||||||
<br>tlspr может использоваться как родительский прокси типа "tls" для реализации SNI-фрагментации (аналог NoDPI/GoodByeDPI).
|
<br>tlspr может использоваться как родительский прокси типа "tls" для реализации SNI-фрагментации (аналог NoDPI/GoodByeDPI).
|
||||||
Клиент отправляет первую часть TLS ClientHello, tlspr разбивает его на расширении SNI и отправляет двумя TCP-пакетами,
|
Клиент отправляет первую часть TLS ClientHello, tlspr разбивает его на расширении SNI и отправляет двумя TCP-пакетами,
|
||||||
@@ -639,9 +689,7 @@ socks
|
|||||||
<p>
|
<p>
|
||||||
3. Использование tlspr с HTTP proxy для ACL по имени хоста TLS:
|
3. Использование tlspr с HTTP proxy для ACL по имени хоста TLS:
|
||||||
</p><pre>
|
</p><pre>
|
||||||
allow * * * 80
|
allow * * * * HTTP_CONNECT
|
||||||
parent 1000 http 0.0.0.0 0
|
|
||||||
allow * * * 443
|
|
||||||
parent 1000 tls 0.0.0.0 0
|
parent 1000 tls 0.0.0.0 0
|
||||||
deny * * blocked.example.com
|
deny * * blocked.example.com
|
||||||
allow *
|
allow *
|
||||||
@@ -649,6 +697,259 @@ proxy
|
|||||||
</pre>
|
</pre>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<li><a name="DNSPR"><i>Как настроить DNS proxy (dnspr)</i></a></li>
|
||||||
|
<p>
|
||||||
|
dnspr - сервис пересылки DNS-запросов. Он отвечает на запросы из кэша имен 3proxy (включая статические записи
|
||||||
|
nsrecord), пересылает остальные запросы на резолверы, заданные командой nserver, и кэширует результаты, если
|
||||||
|
настроены nscache/nscache6. Опции:
|
||||||
|
</p><pre>
|
||||||
|
-s - простая пересылка DNS: не использовать резолвер / кэш имен 3proxy
|
||||||
|
-F<ip> - fake: отвечать на все A (или AAAA) запросы заданным IP-адресом.
|
||||||
|
Может быть указана дважды - один раз с IPv4 и один раз с IPv6 адресом.
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
dnspr можно использовать для перенаправления трафика по имени хоста, например, чтобы направить почтовых
|
||||||
|
клиентов на установку <a href="#TLSPR">tlspr</a>, добавив записи nsrecord для имен почтовых сервисов
|
||||||
|
(nscache/nscache6 сохраняют ответы для всех остальных имен):
|
||||||
|
</p><pre>
|
||||||
|
nscache 65536
|
||||||
|
nscache6 65536
|
||||||
|
dnspr -p53
|
||||||
|
|
||||||
|
# google
|
||||||
|
nsrecord smtp.gmail.com 10.0.0.1
|
||||||
|
nsrecord imap.gmail.com 10.0.0.1
|
||||||
|
nsrecord pop.gmail.com 10.0.0.1
|
||||||
|
# mail.ru
|
||||||
|
nsrecord smtp.mail.ru 10.0.0.1
|
||||||
|
nsrecord imap.mail.ru 10.0.0.1
|
||||||
|
nsrecord pop.mail.ru 10.0.0.1
|
||||||
|
# yandex.ru
|
||||||
|
nsrecord smtp.yandex.ru 10.0.0.1
|
||||||
|
nsrecord imap.yandex.ru 10.0.0.1
|
||||||
|
nsrecord pop.yandex.ru 10.0.0.1
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
где 10.0.0.1 - адрес, на котором слушает tlspr. Если перенаправлять нужно все имена, вместо отдельных
|
||||||
|
записей nsrecord можно использовать один fake-адрес:
|
||||||
|
</p><pre>
|
||||||
|
nscache 65536
|
||||||
|
nscache6 65536
|
||||||
|
dnspr -p53 -F10.0.0.1
|
||||||
|
</pre>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<li><a name="HTTPSRV"><i>Как отдавать страницы встроенным HTTP-сервером (httpsrv)</i></a>
|
||||||
|
<p>
|
||||||
|
httpsrv отвечает на запросы сам, а не пересылает их. Что делать с запросом,
|
||||||
|
определяют правила <code>http</code>, записанные перед сервисом, как и правила
|
||||||
|
доступа: запрос обрабатывает первое правило, у которого совпали и хост, и URL.
|
||||||
|
Это удобно для страницы состояния, небольшого статического сайта, страницы
|
||||||
|
блокировки для запросов, отклонённых ACL, или health check, который опрашивает
|
||||||
|
вышестоящий балансировщик.
|
||||||
|
</p><pre>
|
||||||
|
http ОПЕРАЦИЯ ХОСТ URL [ПАРАМЕТРЫ]
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
ХОСТ сопоставляется с заголовком Host, URL - с путём без строки запроса.
|
||||||
|
Минимальный статический сайт:
|
||||||
|
</p><pre>
|
||||||
|
auth iponly
|
||||||
|
allow *
|
||||||
|
|
||||||
|
http file * / /usr/local/web/index.html
|
||||||
|
http file * /*.html "/usr/local/web/$1.html"
|
||||||
|
http file * /css/*.css "/usr/local/web/css/$1.css"
|
||||||
|
http cache * /img/** "/usr/local/web/img/$1" * 3600
|
||||||
|
httpsrv -p80 -i127.0.0.1
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
<b>Шаблоны.</b> <code>*</code> означает любую последовательность символов внутри
|
||||||
|
одного элемента пути и не пересекает <code>/</code>, поэтому правило не может
|
||||||
|
попасть в каталог, который не назван в нём. <code>**</code> пересекает.
|
||||||
|
Каждая звёздочка и каждая группа регулярного выражения запоминаются по порядку:
|
||||||
|
<code>$1</code> и далее подставляют их в путь или адрес, который строит правило,
|
||||||
|
<code>$0</code> - весь путь запроса. Правило <code>rewrite_host</code>
|
||||||
|
использует звёздочки собственного шаблона хоста, поскольку переписывает именно
|
||||||
|
его. В сборке с PCRE шаблон можно записать
|
||||||
|
регулярным выражением с префиксом <code>pcre:</code> - и для URL, и для хоста:
|
||||||
|
</p><pre>
|
||||||
|
http file * /d/*.txt "/usr/local/web/$1.txt"
|
||||||
|
http cache * "pcre:^/(.*)/pic/(.*)\.(gif|jpeg)$" "/usr/local/web/picts/$1/$2.$3"
|
||||||
|
http file status.example.com /** "/usr/local/web/status/$1"
|
||||||
|
http file "pcre:^(www|web)\.example\.com$" /** "/usr/local/web/$1"
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Вне кавычек доллар начинает имя включаемого файла, поэтому аргумент, содержащий
|
||||||
|
доллар - путь с <code>$1</code>, регулярное выражение с якорем <code>$</code> -
|
||||||
|
записывается в кавычках, как выше. <code>$$</code> означает один доллар и тоже
|
||||||
|
не читается как включение файла.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>Операции.</b>
|
||||||
|
</p><pre>
|
||||||
|
# file - отдать файл, через sendfile/TransmitFile там, где система это умеет
|
||||||
|
http file * /dl/** "/usr/local/web/dl/$1"
|
||||||
|
|
||||||
|
# cache - прочитать в память при первом запросе и отвечать из неё
|
||||||
|
http cache * /css/*.css "/usr/local/web/css/$1.css"
|
||||||
|
|
||||||
|
# redir - ответить редиректом, 302, если код не задан
|
||||||
|
http redir * /old/** 301 "https://example.org/$1"
|
||||||
|
|
||||||
|
# rewrite - изменить путь и передать запрос следующим правилам
|
||||||
|
http rewrite * /alias/** "/w/$1"
|
||||||
|
|
||||||
|
# rewrite_host - то же для хоста, от которого зависит выбор следующих правил
|
||||||
|
http rewrite_host *.old.example ** "$1.new.example"
|
||||||
|
|
||||||
|
# reply - только код ответа, без тела
|
||||||
|
http reply * /health** 200 "X-Health: ok"
|
||||||
|
http reply * /down** 503 "Retry-After: 30"
|
||||||
|
|
||||||
|
# echo, data - описание запроса или генерация содержимого заданного размера
|
||||||
|
http echo * /echo**
|
||||||
|
http data * /gen** size=1048576
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
<b>Что правило добавляет в ответ.</b> <code>file</code> и <code>cache</code>
|
||||||
|
принимают после пути тип содержимого, max-age, добавляемые заголовки и код
|
||||||
|
ответа. Любой из них можно опустить или записать как <code>*</code>:
|
||||||
|
</p><pre>
|
||||||
|
http ОПЕРАЦИЯ ХОСТ URL ПУТЬ [ТИП [MAX-AGE [ЗАГОЛОВКИ [КОД]]]]
|
||||||
|
|
||||||
|
# тип определяется по имени файла, клиенты кэшируют час
|
||||||
|
http file * /img/*.png "/usr/local/web/img/$1.png" * 3600
|
||||||
|
|
||||||
|
# собственный тип и заголовок
|
||||||
|
http file * /api/*.json "/usr/local/web/api/$1.json" application/json * "X-Api: 1"
|
||||||
|
|
||||||
|
# файл как тело страницы ошибки
|
||||||
|
http file * /err/** /usr/local/web/404.html text/html * * 404
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
ЗАГОЛОВКИ - один аргумент, содержащий целые строки заголовков, разделённые
|
||||||
|
обратной косой чертой и n - двумя символами, поскольку строка конфигурации не
|
||||||
|
может содержать конец строки. Аргумент нужно брать в кавычки, в заголовках есть
|
||||||
|
пробелы. Заголовки и max-age правила отправляются с тем кодом, который правило
|
||||||
|
задало, но не с отказом, который решил вернуть сам сервер: на запрос
|
||||||
|
отсутствующего файла 404 отвечает сервер, а не правило.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Неизвестные серверу типы регистрируются командой
|
||||||
|
<code>http_content_type</code>, а тип, названный в правиле, используется
|
||||||
|
независимо от имени файла:
|
||||||
|
</p><pre>
|
||||||
|
http_content_type .webp image/webp
|
||||||
|
http_content_type wasm application/wasm
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
<b>Файлы и даты.</b> Принимается только полный путь - относительный отсчитывался
|
||||||
|
бы от того каталога, в котором оказался сервис, - а путь с элементом
|
||||||
|
<code>.</code> или <code>..</code>, концом строки или звёздочкой отвергается. В
|
||||||
|
Windows путь должен указывать диск или сетевой ресурс (<code>"C:\web\$1"</code>
|
||||||
|
или <code>"\\host\share\$1"</code>). Запрос, который декодируется в путь за
|
||||||
|
пределами дерева, отвергается раньше всего этого. Каждый ответ содержит
|
||||||
|
Last-Modified, а запрос с If-Modified-Since получает 304 без тела, если файл не
|
||||||
|
изменился.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>Кэширование.</b> <code>cache</code> читает файл один раз и дальше отвечает из
|
||||||
|
памяти; изменившийся на диске файл читается заново, а файл больше мегабайта
|
||||||
|
отдаётся так же, как это сделал бы <code>file</code>. При заданном MAX-AGE файл
|
||||||
|
не проверяется в течение этого времени - правило уже сообщило клиентам, что
|
||||||
|
столько файл можно считать неизменным, - и запрос стоит только копирования
|
||||||
|
наружу. Без MAX-AGE каждый запрос делает stat, и изменение подхватывается сразу.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>Страница блокировки.</b> Сервис, отклоняющий запрос редиректом, может
|
||||||
|
отправить клиента на httpsrv, работающий рядом:
|
||||||
|
</p><pre>
|
||||||
|
auth iponly
|
||||||
|
deny * * "pcre:^(ads|track)[0-9]*\.example\.(com|net)$"
|
||||||
|
allow *
|
||||||
|
proxy -p3128 -i192.168.1.1
|
||||||
|
|
||||||
|
flush
|
||||||
|
auth iponly
|
||||||
|
allow *
|
||||||
|
http file * /** /usr/local/web/blocked.html text/html * * 403
|
||||||
|
httpsrv -p8080 -i127.0.0.1
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
<b>И сайт, и прокси.</b> Запрос может прийти так, как приходит на сайт - путь,
|
||||||
|
имя в заголовке Host, - или так, как приходит на прокси: с полным URL, либо, для
|
||||||
|
туннеля, с одним именем хоста в CONNECT. Читается и то, и другое. Запрос в форме
|
||||||
|
для прокси аутентифицируется через Proxy-Authorization и отклоняется кодом 407,
|
||||||
|
как это делает прокси; запрос в форме для сайта - через Authorization и 401. Чем
|
||||||
|
он будет обработан, в обоих случаях решают правила.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<code>proxypass</code> - правило, которое отвечает, забирая ресурс, поэтому один
|
||||||
|
сервис может отдавать своё и проксировать остальное:
|
||||||
|
</p><pre>
|
||||||
|
auth iponly
|
||||||
|
allow *
|
||||||
|
http file * /local/** "/usr/local/web/$1"
|
||||||
|
http proxypass * /**
|
||||||
|
httpsrv -p8080
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Правило доступа с перенаправлением на локальный прокси делает то же самое без
|
||||||
|
отдельного правила. Цепочка без адреса и означает "локальный прокси", а второй
|
||||||
|
<code>allow</code> - то, с чем совпадает сам прокси на своём проходе, так как
|
||||||
|
правило с цепочкой второй раз не берётся:
|
||||||
|
</p><pre>
|
||||||
|
auth iponly
|
||||||
|
allow *
|
||||||
|
parent 1000 http 0.0.0.0 0
|
||||||
|
allow *
|
||||||
|
http file * /local/** "/usr/local/web/$1"
|
||||||
|
httpsrv -p8080
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Аутентификация по той же причине происходит дважды - для сервиса и для прокси, -
|
||||||
|
поэтому конфигурация, требующая учётных данных, запрашивает их так, как это
|
||||||
|
делает прокси.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Правила доступа просматриваются с начала на обоих проходах, и назначение запроса
|
||||||
|
известно на втором. На первом сервис отвечает сам за себя, поэтому адрес или порт
|
||||||
|
в правиле сопоставляется с адресом, на который подключился клиент; имя из запроса
|
||||||
|
сопоставляется на обоих проходах. На втором назначение - то, которое названо в
|
||||||
|
запросе, поэтому правила с адресом, портом или именем определяют, что прокси
|
||||||
|
разрешено забрать, и определяют это до установления соединения:
|
||||||
|
</p><pre>
|
||||||
|
auth iponly
|
||||||
|
allow *
|
||||||
|
parent 1000 http 0.0.0.0 0
|
||||||
|
allow * * * 80,443
|
||||||
|
deny *
|
||||||
|
httpsrv -p8080
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
До правил доходит всё, забираются только порты 80 и 443, а <code>deny</code>,
|
||||||
|
записанный до правила с цепочкой, действует на обоих проходах точно так же. Соединение с сервером сохраняется для следующего запроса и
|
||||||
|
закрывается, если следующий запрос идёт в другое место или если сервер за это
|
||||||
|
время его закрыл.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>Соединения.</b> Клиент, обратившийся по HTTP/1.1, получает ответ 1.1, и
|
||||||
|
соединение сохраняется для следующего запроса, если он не прислал
|
||||||
|
<code>Connection: close</code>; клиенту 1.0 нужно запросить keep-alive явно.
|
||||||
|
Соединение сохраняется только тогда, когда длина ответа известна точно - это
|
||||||
|
верно для всех операций, кроме страниц администрирования, поэтому они всегда
|
||||||
|
последнее, что отдаётся в соединении. Тело запроса, которое сервер не может
|
||||||
|
дочитать до конца - присланное chunked или размером больше мегабайта, - тоже
|
||||||
|
завершает соединение.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>Администрирование.</b> Сервис <code>admin</code> - это httpsrv с уже
|
||||||
|
объявленными страницами интерфейса администрирования, см.
|
||||||
|
<a href="#ADMIN">Администрирование и анализ информации</a>. Правила можно
|
||||||
|
добавлять перед ним так же, и они проверяются первыми.
|
||||||
|
</p>
|
||||||
|
</p>
|
||||||
<li><a name="SSLPLUGIN"><i>Как настроить TLS/SSL (https прокси, mTLS)</i></a>
|
<li><a name="SSLPLUGIN"><i>Как настроить TLS/SSL (https прокси, mTLS)</i></a>
|
||||||
<p>
|
<p>
|
||||||
Начиная с версии 0.9.7 поддержка TLS/SSL встроена в 3proxy при компиляции с OpenSSL
|
Начиная с версии 0.9.7 поддержка TLS/SSL встроена в 3proxy при компиляции с OpenSSL
|
||||||
@@ -747,30 +1048,50 @@ ssl_nocli
|
|||||||
<b>Создание удостоверяющего центра (CA):</b>
|
<b>Создание удостоверяющего центра (CA):</b>
|
||||||
<br>Для MITM или mTLS требуется CA. Сгенерируйте закрытый ключ CA и сертификат:
|
<br>Для MITM или mTLS требуется CA. Сгенерируйте закрытый ключ CA и сертификат:
|
||||||
</p><pre>
|
</p><pre>
|
||||||
# Генерация закрытого ключа CA
|
# Генерация закрытого ключа CA
|
||||||
openssl genrsa -out ca.key 4096
|
openssl genrsa -out ca.key 4096
|
||||||
|
|
||||||
# Генерация сертификата CA (действителен 10 лет)
|
# Расширения, без которых сертификат не годится как CA
|
||||||
openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 \
|
cat > ca.ext << 'EOF'
|
||||||
|
basicConstraints=critical,CA:TRUE
|
||||||
|
keyUsage=critical,keyCertSign,cRLSign
|
||||||
|
subjectKeyIdentifier=hash
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Генерация сертификата CA (действителен 10 лет)
|
||||||
|
openssl req -new -nodes -key ca.key \
|
||||||
-subj "/C=RU/ST=Region/L=City/O=MyOrg/CN=My CA" \
|
-subj "/C=RU/ST=Region/L=City/O=MyOrg/CN=My CA" \
|
||||||
-out ca.crt
|
-out ca.csr
|
||||||
|
openssl x509 -req -in ca.csr -signkey ca.key -sha256 -days 3650 \
|
||||||
|
-extfile ca.ext -out ca.crt
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
|
Расширения обязательны. Без <b>basicConstraints=CA:TRUE</b> и
|
||||||
|
<b>keyCertSign</b> сертификат не принимается как CA, и клиент сообщает, что не
|
||||||
|
может получить сертификат издателя. <b>subjectKeyIdentifier</b> — то, на что
|
||||||
|
ссылаются подписанные этим CA сертификаты.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Расширения задаются файлом, а не через <b>-addext</b>, потому что LibreSSL —
|
||||||
|
команда <b>openssl</b> в macOS и некоторых BSD — обрабатывает -addext иначе,
|
||||||
|
чем OpenSSL. Приведённый вариант одинаково работает в обоих.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
Для MITM импортируйте ca.crt в браузеры/ОС клиентов как доверенный корневой CA.
|
Для MITM импортируйте ca.crt в браузеры/ОС клиентов как доверенный корневой CA.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<b>Создание серверного сертификата для https:// прокси:</b>
|
<b>Создание серверного сертификата для https:// прокси:</b>
|
||||||
<br>Серверный сертификат должен иметь правильные альтернативные имена (SAN):
|
<br>Серверный сертификат должен иметь правильные альтернативные имена (SAN):
|
||||||
</p><pre>
|
</p><pre>
|
||||||
# Генерация закрытого ключа сервера
|
# Генерация закрытого ключа сервера
|
||||||
openssl genrsa -out server.key 2048
|
openssl genrsa -out server.key 2048
|
||||||
|
|
||||||
# Создание запроса на подпись сертификата (CSR)
|
# Создание запроса на подпись сертификата (CSR)
|
||||||
openssl req -new -key server.key \
|
openssl req -new -key server.key \
|
||||||
-subj "/C=RU/ST=Region/L=City/O=MyOrg/CN=proxy.example.com" \
|
-subj "/C=RU/ST=Region/L=City/O=MyOrg/CN=proxy.example.com" \
|
||||||
-out server.csr
|
-out server.csr
|
||||||
|
|
||||||
# Создание файла расширений для SAN
|
# Создание файла расширений для SAN
|
||||||
cat > server.ext << 'EOF'
|
cat > server.ext << 'EOF'
|
||||||
authorityKeyIdentifier=keyid,issuer
|
authorityKeyIdentifier=keyid,issuer
|
||||||
basicConstraints=CA:FALSE
|
basicConstraints=CA:FALSE
|
||||||
@@ -784,38 +1105,50 @@ DNS.2 = proxy
|
|||||||
IP.1 = 192.168.1.100
|
IP.1 = 192.168.1.100
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Подписание сертификата CA
|
# Подписание сертификата CA
|
||||||
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key \
|
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key \
|
||||||
-CAcreateserial -out server.crt -days 365 -sha256 \
|
-CAcreateserial -out server.crt -days 365 -sha256 \
|
||||||
-extfile server.ext
|
-extfile server.ext
|
||||||
|
|
||||||
|
# Проверка так же, как это делает современный клиент
|
||||||
|
openssl verify -x509_strict -CAfile ca.crt server.crt
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
|
Проверять следует строго, потому что именно так проверяет клиент. OpenSSL 3
|
||||||
|
добавляет идентификаторы ключей при подписании, а LibreSSL — нет, поэтому файл
|
||||||
|
расширений запрашивает их явно. Python начиная с 3.13 проверяет строго и
|
||||||
|
отвергает сертификат без <b>authorityKeyIdentifier</b>; другие клиенты идут тем
|
||||||
|
же путём.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
Для публичного https:// прокси используйте CA вроде Let's Encrypt вместо самоподписанного.
|
Для публичного https:// прокси используйте CA вроде Let's Encrypt вместо самоподписанного.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<b>Создание клиентского сертификата для mTLS:</b>
|
<b>Создание клиентского сертификата для mTLS:</b>
|
||||||
</p><pre>
|
</p><pre>
|
||||||
# Генерация закрытого ключа клиента
|
# Генерация закрытого ключа клиента
|
||||||
openssl genrsa -out client1.key 2048
|
openssl genrsa -out client1.key 2048
|
||||||
|
|
||||||
# Создание CSR
|
# Создание CSR
|
||||||
openssl req -new -key client1.key \
|
openssl req -new -key client1.key \
|
||||||
-subj "/C=RU/ST=Region/L=City/O=MyOrg/CN=client1" \
|
-subj "/C=RU/ST=Region/L=City/O=MyOrg/CN=client1" \
|
||||||
-out client1.csr
|
-out client1.csr
|
||||||
|
|
||||||
# Создание файла расширений
|
# Создание файла расширений
|
||||||
cat > client.ext << 'EOF'
|
cat > client.ext << 'EOF'
|
||||||
basicConstraints=CA:FALSE
|
basicConstraints=CA:FALSE
|
||||||
keyUsage = digitalSignature, nonRepudiation, keyEncipherment
|
keyUsage = digitalSignature, nonRepudiation, keyEncipherment
|
||||||
extendedKeyUsage = clientAuth
|
extendedKeyUsage = clientAuth
|
||||||
|
subjectKeyIdentifier=hash
|
||||||
|
authorityKeyIdentifier=keyid,issuer
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Подписание CA
|
# Подписание CA
|
||||||
openssl x509 -req -in client1.csr -CA ca.crt -CAkey ca.key \
|
openssl x509 -req -in client1.csr -CA ca.crt -CAkey ca.key \
|
||||||
-CAcreateserial -out client1.crt -days 365 -sha256 \
|
-CAcreateserial -out client1.crt -days 365 -sha256 \
|
||||||
-extfile client.ext
|
-extfile client.ext
|
||||||
|
|
||||||
# Создание PKCS#12 для импорта в браузер
|
# Создание PKCS#12 для импорта в браузер
|
||||||
openssl pkcs12 -export -out client1.p12 \
|
openssl pkcs12 -export -out client1.p12 \
|
||||||
-inkey client1.key -in client1.crt -certfile ca.crt
|
-inkey client1.key -in client1.crt -certfile ca.crt
|
||||||
</pre>
|
</pre>
|
||||||
@@ -825,15 +1158,21 @@ openssl pkcs12 -export -out client1.p12 \
|
|||||||
<p>
|
<p>
|
||||||
<b>Скрипт быстрой настройки для разработки/тестирования:</b>
|
<b>Скрипт быстрой настройки для разработки/тестирования:</b>
|
||||||
</p><pre>
|
</p><pre>
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Создаёт CA, серверный и клиентский сертификаты для тестирования SSLPlugin
|
# Создаёт CA, серверный и клиентский сертификаты для тестирования SSLPlugin
|
||||||
|
|
||||||
# CA
|
# CA
|
||||||
openssl genrsa -out ca.key 4096
|
openssl genrsa -out ca.key 4096
|
||||||
openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 \
|
cat > ca.ext << 'EOF'
|
||||||
-subj "/CN=3proxy CA" -out ca.crt
|
basicConstraints=critical,CA:TRUE
|
||||||
|
keyUsage=critical,keyCertSign,cRLSign
|
||||||
|
subjectKeyIdentifier=hash
|
||||||
|
EOF
|
||||||
|
openssl req -new -nodes -key ca.key -subj "/CN=3proxy CA" -out ca.csr
|
||||||
|
openssl x509 -req -in ca.csr -signkey ca.key -sha256 -days 3650 \
|
||||||
|
-extfile ca.ext -out ca.crt
|
||||||
|
|
||||||
# Сервер
|
# Сервер
|
||||||
openssl genrsa -out server.key 2048
|
openssl genrsa -out server.key 2048
|
||||||
openssl req -new -key server.key -subj "/CN=localhost" -out server.csr
|
openssl req -new -key server.key -subj "/CN=localhost" -out server.csr
|
||||||
cat > server.ext << 'EOF'
|
cat > server.ext << 'EOF'
|
||||||
@@ -841,23 +1180,201 @@ basicConstraints=CA:FALSE
|
|||||||
keyUsage = keyEncipherment
|
keyUsage = keyEncipherment
|
||||||
extendedKeyUsage = serverAuth
|
extendedKeyUsage = serverAuth
|
||||||
subjectAltName = DNS:localhost,DNS:proxy,IP:127.0.0.1
|
subjectAltName = DNS:localhost,DNS:proxy,IP:127.0.0.1
|
||||||
|
subjectKeyIdentifier=hash
|
||||||
|
authorityKeyIdentifier=keyid,issuer
|
||||||
EOF
|
EOF
|
||||||
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key \
|
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key \
|
||||||
-CAcreateserial -out server.crt -days 365 -sha256 -extfile server.ext
|
-CAcreateserial -out server.crt -days 365 -sha256 -extfile server.ext
|
||||||
|
|
||||||
# Клиент
|
# Клиент
|
||||||
openssl genrsa -out client.key 2048
|
openssl genrsa -out client.key 2048
|
||||||
openssl req -new -key client.key -subj "/CN=client" -out client.csr
|
openssl req -new -key client.key -subj "/CN=client" -out client.csr
|
||||||
cat > client.ext << 'EOF'
|
cat > client.ext << 'EOF'
|
||||||
basicConstraints=CA:FALSE
|
basicConstraints=CA:FALSE
|
||||||
extendedKeyUsage = clientAuth
|
extendedKeyUsage = clientAuth
|
||||||
|
subjectKeyIdentifier=hash
|
||||||
|
authorityKeyIdentifier=keyid,issuer
|
||||||
EOF
|
EOF
|
||||||
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key \
|
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key \
|
||||||
-CAcreateserial -out client.crt -days 365 -sha256 -extfile client.ext
|
-CAcreateserial -out client.crt -days 365 -sha256 -extfile client.ext
|
||||||
openssl pkcs12 -export -out client.p12 -passout pass: \
|
openssl pkcs12 -export -out client.p12 -passout pass: \
|
||||||
-inkey client.key -in client.crt -certfile ca.crt
|
-inkey client.key -in client.crt -certfile ca.crt
|
||||||
|
|
||||||
|
# Оба должны пройти проверку, которую делает современный клиент
|
||||||
|
openssl verify -x509_strict -CAfile ca.crt server.crt
|
||||||
|
openssl verify -x509_strict -CAfile ca.crt client.crt
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
|
<li><a name="TRANSPARENT"><i>Как сделать транспарентный прокси</i></a>
|
||||||
|
<p>
|
||||||
|
Транспарентный прокси обслуживает клиентов, которые не настроены на работу
|
||||||
|
через прокси. Пакетный фильтр перенаправляет их соединения на 3proxy, а команда
|
||||||
|
<b>transparent</b> указывает сервису брать адрес назначения у фильтра, а не из
|
||||||
|
запроса. Всё остальное работает как обычно: правила доступа, родительские
|
||||||
|
прокси, ограничения и логирование видят настоящий адрес назначения. Работает в
|
||||||
|
Linux и BSD. С версии 1.0.1 встроено в бинарник, раньше это был отдельный
|
||||||
|
TransparentPlugin, и строка <b>plugin</b> больше не нужна.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Команда даёт и адрес, и порт назначения, поэтому сервис обслуживает всё, что
|
||||||
|
на него перенаправлено, а не один порт с одним адресом назначения.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Без неё сервис берёт адрес откуда-то ещё: HTTP-прокси - из заголовка
|
||||||
|
<b>Host</b>, порт-маппер - из своей конфигурации. Именно получение адреса от
|
||||||
|
фильтра позволяет работать с остальными протоколами и делает адрес
|
||||||
|
достоверным, а не заявленным клиентом.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Нагляднее всего это с <b>tlspr</b>. Без перенаправления трафика (или без
|
||||||
|
резолва имён на него через DNS) на него вообще ничего не попадёт. С
|
||||||
|
перенаправлением он получает и имя из TLS handshake, и адрес назначения -
|
||||||
|
именно это позволяет писать правила доступа по именам хостов: имя из handshake
|
||||||
|
проверяется в ACL, а соединение идёт на тот адрес, куда шёл клиент. Без адреса
|
||||||
|
пришлось бы резолвить имя самостоятельно, то есть делать ещё один запрос и
|
||||||
|
получать ещё один ответ.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Конфигурация для веб- и TLS-трафика:
|
||||||
|
</p><pre>
|
||||||
|
log /var/log/3proxy.log D
|
||||||
|
auth iponly
|
||||||
|
allow *
|
||||||
|
|
||||||
|
# для сервисов ниже адрес назначения берётся из перенаправления
|
||||||
|
transparent
|
||||||
|
|
||||||
|
# обычный веб-трафик, перенаправленный сюда с порта 80
|
||||||
|
proxy -p3129 -e192.0.2.10
|
||||||
|
|
||||||
|
# TLS, перенаправленный сюда с порта 443: без этого у tlspr было бы только
|
||||||
|
# имя из handshake, а так есть и адрес
|
||||||
|
tlspr -p3143 -e192.0.2.10
|
||||||
|
|
||||||
|
notransparent
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
<b>-e</b> задаёт сервисам собственный адрес для исходящих соединений. Именно
|
||||||
|
этот адрес исключается в правилах перенаправления, и это исключение не даёт
|
||||||
|
соединениям самого прокси попасть обратно в него. Без исключения соединение,
|
||||||
|
которое 3proxy устанавливает к серверу назначения, попадает под то же правило,
|
||||||
|
возвращается в 3proxy, и трафик зацикливается. Можно вместо этого запускать
|
||||||
|
3proxy под отдельной учётной записью и исключать её - так лучше, если у машины
|
||||||
|
один адрес.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>Linux, iptables</b>. Для транзитного трафика:
|
||||||
|
</p><pre>
|
||||||
|
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-ports 3129
|
||||||
|
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-ports 3143
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Трафик самой машины проходит через цепочку OUTPUT, где соединения прокси нужно
|
||||||
|
исключить:
|
||||||
|
</p><pre>
|
||||||
|
# по адресу, с которого сервисы устанавливают соединения
|
||||||
|
iptables -t nat -A OUTPUT -p tcp --dport 80 ! -s 192.0.2.10 -j REDIRECT --to-ports 3129
|
||||||
|
|
||||||
|
# либо по учётной записи, под которой работает 3proxy
|
||||||
|
iptables -t nat -A OUTPUT -p tcp --dport 80 -m owner ! --uid-owner proxy3 \
|
||||||
|
-j REDIRECT --to-ports 3129
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p><b>Linux, nftables</b> (Debian 11+, Ubuntu 22.04+, RHEL 8+, Fedora, Arch):
|
||||||
|
</p><pre>
|
||||||
|
table ip proxy3 {
|
||||||
|
chain prerouting {
|
||||||
|
type nat hook prerouting priority dstnat; policy accept;
|
||||||
|
iif "eth0" tcp dport 80 redirect to :3129
|
||||||
|
iif "eth0" tcp dport 443 redirect to :3143
|
||||||
|
}
|
||||||
|
|
||||||
|
chain output {
|
||||||
|
type nat hook output priority dstnat; policy accept;
|
||||||
|
meta skuid != "proxy3" tcp dport 80 redirect to :3129
|
||||||
|
meta skuid != "proxy3" tcp dport 443 redirect to :3143
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Загружается через <b>nft -f</b>, сохраняется в <b>/etc/nftables.conf</b>
|
||||||
|
(Debian, Ubuntu) или <b>/etc/sysconfig/nftables.conf</b> (RHEL, Fedora). Имя
|
||||||
|
таблицы не может начинаться с цифры, поэтому таблица называется не 3proxy.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>Linux, firewalld</b> (RHEL, CentOS Stream, Fedora, openSUSE):
|
||||||
|
</p><pre>
|
||||||
|
firewall-cmd --permanent --zone=internal --add-forward-port=port=80:proto=tcp:toport=3129
|
||||||
|
firewall-cmd --permanent --zone=internal --add-forward-port=port=443:proto=tcp:toport=3143
|
||||||
|
firewall-cmd --reload
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Исключение для трафика самого прокси в таком виде не задаётся, для него нужно
|
||||||
|
прямое правило:
|
||||||
|
</p><pre>
|
||||||
|
firewall-cmd --permanent --direct --add-rule ipv4 nat OUTPUT 0 \
|
||||||
|
-p tcp --dport 80 -m owner ! --uid-owner proxy3 -j REDIRECT --to-ports 3129
|
||||||
|
firewall-cmd --reload
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p><b>Linux, ufw</b> (Ubuntu, Debian). В ufw нет команды для перенаправления,
|
||||||
|
правила добавляются в <b>/etc/ufw/before.rules</b> перед блоком <b>*filter</b>:
|
||||||
|
</p><pre>
|
||||||
|
*nat
|
||||||
|
:PREROUTING ACCEPT [0:0]
|
||||||
|
-A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-ports 3129
|
||||||
|
-A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-ports 3143
|
||||||
|
COMMIT
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
В Linux 3proxy спрашивает у ядра, куда шло соединение. В BSD он спрашивает у pf,
|
||||||
|
который хранит исходный адрес назначения в таблице состояний, через
|
||||||
|
<b>/dev/pf</b> - поэтому работают правила <b>rdr</b>, и 3proxy должен иметь
|
||||||
|
доступ к этому устройству. Если перенаправление оставляет адрес на самом сокете,
|
||||||
|
используется он: так делают OpenBSD <b>divert-to</b> и FreeBSD <b>ipfw fwd</b>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Механизм выбирается автоматически, а команда <b>transparent</b> принимает
|
||||||
|
аргумент для случаев, когда его надо зафиксировать: <b>auto</b> (по умолчанию),
|
||||||
|
<b>netfilter</b>, <b>pf</b> или <b>socket</b> для чтения адреса с сокета. Режим,
|
||||||
|
которого нет в сборке, отвергается, поэтому конфигурация, написанная для другой
|
||||||
|
платформы, не запустится вместо того, чтобы молча делать что-то другое.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>FreeBSD, NetBSD, OpenBSD, pf</b>. Перенаправление в <b>/etc/pf.conf</b> с
|
||||||
|
исключением адреса, с которого соединяется прокси:
|
||||||
|
</p><pre>
|
||||||
|
rdr pass on em0 inet proto tcp from ! 192.0.2.10 to any port 80 -> 127.0.0.1 port 3129
|
||||||
|
rdr pass on em0 inet proto tcp from ! 192.0.2.10 to any port 443 -> 127.0.0.1 port 3143
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Загружается через <b>pfctl -f /etc/pf.conf</b>. 3proxy ищет адрес назначения в
|
||||||
|
таблице состояний pf, поэтому ему нужен доступ на чтение к <b>/dev/pf</b>: либо
|
||||||
|
запуск от root, либо права на устройство для его учётной записи.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>OpenBSD, divert-to</b> - альтернатива, оставляющая адрес на сокете, доступ
|
||||||
|
к <b>/dev/pf</b> при этом не нужен:
|
||||||
|
</p><pre>
|
||||||
|
pass in on em0 inet proto tcp to any port 80 divert-to 127.0.0.1 port 3129
|
||||||
|
pass in on em0 inet proto tcp to any port 443 divert-to 127.0.0.1 port 3143
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p><b>FreeBSD, ipfw</b>. <b>fwd</b> доставляет соединение локально, не переписывая
|
||||||
|
его, и адрес тоже остаётся на сокете:
|
||||||
|
</p><pre>
|
||||||
|
ipfw add fwd 127.0.0.1,3129 tcp from any to any 80 in recv em0
|
||||||
|
ipfw add fwd 127.0.0.1,3143 tcp from any to any 443 in recv em0
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p><b>macOS</b>: <b>/dev/pf</b> есть, но заголовочных файлов для него нет,
|
||||||
|
поэтому в сборке под macOS нет обращения к pf, а ни <b>divert-to</b>, ни ipfw в
|
||||||
|
macOS нет. Транспарентное проксирование там неприменимо, хотя команды в сборке
|
||||||
|
присутствуют.
|
||||||
|
</p>
|
||||||
|
|
||||||
<li><a name="PCRE"><i>Как использовать PCRE-фильтрацию (регулярные выражения)</i></a>
|
<li><a name="PCRE"><i>Как использовать PCRE-фильтрацию (регулярные выражения)</i></a>
|
||||||
<p>
|
<p>
|
||||||
Начиная с версии 0.9.7 фильтрация PCRE встроена в 3proxy при компиляции с поддержкой
|
Начиная с версии 0.9.7 фильтрация PCRE встроена в 3proxy при компиляции с поддержкой
|
||||||
@@ -903,19 +1420,47 @@ IP назначения, порты и т.д.), аналогичный кома
|
|||||||
<p>
|
<p>
|
||||||
<b>Примеры:</b>
|
<b>Примеры:</b>
|
||||||
</p><pre>
|
</p><pre>
|
||||||
# Блокировать запросы с определёнными ключевыми словами для некоторых пользователей
|
# Блокировать запросы с определёнными ключевыми словами для некоторых пользователей
|
||||||
pcre request deny "porn|sex" user1,user2,user3 192.168.0.0/16
|
pcre request deny "porn|sex" user1,user2,user3 192.168.0.0/16
|
||||||
|
|
||||||
# Блокировать ответы с определённым content-type
|
# Блокировать ответы с определённым content-type
|
||||||
pcre srvheader deny "Content-type: application"
|
pcre srvheader deny "Content-type: application"
|
||||||
|
|
||||||
# Замена содержимого в обоих направлениях (цензура)
|
# Замена содержимого в обоих направлениях (цензура)
|
||||||
pcre_rewrite clidata,srvdata dunno "porn|sex|pussy" "***" baduser
|
pcre_rewrite clidata,srvdata dunno "porn|sex|pussy" "***" baduser
|
||||||
pcre_extend deny * 192.168.0.1/16
|
pcre_extend deny * 192.168.0.1/16
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
<b>Примечание:</b> Регулярные выражения не требуют авторизации и не могут заменить
|
<b>Примечание:</b> Регулярные выражения не требуют авторизации и не могут заменить
|
||||||
авторизацию и/или ACL allow/deny.
|
авторизацию и/или ACL allow/deny.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<b>Регулярные выражения в именах хостов:</b> имя хоста в списке назначения
|
||||||
|
правила доступа может быть записано регулярным выражением вместо маски, для
|
||||||
|
этого используется префикс <code>pcre:</code> (<code>regex:</code> означает то
|
||||||
|
же самое). Требуется сборка с поддержкой PCRE, как и для команд
|
||||||
|
<code>pcre</code> выше.
|
||||||
|
</p><pre>
|
||||||
|
# Маска: имя сопоставляется только с начала и с конца
|
||||||
|
deny * * *ads.example.com
|
||||||
|
|
||||||
|
# Регулярное выражение: всё, что выразимо средствами PCRE
|
||||||
|
deny * * "pcre:^(ads|track)[0-9]*\.example\.(com|net)$"
|
||||||
|
allow * * "pcre:^(www|api)\.example\.com$"
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Перед сопоставлением имя приводится к нижнему регистру, завершающие точки
|
||||||
|
удаляются, поэтому шаблоны пишутся в нижнем регистре. Шаблон, оканчивающийся на
|
||||||
|
<code>$</code>, нужно взять в кавычки или записать как <code>$$</code>: вне
|
||||||
|
кавычек одиночный доллар начинает имя включаемого файла. Имена допустимы только
|
||||||
|
в списке назначения (список источника - адреса), и имя проверяется лишь тогда,
|
||||||
|
когда оно присутствует в запросе. Маска обходится дешевле и достаточна для
|
||||||
|
большинства правил, регулярное выражение сопоставляется на каждый запрос.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Тот же префикс и те же шаблоны использует команда <code>http</code> встроенного
|
||||||
|
HTTP-сервера - для хоста, на который отвечает правило, и для URL, который оно
|
||||||
|
сопоставляет.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<li><a name="AUTH"><i>Как ограничить доступ к службе</i></a>
|
<li><a name="AUTH"><i>Как ограничить доступ к службе</i></a>
|
||||||
@@ -1180,16 +1725,16 @@ pcre_extend deny * 192.168.0.1/16
|
|||||||
allow * * * 80,8080-8088
|
allow * * * 80,8080-8088
|
||||||
parent 1000 http 0.0.0.0 0
|
parent 1000 http 0.0.0.0 0
|
||||||
allow * * * 80,8080-8088
|
allow * * * 80,8080-8088
|
||||||
#перенаправить соединения по портам 80 и 8080-8088 в локальный
|
#перенаправить соединения по портам 80 и 8080-8088 в локальный
|
||||||
#http прокси. Вторая команда allow необходима, т.к. контроль доступа
|
#http прокси. Вторая команда allow необходима, т.к. контроль доступа
|
||||||
#осуществляется 2 раза - на уровне socks и на уровне HTTP прокси
|
#осуществляется 2 раза - на уровне socks и на уровне HTTP прокси
|
||||||
allow * * * 21,2121
|
allow * * * 21,2121
|
||||||
parent 1000 ftp 0.0.0.0 0
|
parent 1000 ftp 0.0.0.0 0
|
||||||
allow * * * 21,2121
|
allow * * * 21,2121
|
||||||
#перенаправить соединения по портам 21 и 2121 в локальный
|
#перенаправить соединения по портам 21 и 2121 в локальный
|
||||||
#ftp прокси
|
#ftp прокси
|
||||||
allow *
|
allow *
|
||||||
#пустить все соединения напрямую
|
#пустить все соединения напрямую
|
||||||
socks</pre>
|
socks</pre>
|
||||||
</p>
|
</p>
|
||||||
<li><a name="REDIINTER"><i>Q: Как взаимодействует с другими правилами в ACL?</i></a></li>
|
<li><a name="REDIINTER"><i>Q: Как взаимодействует с другими правилами в ACL?</i></a></li>
|
||||||
@@ -1204,14 +1749,14 @@ pcre_extend deny * 192.168.0.1/16
|
|||||||
<pre>
|
<pre>
|
||||||
allow * * * 80,8080-8088
|
allow * * * 80,8080-8088
|
||||||
parent 1000 http 0.0.0.0 0
|
parent 1000 http 0.0.0.0 0
|
||||||
#перенаправить во внутренний прокси
|
#перенаправить во внутренний прокси
|
||||||
allow * * $c:\3proxy\local.nets 80,8080-8088
|
allow * * $c:\3proxy\local.nets 80,8080-8088
|
||||||
#разрешить прямой web-доступ к сетям из local.nets
|
#разрешить прямой web-доступ к сетям из local.nets
|
||||||
allow * * * 80,8080-8088
|
allow * * * 80,8080-8088
|
||||||
parent 1000 http proxy.3proxy.ru 3128
|
parent 1000 http proxy.3proxy.ru 3128
|
||||||
#все остальные веб-запросы перенаправить на внешний прокси-сервер
|
#все остальные веб-запросы перенаправить на внешний прокси-сервер
|
||||||
allow *
|
allow *
|
||||||
#разрешить socks-запросы по другим портам</pre>
|
#разрешить socks-запросы по другим портам</pre>
|
||||||
</p>
|
</p>
|
||||||
</ul>
|
</ul>
|
||||||
<li><a name="ROUNDROBIN"><i>Как организовать балансировку между несоклькими каналами</i></a>
|
<li><a name="ROUNDROBIN"><i>Как организовать балансировку между несоклькими каналами</i></a>
|
||||||
@@ -1283,6 +1828,85 @@ pcre_extend deny * 192.168.0.1/16
|
|||||||
192.168.10.1, второе - 192.168.20.1, а третье - либо 192.168.30.1 с
|
192.168.10.1, второе - 192.168.20.1, а третье - либо 192.168.30.1 с
|
||||||
вероятностью 0.3 либо 192.168.40.1 с вероятностью 0.7
|
вероятностью 0.3 либо 192.168.40.1 с вероятностью 0.7
|
||||||
</p>
|
</p>
|
||||||
|
<li><a name="UDPACL"><i>Как применять ACL к UDP трафику</i></a>
|
||||||
|
<p>
|
||||||
|
Запрос SOCKSv5 UDP ASSOCIATE лишь просит 3proxy открыть порт для ретрансляции
|
||||||
|
и не содержит адреса назначения. Адрес назначения берется из каждой
|
||||||
|
датаграммы, отправленной клиентом, поэтому одна ассоциация может обращаться
|
||||||
|
к любому числу адресов назначения. 3proxy авторизует адрес назначения каждой
|
||||||
|
датаграммы, поэтому ACL, ограничивающие адрес, имя хоста или порт
|
||||||
|
назначения, применяются и к UDP трафику.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Отличия от TCP:
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>Датаграмма к запрещенному адресу назначения отбрасывается, ассоциация
|
||||||
|
при этом не завершается.
|
||||||
|
<li>Вышестоящий прокси и внешний адрес выбираются для адреса назначения
|
||||||
|
датаграммы, а не для запроса ASSOCIATE, и устанавливаются заново, если
|
||||||
|
последующий адрес назначения соответствует другой записи ACL. Для UDP
|
||||||
|
могут использоваться только родители типа <code>socks5</code> и
|
||||||
|
<code>socks5+</code>.
|
||||||
|
<li>ACL проверяются только для датаграмм, отправленных клиентом. Датаграмма,
|
||||||
|
полученная в рамках ассоциации, передается клиенту без проверки ACL: при
|
||||||
|
использовании вышестоящего прокси принимаются только датаграммы от него, а
|
||||||
|
ассоциация без вышестоящего прокси принимает датаграмму от любого источника.
|
||||||
|
Клиенту сообщается фактический адрес источника датаграммы. В журнал записывается адрес назначения, на который клиент
|
||||||
|
отправлял датаграммы, а не адрес источника полученных датаграмм.
|
||||||
|
<li>Клиент может использовать одну ассоциацию для обращения ко многим адресам
|
||||||
|
назначения. Запись ACL, ограничивающая адрес назначения, молча отбрасывает
|
||||||
|
датаграммы ко всем остальным адресам назначения, поэтому ограничение адреса
|
||||||
|
назначения для UDP может нарушить работу таких клиентов, и причину трудно
|
||||||
|
установить. Ограничивайте его, только если это действительно необходимо.
|
||||||
|
<li>Ограничители полосы и счетчики трафика, ограничивающие адрес назначения,
|
||||||
|
выбираются при авторизации адреса назначения, поэтому они выбираются для
|
||||||
|
адреса назначения первой датаграммы и не выбираются заново для каждого
|
||||||
|
последующего адреса назначения. К входящему UDP трафику они не могут быть
|
||||||
|
применены по адресу назначения вообще.
|
||||||
|
<li>Каждое изменение имени хоста, адреса или порта назначения
|
||||||
|
авторизуется заново и записывается в журнал. Используйте <code>nscache</code>
|
||||||
|
для имен хостов и кэш аутентификации для всего, что дороже 'iponly'. Опция
|
||||||
|
<code>-U</code> сервиса <code>socks</code> отключает журналирование и/или
|
||||||
|
повторную авторизацию; при <code>-U0</code> или <code>-U1</code>
|
||||||
|
авторизуется только первый адрес назначения ассоциации.
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
Ограничить адреса назначения, куда клиент может отправлять датаграммы:
|
||||||
|
</p><pre>
|
||||||
|
auth iponly
|
||||||
|
allow * * 8.8.8.8 53
|
||||||
|
deny *
|
||||||
|
socks -p1080
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
Запрос ASSOCIATE выполняется успешно, датаграммы к 8.8.8.8:53 передаются,
|
||||||
|
датаграммы к любому другому адресу назначения отбрасываются.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
То же самое с аутентификацией 'strong' (или RADIUS, или через плагин), при
|
||||||
|
которой иначе каждый новый адрес назначения аутентифицировался бы заново:
|
||||||
|
</p><pre>
|
||||||
|
users user1:CL:password
|
||||||
|
authcache user,pass,dstaddr,dstport 60
|
||||||
|
auth cacheacl strong
|
||||||
|
allow user1 * 8.8.8.8 53
|
||||||
|
deny *
|
||||||
|
socks -p1080
|
||||||
|
</pre>
|
||||||
|
<p>
|
||||||
|
При 'cacheacl' результат проверки ACL не вычисляется заново при попадании
|
||||||
|
в кэш, поэтому каждое поле, ограничиваемое в ACL, должно входить в ключ
|
||||||
|
кэша: 'user' и 'pass' для списка пользователей, 'dstaddr' и 'dstport' для списка
|
||||||
|
адресов и списка портов назначения, 'ip' для списка источников, 'dsthost'
|
||||||
|
для имен хостов в списке назначения, 'dstoper' для списка операций. Без
|
||||||
|
адреса назначения в ключе результат, закэшированный для одного адреса
|
||||||
|
назначения, применяется к любому другому, и адрес назначения не
|
||||||
|
проверяется вообще. Используйте 'cache' вместо 'cacheacl', если ACL могут
|
||||||
|
изменяться в течение времени жизни кэша или если используется вышестоящий
|
||||||
|
прокси: при попадании в кэш 'cacheacl' обход ACL не выполняется, поэтому
|
||||||
|
вышестоящий прокси не выбирается и датаграммы отправляются напрямую.
|
||||||
|
</p>
|
||||||
<li><a name="BANDLIM"><i>Как ограничивать скорости приема</i></a>
|
<li><a name="BANDLIM"><i>Как ограничивать скорости приема</i></a>
|
||||||
<p>
|
<p>
|
||||||
3proxy позволяет устанавливать фильтры ширины потребляемого канала. Для этого
|
3proxy позволяет устанавливать фильтры ширины потребляемого канала. Для этого
|
||||||
@@ -1369,11 +1993,13 @@ pcre_extend deny * 192.168.0.1/16
|
|||||||
nscache и nsrecord.
|
nscache и nsrecord.
|
||||||
<pre>
|
<pre>
|
||||||
nserver 192.168.1.2
|
nserver 192.168.1.2
|
||||||
nserver 192.168.1.3:5353/tcp</pre>
|
nserver 192.168.1.3:5353/tcp
|
||||||
|
nserver [2001:4860:4860::8844]</pre>
|
||||||
указывает 3proxy какие машины следует использвоать в качестве серверов
|
указывает 3proxy какие машины следует использвоать в качестве серверов
|
||||||
DNS. Сервер 192.168.1.3 будет использоваться по порту TCP/5353 (вместо дефолтного UDP/53) только при недостижимости
|
DNS. Сервер 192.168.1.3 будет использоваться по порту TCP/5353 (вместо дефолтного UDP/53) только при недостижимости
|
||||||
192.168.1.2. Можно указать до 5 серверов. Если nserver не указан, будут
|
192.168.1.2. Можно указать до 5 серверов. Если nserver не указан, будут
|
||||||
использованы системные функции разрешения имен.
|
использованы системные функции разрешения имен.
|
||||||
|
Адрес IPv6 необходимо записывать в квадратных скобках.
|
||||||
<pre>
|
<pre>
|
||||||
nscache 65535
|
nscache 65535
|
||||||
nscache6 65535</pre>
|
nscache6 65535</pre>
|
||||||
@@ -1441,16 +2067,20 @@ socks -H -p1080
|
|||||||
<p>
|
<p>
|
||||||
<b>Отправка заголовка PROXY протокола родительскому прокси:</b>
|
<b>Отправка заголовка PROXY протокола родительскому прокси:</b>
|
||||||
<br>Используйте тип родительского прокси <code>ha</code> для отправки заголовка
|
<br>Используйте тип родительского прокси <code>ha</code> для отправки заголовка
|
||||||
PROXY протокола v1 родительскому прокси. Это должен быть последний родитель в цепочке:
|
PROXY протокола v1 родительскому прокси. Укажите <code>ha</code> перед родителем,
|
||||||
|
который должен получить заголовок; после отправки заголовка продолжается
|
||||||
|
хендшейк протокола родителя:
|
||||||
</p><pre>
|
</p><pre>
|
||||||
allow *
|
allow *
|
||||||
parent 1000 ha
|
parent 1000 ha 0.0.0.0 0
|
||||||
parent 1000 socks5 parent.example.com 1080
|
parent 1000 socks5 parent.example.com 1080
|
||||||
socks
|
proxy
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
Эта конфигурация отправляет информацию об IP-адресе клиента SOCKS5 родительскому
|
Эта конфигурация подключается к SOCKS5 родителю, отправляет PROXY заголовок
|
||||||
прокси через PROXY протокол.
|
с исходным IP клиента, затем выполняет SOCKS5-хендшейк и только после этого
|
||||||
|
передаёт полезную нагрузку. Родитель должен использовать <code>-H</code>
|
||||||
|
(например <code>socks -H</code>).
|
||||||
</p>
|
</p>
|
||||||
<li><a name="MAXSEG"><i>Как установить максимальный размер сегмента TCP (MSS)</i></a>
|
<li><a name="MAXSEG"><i>Как установить максимальный размер сегмента TCP (MSS)</i></a>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
+2
-1
@@ -5,9 +5,10 @@
|
|||||||
<a href="howtor.html">How To (Russian)</a><br>
|
<a href="howtor.html">How To (Russian)</a><br>
|
||||||
<a href="devref.html">Developer reference</a><br>
|
<a href="devref.html">Developer reference</a><br>
|
||||||
<h3>Man pages:</h3>
|
<h3>Man pages:</h3>
|
||||||
<br><A HREF="man8/3proxy_crypt.8.html">3proxy_crypt.8</A>
|
|
||||||
<br><A HREF="man8/3proxy.8.html">3proxy.8</A>
|
<br><A HREF="man8/3proxy.8.html">3proxy.8</A>
|
||||||
|
<br><A HREF="man8/3proxy_crypt.8.html">3proxy_crypt.8</A>
|
||||||
<br><A HREF="man8/ftppr.8.html">ftppr.8</A>
|
<br><A HREF="man8/ftppr.8.html">ftppr.8</A>
|
||||||
|
<br><A HREF="man8/imapp.8.html">imapp.8</A>
|
||||||
<br><A HREF="man8/pop3p.8.html">pop3p.8</A>
|
<br><A HREF="man8/pop3p.8.html">pop3p.8</A>
|
||||||
<br><A HREF="man8/proxy.8.html">proxy.8</A>
|
<br><A HREF="man8/proxy.8.html">proxy.8</A>
|
||||||
<br><A HREF="man8/smtpp.8.html">smtpp.8</A>
|
<br><A HREF="man8/smtpp.8.html">smtpp.8</A>
|
||||||
|
|||||||
+762
-141
File diff suppressed because it is too large.
Load diff
+35
-35
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>3proxy</b> -
|
<p style="margin-left:9%; margin-top: 1em"><b>3proxy</b> -
|
||||||
3[APA3A] tiny proxy server, or trivial proxy server, or free
|
3[APA3A] tiny proxy server, or trivial proxy server, or free
|
||||||
proxy server</p>
|
proxy server</p>
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ proxy server</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>3proxy</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>3proxy</b>
|
||||||
[<i>config_file</i>] <b><br>
|
[<i>config_file</i>] <b><br>
|
||||||
3proxy</b> [<i>--install</i>] <b><br>
|
3proxy</b> [<i>--install</i>] <b><br>
|
||||||
3proxy</b> [<i>--remove</i>]</p>
|
3proxy</b> [<i>--remove</i>]</p>
|
||||||
@@ -44,7 +44,7 @@ proxy server</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>3proxy</b> is
|
<p style="margin-left:9%; margin-top: 1em"><b>3proxy</b> is
|
||||||
a universal proxy server. It can be used to provide internal
|
a universal proxy server. It can be used to provide internal
|
||||||
users with fully controllable access to external resources
|
users with fully controllable access to external resources
|
||||||
or to provide external users with access to internal
|
or to provide external users with access to internal
|
||||||
@@ -58,11 +58,11 @@ multiple gateways with HTTP and HTTPS proxy with FTP over
|
|||||||
HTTP support, SOCKS v4, v4.5 and v5, POP3 proxy, UDP and TCP
|
HTTP support, SOCKS v4, v4.5 and v5, POP3 proxy, UDP and TCP
|
||||||
portmappers. Each gateway is started from the configuration
|
portmappers. Each gateway is started from the configuration
|
||||||
file like an independent service <b>proxy</b>(8)
|
file like an independent service <b>proxy</b>(8)
|
||||||
<b>socks</b>(8) <b>pop3p</b>(8) <b>tcppm</b>(8)
|
<b>socks</b>(8) <b>pop3p</b>(8) <b>imapp</b>(8)
|
||||||
<b>udppm</b>(8) <b>ftppr</b>(8) <b>dnspr</b> but
|
<b>tcppm</b>(8) <b>udppm</b>(8) <b>ftppr</b>(8) <b>dnspr</b>
|
||||||
<b>3proxy</b> is not a kind of wrapper or superserver for
|
but <b>3proxy</b> is not a kind of wrapper or superserver
|
||||||
these daemons. It just has the same code compiled in, but
|
for these daemons. It just has the same code compiled in,
|
||||||
provides much more functionality. SOCKSv5 implementation
|
but provides much more functionality. SOCKSv5 implementation
|
||||||
allows you to use 3proxy with any UDP or TCP based client
|
allows you to use 3proxy with any UDP or TCP based client
|
||||||
applications designed without proxy support (with
|
applications designed without proxy support (with
|
||||||
<i>SocksCAP</i>, <i>FreeCAP</i> or another client-side
|
<i>SocksCAP</i>, <i>FreeCAP</i> or another client-side
|
||||||
@@ -71,7 +71,7 @@ under Unix). So you can play your favourite games, listen to
|
|||||||
music, exchange files and messages and even accept incoming
|
music, exchange files and messages and even accept incoming
|
||||||
connections behind a proxy server.</p>
|
connections behind a proxy server.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><i>dnspr</i>
|
<p style="margin-left:9%; margin-top: 1em"><i>dnspr</i>
|
||||||
does not exist as an independent service. It’s a DNS
|
does not exist as an independent service. It’s a DNS
|
||||||
caching proxy (it requires <i>nscache</i> and <i>nserver</i>
|
caching proxy (it requires <i>nscache</i> and <i>nserver</i>
|
||||||
to be set in the configuration. Only A-records are cached.
|
to be set in the configuration. Only A-records are cached.
|
||||||
@@ -79,7 +79,7 @@ Please note that this caching is mostly a ’hack’
|
|||||||
and has nothing to do with a real DNS server, but it works
|
and has nothing to do with a real DNS server, but it works
|
||||||
perfectly for SOHO networks.</p>
|
perfectly for SOHO networks.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy supports
|
<p style="margin-left:9%; margin-top: 1em">3proxy supports
|
||||||
access control lists (ACL) like network router. Source and
|
access control lists (ACL) like network router. Source and
|
||||||
destination networks and destination port can be specified.
|
destination networks and destination port can be specified.
|
||||||
In addition, usernames and gateway action (for example GET
|
In addition, usernames and gateway action (for example GET
|
||||||
@@ -92,7 +92,7 @@ ACL action request can be allowed, denied or redirected to
|
|||||||
another host or to another proxy server or even to a chain
|
another host or to another proxy server or even to a chain
|
||||||
of proxy servers.</p>
|
of proxy servers.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">It supports
|
<p style="margin-left:9%; margin-top: 1em">It supports
|
||||||
different types of logging: to logfiles, <b>syslog</b>(3)
|
different types of logging: to logfiles, <b>syslog</b>(3)
|
||||||
(only under Unix) or to an ODBC database. Logging format is
|
(only under Unix) or to an ODBC database. Logging format is
|
||||||
tunable to provide compatibility with existing log file
|
tunable to provide compatibility with existing log file
|
||||||
@@ -105,9 +105,9 @@ Apache or Squid log parsers.</p>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>config_file</b></p>
|
<p style="margin-left:9%; margin-top: 1em"><b>config_file</b></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">Name of config file. See
|
<p style="margin-left:18%;">Name of config file. See
|
||||||
<b>3proxy.cfg</b>(3) for configuration file format. Under
|
<b>3proxy.cfg</b>(3) for configuration file format. Under
|
||||||
Windows, if config_file is not specified, <b>3proxy</b>
|
Windows, if config_file is not specified, <b>3proxy</b>
|
||||||
looks for a file named <i>3proxy.cfg</i> in the default
|
looks for a file named <i>3proxy.cfg</i> in the default
|
||||||
@@ -119,14 +119,14 @@ script just by setting +x mode and adding <br>
|
|||||||
#!/usr/local/3proxy/3proxy <br>
|
#!/usr/local/3proxy/3proxy <br>
|
||||||
as a first line in 3proxy.cfg</p>
|
as a first line in 3proxy.cfg</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>--install</b></p>
|
<p style="margin-left:9%;"><b>--install</b></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Windows NT family only)
|
<p style="margin-left:18%;">(Windows NT family only)
|
||||||
install <b>3proxy</b> as a system service</p>
|
install <b>3proxy</b> as a system service</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>--remove</b></p>
|
<p style="margin-left:9%;"><b>--remove</b></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Windows NT family only) remove
|
<p style="margin-left:18%;">(Windows NT family only) remove
|
||||||
<b>3proxy</b> from system services</p>
|
<b>3proxy</b> from system services</p>
|
||||||
|
|
||||||
<h2>SIGNALS
|
<h2>SIGNALS
|
||||||
@@ -134,29 +134,29 @@ install <b>3proxy</b> as a system service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Under Unix there
|
<p style="margin-left:9%; margin-top: 1em">Under Unix there
|
||||||
are a few signals <b>3proxy</b> catches. See <b>kill</b>(1).
|
are a few signals <b>3proxy</b> catches. See <b>kill</b>(1).
|
||||||
<b><br>
|
<b><br>
|
||||||
SIGTERM</b></p>
|
SIGTERM</b></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">clean up connections and
|
<p style="margin-left:18%;">clean up connections and
|
||||||
exit</p>
|
exit</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>SIGPAUSE</b></p>
|
<p style="margin-left:9%;"><b>SIGPAUSE</b></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">stop accepting new connections,
|
<p style="margin-left:18%;">stop accepting new connections,
|
||||||
on second signal - start and re-read configuration</p>
|
on second signal - start and re-read configuration</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>SIGCONT</b></p>
|
<p style="margin-left:9%;"><b>SIGCONT</b></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">start to accept new
|
<p style="margin-left:18%;">start to accept new
|
||||||
connections</p>
|
connections</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>SIGUSR1</b></p>
|
<p style="margin-left:9%;"><b>SIGUSR1</b></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">reload configuration</p>
|
<p style="margin-left:18%;">reload configuration</p>
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Under Windows,
|
<p style="margin-left:9%; margin-top: 1em">Under Windows,
|
||||||
if <b>3proxy</b> is installed as a service you can use
|
if <b>3proxy</b> is installed as a service you can use
|
||||||
standard service management to start, stop, pause and
|
standard service management to start, stop, pause and
|
||||||
continue the 3proxy service, for example: <b><br>
|
continue the 3proxy service, for example: <b><br>
|
||||||
@@ -165,7 +165,7 @@ net stop 3proxy <br>
|
|||||||
net pause 3proxy <br>
|
net pause 3proxy <br>
|
||||||
net continue 3proxy</b></p>
|
net continue 3proxy</b></p>
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Web admin
|
<p style="margin-left:9%; margin-top: 1em">Web admin
|
||||||
service can also be used to reload configuration. Use wget
|
service can also be used to reload configuration. Use wget
|
||||||
to automate this task.</p>
|
to automate this task.</p>
|
||||||
|
|
||||||
@@ -175,10 +175,10 @@ to automate this task.</p>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><i>/usr/local/3proxy/3proxy.cfg
|
<p style="margin-left:9%; margin-top: 1em"><i>/usr/local/3proxy/3proxy.cfg
|
||||||
(3proxy.cfg)</i></p>
|
(3proxy.cfg)</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;"><b>3proxy</b> configuration
|
<p style="margin-left:18%;"><b>3proxy</b> configuration
|
||||||
file</p>
|
file</p>
|
||||||
|
|
||||||
<h2>BUGS
|
<h2>BUGS
|
||||||
@@ -186,7 +186,7 @@ file</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -194,9 +194,9 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy.cfg(5),
|
<p style="margin-left:9%; margin-top: 1em">3proxy.cfg(5),
|
||||||
proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8),
|
proxy(8), ftppr(8), socks(8), pop3p(8), imapp(8), tcppm(8),
|
||||||
kill(1), syslogd(8), <br>
|
udppm(8), kill(1), syslogd(8), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
|
|
||||||
<h2>AUTHORS
|
<h2>AUTHORS
|
||||||
@@ -204,7 +204,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>3proxy_crypt</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>3proxy_crypt</b>
|
||||||
- utility to generate encrypted passwords for 3proxy</p>
|
- utility to generate encrypted passwords for 3proxy</p>
|
||||||
|
|
||||||
<h2>SYNOPSIS
|
<h2>SYNOPSIS
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>3proxy_crypt</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>3proxy_crypt</b>
|
||||||
<i>password</i> <b><br>
|
<i>password</i> <b><br>
|
||||||
3proxy_crypt</b> <i>salt password</i></p>
|
3proxy_crypt</b> <i>salt password</i></p>
|
||||||
|
|
||||||
@@ -45,23 +45,23 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><i><b>3proxy_crypt</b></i>
|
<p style="margin-left:9%; margin-top: 1em"><i><b>3proxy_crypt</b></i>
|
||||||
is a utility to generate encrypted password hashes for use
|
is a utility to generate encrypted password hashes for use
|
||||||
with 3proxy configuration. Encrypted passwords allow the
|
with 3proxy configuration. Encrypted passwords allow the
|
||||||
system to avoid storing passwords in cleartext in
|
system to avoid storing passwords in cleartext in
|
||||||
configuration files.</p>
|
configuration files.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">When invoked
|
<p style="margin-left:9%; margin-top: 1em">When invoked
|
||||||
with a single argument, it produces an NT password hash
|
with a single argument, it produces an NT password hash
|
||||||
(MD4-based, suitable for NTLM authentication). The output is
|
(MD4-based, suitable for NTLM authentication). The output is
|
||||||
prefixed with <b>NT:</b>.</p>
|
prefixed with <b>NT:</b>.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">When invoked
|
<p style="margin-left:9%; margin-top: 1em">When invoked
|
||||||
with two arguments (salt and password), it produces a
|
with two arguments (salt and password), it produces a
|
||||||
BLAKE2b password hash. The salt length is limited to 64
|
BLAKE2b password hash. The salt length is limited to 64
|
||||||
characters. The output is prefixed with <b>CR:</b>.</p>
|
characters. The output is prefixed with <b>CR:</b>.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">The resulting
|
<p style="margin-left:9%; margin-top: 1em">The resulting
|
||||||
hash can be used in the 3proxy configuration file with the
|
hash can be used in the 3proxy configuration file with the
|
||||||
<b>users</b> directive instead of a cleartext password.</p>
|
<b>users</b> directive instead of a cleartext password.</p>
|
||||||
|
|
||||||
@@ -71,25 +71,25 @@ hash can be used in the 3proxy configuration file with the
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><i>password</i></p>
|
<p style="margin-left:9%; margin-top: 1em"><i>password</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">Cleartext password to
|
<p style="margin-left:18%;">Cleartext password to
|
||||||
encrypt.</p>
|
encrypt.</p>
|
||||||
|
|
||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="5%">
|
<td width="5%">
|
||||||
|
|
||||||
|
|
||||||
<p><i>salt</i></p></td>
|
<p><i>salt</i></p></td>
|
||||||
<td width="4%"></td>
|
<td width="4%"></td>
|
||||||
<td width="65%">
|
<td width="67%">
|
||||||
|
|
||||||
|
|
||||||
<p>Salt string for BLAKE2b hashing (max 64 characters).</p></td>
|
<p>Salt string for BLAKE2b hashing (max 64 characters).</p></td>
|
||||||
<td width="20%">
|
<td width="15%">
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@@ -98,30 +98,30 @@ encrypt.</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Generate NT
|
<p style="margin-left:9%; margin-top: 1em">Generate NT
|
||||||
password hash:</p>
|
password hash:</p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">3proxy_crypt
|
<p style="margin-left:18%;">3proxy_crypt
|
||||||
MySecretPassword</p>
|
MySecretPassword</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;">Result:</p>
|
<p style="margin-left:9%;">Result:</p>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:15%;">NT:3F7E6D8D96E8E7A9B0C1D2E3F4A5B6C7</p>
|
<p style="margin-left:18%;">NT:3F7E6D8D96E8E7A9B0C1D2E3F4A5B6C7</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;">Generate BLAKE2b password hash
|
<p style="margin-left:9%;">Generate BLAKE2b password hash
|
||||||
with salt:</p>
|
with salt:</p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">3proxy_crypt MySalt
|
<p style="margin-left:18%;">3proxy_crypt MySalt
|
||||||
MySecretPassword</p>
|
MySecretPassword</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;">Result:</p>
|
<p style="margin-left:9%;">Result:</p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">CR:$3$MySalt$...</p>
|
<p style="margin-left:18%;">CR:$3$MySalt$...</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;">Using in 3proxy.cfg:</p>
|
<p style="margin-left:9%;">Using in 3proxy.cfg:</p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">users
|
<p style="margin-left:18%;">users
|
||||||
user1:CR:$3$MySalt$...</p>
|
user1:CR:$3$MySalt$...</p>
|
||||||
|
|
||||||
<h2>NOTES
|
<h2>NOTES
|
||||||
@@ -129,11 +129,11 @@ user1:CR:$3$MySalt$...</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">The NT hash uses
|
<p style="margin-left:9%; margin-top: 1em">The NT hash uses
|
||||||
the RSA MD4 Message-Digest Algorithm. The BLAKE2b hash uses
|
the RSA MD4 Message-Digest Algorithm. The BLAKE2b hash uses
|
||||||
the BLAKE2 cryptographic hash function.</p>
|
the BLAKE2 cryptographic hash function.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">When a password
|
<p style="margin-left:9%; margin-top: 1em">When a password
|
||||||
hash is prefixed with <b>NT:</b> or <b>CR:</b>, 3proxy uses
|
hash is prefixed with <b>NT:</b> or <b>CR:</b>, 3proxy uses
|
||||||
the corresponding algorithm to verify passwords instead of
|
the corresponding algorithm to verify passwords instead of
|
||||||
comparing cleartext strings.</p>
|
comparing cleartext strings.</p>
|
||||||
@@ -143,7 +143,7 @@ comparing cleartext strings.</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -151,7 +151,7 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy(8),
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
3proxy.cfg(5), <br>
|
3proxy.cfg(5), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+59
-61
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>ftppr</b> -
|
<p style="margin-left:9%; margin-top: 1em"><b>ftppr</b> -
|
||||||
FTP proxy gateway service</p>
|
FTP proxy gateway service</p>
|
||||||
|
|
||||||
<h2>SYNOPSIS
|
<h2>SYNOPSIS
|
||||||
@@ -32,7 +32,7 @@ FTP proxy gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>ftppr</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>ftppr</b>
|
||||||
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
||||||
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
||||||
[<b>-e</b><i>external_ip</i>]
|
[<b>-e</b><i>external_ip</i>]
|
||||||
@@ -43,7 +43,7 @@ FTP proxy gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>ftppr</b> is
|
<p style="margin-left:9%; margin-top: 1em"><b>ftppr</b> is
|
||||||
FTP gateway service to allow internal users to access
|
FTP gateway service to allow internal users to access
|
||||||
external FTP servers.</p>
|
external FTP servers.</p>
|
||||||
|
|
||||||
@@ -55,81 +55,80 @@ external FTP servers.</p>
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-I</b></p></td>
|
<p style="margin-top: 1em"><b>-I</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Inetd mode. Standalone service
|
<p style="margin-top: 1em">Inetd mode. Standalone service
|
||||||
only.</p> </td></tr>
|
only.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-d</b></p></td>
|
<p><b>-d</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Daemonize. Detach service from
|
<p>Daemonize. Detach service from console and run in the
|
||||||
console and run in the background.</p></td></tr>
|
background.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-t</b></p></td>
|
<p><b>-t</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Be silenT. Do not log
|
<p>Be silenT. Do not log start/stop/accept error
|
||||||
start/stop/accept error records.</p></td></tr>
|
records.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-u</b></p></td>
|
<p><b>-u</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Never look for username
|
<p>Never look for username authentication.</p></td></tr>
|
||||||
authentication.</p> </td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-e</b></p></td>
|
<p><b>-e</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">External address. IP address of
|
<p>External address. IP address of the interface the proxy
|
||||||
the interface the proxy should initiate connections from. By
|
should initiate connections from. By default, the system
|
||||||
default, the system will decide which address to use in
|
will decide which address to use in accordance with the
|
||||||
accordance with the routing table.</p></td></tr>
|
routing table.</p></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ni</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ni</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> before opening
|
network namespace identified by <i>PATH</i> before opening
|
||||||
the listening socket. The current namespace is saved and
|
the listening socket. The current namespace is saved and
|
||||||
restored immediately after binding, so outgoing connections
|
restored immediately after binding, so outgoing connections
|
||||||
run in the original namespace unless <b>-ne</b> is also
|
run in the original namespace unless <b>-ne</b> is also
|
||||||
given.</p>
|
given.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ne</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ne</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> after the
|
network namespace identified by <i>PATH</i> after the
|
||||||
listening socket has been bound (and after restoring from
|
listening socket has been bound (and after restoring from
|
||||||
<b>-ni</b> if applicable). Both options accept any namespace
|
<b>-ni</b> if applicable). Both options accept any namespace
|
||||||
@@ -140,13 +139,13 @@ file path (e.g. <i>/var/run/netns/myns</i> or
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p><b>-i</b></p></td>
|
<p><b>-i</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p>Internal address. IP address the proxy accepts
|
<p>Internal address. IP address the proxy accepts
|
||||||
@@ -156,56 +155,55 @@ be specified with <i>-iunix:/path/to/socket</i> syntax
|
|||||||
(e.g., -iunix:/var/run/ftppr.sock). On Linux, abstract
|
(e.g., -iunix:/var/run/ftppr.sock). On Linux, abstract
|
||||||
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-h</b></p></td>
|
<p><b>-h</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Default destination. It’s
|
<p>Default destination. It’s used if the target
|
||||||
used if the target address is not specified by the user.</p></td></tr>
|
address is not specified by the user.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-p</b></p></td>
|
<p><b>-p</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Port. Port proxy listens for
|
<p>Port. Port proxy listens for incoming connections.
|
||||||
incoming connections. Default is 21.</p></td></tr>
|
Default is 21.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-l</b></p></td>
|
<p><b>-l</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Log. By default logging is to
|
<p>Log. By default logging is to stdout. If <i>logfile</i>
|
||||||
stdout. If <i>logfile</i> is specified logging is to file.
|
is specified logging is to file. Under Unix, if
|
||||||
Under Unix, if ´<i>@</i>´ precedes
|
´<i>@</i>´ precedes <i>logfile</i>, syslog is
|
||||||
<i>logfile</i>, syslog is used for logging.</p></td></tr>
|
used for logging.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-S</b></p></td>
|
<p><b>-S</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Increase or decrease stack size.
|
<p>Increase or decrease stack size. You may want to try
|
||||||
You may want to try something like -S8192 if you experience
|
something like -S8192 if you experience 3proxy crashes.</p></td></tr>
|
||||||
3proxy crashes.</p></td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>CLIENTS
|
<h2>CLIENTS
|
||||||
@@ -213,7 +211,7 @@ You may want to try something like -S8192 if you experience
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">You can use any
|
<p style="margin-left:9%; margin-top: 1em">You can use any
|
||||||
FTP client, regardless of FTP proxy support. For a client
|
FTP client, regardless of FTP proxy support. For a client
|
||||||
with FTP proxy support, configure <i>internal_ip</i> and
|
with FTP proxy support, configure <i>internal_ip</i> and
|
||||||
<i>port</i> in the FTP proxy parameters. For clients without
|
<i>port</i> in the FTP proxy parameters. For clients without
|
||||||
@@ -232,7 +230,7 @@ supported.</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -240,7 +238,7 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy(8),
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
proxy(8), pop3p(8), socks(8), tcppm(8), udppm(8),
|
proxy(8), pop3p(8), socks(8), tcppm(8), udppm(8),
|
||||||
syslogd(8), <br>
|
syslogd(8), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
@@ -250,7 +248,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -0,0 +1,285 @@
|
|||||||
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1 align="center">imapp</h1>
|
||||||
|
|
||||||
|
<a href="#NAME">NAME</a><br>
|
||||||
|
<a href="#SYNOPSIS">SYNOPSIS</a><br>
|
||||||
|
<a href="#DESCRIPTION">DESCRIPTION</a><br>
|
||||||
|
<a href="#OPTIONS">OPTIONS</a><br>
|
||||||
|
<a href="#CLIENTS">CLIENTS</a><br>
|
||||||
|
<a href="#BUGS">BUGS</a><br>
|
||||||
|
<a href="#SEE ALSO">SEE ALSO</a><br>
|
||||||
|
<a href="#AUTHORS">AUTHORS</a><br>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>NAME
|
||||||
|
<a name="NAME"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:9%; margin-top: 1em"><b>imapp</b> -
|
||||||
|
IMAPv4 proxy gateway service</p>
|
||||||
|
|
||||||
|
<h2>SYNOPSIS
|
||||||
|
<a name="SYNOPSIS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:9%; margin-top: 1em"><b>imapp</b>
|
||||||
|
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
||||||
|
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
||||||
|
[<b>-e</b><i>external_ip</i>]
|
||||||
|
[<b>-h</b><i>default_ip[:port]</i>] [<b>-x</b><i>]</i></p>
|
||||||
|
|
||||||
|
<h2>DESCRIPTION
|
||||||
|
<a name="DESCRIPTION"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:9%; margin-top: 1em"><i><b>imapp</b></i>
|
||||||
|
is IMAPv4 (IMAP4rev1) gateway service to allow internal
|
||||||
|
users to access external IMAP servers.</p>
|
||||||
|
|
||||||
|
<h2>OPTIONS
|
||||||
|
<a name="OPTIONS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
|
cellspacing="0" cellpadding="0">
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-top: 1em"><b>-I</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-top: 1em">Inetd mode. Standalone service
|
||||||
|
only.</p> </td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-d</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Daemonize. Detach service from console and run in the
|
||||||
|
background.</p> </td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-t</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Be silenT. Do not log start/stop/accept error
|
||||||
|
records.</p> </td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-u</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Never look for username authentication.</p></td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-e</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>External address. IP address of the interface the proxy
|
||||||
|
should initiate connections from. By default, the system
|
||||||
|
will decide which address to use in accordance with the
|
||||||
|
routing table.</p></td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p style="margin-left:9%;"><b>-ni</b><i>PATH</i></p>
|
||||||
|
|
||||||
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
|
network namespace identified by <i>PATH</i> before opening
|
||||||
|
the listening socket. The current namespace is saved and
|
||||||
|
restored immediately after binding, so outgoing connections
|
||||||
|
run in the original namespace unless <b>-ne</b> is also
|
||||||
|
given.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:9%;"><b>-ne</b><i>PATH</i></p>
|
||||||
|
|
||||||
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
|
network namespace identified by <i>PATH</i> after the
|
||||||
|
listening socket has been bound (and after restoring from
|
||||||
|
<b>-ni</b> if applicable). Both options accept any namespace
|
||||||
|
file path (e.g. <i>/var/run/netns/myns</i> or
|
||||||
|
<i>/proc/PID/ns/net</i>) and require
|
||||||
|
<b>CAP_SYS_ADMIN</b>.</p>
|
||||||
|
|
||||||
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
|
cellspacing="0" cellpadding="0">
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-i</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Internal address. IP address the proxy accepts
|
||||||
|
connections to. By default, connections to any interface are
|
||||||
|
accepted. It´s usually unsafe. Unix domain sockets can
|
||||||
|
be specified with <i>-iunix:/path/to/socket</i> syntax
|
||||||
|
(e.g., -iunix:/var/run/imapp.sock). On Linux, abstract
|
||||||
|
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-p</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Port. Port proxy listens for incoming connections.
|
||||||
|
Default is 143.</p></td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-h</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Default destination. It’s used if the target
|
||||||
|
address is not specified by the user.</p></td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-x</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Disable STARTTLS support. STARTTLS is not announced in
|
||||||
|
the CAPABILITY response and the STARTTLS command is not
|
||||||
|
accepted.</p> </td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-l</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Log. By default logging is to stdout. If <i>logfile</i>
|
||||||
|
is specified logging is to file. Under Unix, if
|
||||||
|
´<i>@</i>´ precedes <i>logfile</i>, syslog is
|
||||||
|
used for logging.</p></td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-S</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Increase or decrease stack size. You may want to try
|
||||||
|
something like -S8192 if you experience 3proxy crashes.</p></td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h2>CLIENTS
|
||||||
|
<a name="CLIENTS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:9%; margin-top: 1em">You can use any
|
||||||
|
MUA (Mail User Agent) with IMAPv4 support. Set the client to
|
||||||
|
use <i>internal_ip</i> and <i>port</i> as an IMAP server.
|
||||||
|
The address of the real IMAP server must be configured as a
|
||||||
|
part of the IMAP username. The format for the username is
|
||||||
|
<i>username</i>@<i>server</i>, where <i>server</i> is the
|
||||||
|
address of the IMAP server and <i>username</i> is the
|
||||||
|
user´s login on this IMAP server. The login itself may
|
||||||
|
contain an ´@´ sign. Supported client
|
||||||
|
authentication methods are the LOGIN command, AUTHENTICATE
|
||||||
|
PLAIN and AUTHENTICATE LOGIN. With the server, the proxy
|
||||||
|
authenticates using the method chosen by the client if the
|
||||||
|
server supports it (as advertised in the CAPABILITY
|
||||||
|
response); otherwise it falls back to AUTHENTICATE LOGIN,
|
||||||
|
AUTHENTICATE PLAIN or the LOGIN command, in this order of
|
||||||
|
preference. Challenge-response authentication (CRAM-MD5,
|
||||||
|
etc.) is not supported, because it requires a challenge from
|
||||||
|
the server before we know which server to connect to. When
|
||||||
|
running as a 3proxy service (not as a standalone binary),
|
||||||
|
STARTTLS is supported and announced in the CAPABILITY
|
||||||
|
response unless disabled with <b>-x</b>. After the client
|
||||||
|
issues STARTTLS, the connection is handled by
|
||||||
|
<b>tlspr</b>(8): the destination host is taken from the SNI
|
||||||
|
of the client TLS handshake (or from the -h option), the
|
||||||
|
proxy performs STARTTLS negotiation with the destination
|
||||||
|
server, and then transparently passes TLS traffic between
|
||||||
|
the client and the server. If the destination server does
|
||||||
|
not support STARTTLS, the TLS handshake with the client
|
||||||
|
fails.</p>
|
||||||
|
|
||||||
|
<h2>BUGS
|
||||||
|
<a name="BUGS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
|
<h2>SEE ALSO
|
||||||
|
<a name="SEE ALSO"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
|
ftppr(8), pop3p(8), proxy(8), smtpp(8), socks(8), tcppm(8),
|
||||||
|
tlspr(8), udppm(8), syslogd(8), <br>
|
||||||
|
https://3proxy.org/</p>
|
||||||
|
|
||||||
|
<h2>AUTHORS
|
||||||
|
<a name="AUTHORS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
|
<hr>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+86
-65
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>pop3p</b> -
|
<p style="margin-left:9%; margin-top: 1em"><b>pop3p</b> -
|
||||||
POP3 proxy gateway service</p>
|
POP3 proxy gateway service</p>
|
||||||
|
|
||||||
<h2>SYNOPSIS
|
<h2>SYNOPSIS
|
||||||
@@ -32,19 +32,20 @@ POP3 proxy gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>pop3p</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>pop3p</b>
|
||||||
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
||||||
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
||||||
[<b>-e</b><i>external_ip</i>]
|
[<b>-e</b><i>external_ip</i>]
|
||||||
[<b>-h</b><i>default_ip[:port]</i>]</p>
|
[<b>-h</b><i>default_ip[:port]</i>] [<b>-x</b><i>]</i></p>
|
||||||
|
|
||||||
<h2>DESCRIPTION
|
<h2>DESCRIPTION
|
||||||
<a name="DESCRIPTION"></a>
|
<a name="DESCRIPTION"></a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>pop3p</b> is
|
|
||||||
POP3 gateway service to allow internal users to access
|
<p style="margin-left:9%; margin-top: 1em"><i><b>pop3p</b></i>
|
||||||
|
is POP3 gateway service to allow internal users to access
|
||||||
external POP3 servers.</p>
|
external POP3 servers.</p>
|
||||||
|
|
||||||
<h2>OPTIONS
|
<h2>OPTIONS
|
||||||
@@ -55,81 +56,80 @@ external POP3 servers.</p>
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-I</b></p></td>
|
<p style="margin-top: 1em"><b>-I</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Inetd mode. Standalone service
|
<p style="margin-top: 1em">Inetd mode. Standalone service
|
||||||
only.</p> </td></tr>
|
only.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-d</b></p></td>
|
<p><b>-d</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Daemonize. Detach service from
|
<p>Daemonize. Detach service from console and run in the
|
||||||
console and run in the background.</p></td></tr>
|
background.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-t</b></p></td>
|
<p><b>-t</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Be silenT. Do not log
|
<p>Be silenT. Do not log start/stop/accept error
|
||||||
start/stop/accept error records.</p></td></tr>
|
records.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-u</b></p></td>
|
<p><b>-u</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Never look for username
|
<p>Never look for username authentication.</p></td></tr>
|
||||||
authentication.</p> </td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-e</b></p></td>
|
<p><b>-e</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">External address. IP address of
|
<p>External address. IP address of the interface the proxy
|
||||||
the interface the proxy should initiate connections from. By
|
should initiate connections from. By default, the system
|
||||||
default, the system will decide which address to use in
|
will decide which address to use in accordance with the
|
||||||
accordance with the routing table.</p></td></tr>
|
routing table.</p></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ni</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ni</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> before opening
|
network namespace identified by <i>PATH</i> before opening
|
||||||
the listening socket. The current namespace is saved and
|
the listening socket. The current namespace is saved and
|
||||||
restored immediately after binding, so outgoing connections
|
restored immediately after binding, so outgoing connections
|
||||||
run in the original namespace unless <b>-ne</b> is also
|
run in the original namespace unless <b>-ne</b> is also
|
||||||
given.</p>
|
given.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ne</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ne</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> after the
|
network namespace identified by <i>PATH</i> after the
|
||||||
listening socket has been bound (and after restoring from
|
listening socket has been bound (and after restoring from
|
||||||
<b>-ni</b> if applicable). Both options accept any namespace
|
<b>-ni</b> if applicable). Both options accept any namespace
|
||||||
@@ -140,13 +140,13 @@ file path (e.g. <i>/var/run/netns/myns</i> or
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p><b>-i</b></p></td>
|
<p><b>-i</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p>Internal address. IP address the proxy accepts
|
<p>Internal address. IP address the proxy accepts
|
||||||
@@ -156,56 +156,68 @@ be specified with <i>-iunix:/path/to/socket</i> syntax
|
|||||||
(e.g., -iunix:/var/run/pop3p.sock). On Linux, abstract
|
(e.g., -iunix:/var/run/pop3p.sock). On Linux, abstract
|
||||||
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-p</b></p></td>
|
<p><b>-p</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Port. Port proxy listens for
|
<p>Port. Port proxy listens for incoming connections.
|
||||||
incoming connections. Default is 110.</p></td></tr>
|
Default is 110.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-h</b></p></td>
|
<p><b>-h</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Default destination. It’s
|
<p>Default destination. It’s used if the target
|
||||||
used if the target address is not specified by the user.</p></td></tr>
|
address is not specified by the user.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-l</b></p></td>
|
<p><b>-x</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Log. By default logging is to
|
<p>Disable STARTTLS (STLS) support. STLS is not announced
|
||||||
stdout. If <i>logfile</i> is specified logging is to file.
|
in the CAPA response and the STLS command is not
|
||||||
Under Unix, if ´<i>@</i>´ precedes
|
accepted.</p> </td></tr>
|
||||||
<i>logfile</i>, syslog is used for logging.</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-S</b></p></td>
|
<p><b>-l</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Increase or decrease stack size.
|
<p>Log. By default logging is to stdout. If <i>logfile</i>
|
||||||
You may want to try something like -S8192 if you experience
|
is specified logging is to file. Under Unix, if
|
||||||
3proxy crashes.</p></td></tr>
|
´<i>@</i>´ precedes <i>logfile</i>, syslog is
|
||||||
|
used for logging.</p></td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-S</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Increase or decrease stack size. You may want to try
|
||||||
|
something like -S8192 if you experience 3proxy crashes.</p></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>CLIENTS
|
<h2>CLIENTS
|
||||||
@@ -213,7 +225,7 @@ You may want to try something like -S8192 if you experience
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">You can use any
|
<p style="margin-left:9%; margin-top: 1em">You can use any
|
||||||
MUA (Mail User Agent) with POP3 support. Set the client to
|
MUA (Mail User Agent) with POP3 support. Set the client to
|
||||||
use <i>internal_ip</i> and <i>port</i> as a POP3 server. The
|
use <i>internal_ip</i> and <i>port</i> as a POP3 server. The
|
||||||
address of the real POP3 server must be configured as a part
|
address of the real POP3 server must be configured as a part
|
||||||
@@ -224,15 +236,24 @@ user´s login on this POP3 server. The login itself may
|
|||||||
contain an ´@´ sign. Only cleartext
|
contain an ´@´ sign. Only cleartext
|
||||||
authentication is supported, because challenge-response
|
authentication is supported, because challenge-response
|
||||||
authentication (APOP, CRAM-MD5, etc.) requires a challenge
|
authentication (APOP, CRAM-MD5, etc.) requires a challenge
|
||||||
from the server before we know which server to connect
|
from the server before we know which server to connect to.
|
||||||
to.</p>
|
When running as a 3proxy service (not as a standalone
|
||||||
|
binary), STLS is supported and announced in the CAPA
|
||||||
|
response unless disabled with <b>-x</b>. After the client
|
||||||
|
issues STLS, the connection is handled by <b>tlspr</b>(8):
|
||||||
|
the destination host is taken from the SNI of the client TLS
|
||||||
|
handshake (or from the -h option), the proxy performs STLS
|
||||||
|
negotiation with the destination server, and then
|
||||||
|
transparently passes TLS traffic between the client and the
|
||||||
|
server. If the destination server does not support STLS, the
|
||||||
|
TLS handshake with the client fails.</p>
|
||||||
|
|
||||||
<h2>BUGS
|
<h2>BUGS
|
||||||
<a name="BUGS"></a>
|
<a name="BUGS"></a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -240,7 +261,7 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy(8),
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
ftppr(8), proxy(8), socks(8), tcppm(8), udppm(8),
|
ftppr(8), proxy(8), socks(8), tcppm(8), udppm(8),
|
||||||
syslogd(8), <br>
|
syslogd(8), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
@@ -250,7 +271,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+62
-66
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>proxy</b> -
|
<p style="margin-left:9%; margin-top: 1em"><b>proxy</b> -
|
||||||
HTTP proxy gateway service</p>
|
HTTP proxy gateway service</p>
|
||||||
|
|
||||||
<h2>SYNOPSIS
|
<h2>SYNOPSIS
|
||||||
@@ -32,7 +32,7 @@ HTTP proxy gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>proxy</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>proxy</b>
|
||||||
[<b>-d</b>][<b>-a</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
[<b>-d</b>][<b>-a</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
||||||
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
||||||
[<b>-e</b><i>external_ip</i>]</p>
|
[<b>-e</b><i>external_ip</i>]</p>
|
||||||
@@ -42,7 +42,7 @@ HTTP proxy gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>proxy</b> is
|
<p style="margin-left:9%; margin-top: 1em"><b>proxy</b> is
|
||||||
HTTP gateway service with HTTPS and FTP over HTTPS
|
HTTP gateway service with HTTPS and FTP over HTTPS
|
||||||
support.</p>
|
support.</p>
|
||||||
|
|
||||||
@@ -54,81 +54,80 @@ support.</p>
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-I</b></p></td>
|
<p style="margin-top: 1em"><b>-I</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Inetd mode. Standalone service
|
<p style="margin-top: 1em">Inetd mode. Standalone service
|
||||||
only.</p> </td></tr>
|
only.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-d</b></p></td>
|
<p><b>-d</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Daemonize. Detach service from
|
<p>Daemonize. Detach service from console and run in the
|
||||||
console and run in the background.</p></td></tr>
|
background.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-t</b></p></td>
|
<p><b>-t</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Be silenT. Do not log
|
<p>Be silenT. Do not log start/stop/accept error
|
||||||
start/stop/accept error records.</p></td></tr>
|
records.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-u</b></p></td>
|
<p><b>-u</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Never ask for username
|
<p>Never ask for username authentication</p></td></tr>
|
||||||
authentication</p> </td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-e</b></p></td>
|
<p><b>-e</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">External address. IP address of
|
<p>External address. IP address of the interface the proxy
|
||||||
the interface the proxy should initiate connections from. By
|
should initiate connections from. By default, the system
|
||||||
default, the system will decide which address to use in
|
will decide which address to use in accordance with the
|
||||||
accordance with the routing table.</p></td></tr>
|
routing table.</p></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ni</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ni</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> before opening
|
network namespace identified by <i>PATH</i> before opening
|
||||||
the listening socket. The current namespace is saved and
|
the listening socket. The current namespace is saved and
|
||||||
restored immediately after binding, so outgoing connections
|
restored immediately after binding, so outgoing connections
|
||||||
run in the original namespace unless <b>-ne</b> is also
|
run in the original namespace unless <b>-ne</b> is also
|
||||||
given.</p>
|
given.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ne</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ne</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> after the
|
network namespace identified by <i>PATH</i> after the
|
||||||
listening socket has been bound (and after restoring from
|
listening socket has been bound (and after restoring from
|
||||||
<b>-ni</b> if applicable). Both options accept any namespace
|
<b>-ni</b> if applicable). Both options accept any namespace
|
||||||
@@ -139,13 +138,13 @@ file path (e.g. <i>/var/run/netns/myns</i> or
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p><b>-i</b></p></td>
|
<p><b>-i</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p>Internal address. IP address the proxy accepts
|
<p>Internal address. IP address the proxy accepts
|
||||||
@@ -155,68 +154,65 @@ be specified with <i>-iunix:/path/to/socket</i> syntax
|
|||||||
(e.g., -iunix:/var/run/proxy.sock). On Linux, abstract
|
(e.g., -iunix:/var/run/proxy.sock). On Linux, abstract
|
||||||
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-a</b></p></td>
|
<p><b>-a</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Anonymous. Hide information
|
<p>Anonymous. Hide information about client.</p></td></tr>
|
||||||
about client.</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-a1</b></p></td>
|
<p><b>-a1</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Anonymous. Show fake information
|
<p>Anonymous. Show fake information about client.</p></td></tr>
|
||||||
about client.</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-p</b></p></td>
|
<p><b>-p</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Port. Port proxy listens for
|
<p>Port. Port proxy listens for incoming connections.
|
||||||
incoming connections. Default is 3128.</p></td></tr>
|
Default is 3128.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-l</b></p></td>
|
<p><b>-l</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Log. By default logging is to
|
<p>Log. By default logging is to stdout. If <i>logfile</i>
|
||||||
stdout. If <i>logfile</i> is specified logging is to file.
|
is specified logging is to file. Under Unix, if
|
||||||
Under Unix, if ´<i>@</i>´ preceeds
|
´<i>@</i>´ preceeds <i>logfile</i>, syslog is
|
||||||
<i>logfile</i>, syslog is used for logging.</p></td></tr>
|
used for logging.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-S</b></p></td>
|
<p><b>-S</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Increase or decrease stack size.
|
<p>Increase or decrease stack size. You may want to try
|
||||||
You may want to try something like -S8192 if you experience
|
something like -S8192 if you experience 3proxy crashes.</p></td></tr>
|
||||||
3proxy crashes.</p></td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>CLIENTS
|
<h2>CLIENTS
|
||||||
@@ -224,7 +220,7 @@ You may want to try something like -S8192 if you experience
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">You should use a
|
<p style="margin-left:9%; margin-top: 1em">You should use a
|
||||||
client with HTTP proxy support or configure a router to
|
client with HTTP proxy support or configure a router to
|
||||||
redirect HTTP traffic to the proxy (transparent proxy).
|
redirect HTTP traffic to the proxy (transparent proxy).
|
||||||
Configure the client to connect to <i>internal_ip</i> and
|
Configure the client to connect to <i>internal_ip</i> and
|
||||||
@@ -237,7 +233,7 @@ TCP-based protocol. If you need to limit clients, use
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -245,7 +241,7 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy(8),
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8),
|
ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8),
|
||||||
syslogd(8), <br>
|
syslogd(8), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
@@ -255,7 +251,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+86
-64
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>smtpp</b> -
|
<p style="margin-left:9%; margin-top: 1em"><b>smtpp</b> -
|
||||||
SMTP proxy gateway service</p>
|
SMTP proxy gateway service</p>
|
||||||
|
|
||||||
<h2>SYNOPSIS
|
<h2>SYNOPSIS
|
||||||
@@ -32,19 +32,20 @@ SMTP proxy gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>smtpp</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>smtpp</b>
|
||||||
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
||||||
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
||||||
[<b>-e</b><i>external_ip</i>]
|
[<b>-e</b><i>external_ip</i>]
|
||||||
[<b>-h</b><i>default_ip[:port]</i>]</p>
|
[<b>-h</b><i>default_ip[:port]</i>] [<b>-x</b><i>]</i></p>
|
||||||
|
|
||||||
<h2>DESCRIPTION
|
<h2>DESCRIPTION
|
||||||
<a name="DESCRIPTION"></a>
|
<a name="DESCRIPTION"></a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>smtpp</b> is
|
|
||||||
SMTP gateway service to allow internal users to access
|
<p style="margin-left:9%; margin-top: 1em"><i><b>smtpp</b></i>
|
||||||
|
is SMTP gateway service to allow internal users to access
|
||||||
external SMTP servers.</p>
|
external SMTP servers.</p>
|
||||||
|
|
||||||
<h2>OPTIONS
|
<h2>OPTIONS
|
||||||
@@ -55,81 +56,80 @@ external SMTP servers.</p>
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-I</b></p></td>
|
<p style="margin-top: 1em"><b>-I</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Inetd mode. Standalone service
|
<p style="margin-top: 1em">Inetd mode. Standalone service
|
||||||
only.</p> </td></tr>
|
only.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-d</b></p></td>
|
<p><b>-d</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Daemonize. Detach service from
|
<p>Daemonize. Detach service from console and run in the
|
||||||
console and run in the background.</p></td></tr>
|
background.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-t</b></p></td>
|
<p><b>-t</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Be silenT. Do not log
|
<p>Be silenT. Do not log start/stop/accept error
|
||||||
start/stop/accept error records.</p></td></tr>
|
records.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-u</b></p></td>
|
<p><b>-u</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Never look for username
|
<p>Never look for username authentication.</p></td></tr>
|
||||||
authentication.</p> </td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-e</b></p></td>
|
<p><b>-e</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">External address. IP address of
|
<p>External address. IP address of the interface the proxy
|
||||||
the interface the proxy should initiate connections from. By
|
should initiate connections from. By default, the system
|
||||||
default, the system will decide which address to use in
|
will decide which address to use in accordance with the
|
||||||
accordance with the routing table.</p></td></tr>
|
routing table.</p></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ni</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ni</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> before opening
|
network namespace identified by <i>PATH</i> before opening
|
||||||
the listening socket. The current namespace is saved and
|
the listening socket. The current namespace is saved and
|
||||||
restored immediately after binding, so outgoing connections
|
restored immediately after binding, so outgoing connections
|
||||||
run in the original namespace unless <b>-ne</b> is also
|
run in the original namespace unless <b>-ne</b> is also
|
||||||
given.</p>
|
given.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ne</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ne</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> after the
|
network namespace identified by <i>PATH</i> after the
|
||||||
listening socket has been bound (and after restoring from
|
listening socket has been bound (and after restoring from
|
||||||
<b>-ni</b> if applicable). Both options accept any namespace
|
<b>-ni</b> if applicable). Both options accept any namespace
|
||||||
@@ -140,13 +140,13 @@ file path (e.g. <i>/var/run/netns/myns</i> or
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p><b>-i</b></p></td>
|
<p><b>-i</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p>Internal address. IP address the proxy accepts
|
<p>Internal address. IP address the proxy accepts
|
||||||
@@ -156,56 +156,68 @@ be specified with <i>-iunix:/path/to/socket</i> syntax
|
|||||||
(e.g., -iunix:/var/run/smtpp.sock). On Linux, abstract
|
(e.g., -iunix:/var/run/smtpp.sock). On Linux, abstract
|
||||||
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-p</b></p></td>
|
<p><b>-p</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Port. Port proxy listens for
|
<p>Port. Port proxy listens for incoming connections.
|
||||||
incoming connections. Default is 25.</p></td></tr>
|
Default is 587.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-h</b></p></td>
|
<p><b>-h</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Default destination. It’s
|
<p>Default destination. It’s used if the target
|
||||||
used if the target address is not specified by the user.</p></td></tr>
|
address is not specified by the user.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-l</b></p></td>
|
<p><b>-x</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Log. By default logging is to
|
<p>Disable STARTTLS support. STARTTLS is not announced in
|
||||||
stdout. If <i>logfile</i> is specified logging is to file.
|
the EHLO response and the STARTTLS command is not
|
||||||
Under Unix, if ´<i>@</i>´ precedes
|
accepted.</p> </td></tr>
|
||||||
<i>logfile</i>, syslog is used for logging.</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-S</b></p></td>
|
<p><b>-l</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Increase or decrease stack size.
|
<p>Log. By default logging is to stdout. If <i>logfile</i>
|
||||||
You may want to try something like -S8192 if you experience
|
is specified logging is to file. Under Unix, if
|
||||||
3proxy crashes.</p></td></tr>
|
´<i>@</i>´ precedes <i>logfile</i>, syslog is
|
||||||
|
used for logging.</p></td></tr>
|
||||||
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-S</b></p></td>
|
||||||
|
<td width="6%"></td>
|
||||||
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
|
<p>Increase or decrease stack size. You may want to try
|
||||||
|
something like -S8192 if you experience 3proxy crashes.</p></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>CLIENTS
|
<h2>CLIENTS
|
||||||
@@ -213,7 +225,7 @@ You may want to try something like -S8192 if you experience
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">You can use any
|
<p style="margin-left:9%; margin-top: 1em">You can use any
|
||||||
MUA (Mail User Agent) with SMTP authentication support. Set
|
MUA (Mail User Agent) with SMTP authentication support. Set
|
||||||
the client to use <i>internal_ip</i> and <i>port</i> as an
|
the client to use <i>internal_ip</i> and <i>port</i> as an
|
||||||
SMTP server. The address of the real SMTP server must be
|
SMTP server. The address of the real SMTP server must be
|
||||||
@@ -225,14 +237,24 @@ server. The login itself may contain an ´@´
|
|||||||
sign. Only cleartext authentication is supported, because
|
sign. Only cleartext authentication is supported, because
|
||||||
challenge-response authentication (CRAM-MD5, SPA, etc.)
|
challenge-response authentication (CRAM-MD5, SPA, etc.)
|
||||||
requires a challenge from the server before we know which
|
requires a challenge from the server before we know which
|
||||||
server to connect to.</p>
|
server to connect to. When running as a 3proxy service (not
|
||||||
|
as a standalone binary), STARTTLS is supported and announced
|
||||||
|
in the EHLO response unless disabled with <b>-x</b>. After
|
||||||
|
the client issues STARTTLS, the connection is handled by
|
||||||
|
<b>tlspr</b>(8): the destination host is taken from the SNI
|
||||||
|
of the client TLS handshake (or from the -h option), the
|
||||||
|
proxy performs STARTTLS negotiation with the destination
|
||||||
|
server, and then transparently passes TLS traffic between
|
||||||
|
the client and the server. If the destination server does
|
||||||
|
not support STARTTLS, the TLS handshake with the client
|
||||||
|
fails.</p>
|
||||||
|
|
||||||
<h2>BUGS
|
<h2>BUGS
|
||||||
<a name="BUGS"></a>
|
<a name="BUGS"></a>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -240,7 +262,7 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy(8),
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
ftppr(8), proxy(8), socks(8), tcppm(8), udppm(8),
|
ftppr(8), proxy(8), socks(8), tcppm(8), udppm(8),
|
||||||
syslogd(8), <br>
|
syslogd(8), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
@@ -250,7 +272,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+73
-76
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>socks</b> -
|
<p style="margin-left:9%; margin-top: 1em"><b>socks</b> -
|
||||||
SOCKS 4/4.5/5 gateway service</p>
|
SOCKS 4/4.5/5 gateway service</p>
|
||||||
|
|
||||||
<h2>SYNOPSIS
|
<h2>SYNOPSIS
|
||||||
@@ -32,7 +32,7 @@ SOCKS 4/4.5/5 gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>socks</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>socks</b>
|
||||||
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
||||||
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
[<b>-p</b><i>port</i>] [<b>-i</b><i>internal_ip</i>]
|
||||||
[<b>-e</b><i>external_ip</i>]</p>
|
[<b>-e</b><i>external_ip</i>]</p>
|
||||||
@@ -42,7 +42,7 @@ SOCKS 4/4.5/5 gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>socks</b> is
|
<p style="margin-left:9%; margin-top: 1em"><b>socks</b> is
|
||||||
SOCKS server. It supports SOCKSv4, SOCKSv4.5 (extension to
|
SOCKS server. It supports SOCKSv4, SOCKSv4.5 (extension to
|
||||||
v4 for server side name resolution) and SOCKSv5. SOCKSv5
|
v4 for server side name resolution) and SOCKSv5. SOCKSv5
|
||||||
specification allows both outgoing and reverse TCP
|
specification allows both outgoing and reverse TCP
|
||||||
@@ -56,82 +56,81 @@ connections and UDP portmapping.</p>
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-I</b></p></td>
|
<p style="margin-top: 1em"><b>-I</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Inetd mode. Standalone service
|
<p style="margin-top: 1em">Inetd mode. Standalone service
|
||||||
only.</p> </td></tr>
|
only.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-d</b></p></td>
|
<p><b>-d</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Daemonize. Detach service from
|
<p>Daemonize. Detach service from console and run in the
|
||||||
console and run in the background.</p></td></tr>
|
background.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-t</b></p></td>
|
<p><b>-t</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Be silenT. Do not log
|
<p>Be silenT. Do not log start/stop/accept error
|
||||||
start/stop/accept error records.</p></td></tr>
|
records.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-u</b></p></td>
|
<p><b>-u</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Never ask for username
|
<p>Never ask for username authentication</p></td></tr>
|
||||||
authentication</p> </td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-e</b></p></td>
|
<p><b>-e</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">External address. IP address of
|
<p>External address. IP address of the interface the proxy
|
||||||
the interface the proxy should initiate connections from.
|
should initiate connections from. External IP must be
|
||||||
External IP must be specified if you need incoming
|
specified if you need incoming connections. By default, the
|
||||||
connections. By default, the system will decide which
|
system will decide which address to use in accordance with
|
||||||
address to use in accordance with the routing table.</p></td></tr>
|
the routing table.</p></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ni</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ni</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> before opening
|
network namespace identified by <i>PATH</i> before opening
|
||||||
the listening socket. The current namespace is saved and
|
the listening socket. The current namespace is saved and
|
||||||
restored immediately after binding, so outgoing connections
|
restored immediately after binding, so outgoing connections
|
||||||
run in the original namespace unless <b>-ne</b> is also
|
run in the original namespace unless <b>-ne</b> is also
|
||||||
given.</p>
|
given.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ne</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ne</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> after the
|
network namespace identified by <i>PATH</i> after the
|
||||||
listening socket has been bound (and after restoring from
|
listening socket has been bound (and after restoring from
|
||||||
<b>-ni</b> if applicable). Both options accept any namespace
|
<b>-ni</b> if applicable). Both options accept any namespace
|
||||||
@@ -142,13 +141,13 @@ file path (e.g. <i>/var/run/netns/myns</i> or
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p><b>-Ne</b></p></td>
|
<p><b>-Ne</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p>External NAT address 3proxy reports to client for
|
<p>External NAT address 3proxy reports to client for
|
||||||
@@ -157,77 +156,75 @@ and destination server. By default, the external address is
|
|||||||
reported. It’s only useful in the case of IP-IP NAT
|
reported. It’s only useful in the case of IP-IP NAT
|
||||||
and does not work with port translation.</p></td></tr>
|
and does not work with port translation.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-Ni</b></p></td>
|
<p><b>-Ni</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Internal NAT address 3proxy
|
<p>Internal NAT address 3proxy reports to client for
|
||||||
reports to client for UDPASSOC. This is external address of
|
UDPASSOC. This is external address of the NAT between 3proxy
|
||||||
the NAT between 3proxy and the client, client uses to
|
and the client, client uses to connect to 3proxy. By
|
||||||
connect to 3proxy. By default, the internal address is
|
default, the internal address is reported. It’s only
|
||||||
reported. It’s only useful in the case of IP-IP NAT
|
useful in the case of IP-IP NAT and does not work with port
|
||||||
and does not work with port translation.</p></td></tr>
|
translation.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-i</b></p></td>
|
<p><b>-i</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Internal address. IP address the
|
<p>Internal address. IP address the proxy accepts
|
||||||
proxy accepts connections to. By default, connections to any
|
connections to. By default, connections to any interface are
|
||||||
interface are accepted. It´s usually unsafe. Unix
|
accepted. It´s usually unsafe. Unix domain sockets can
|
||||||
domain sockets can be specified with
|
be specified with <i>-iunix:/path/to/socket</i> syntax
|
||||||
<i>-iunix:/path/to/socket</i> syntax (e.g.,
|
(e.g., -iunix:/var/run/socks.sock). On Linux, abstract
|
||||||
-iunix:/var/run/socks.sock). On Linux, abstract sockets use
|
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
||||||
<i>-iunix:@socketname</i> syntax.</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-p</b></p></td>
|
<p><b>-p</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Port. Port proxy listens for
|
<p>Port. Port proxy listens for incoming connections.
|
||||||
incoming connections. Default is 1080.</p></td></tr>
|
Default is 1080.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-l</b></p></td>
|
<p><b>-l</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Log. By default logging is to
|
<p>Log. By default logging is to stdout. If <i>logfile</i>
|
||||||
stdout. If <i>logfile</i> is specified logging is to file.
|
is specified logging is to file. Under Unix, if
|
||||||
Under Unix, if ´<i>@</i>´ preceeds
|
´<i>@</i>´ preceeds <i>logfile</i>, syslog is
|
||||||
<i>logfile</i>, syslog is used for logging.</p></td></tr>
|
used for logging.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-S</b></p></td>
|
<p><b>-S</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Increase or decrease stack size.
|
<p>Increase or decrease stack size. You may want to try
|
||||||
You may want to try something like -S8192 if you experience
|
something like -S8192 if you experience 3proxy crashes.</p></td></tr>
|
||||||
3proxy crashes.</p></td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>CLIENTS
|
<h2>CLIENTS
|
||||||
@@ -235,7 +232,7 @@ You may want to try something like -S8192 if you experience
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">You should use a
|
<p style="margin-left:9%; margin-top: 1em">You should use a
|
||||||
client with SOCKS support or use some socksification support
|
client with SOCKS support or use some socksification support
|
||||||
(for example <i>SocksCAP</i> or <i>FreeCAP</i>). Configure
|
(for example <i>SocksCAP</i> or <i>FreeCAP</i>). Configure
|
||||||
client to use <i>internal_ip</i> and <i>port</i>. SOCKS
|
client to use <i>internal_ip</i> and <i>port</i>. SOCKS
|
||||||
@@ -250,7 +247,7 @@ privileges). If you need to control access, use
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -258,7 +255,7 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy(8),
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
proxy(8), ftppr(8), pop3p(8), tcppm(8), udppm(8),
|
proxy(8), ftppr(8), pop3p(8), tcppm(8), udppm(8),
|
||||||
syslogd(8), <br>
|
syslogd(8), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
@@ -268,7 +265,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+51
-52
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>tcppm</b> -
|
<p style="margin-left:9%; margin-top: 1em"><b>tcppm</b> -
|
||||||
TCP port mapper</p>
|
TCP port mapper</p>
|
||||||
|
|
||||||
<h2>SYNOPSIS
|
<h2>SYNOPSIS
|
||||||
@@ -33,7 +33,7 @@ TCP port mapper</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>tcppm</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>tcppm</b>
|
||||||
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
[<b>-d</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
||||||
[<b>-i</b><i>internal_ip</i>] [<b>-e</b><i>external_ip</i>]
|
[<b>-i</b><i>internal_ip</i>] [<b>-e</b><i>external_ip</i>]
|
||||||
<i>local_port remote_host remote_port</i></p>
|
<i>local_port remote_host remote_port</i></p>
|
||||||
@@ -44,7 +44,7 @@ TCP port mapper</p>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><i><b>tcppm</b></i>
|
<p style="margin-left:9%; margin-top: 1em"><i><b>tcppm</b></i>
|
||||||
forwards connections from local to remote TCP port</p>
|
forwards connections from local to remote TCP port</p>
|
||||||
|
|
||||||
<h2>OPTIONS
|
<h2>OPTIONS
|
||||||
@@ -55,69 +55,69 @@ forwards connections from local to remote TCP port</p>
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-I</b></p></td>
|
<p style="margin-top: 1em"><b>-I</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Inetd mode. Standalone service
|
<p style="margin-top: 1em">Inetd mode. Standalone service
|
||||||
only.</p> </td></tr>
|
only.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-d</b></p></td>
|
<p><b>-d</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Daemonize. Detach service from
|
<p>Daemonize. Detach service from console and run in the
|
||||||
console and run in the background.</p></td></tr>
|
background.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-t</b></p></td>
|
<p><b>-t</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Be silenT. Do not log
|
<p>Be silenT. Do not log start/stop/accept error
|
||||||
start/stop/accept error records.</p></td></tr>
|
records.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-e</b></p></td>
|
<p><b>-e</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">External address. IP address of
|
<p>External address. IP address of the interface the proxy
|
||||||
the interface the proxy should initiate connections from. By
|
should initiate connections from. By default, the system
|
||||||
default, the system will decide which address to use in
|
will decide which address to use in accordance with the
|
||||||
accordance with the routing table.</p></td></tr>
|
routing table.</p></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ni</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ni</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> before opening
|
network namespace identified by <i>PATH</i> before opening
|
||||||
the listening socket. The current namespace is saved and
|
the listening socket. The current namespace is saved and
|
||||||
restored immediately after binding, so outgoing connections
|
restored immediately after binding, so outgoing connections
|
||||||
run in the original namespace unless <b>-ne</b> is also
|
run in the original namespace unless <b>-ne</b> is also
|
||||||
given.</p>
|
given.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ne</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ne</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> after the
|
network namespace identified by <i>PATH</i> after the
|
||||||
listening socket has been bound (and after restoring from
|
listening socket has been bound (and after restoring from
|
||||||
<b>-ni</b> if applicable). Both options accept any namespace
|
<b>-ni</b> if applicable). Both options accept any namespace
|
||||||
@@ -128,13 +128,13 @@ file path (e.g. <i>/var/run/netns/myns</i> or
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p><b>-i</b></p></td>
|
<p><b>-i</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p>Internal address. IP address the proxy accepts
|
<p>Internal address. IP address the proxy accepts
|
||||||
@@ -144,32 +144,31 @@ be specified with <i>-iunix:/path/to/socket</i> syntax
|
|||||||
(e.g., -iunix:/var/run/tcppm.sock). On Linux, abstract
|
(e.g., -iunix:/var/run/tcppm.sock). On Linux, abstract
|
||||||
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-l</b></p></td>
|
<p><b>-l</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Log. By default logging is to
|
<p>Log. By default logging is to stdout. If <i>logfile</i>
|
||||||
stdout. If <i>logfile</i> is specified logging is to file.
|
is specified logging is to file. Under Unix, if
|
||||||
Under Unix, if ´<i>@</i>´ precedes
|
´<i>@</i>´ precedes <i>logfile</i>, syslog is
|
||||||
<i>logfile</i>, syslog is used for logging.</p></td></tr>
|
used for logging.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-S</b></p></td>
|
<p><b>-S</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Increase or decrease stack size.
|
<p>Increase or decrease stack size. You may want to try
|
||||||
You may want to try something like -S8192 if you experience
|
something like -S8192 if you experience 3proxy crashes.</p></td></tr>
|
||||||
3proxy crashes.</p></td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>ARGUMENTS
|
<h2>ARGUMENTS
|
||||||
@@ -178,23 +177,23 @@ You may want to try something like -S8192 if you experience
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><i>local_port</i></p>
|
<p style="margin-left:9%; margin-top: 1em"><i>local_port</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">- port tcppm accepts
|
<p style="margin-left:18%;">- port tcppm accepts
|
||||||
connections on</p>
|
connections on</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><i>remote_host</i></p>
|
<p style="margin-left:9%;"><i>remote_host</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">- IP address of the host the
|
<p style="margin-left:18%;">- IP address of the host the
|
||||||
connection is forwarded to. Unix domain sockets can be
|
connection is forwarded to. Unix domain sockets can be
|
||||||
specified with the syntax <i>unix:/path/to/socket</i> (e.g.,
|
specified with the syntax <i>unix:/path/to/socket</i> (e.g.,
|
||||||
unix:/var/run/app.sock). On Linux, abstract (fileless) Unix
|
unix:/var/run/app.sock). On Linux, abstract (fileless) Unix
|
||||||
sockets use the syntax <i>unix:@socketname</i> (e.g.,
|
sockets use the syntax <i>unix:@socketname</i> (e.g.,
|
||||||
unix:@app.socket).</p>
|
unix:@app.socket).</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><i>remote_port</i></p>
|
<p style="margin-left:9%;"><i>remote_port</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">- remote port the connection is
|
<p style="margin-left:18%;">- remote port the connection is
|
||||||
forwarded to. Ignored when using Unix socket destination,
|
forwarded to. Ignored when using Unix socket destination,
|
||||||
but must be specified (use any positive value) for syntax
|
but must be specified (use any positive value) for syntax
|
||||||
compatibility.</p>
|
compatibility.</p>
|
||||||
@@ -204,7 +203,7 @@ compatibility.</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Any TCP-based
|
<p style="margin-left:9%; margin-top: 1em">Any TCP-based
|
||||||
application can be used as a client. Use <i>internal_ip</i>
|
application can be used as a client. Use <i>internal_ip</i>
|
||||||
and <i>local_port</i> as the destination in the client
|
and <i>local_port</i> as the destination in the client
|
||||||
application. The connection is forwarded to
|
application. The connection is forwarded to
|
||||||
@@ -215,7 +214,7 @@ application. The connection is forwarded to
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -223,7 +222,7 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy(8),
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8),
|
proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8),
|
||||||
syslogd(8), <br>
|
syslogd(8), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
@@ -233,7 +232,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+113
-98
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>tlspr</b> -
|
<p style="margin-left:9%; margin-top: 1em"><b>tlspr</b> -
|
||||||
SNI proxy gateway service</p>
|
SNI proxy gateway service</p>
|
||||||
|
|
||||||
<h2>SYNOPSIS
|
<h2>SYNOPSIS
|
||||||
@@ -32,7 +32,7 @@ SNI proxy gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>tlspr</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>tlspr</b>
|
||||||
[<b>-d</b>][<b>-a</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
[<b>-d</b>][<b>-a</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
||||||
[<b>-p</b><i>listening_port</i>]
|
[<b>-p</b><i>listening_port</i>]
|
||||||
[<b>-P</b><i>destination_port</i>]
|
[<b>-P</b><i>destination_port</i>]
|
||||||
@@ -45,11 +45,13 @@ SNI proxy gateway service</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>tlspr</b> is
|
<p style="margin-left:9%; margin-top: 1em"><b>tlspr</b> is
|
||||||
an SNI gateway service (destination host is taken from TLS
|
an SNI gateway service (destination host is taken from TLS
|
||||||
handshake). The destination port must be specified via the
|
handshake). The destination port must be specified via the
|
||||||
-P option (or it may be detected with the Transparent
|
-P option (or it may be detected with the Transparent
|
||||||
plugin).</p>
|
plugin). tlspr does not support user authentication; use
|
||||||
|
ACLs by client IP or a parent proxy with authentication if
|
||||||
|
access control is required.</p>
|
||||||
|
|
||||||
<h2>OPTIONS
|
<h2>OPTIONS
|
||||||
<a name="OPTIONS"></a>
|
<a name="OPTIONS"></a>
|
||||||
@@ -59,81 +61,80 @@ plugin).</p>
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-I</b></p></td>
|
<p style="margin-top: 1em"><b>-I</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Inetd mode. Standalone service
|
<p style="margin-top: 1em">Inetd mode. Standalone service
|
||||||
only.</p> </td></tr>
|
only.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-d</b></p></td>
|
<p><b>-d</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Daemonize. Detach service from
|
<p>Daemonize. Detach service from console and run in the
|
||||||
console and run in the background.</p></td></tr>
|
background.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-t</b></p></td>
|
<p><b>-t</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Be silenT. Do not log
|
<p>Be silenT. Do not log start/stop/accept error
|
||||||
start/stop/accept error records.</p></td></tr>
|
records.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-u</b></p></td>
|
<p><b>-u</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Never ask for username
|
<p>Never ask for username authentication</p></td></tr>
|
||||||
authentication</p> </td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-e</b></p></td>
|
<p><b>-e</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">External address. IP address of
|
<p>External address. IP address of the interface the proxy
|
||||||
the interface the proxy should initiate connections from. By
|
should initiate connections from. By default, the system
|
||||||
default, the system will decide which address to use in
|
will decide which address to use in accordance with the
|
||||||
accordance with the routing table.</p></td></tr>
|
routing table.</p></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ni</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ni</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> before opening
|
network namespace identified by <i>PATH</i> before opening
|
||||||
the listening socket. The current namespace is saved and
|
the listening socket. The current namespace is saved and
|
||||||
restored immediately after binding, so outgoing connections
|
restored immediately after binding, so outgoing connections
|
||||||
run in the original namespace unless <b>-ne</b> is also
|
run in the original namespace unless <b>-ne</b> is also
|
||||||
given.</p>
|
given.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ne</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ne</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> after the
|
network namespace identified by <i>PATH</i> after the
|
||||||
listening socket has been bound (and after restoring from
|
listening socket has been bound (and after restoring from
|
||||||
<b>-ni</b> if applicable). Both options accept any namespace
|
<b>-ni</b> if applicable). Both options accept any namespace
|
||||||
@@ -144,13 +145,13 @@ file path (e.g. <i>/var/run/netns/myns</i> or
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p><b>-i</b></p></td>
|
<p><b>-i</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p>Internal address. IP address the proxy accepts
|
<p>Internal address. IP address the proxy accepts
|
||||||
@@ -160,114 +161,128 @@ be specified with <i>-iunix:/path/to/socket</i> syntax
|
|||||||
(e.g., -iunix:/var/run/tlspr.sock). On Linux, abstract
|
(e.g., -iunix:/var/run/tlspr.sock). On Linux, abstract
|
||||||
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
sockets use <i>-iunix:@socketname</i> syntax.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-a</b></p></td>
|
<p><b>-a</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Anonymous. Hide information
|
<p>Anonymous. Hide information about client.</p></td></tr>
|
||||||
about client.</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-a1</b></p></td>
|
<p><b>-a1</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Anonymous. Show fake information
|
<p>Anonymous. Show fake information about client.</p></td></tr>
|
||||||
about client.</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-p</b></p></td>
|
<p><b>-p</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">listening_port. Port proxy
|
<p>listening_port. Port proxy listens for incoming
|
||||||
listens for incoming connections. Default is 1443.</p></td></tr>
|
connections. Default is 1443.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-P</b></p></td>
|
<p><b>-P</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">destination_port. Port to
|
<p>destination_port. Port to establish outgoing
|
||||||
establish outgoing connections. Required unless the
|
connections. Required unless the Transparent plugin is used,
|
||||||
Transparent plugin is used, because the TLS handshake does
|
because the TLS handshake does not contain port information.
|
||||||
not contain port information. Default is 443.</p></td></tr>
|
Default is 443.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-c</b></p></td>
|
<p><b>-c</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">TLS_CHECK_LEVEL. 0 (default) -
|
<p>TLS_CHECK_LEVEL. 0 (default) - allow non-TLS traffic to
|
||||||
allow non-TLS traffic to pass, 1 - require TLS, only check
|
pass, 1 - require TLS, only check client HELLO packet, 2 -
|
||||||
client HELLO packet, 2 - require TLS, check both client and
|
require TLS, check both client and server HELLO, 3 - require
|
||||||
server HELLO, 3 - require TLS, check that the server sends a
|
TLS, check that the server sends a certificate (not
|
||||||
certificate (not compatible with TLS 1.3), 4 - require
|
compatible with TLS 1.3), 4 - require mutual TLS, check that
|
||||||
mutual TLS, check that the server sends a certificate
|
the server sends a certificate request and the client sends
|
||||||
request and the client sends a certificate (not compatible
|
a certificate (not compatible with TLS 1.3)</p></td></tr>
|
||||||
with TLS 1.3)</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="4%">
|
<td width="4%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-s</b></p></td>
|
<p><b>-s</b></p></td>
|
||||||
<td width="5%"></td>
|
<td width="5%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Split the TLS Client HELLO
|
<p>Split the TLS Client HELLO packet across multiple TCP
|
||||||
packet across multiple TCP segments to make SNI-based DPI
|
segments to make SNI-based DPI detection harder. An optional
|
||||||
detection harder. An optional numeric value can follow (e.g.
|
numeric value can follow (e.g. <b>-s1</b>) to control the
|
||||||
<b>-s1</b>) to control the splitting behaviour.</p></td></tr>
|
splitting behaviour.</p></td></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p style="margin-left:9%;"><b>-Ximap | -Xpop3 |
|
||||||
|
-Xsmtp</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:18%;">STARTTLS mode for the given
|
||||||
|
protocol. The proxy speaks the plaintext protocol with the
|
||||||
|
client (greeting, capability advertisement with STARTTLS
|
||||||
|
only, STARTTLS command), then, after the client issues
|
||||||
|
STARTTLS and sends a TLS Client HELLO, connects to the
|
||||||
|
destination taken from SNI (default port 143/110/587),
|
||||||
|
performs STARTTLS negotiation with the destination server
|
||||||
|
and transparently passes TLS traffic. If the destination
|
||||||
|
server does not support STARTTLS, the TLS handshake with the
|
||||||
|
client fails.</p>
|
||||||
|
|
||||||
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-l</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="4%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-l</b></p></td>
|
<p>Log. By default logging is to stdout. If <i>logfile</i>
|
||||||
<td width="5%"></td>
|
is specified logging is to file. Under Unix, if
|
||||||
<td width="85%">
|
´<i>@</i>´ precedes <i>logfile</i>, syslog is
|
||||||
|
used for logging.</p></td></tr>
|
||||||
|
|
||||||
<p style="margin-top: 1em">Log. By default logging is to
|
|
||||||
stdout. If <i>logfile</i> is specified logging is to file.
|
|
||||||
Under Unix, if ´<i>@</i>´ precedes
|
|
||||||
<i>logfile</i>, syslog is used for logging.</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
|
<td width="9%"></td>
|
||||||
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
|
<p><b>-S</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="4%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-S</b></p></td>
|
<p>Increase or decrease stack size. You may want to try
|
||||||
<td width="5%"></td>
|
something like -S8192 if you experience 3proxy crashes.</p></td></tr>
|
||||||
<td width="85%">
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Increase or decrease stack size.
|
|
||||||
You may want to try something like -S8192 if you experience
|
|
||||||
3proxy crashes.</p></td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>CLIENTS
|
<h2>CLIENTS
|
||||||
@@ -275,7 +290,7 @@ You may want to try something like -S8192 if you experience
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">You should use a
|
<p style="margin-left:9%; margin-top: 1em">You should use a
|
||||||
client with TLS support or configure a router to redirect
|
client with TLS support or configure a router to redirect
|
||||||
TLS traffic to the proxy (transparent proxy). Configure the
|
TLS traffic to the proxy (transparent proxy). Configure the
|
||||||
client to connect to <i>internal_ip</i> and <i>port</i>. If
|
client to connect to <i>internal_ip</i> and <i>port</i>. If
|
||||||
@@ -286,7 +301,7 @@ you need to limit clients, use <b>3proxy</b>(8) instead.</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -294,7 +309,7 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy(8),
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
ftppr(8), proxy(8), socks(8), pop3p(8), smtpp(8), tcppm(8),
|
ftppr(8), proxy(8), socks(8), pop3p(8), smtpp(8), tcppm(8),
|
||||||
udppm(8), syslogd(8), <br>
|
udppm(8), syslogd(8), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
@@ -304,7 +319,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+59
-61
@@ -1,4 +1,4 @@
|
|||||||
<!-- Creator : groff version 1.24.1 -->
|
<!-- Creator : groff version 1.23.0 -->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>udppm</b> -
|
<p style="margin-left:9%; margin-top: 1em"><b>udppm</b> -
|
||||||
UDP port mapper</p>
|
UDP port mapper</p>
|
||||||
|
|
||||||
<h2>SYNOPSIS
|
<h2>SYNOPSIS
|
||||||
@@ -33,7 +33,7 @@ UDP port mapper</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><b>udppm</b>
|
<p style="margin-left:9%; margin-top: 1em"><b>udppm</b>
|
||||||
[<b>-ds</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
[<b>-ds</b>] [<b>-l</b>[[<i>@</i>]<i>logfile</i>]]
|
||||||
[<b>-i</b><i>internal_ip</i>] [<b>-e</b><i>external_ip</i>]
|
[<b>-i</b><i>internal_ip</i>] [<b>-e</b><i>external_ip</i>]
|
||||||
<i>local_port remote_host remote_port</i></p>
|
<i>local_port remote_host remote_port</i></p>
|
||||||
@@ -44,7 +44,7 @@ UDP port mapper</p>
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><i><b>udppm</b></i>
|
<p style="margin-left:9%; margin-top: 1em"><i><b>udppm</b></i>
|
||||||
forwards datagrams from local to remote UDP port</p>
|
forwards datagrams from local to remote UDP port</p>
|
||||||
|
|
||||||
<h2>OPTIONS
|
<h2>OPTIONS
|
||||||
@@ -55,69 +55,69 @@ forwards datagrams from local to remote UDP port</p>
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-I</b></p></td>
|
<p style="margin-top: 1em"><b>-I</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Inetd mode. Standalone service
|
<p style="margin-top: 1em">Inetd mode. Standalone service
|
||||||
only.</p> </td></tr>
|
only.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-d</b></p></td>
|
<p><b>-d</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Daemonize. Detach service from
|
<p>Daemonize. Detach service from console and run in the
|
||||||
console and run in the background.</p></td></tr>
|
background.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-t</b></p></td>
|
<p><b>-t</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Be silenT. Do not log
|
<p>Be silenT. Do not log start/stop/accept error
|
||||||
start/stop/accept error records.</p></td></tr>
|
records.</p> </td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-e</b></p></td>
|
<p><b>-e</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">External address. IP address of
|
<p>External address. IP address of the interface the proxy
|
||||||
the interface the proxy should initiate datagrams from. By
|
should initiate datagrams from. By default, the system will
|
||||||
default, the system will decide which address to use in
|
decide which address to use in accordance with the routing
|
||||||
accordance with the routing table.</p></td></tr>
|
table.</p> </td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ni</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ni</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> before opening
|
network namespace identified by <i>PATH</i> before opening
|
||||||
the listening socket. The current namespace is saved and
|
the listening socket. The current namespace is saved and
|
||||||
restored immediately after binding, so outgoing connections
|
restored immediately after binding, so outgoing connections
|
||||||
run in the original namespace unless <b>-ne</b> is also
|
run in the original namespace unless <b>-ne</b> is also
|
||||||
given.</p>
|
given.</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><b>-ne</b><i>PATH</i></p>
|
<p style="margin-left:9%;"><b>-ne</b><i>PATH</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">(Linux only) Switch to the
|
<p style="margin-left:18%;">(Linux only) Switch to the
|
||||||
network namespace identified by <i>PATH</i> after the
|
network namespace identified by <i>PATH</i> after the
|
||||||
listening socket has been bound (and after restoring from
|
listening socket has been bound (and after restoring from
|
||||||
<b>-ni</b> if applicable). Both options accept any namespace
|
<b>-ni</b> if applicable). Both options accept any namespace
|
||||||
@@ -128,61 +128,59 @@ file path (e.g. <i>/var/run/netns/myns</i> or
|
|||||||
<table width="100%" border="0" rules="none" frame="void"
|
<table width="100%" border="0" rules="none" frame="void"
|
||||||
cellspacing="0" cellpadding="0">
|
cellspacing="0" cellpadding="0">
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p><b>-i</b></p></td>
|
<p><b>-i</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p>Internal address. IP address the proxy accepts datagrams
|
<p>Internal address. IP address the proxy accepts datagrams
|
||||||
to. By default, connections to any interface are accepted.
|
to. By default, connections to any interface are accepted.
|
||||||
It´s usually unsafe.</p></td></tr>
|
It´s usually unsafe.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-l</b></p></td>
|
<p><b>-l</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Log. By default logging is to
|
<p>Log. By default logging is to stdout. If <i>logfile</i>
|
||||||
stdout. If <i>logfile</i> is specified logging is to file.
|
is specified logging is to file. Under Unix, if
|
||||||
Under Unix, if ´<i>@</i>´ precedes
|
´<i>@</i>´ precedes <i>logfile</i>, syslog is
|
||||||
<i>logfile</i>, syslog is used for logging.</p></td></tr>
|
used for logging.</p></td></tr>
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-s</b></p></td>
|
<p><b>-s</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Single packet. By default, only
|
<p>Single packet. By default, only one client can use the
|
||||||
one client can use the udppm service, but if -s is
|
udppm service, but if -s is specified, only one packet will
|
||||||
specified, only one packet will be forwarded between client
|
be forwarded between client and server. This allows the
|
||||||
and server. This allows the service to be shared between
|
service to be shared between multiple clients for
|
||||||
multiple clients for single-packet services (for example,
|
single-packet services (for example, name lookups).</p></td></tr>
|
||||||
name lookups).</p></td></tr>
|
|
||||||
<tr valign="top" align="left">
|
<tr valign="top" align="left">
|
||||||
<td width="6%"></td>
|
<td width="9%"></td>
|
||||||
<td width="3%">
|
<td width="3%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em"><b>-S</b></p></td>
|
<p><b>-S</b></p></td>
|
||||||
<td width="6%"></td>
|
<td width="6%"></td>
|
||||||
<td width="85%">
|
<td width="82%">
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-top: 1em">Increase or decrease stack size.
|
<p>Increase or decrease stack size. You may want to try
|
||||||
You may want to try something like -S8192 if you experience
|
something like -S8192 if you experience 3proxy crashes.</p></td></tr>
|
||||||
3proxy crashes.</p></td></tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>ARGUMENTS
|
<h2>ARGUMENTS
|
||||||
@@ -191,19 +189,19 @@ You may want to try something like -S8192 if you experience
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em"><i>local_port</i></p>
|
<p style="margin-left:9%; margin-top: 1em"><i>local_port</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">- port udppm accepts datagrams
|
<p style="margin-left:18%;">- port udppm accepts datagrams
|
||||||
on</p>
|
on</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><i>remote_host</i></p>
|
<p style="margin-left:9%;"><i>remote_host</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">- IP address of the host
|
<p style="margin-left:18%;">- IP address of the host
|
||||||
datagrams are forwarded to</p>
|
datagrams are forwarded to</p>
|
||||||
|
|
||||||
<p style="margin-left:6%;"><i>remote_port</i></p>
|
<p style="margin-left:9%;"><i>remote_port</i></p>
|
||||||
|
|
||||||
<p style="margin-left:15%;">- remote port datagrams are
|
<p style="margin-left:18%;">- remote port datagrams are
|
||||||
forwarded to</p>
|
forwarded to</p>
|
||||||
|
|
||||||
<h2>CLIENTS
|
<h2>CLIENTS
|
||||||
@@ -211,7 +209,7 @@ forwarded to</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Any UDP-based
|
<p style="margin-left:9%; margin-top: 1em">Any UDP-based
|
||||||
application can be used as a client. Use <i>internal_ip</i>
|
application can be used as a client. Use <i>internal_ip</i>
|
||||||
and <i>local_port</i> as the destination in the client
|
and <i>local_port</i> as the destination in the client
|
||||||
application. All datagrams are forwarded to
|
application. All datagrams are forwarded to
|
||||||
@@ -222,7 +220,7 @@ application. All datagrams are forwarded to
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">Report all bugs
|
<p style="margin-left:9%; margin-top: 1em">Report all bugs
|
||||||
to <b>3proxy@3proxy.org</b></p>
|
to <b>3proxy@3proxy.org</b></p>
|
||||||
|
|
||||||
<h2>SEE ALSO
|
<h2>SEE ALSO
|
||||||
@@ -230,7 +228,7 @@ to <b>3proxy@3proxy.org</b></p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy(8),
|
<p style="margin-left:9%; margin-top: 1em">3proxy(8),
|
||||||
proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8),
|
proxy(8), ftppr(8), socks(8), pop3p(8), udppm(8),
|
||||||
syslogd(8), <br>
|
syslogd(8), <br>
|
||||||
https://3proxy.org/</p>
|
https://3proxy.org/</p>
|
||||||
@@ -240,7 +238,7 @@ https://3proxy.org/</p>
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
<p style="margin-left:6%; margin-top: 1em">3proxy is
|
<p style="margin-left:9%; margin-top: 1em">3proxy is
|
||||||
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
designed by Vladimir Dubrovin <vlad@3proxy.org></p>
|
||||||
<hr>
|
<hr>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,31 +1,56 @@
|
|||||||
<h3>3proxy TransparentPlugin (Linux/BSD only)</h3>
|
<h3>3proxy transparent proxying (Linux/BSD only)</h3>
|
||||||
|
|
||||||
This plugin can turn 3proxy into a transparent proxy for virtually any TCP-based protocol
|
Transparent proxying is part of 3proxy itself since 1.0.1. It was the separate
|
||||||
and use all 3proxy features - redirections, parent proxies, ACLs, traffic limitations,
|
TransparentPlugin before that, and the <b>plugin</b> line that used to load it
|
||||||
etc. The TransparentPlugin takes the destination IP:port from Linux and uses this
|
is no longer needed: the <b>transparent</b> and <b>notransparent</b> commands
|
||||||
information as the target IP in the proxy. An example usage:
|
are always available on the platforms that can redirect a connection.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
It turns 3proxy into a transparent proxy for virtually any TCP-based protocol,
|
||||||
|
with the rest of 3proxy applying as usual - redirections, parent proxies, ACLs,
|
||||||
|
traffic limitations and logging. The destination IP and port come from the
|
||||||
|
packet filter that redirected the connection, and are used as the target of the
|
||||||
|
proxied connection.
|
||||||
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
plugin /path/to/TransparentPlugin.ld.so transparent_plugin
|
|
||||||
log /path/to/log
|
log /path/to/log
|
||||||
auth iponly
|
auth iponly
|
||||||
allow * * * 80
|
allow * * * 80
|
||||||
parent 1000 http 0.0.0.0 0
|
parent 1000 http 0.0.0.0 0
|
||||||
allow *
|
allow *
|
||||||
parent 1000 socks5 SOCKS5_IP SOCKS5_PORT USER PASSWORD
|
parent 1000 socks5 SOCKS5_IP SOCKS5_PORT USER PASSWORD
|
||||||
|
|
||||||
transparent
|
transparent
|
||||||
tcppm -iLOCAL_IP 12345 127.0.0.1 11111
|
tcppm -eLOCAL_IP 12345 127.0.0.1 11111
|
||||||
notransparent
|
notransparent
|
||||||
proxy
|
proxy
|
||||||
</pre>
|
</pre>
|
||||||
Now, any TCP traffic transparently redirected to port 12345 will be routed via
|
|
||||||
the parent SOCKSv5 proxy and logged; all URLs for web requests are visible in logs.
|
|
||||||
The parameters '127.0.0.1 11111' in this case are not used and are overwritten by
|
|
||||||
the destination IP:port for each transparent connection.
|
|
||||||
|
|
||||||
<h4>Download:</h4>
|
<p>
|
||||||
<ul>
|
Any TCP traffic redirected to port 12345 is routed through the parent SOCKSv5
|
||||||
<li>Plugin is included in 3proxy 0.8
|
proxy and logged, with the URLs of web requests visible in the log. The
|
||||||
</li></ul>
|
'127.0.0.1 11111' arguments are not used in that case: they are replaced by the
|
||||||
|
destination the client was trying to reach.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The destination is looked up in pf on the BSDs, through <b>/dev/pf</b>, and
|
||||||
|
asked of the kernel on Linux; a redirection that leaves the address on the
|
||||||
|
socket is used where there is one. <b>transparent</b> takes an optional
|
||||||
|
<b>auto</b>, <b>netfilter</b>, <b>pf</b> or <b>socket</b> to pin that choice.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
The redirection rules must not match the connections 3proxy itself makes, or
|
||||||
|
the traffic returns to the proxy and loops. Give the service an address to
|
||||||
|
connect from with <b>-e</b> and exclude it in the rules, or run 3proxy as its
|
||||||
|
own account and exclude that account.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Redirection rules for iptables, nftables, firewalld, ufw and pf are in
|
||||||
|
<a href="../howtoe.html#TRANSPARENT">How to proxy transparently</a>, and the
|
||||||
|
commands are described in 3proxy.cfg(5).
|
||||||
|
</p>
|
||||||
|
|
||||||
© Vladimir Dubrovin, License: BSD style
|
© Vladimir Dubrovin, License: BSD style
|
||||||
@@ -1,33 +1,56 @@
|
|||||||
<h3>Плагин TransparentPlugin 3proxy (только для Linux/BSD)</h3>
|
<h3>Транспарентное проксирование 3proxy (только для Linux/BSD)</h3>
|
||||||
|
|
||||||
Плагин превращает 3proxy в транспарентный прокси для практически любых TCP-соединений
|
Начиная с 1.0.1 транспарентное проксирование встроено в 3proxy. Раньше это был
|
||||||
и позволяет прозрачно для клиентов использовать весь фунционал прокси - редиректоры,
|
отдельный TransparentPlugin, и строка <b>plugin</b>, которой он загружался,
|
||||||
родительские прокси, ACLи, ограничения трафика. TransparentPlugin получает IP:port
|
больше не нужна: команды <b>transparent</b> и <b>notransparent</b> доступны
|
||||||
назначения от Linux и использует эту информацию в качестве конечного адреса назначения.
|
всегда на тех платформах, где соединение можно перенаправить.
|
||||||
<br>
|
|
||||||
Пример использования:
|
<p>
|
||||||
|
3proxy становится транспарентным прокси практически для любых TCP-соединений,
|
||||||
|
причём весь остальной функционал работает как обычно - редиректоры,
|
||||||
|
родительские прокси, ACLи, ограничения трафика и логирование. IP и порт
|
||||||
|
назначения берутся у пакетного фильтра, перенаправившего соединение, и
|
||||||
|
используются как адрес назначения проксируемого соединения.
|
||||||
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
plugin /path/to/TransparentPlugin.ld.so transparent_plugin
|
|
||||||
log /path/to/log
|
log /path/to/log
|
||||||
auth iponly
|
auth iponly
|
||||||
allow * * * 80
|
allow * * * 80
|
||||||
parent 1000 http 0.0.0.0 0
|
parent 1000 http 0.0.0.0 0
|
||||||
allow *
|
allow *
|
||||||
parent 1000 socks5 SOCKS5_IP SOCKS5_PORT USER PASSWORD
|
parent 1000 socks5 SOCKS5_IP SOCKS5_PORT USER PASSWORD
|
||||||
|
|
||||||
transparent
|
transparent
|
||||||
tcppm -iLOCAL_IP 12345 127.0.0.1 11111
|
tcppm -eLOCAL_IP 12345 127.0.0.1 11111
|
||||||
notransparent
|
notransparent
|
||||||
proxy
|
proxy
|
||||||
</pre>
|
</pre>
|
||||||
Теперь любые TCP-соединения транспарентно перенаправленные в локальный порт 12345
|
|
||||||
будут прологгированы и перенаправлены в родительский SOCKSv5 proxy, при этом для
|
<p>
|
||||||
HTTP-запросов по порту TCP/80 будут видны параметры HTTP-запроса.
|
Любой TCP-трафик, перенаправленный на порт 12345, пойдёт через родительский
|
||||||
Параметры '127.0.0.1 11111' в данном случае не оказывают влияния, т.к.
|
SOCKSv5 прокси и будет залогирован, URL веб-запросов видны в логе. Аргументы
|
||||||
будут перезаписываться IP и портом назначения для каждого TCP-соединения соответственно.
|
'127.0.0.1 11111' в этом случае не используются: они заменяются адресом, к
|
||||||
<h4>Загрузить:</h4>
|
которому обращался клиент.
|
||||||
<ul>
|
</p>
|
||||||
<li>Плагин включен в дистрибутив 3proxy 0.8
|
|
||||||
</li></ul>
|
<p>
|
||||||
|
В BSD адрес назначения ищется в pf через <b>/dev/pf</b>, в Linux запрашивается у
|
||||||
|
ядра; если перенаправление оставляет адрес на сокете, используется он. Команда
|
||||||
|
<b>transparent</b> принимает необязательный аргумент <b>auto</b>,
|
||||||
|
<b>netfilter</b>, <b>pf</b> или <b>socket</b>, чтобы зафиксировать выбор.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Правила перенаправления не должны попадать на соединения, которые устанавливает
|
||||||
|
сам 3proxy, иначе трафик возвращается в прокси и зацикливается. Задайте сервису
|
||||||
|
адрес для исходящих соединений через <b>-e</b> и исключите его в правилах, либо
|
||||||
|
запускайте 3proxy под отдельной учётной записью и исключайте её.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Правила перенаправления для iptables, nftables, firewalld, ufw и pf приведены в
|
||||||
|
<a href="../howtor.html#TRANSPARENT">описании транспарентного проксирования</a>,
|
||||||
|
команды описаны в 3proxy.cfg(5).
|
||||||
|
</p>
|
||||||
|
|
||||||
© Vladimir Dubrovin, License: BSD style
|
© Vladimir Dubrovin, License: BSD style
|
||||||
@@ -19,12 +19,71 @@ authentication is currently available.
|
|||||||
<li>Always limit connections to the internal network and localhost (to 127.0.0.1 and
|
<li>Always limit connections to the internal network and localhost (to 127.0.0.1 and
|
||||||
all interfaces) with ACLs. Be careful, because the BIND command in SOCKS requires the
|
all interfaces) with ACLs. Be careful, because the BIND command in SOCKS requires the
|
||||||
BIND method with the external interface IP address to be allowed.
|
BIND method with the external interface IP address to be allowed.
|
||||||
|
<li>Services resolve IPv4 only unless told otherwise ('-4' is the default). Enabling
|
||||||
|
IPv6 with '-6', '-46' or '-64' makes every ACL written in IPv4 incomplete, because the
|
||||||
|
same host can be asked for in another way. A proxy that denies 127.0.0.1 but has IPv6
|
||||||
|
enabled still reaches that host as '::ffff:127.0.0.1', and reaches the machine again as
|
||||||
|
'::1', which is a different address the IPv4 rule never mentioned. When IPv6 is enabled,
|
||||||
|
deny the mapped form '::ffff:0:0/96' as well unless it is needed, and deny the IPv6
|
||||||
|
addresses that correspond to whatever the IPv4 rules protect: '::1' and '::' for the
|
||||||
|
local machine, 'fe80::/10' for link-local and 'fc00::/7' for unique local addresses.
|
||||||
|
Denying the IPv4 spelling alone is not enough.
|
||||||
|
<li>With '-46' or '-64' a name resolves to either family, so a target ACL that names
|
||||||
|
only one of a host's addresses does not limit that host. Names are resolved into
|
||||||
|
separate caches, and a name that resolves to an IPv6 address is only cached when
|
||||||
|
'nscache6' is configured.
|
||||||
|
<li>The 'admin' service hands out counters, the list of running services and a way to
|
||||||
|
trigger a configuration reload. Bind it to an internal interface, and put
|
||||||
|
authentication and an ACL in front of it. The '-s' option limits what the pages offer
|
||||||
|
but is not authentication.
|
||||||
|
<li>The 'echo' and 'data' operations of the 'http' command exist for testing. 'data'
|
||||||
|
returns a response of whatever size the request asks for, so a listener offering it to
|
||||||
|
anyone is a traffic amplifier. Do not configure them on a public service.
|
||||||
|
<li>'ssl_server_ca_key' is the private key of a certificate authority that clients have
|
||||||
|
been told to trust. Anyone who obtains it can impersonate any site to those clients, so
|
||||||
|
protect it as a signing key and use a CA created for this purpose only, never one that
|
||||||
|
is trusted for anything else. Restrict the 'ssl_certcache' directory as well: it holds
|
||||||
|
the certificates generated from that key.
|
||||||
|
<li>Interception ('ssl_mitm') ends the guarantee the client believes it has. The full
|
||||||
|
URL of every request inside the tunnel, query string included, becomes visible to the
|
||||||
|
proxy and reaches the log, where a plain CONNECT would have shown only a host and a
|
||||||
|
port. Treat those logs accordingly.
|
||||||
|
<li>Certificates generated for interception by a build against wolfSSL carry no key
|
||||||
|
identifiers, because that library cannot generate certificate extensions, and a client
|
||||||
|
verifying strictly (OpenSSL 'x509_strict', which recent Python enables by default)
|
||||||
|
rejects them. Builds against OpenSSL generate them. Where they are missing, turning
|
||||||
|
verification off in the client removes the protection interception was supposed to
|
||||||
|
preserve; use an OpenSSL build instead.
|
||||||
|
<li>Regular expression rules ('pcre', 'pcre_rewrite') are matched without
|
||||||
|
authentication and do not replace ACLs. A rewrite that would change the method or the
|
||||||
|
destination of a request is ignored, because the destination was already authorized;
|
||||||
|
do not rely on one to redirect traffic.
|
||||||
<li>Before 3proxy 0.8, always use nserver and nscache under Unix; otherwise, a DoS attack is possible
|
<li>Before 3proxy 0.8, always use nserver and nscache under Unix; otherwise, a DoS attack is possible
|
||||||
with an unreachable DNS server (because gethostbyname will block other threads).
|
with an unreachable DNS server (because gethostbyname will block other threads).
|
||||||
<li>Keep logs in a secure location, because some confidential information from
|
<li>Keep logs in a secure location, because some confidential information from
|
||||||
user requests can be logged.
|
user requests can be logged.
|
||||||
<li>Use -xyz+A character filtering sequences for 'logformat', especially with
|
<li>Use -xyz+A character filtering sequences for 'logformat', especially with
|
||||||
ODBC logging, to prevent SQL and log record injections.
|
ODBC logging, to prevent SQL and log record injections.
|
||||||
|
<li>With the 'cacheacl' authentication type the ACL result is cached and is not
|
||||||
|
re-evaluated on a cache hit, so every field the ACL limits must be a part of
|
||||||
|
the 'authcache' key. Any field the ACL limits but the key does not contain
|
||||||
|
makes the cached result apply to a request it was not computed for, and that
|
||||||
|
limitation is not enforced. Use 'user' and 'pass' for the userlist, 'ip' for
|
||||||
|
the sourcelist, 'dstaddr' and 'dsthost' for the targetlist, 'dstport' for the
|
||||||
|
targetportlist and 'dstoper' for the operationlist. Use plain 'cache' instead
|
||||||
|
of 'cacheacl' if ACLs may change during the cache lifetime; cache entries are
|
||||||
|
not invalidated by a configuration reload.
|
||||||
|
<li>'cacheacl' must not be used together with parent proxies. The ACL is not
|
||||||
|
walked on a cache hit, so no redirection is applied and the request is sent
|
||||||
|
directly instead of through the 'parent' proxy of the matching ACL entry,
|
||||||
|
without any error. If the parent proxy is the only sanctioned path to the
|
||||||
|
network, this silently bypasses it. Use 'cache' instead. 'parent ... extip'
|
||||||
|
is the only redirection which survives, and only if 'ext' is a part of the
|
||||||
|
'authcache' key.
|
||||||
|
<li>The destination of every datagram of a SOCKSv5 UDP association is
|
||||||
|
authorized, but only with the default '-U3' (or '-U2') of the 'socks' service.
|
||||||
|
With '-U0' or '-U1' only the first destination of an association is authorized,
|
||||||
|
so ACLs limiting the destination do not restrict the rest of the association.
|
||||||
<li>Immediately report all service crashes to the developers.
|
<li>Immediately report all service crashes to the developers.
|
||||||
<li>Participate in code audit :)
|
<li>Participate in code audit :)
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
+2
-1
@@ -29,6 +29,7 @@ from the configuration file like an independent service
|
|||||||
.BR proxy (8)
|
.BR proxy (8)
|
||||||
.BR socks (8)
|
.BR socks (8)
|
||||||
.BR pop3p (8)
|
.BR pop3p (8)
|
||||||
|
.BR imapp (8)
|
||||||
.BR tcppm (8)
|
.BR tcppm (8)
|
||||||
.BR udppm (8)
|
.BR udppm (8)
|
||||||
.BR ftppr (8)
|
.BR ftppr (8)
|
||||||
@@ -140,7 +141,7 @@ configuration file
|
|||||||
Report all bugs to
|
Report all bugs to
|
||||||
.BR 3proxy@3proxy.org
|
.BR 3proxy@3proxy.org
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
3proxy.cfg(5), proxy(8), ftppr(8), socks(8), pop3p(8), tcppm(8), udppm(8),
|
3proxy.cfg(5), proxy(8), ftppr(8), socks(8), pop3p(8), imapp(8), tcppm(8), udppm(8),
|
||||||
kill(1), syslogd(8),
|
kill(1), syslogd(8),
|
||||||
.br
|
.br
|
||||||
https://3proxy.org/
|
https://3proxy.org/
|
||||||
|
|||||||
+543
-32
@@ -39,7 +39,9 @@ For included file <CR> (end of line characters) is treated as space character
|
|||||||
(arguments delimiter instead of end of command delimiter).
|
(arguments delimiter instead of end of command delimiter).
|
||||||
Thus, include files are only useful to store long single-line commands
|
Thus, include files are only useful to store long single-line commands
|
||||||
(like userlist, network lists, etc).
|
(like userlist, network lists, etc).
|
||||||
To use dollar sign somewhere in argument it must be quoted.
|
To use dollar sign somewhere in argument it must be quoted or doubled: inside
|
||||||
|
quotes a dollar is ordinary text, and \fB$$\fR stands for a single dollar and is
|
||||||
|
not read as an include.
|
||||||
Recursion is not allowed.
|
Recursion is not allowed.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
@@ -55,6 +57,9 @@ Recursion is not allowed.
|
|||||||
.B pop3p
|
.B pop3p
|
||||||
[options]
|
[options]
|
||||||
.br
|
.br
|
||||||
|
.B imapp
|
||||||
|
[options]
|
||||||
|
.br
|
||||||
.B smtpp
|
.B smtpp
|
||||||
[options]
|
[options]
|
||||||
.br
|
.br
|
||||||
@@ -90,13 +95,19 @@ SNI proxy (destination address is taken from TLS handshake), may be used to redi
|
|||||||
Proxy with protocol autoselection between proxy / socks / tlspr
|
Proxy with protocol autoselection between proxy / socks / tlspr
|
||||||
.br
|
.br
|
||||||
.B pop3p
|
.B pop3p
|
||||||
POP3 proxy (default port 110)
|
POP3 proxy (default port 110), in a build which has one: otherwise the
|
||||||
|
service is \fBtlspr\fR speaking POP3 to negotiate STARTTLS, under this name.
|
||||||
|
.br
|
||||||
|
.B imapp
|
||||||
|
IMAPv4 proxy (default port 143), or \fBtlspr\fR speaking IMAP, as above.
|
||||||
.br
|
.br
|
||||||
.B smtpp
|
.B smtpp
|
||||||
SMTP proxy (default port 25)
|
SMTP proxy (default port 25), or \fBtlspr\fR speaking SMTP, as above.
|
||||||
.br
|
.br
|
||||||
.B ftppr
|
.B ftppr
|
||||||
FTP proxy (default port 21)
|
FTP proxy (default port 21), in a build with FTP support. Without it the
|
||||||
|
service is known but answers nothing, and \fBftp://\fR is not a URL the HTTP
|
||||||
|
proxy fetches.
|
||||||
.br
|
.br
|
||||||
.B admin
|
.B admin
|
||||||
Web interface (default port 80)
|
Web interface (default port 80)
|
||||||
@@ -126,7 +137,8 @@ change default server port to NUMBER
|
|||||||
Only resolve IPv6 addresses. IPv4 addresses are packed in IPv6 in IPV6_V6ONLY compatible way.
|
Only resolve IPv6 addresses. IPv4 addresses are packed in IPv6 in IPV6_V6ONLY compatible way.
|
||||||
.br
|
.br
|
||||||
.B -4
|
.B -4
|
||||||
Only resolve IPv4 addresses
|
Only resolve IPv4 addresses. This is the default: a service reaches an IPv6
|
||||||
|
address only when told to with \fB-6\fR, \fB-46\fR or \fB-64\fR.
|
||||||
.br
|
.br
|
||||||
.B -46
|
.B -46
|
||||||
Prefer IPv4. Resolve IPv6 addresses if IPv4 address is not resolvable
|
Prefer IPv4. Resolve IPv6 addresses if IPv4 address is not resolvable
|
||||||
@@ -172,7 +184,10 @@ connect to given remote HOST:port instead of listening local connection on -p or
|
|||||||
.br
|
.br
|
||||||
.B -oc\fIOPTIONS\fB, -os\fIOPTIONS\fB, -ol\fIOPTIONS\fB, -or\fIOPTIONS\fB, -oR\fIOPTIONS\fR
|
.B -oc\fIOPTIONS\fB, -os\fIOPTIONS\fB, -ol\fIOPTIONS\fB, -or\fIOPTIONS\fB, -oR\fIOPTIONS\fR
|
||||||
options for proxy-to-client (\fB-oc\fR), proxy-to-server (\fB-os\fR), proxy listening (\fB-ol\fR), connect back client (\fB-or\fR), connect back listening (\fB-oR\fR) sockets.
|
options for proxy-to-client (\fB-oc\fR), proxy-to-server (\fB-os\fR), proxy listening (\fB-ol\fR), connect back client (\fB-or\fR), connect back listening (\fB-oR\fR) sockets.
|
||||||
Options like TCP_CORK, TCP_NODELAY, TCP_DEFER_ACCEPT, TCP_QUICKACK, TCP_TIMESTAMPS, USE_TCP_FASTOPEN, SO_REUSEADDR, SO_REUSEPORT, SO_PORT_SCALABILITY, SO_REUSE_UNICASTPORT, SO_KEEPALIVE, SO_DONTROUTE may be supported depending on OS.
|
\fIOPTIONS\fR is a comma separated list of \fINAME\fR or \fINAME\fR=\fIVALUE\fR; a name alone sets the option to 1 (TCP_MAXSEG to the value of \fBmaxseg\fR), and \fINAME\fR=0 turns it off. Options add to the defaults and to the options given earlier for the same socket. An unknown name or a value which is not a number is an error.
|
||||||
|
TCP_NODELAY is set by default on proxy-to-client and proxy-to-server sockets, so a reply written in several parts is not delayed by Nagle's algorithm; use \fB-ocTCP_NODELAY=0\fR or \fB-osTCP_NODELAY=0\fR to turn it off, e.g. to send fewer packets on slow links.
|
||||||
|
Options like TCP_CORK, TCP_NODELAY, TCP_DEFER_ACCEPT, TCP_QUICKACK, TCP_TIMESTAMPS, TCP_FASTOPEN, SO_REUSEADDR, SO_REUSEPORT, SO_EXCLUSIVEADDRUSE, SO_PORT_SCALABILITY, SO_REUSE_UNICASTPORT, SO_KEEPALIVE, SO_DONTROUTE may be supported depending on OS.
|
||||||
|
SO_REUSEADDR and SO_REUSEPORT are set by default on the listening sockets (\fB-ol\fR, \fB-oR\fR) on Unix; \fB-olSO_REUSEPORT=0\fR turns one off. On Windows SO_REUSEADDR is not set: it is not required to rebind a listening port and it only lets another local process bind the same address and port. Use SO_EXCLUSIVEADDRUSE (Windows) on the listening socket (\fB-ol\fR) to prevent that.
|
||||||
.br
|
.br
|
||||||
.B -H
|
.B -H
|
||||||
(for all services) Expect HAProxy PROXY protocol v1 header on incoming connection.
|
(for all services) Expect HAProxy PROXY protocol v1 header on incoming connection.
|
||||||
@@ -182,9 +197,43 @@ any protocol-specific data.
|
|||||||
.br
|
.br
|
||||||
.B -g(\fIGRACE_TRAFF\fB,\fIGRACE_NUM\fB,\fIGRACE_DELAY\fR)
|
.B -g(\fIGRACE_TRAFF\fB,\fIGRACE_NUM\fB,\fIGRACE_DELAY\fR)
|
||||||
delay GRACE_DELAY milliseconds before polling if average polling size is below GRACE_TRAFF bytes and GRACE_NUM read operations in a single direction are detected within 1 second. Useful to minimize polling
|
delay GRACE_DELAY milliseconds before polling if average polling size is below GRACE_TRAFF bytes and GRACE_NUM read operations in a single direction are detected within 1 second. Useful to minimize polling
|
||||||
|
.br
|
||||||
.B -s
|
.B -s
|
||||||
(for admin) secure, allow only secure operations, currently only traffic counters
|
(for admin) secure, allow only secure operations, currently only traffic counters
|
||||||
view without ability to reset.
|
view without ability to reset.
|
||||||
|
.br
|
||||||
|
(for TCP services, Linux) use splice() to pass data between the client and the
|
||||||
|
server without copying it through 3proxy. \fB-s\fR alone splices both directions where
|
||||||
|
it pays: a body of known length if at least 16K of it is left to read, a stream
|
||||||
|
once it carries large reads, back to copying when they turn small. \fB-s1\fR always
|
||||||
|
splices what the server sends to the client (downloads), \fB-s2\fR what the client
|
||||||
|
sends (uploads), \fB-s3\fR both; adding 4 (\fB-s5\fR, \fB-s6\fR, \fB-s7\fR, the last the same as
|
||||||
|
\fB-s\fR) splices those directions only where it pays. \fB-s0\fR, the default, turns it
|
||||||
|
off. splice() suits large transfers: they go faster and use less CPU; small
|
||||||
|
requests go slower with it. A spliced direction needs a pipe (two file
|
||||||
|
descriptors), made when first needed and kept for the connection, and more
|
||||||
|
kernel memory; data filters are not applied to spliced data. Available in builds
|
||||||
|
with WITHSPLICE, the default on Linux.
|
||||||
|
.br
|
||||||
|
.B -C
|
||||||
|
(for TCP services) a connection closed by any of the sides terminates the
|
||||||
|
session, buffered data is delivered before the sockets are closed. By default
|
||||||
|
the session is kept until both sides close the connection (TCP half-close).
|
||||||
|
Half-close is required for the protocols where one of the sides closes its
|
||||||
|
sending side and expects the answer, but it keeps the socket of the side which
|
||||||
|
has already closed the connection in CLOSE_WAIT state. Use -C to close both
|
||||||
|
sockets as soon as any of the sides closes the connection, -C1 to request
|
||||||
|
the default behaviour explicitly.
|
||||||
|
.br
|
||||||
|
.B -U\fI[MODE]\fR
|
||||||
|
(for socks) what to do when the destination changes within an UDP association:
|
||||||
|
\fB1\fR - log it, \fB2\fR - authorize it, \fB3\fR - both, the default,
|
||||||
|
\fB0\fR (same as bare \fB-U\fR) - neither. The destination of the first datagram
|
||||||
|
is always authorized and logged. With \fB-U0\fR and \fB-U1\fR the destination is
|
||||||
|
not authorized again, so ACLs limiting the destination only apply to the first
|
||||||
|
destination of the association, and the parent proxy and the external address
|
||||||
|
selected for it are kept for the whole association. Use \fB-U2\fR to keep the
|
||||||
|
authorization and to drop the per-destination log records only.
|
||||||
.br
|
.br
|
||||||
(for dnspr) simple, do not use resolver and 3proxy cache, always use external DNS server.
|
(for dnspr) simple, do not use resolver and 3proxy cache, always use external DNS server.
|
||||||
.br
|
.br
|
||||||
@@ -204,11 +253,18 @@ Never ask for username/password
|
|||||||
.br
|
.br
|
||||||
.B -a2
|
.B -a2
|
||||||
(for proxy) generate Via: and X-Forwarded-For: instead of Forwarded:
|
(for proxy) generate Via: and X-Forwarded-For: instead of Forwarded:
|
||||||
|
.br
|
||||||
|
.B -Xftp
|
||||||
|
(for proxy) fetch \fBftp://\fR URLs, in a build with FTP support. Without
|
||||||
|
this the scheme is not one the service knows, whatever the build: fetching it
|
||||||
|
opens a second connection and builds a listing, which a service serving http
|
||||||
|
has no use for.
|
||||||
.br
|
.br
|
||||||
Also, all options mentioned for
|
Also, all options mentioned for
|
||||||
.BR proxy (8)
|
.BR proxy (8)
|
||||||
.BR socks (8)
|
.BR socks (8)
|
||||||
.BR pop3p (8)
|
.BR pop3p (8)
|
||||||
|
.BR imapp (8)
|
||||||
.BR tcppm (8)
|
.BR tcppm (8)
|
||||||
.BR udppm (8)
|
.BR udppm (8)
|
||||||
.BR ftppr (8)
|
.BR ftppr (8)
|
||||||
@@ -247,16 +303,7 @@ proxy on a client with FTP proxy support. Username format is one of
|
|||||||
.BR config
|
.BR config
|
||||||
\fI<path>\fR
|
\fI<path>\fR
|
||||||
.br
|
.br
|
||||||
Path to configuration file to use on 3proxy restart or to save configuration.
|
Path to configuration file to use on 3proxy restart.
|
||||||
|
|
||||||
.br
|
|
||||||
.B writable
|
|
||||||
.br
|
|
||||||
ReOpens configuration file for write access via Web interface,
|
|
||||||
and rereads it. Usually should be first command on config file
|
|
||||||
but in combination with config
|
|
||||||
it can be used anywhere to open
|
|
||||||
alternate config file. Think twice before using it.
|
|
||||||
|
|
||||||
.br
|
.br
|
||||||
.B end
|
.B end
|
||||||
@@ -412,9 +459,9 @@ can use %A as produced archive name and %F as filename.
|
|||||||
|
|
||||||
.br
|
.br
|
||||||
.BR timeouts
|
.BR timeouts
|
||||||
\fI<BYTE_SHORT>\fR \fI<BYTE_LONG>\fR \fI<STRING_SHORT>\fR \fI<STRING_LONG>\fR \fI<CONNECTION_SHORT>\fR \fI<CONNECTION_LONG>\fR \fI<DNS>\fR \fI<CHAIN>\fR \fI<CONNECT>\fR \fI<CONNECTBACK>\fR
|
\fI<BYTE_SHORT>\fR \fI<BYTE_LONG>\fR \fI<STRING_SHORT>\fR \fI<STRING_LONG>\fR \fI<CONNECTION_SHORT>\fR \fI<CONNECTION_LONG>\fR \fI<DNS>\fR \fI<CHAIN>\fR \fI<CONNECT>\fR \fI<CONNECTBACK>\fR \fI<LINGER>\fR
|
||||||
.br
|
.br
|
||||||
Sets timeout values, defaults 1, 5, 30, 60, 180, 1800, 15, 60, 15, 5.
|
Sets timeout values, defaults 1, 5, 30, 60, 180, 1800, 15, 60, 15, 5, 5.
|
||||||
.br
|
.br
|
||||||
\fBBYTE_SHORT\fR short timeout for single byte, is usually used for receiving single byte from stream.
|
\fBBYTE_SHORT\fR short timeout for single byte, is usually used for receiving single byte from stream.
|
||||||
.br
|
.br
|
||||||
@@ -432,7 +479,12 @@ can use %A as produced archive name and %F as filename.
|
|||||||
.br
|
.br
|
||||||
\fBCHAIN\fR timeout for reading data from chained connection
|
\fBCHAIN\fR timeout for reading data from chained connection
|
||||||
.br
|
.br
|
||||||
default timeouts 1 5 30 60 180 1800 15 60 15 5
|
\fBLINGER\fR timeout to deliver buffered data after one of the sides has closed
|
||||||
|
its sending side, also used as SO_LINGER value on outgoing connections. Too small
|
||||||
|
value may cause the tail of the data to be lost on slow connections, too large one
|
||||||
|
delays release of the sockets.
|
||||||
|
.br
|
||||||
|
default timeouts 1 5 30 60 180 1800 15 60 15 5 5
|
||||||
|
|
||||||
.br
|
.br
|
||||||
.BR maxseg
|
.BR maxseg
|
||||||
@@ -474,6 +526,13 @@ system routines for name resolution is
|
|||||||
used. Optional port number may be specified.
|
used. Optional port number may be specified.
|
||||||
If optional /tcp is added to IP address, name resolution is
|
If optional /tcp is added to IP address, name resolution is
|
||||||
performed over TCP.
|
performed over TCP.
|
||||||
|
An IPv6 address has to be enclosed in square brackets:
|
||||||
|
.br
|
||||||
|
\fBnserver 1.1.1.1\fR
|
||||||
|
.br
|
||||||
|
\fBnserver [2001:4860:4860::8844]\fR
|
||||||
|
.br
|
||||||
|
\fBnserver [2001:4860:4860::8844]:5353/tcp\fR
|
||||||
|
|
||||||
.br
|
.br
|
||||||
.BR authnserver
|
.BR authnserver
|
||||||
@@ -490,13 +549,20 @@ If not specified, nserver is used. The syntax is the same as for nserver.
|
|||||||
.br
|
.br
|
||||||
Cache \fI<cachesize>\fR records for name resolution (\fBnscache\fR for IPv4,
|
Cache \fI<cachesize>\fR records for name resolution (\fBnscache\fR for IPv4,
|
||||||
\fBnscache6\fR for IPv6). The cache size should usually be large enough
|
\fBnscache6\fR for IPv6). The cache size should usually be large enough
|
||||||
(for example, 65536).
|
(for example, 65536). The two are separate: a name that resolves to an IPv6
|
||||||
|
address, including one given with \fBnsrecord\fR, is only held when
|
||||||
|
\fBnscache6\fR is configured, and \fBnscache\fR does nothing for it. Both
|
||||||
|
caches are global rather than per-service.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
.BR nsrecord
|
.BR nsrecord
|
||||||
\fI<hostname>\fR \fI<hostaddr>\fR
|
\fI<hostname>\fR \fI<hostaddr>\fR
|
||||||
.br
|
.br
|
||||||
Adds static record to nscache. \fBnscache\fR must be enabled. If 0.0.0.0
|
Adds static record to nscache. \fBnscache\fR must be enabled and must come
|
||||||
|
first, because the record is placed in the table it allocates - \fBnscache6\fR
|
||||||
|
for a record naming an IPv6 address - and
|
||||||
|
\fBnserver\fR must be set as well: without it the system resolver is used and
|
||||||
|
static records are never consulted. If 0.0.0.0
|
||||||
is used as a hostaddr host will never resolve, it can be used to
|
is used as a hostaddr host will never resolve, it can be used to
|
||||||
blacklist something or together with
|
blacklist something or together with
|
||||||
.B dialer
|
.B dialer
|
||||||
@@ -608,6 +674,13 @@ SOCKSv5, FTP, POP3 and HTTP proxy.
|
|||||||
authorization result is also cached and not re-evaluated on each request. Faster
|
authorization result is also cached and not re-evaluated on each request. Faster
|
||||||
than \fBcache\fR, but ACL changes do not take effect for cached users until the
|
than \fBcache\fR, but ACL changes do not take effect for cached users until the
|
||||||
cache entry expires. Use \fBcache\fR if ACLs may change during the cache lifetime.
|
cache entry expires. Use \fBcache\fR if ACLs may change during the cache lifetime.
|
||||||
|
Because the ACL is not walked on a cache hit, no redirection is applied to a
|
||||||
|
request served from the cache: it is sent directly instead of through the
|
||||||
|
\fBparent\fR proxy of the matching ACL entry, with no error reported. Do not use
|
||||||
|
\fBcacheacl\fR together with parent proxies, use \fBcache\fR instead. The only
|
||||||
|
redirection type which survives is \fBextip\fR, and only if \fBext\fR is a part
|
||||||
|
of the \fBauthcache\fR key, because the external address is then restored from
|
||||||
|
the cache entry.
|
||||||
.br
|
.br
|
||||||
\fBradius\fR - authentication with RADIUS.
|
\fBradius\fR - authentication with RADIUS.
|
||||||
.br
|
.br
|
||||||
@@ -663,6 +736,17 @@ assigned to the same user without actual authentication.
|
|||||||
.br
|
.br
|
||||||
Multiple types can be combined (e.g. \fBip,user,dstaddr,dstport\fR).
|
Multiple types can be combined (e.g. \fBip,user,dstaddr,dstport\fR).
|
||||||
.br
|
.br
|
||||||
|
With \fBcacheacl\fR the ACL result is not re-evaluated on a cache hit, so every
|
||||||
|
field the ACL limits must be a part of the cache key, otherwise the result
|
||||||
|
cached for one request is applied to a different one: \fBuser\fR/\fBpass\fR
|
||||||
|
for the userlist, \fBip\fR for the sourcelist, \fBdstaddr\fR/\fBdsthost\fR
|
||||||
|
for the targetlist, \fBdstport\fR for the targetportlist and \fBdstoper\fR
|
||||||
|
for the operationlist. It is especially important for SOCKSv5 UDP traffic,
|
||||||
|
where the destination of every datagram is authorized: without \fBdstaddr\fR
|
||||||
|
and \fBdstport\fR in the key the result cached for one destination is applied
|
||||||
|
to any other destination and the destination is not checked at all, see
|
||||||
|
\fBallow\fR.
|
||||||
|
.br
|
||||||
Use auth type \fBcache\fR (or \fBcacheacl\fR) for cached authentication
|
Use auth type \fBcache\fR (or \fBcacheacl\fR) for cached authentication
|
||||||
|
|
||||||
.br
|
.br
|
||||||
@@ -686,6 +770,17 @@ Since 0.6, the targetlist may also contain host names,
|
|||||||
instead of addresses. It\'s possible to use a wildmask in
|
instead of addresses. It\'s possible to use a wildmask in
|
||||||
the beginning and at the end of the hostname, e.g. *badsite.com or *badcontent*.
|
the beginning and at the end of the hostname, e.g. *badsite.com or *badcontent*.
|
||||||
The hostname is only checked if a hostname is present in the request.
|
The hostname is only checked if a hostname is present in the request.
|
||||||
|
A name written with a \fBpcre:\fR prefix (\fBregex:\fR is the same thing) is a
|
||||||
|
regular expression instead of a wildmask, in a build with PCRE support:
|
||||||
|
.br
|
||||||
|
deny * * "pcre:^(ads|track)[0-9]*\\.example\\.(com|net)$"
|
||||||
|
.br
|
||||||
|
The name is lowercased and any trailing dots are removed before it is matched,
|
||||||
|
so patterns are written in lower case. A pattern ending in \fB$\fR has to be
|
||||||
|
quoted or written \fB$$\fR, since a lone dollar outside quotes begins the name
|
||||||
|
of a file to include. The same patterns, and the same prefix, are used by the
|
||||||
|
\fBhttp\fR command, see BUILT IN HTTP SERVER. Regular expressions are matched
|
||||||
|
per request and cost more than a wildmask, which is enough for most rules.
|
||||||
Targetportlist may contain ports (X) or port ranges lists (X-Y). For any field *
|
Targetportlist may contain ports (X) or port ranges lists (X-Y). For any field *
|
||||||
sign means ANY. If access list is empty it\'s assumed to be
|
sign means ANY. If access list is empty it\'s assumed to be
|
||||||
.br
|
.br
|
||||||
@@ -747,6 +842,39 @@ non-privileged (1024-65535) ports on the remote side.
|
|||||||
.br
|
.br
|
||||||
Timeperiodlists is a list of time
|
Timeperiodlists is a list of time
|
||||||
periods in HH:MM:SS-HH:MM:SS format. For example, 00:00:00-08:00:00,17:00:00-24:00:00 lists non-working hours.
|
periods in HH:MM:SS-HH:MM:SS format. For example, 00:00:00-08:00:00,17:00:00-24:00:00 lists non-working hours.
|
||||||
|
.br
|
||||||
|
A SOCKSv5 UDP ASSOCIATE request carries no destination, the destination of
|
||||||
|
every datagram is taken from the datagram itself. 3proxy authorizes the
|
||||||
|
destination of every datagram, so ACLs limiting the destination address, the
|
||||||
|
destination host name or the destination port do apply to UDP traffic, unless
|
||||||
|
the \fB-U\fR option of the \fBsocks\fR service says otherwise.
|
||||||
|
.br
|
||||||
|
ACLs are only checked for the datagrams sent by the client. A datagram received
|
||||||
|
on the association is relayed to the client without an ACL check: with a parent
|
||||||
|
proxy only the datagrams from the parent are accepted, an association without a
|
||||||
|
parent accepts a datagram from any source. The source reported to the client is
|
||||||
|
the actual source of the datagram. The address in the log record is the destination the
|
||||||
|
client sent the datagrams to, the source of the datagrams received on the
|
||||||
|
association is not logged.
|
||||||
|
.br
|
||||||
|
A client may use a single association to reach many destinations. An ACL entry
|
||||||
|
which limits the destination silently drops the datagrams to every other
|
||||||
|
destination, so limiting the destination of UDP traffic can break such clients
|
||||||
|
in a way which is hard to diagnose. Limit it only when it is really required.
|
||||||
|
.br
|
||||||
|
Bandwidth limiters (\fBbandlimin\fR, \fBbandlimout\fR) and traffic counters
|
||||||
|
(\fBcountin\fR, \fBcountout\fR) which limit the destination are selected when
|
||||||
|
the destination is authorized, so within an UDP association they are selected
|
||||||
|
for the destination of the first datagram and are not re-selected for every
|
||||||
|
following destination. They can not be applied per destination to the incoming
|
||||||
|
UDP traffic at all, because an incoming datagram is not matched against any
|
||||||
|
destination.
|
||||||
|
.br
|
||||||
|
Only \fBsocks5\fR and \fBsocks5+\fR parents can be used for UDP. Because
|
||||||
|
every new destination is authorized, use \fBauthcache\fR, especially with
|
||||||
|
\'strong\', RADIUS or plugin authentication: \fBcacheacl\fR with the
|
||||||
|
destination in the cache key if no parent proxy is used, \fBcache\fR
|
||||||
|
otherwise, see \fBcacheacl\fR.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
.BR parent
|
.BR parent
|
||||||
@@ -757,9 +885,35 @@ build proxy chain. Proxies may be grouped. Proxy inside the
|
|||||||
group is selected randomly. If few groups are specified one proxy
|
group is selected randomly. If few groups are specified one proxy
|
||||||
is randomly picked from each group and chain of proxies is created
|
is randomly picked from each group and chain of proxies is created
|
||||||
(that is second proxy connected through first one and so on).
|
(that is second proxy connected through first one and so on).
|
||||||
Weight is used to group proxies. Weight is a number between 1 and 1000.
|
Weight is used to group proxies. A weight is a share of the whole, written
|
||||||
Weights are summed and proxies are grouped together until the weight of
|
either as a fraction of one, anything beginning with 0 or with a point, or the
|
||||||
the group is 1000. That is:
|
old way, in thousandths:
|
||||||
|
.br
|
||||||
|
\fB.5\fR and \fB0.5\fR and \fB500\fR are all a half
|
||||||
|
.br
|
||||||
|
\fB.333\fR and \fB333\fR are both 333 thousandths
|
||||||
|
.br
|
||||||
|
\fB1000\fR and \fB1.0\fR and \fB100%\fR are all the whole share
|
||||||
|
.br
|
||||||
|
\fB50.5%\fR and \fB.505\fR and \fB505\fR are all the same share
|
||||||
|
.br
|
||||||
|
\fB0\fR is a fallback, described below
|
||||||
|
.br
|
||||||
|
A fraction takes up to nine digits after the point, \fB.333333333\fR being
|
||||||
|
the finest share there is, and the old notation may now carry further digits
|
||||||
|
after a point of its own, so \fB123.456\fR means the same as \fB.123456\fR.
|
||||||
|
Weights are scanned as integers, nothing is read as a floating point number.
|
||||||
|
\fB1.0\fR, with as many zeroes after the point as you care to write, is the
|
||||||
|
one weight read as it looks rather than in thousandths, so that the whole
|
||||||
|
share can be written as a fraction too: a bare \fB1\fR is still a thousandth
|
||||||
|
of it, and \fB1.5\fR still one and a half of them. A weight ending in
|
||||||
|
\fB%\fR is a percentage, and takes up to seven digits after the point.
|
||||||
|
.br
|
||||||
|
Weights are summed and proxies are grouped together until the weight of
|
||||||
|
the group is the whole share. A group which falls short of it by no more than
|
||||||
|
a thousandth, which three weights of \fB333\fR do, is taken for a whole one
|
||||||
|
rather than for a group with a remainder, so a share which cannot be divided
|
||||||
|
evenly needs no adjusting by hand. That is:
|
||||||
.br
|
.br
|
||||||
allow *
|
allow *
|
||||||
.br
|
.br
|
||||||
@@ -768,7 +922,8 @@ the group is 1000. That is:
|
|||||||
parent 500 connect 192.168.10.1 3128
|
parent 500 connect 192.168.10.1 3128
|
||||||
.br
|
.br
|
||||||
makes 3proxy to randomly choose between 2 proxies for all outgoing
|
makes 3proxy to randomly choose between 2 proxies for all outgoing
|
||||||
connections. These 2 proxies form 1 group (summarized weight is 1000).
|
connections. These 2 proxies form 1 group (their weights are the whole share
|
||||||
|
between them).
|
||||||
.br
|
.br
|
||||||
allow * * * 80
|
allow * * * 80
|
||||||
.br
|
.br
|
||||||
@@ -788,6 +943,10 @@ with probability of 0.7) for outgoing web connections. Chains are only applied t
|
|||||||
type is one of:
|
type is one of:
|
||||||
.br
|
.br
|
||||||
\fBextip\fR does not actually redirect the request; it sets the external address for this request to \fI<ip>\fR. It can be chained with another parent type. It's useful to set the external IP based on ACL or make it random.
|
\fBextip\fR does not actually redirect the request; it sets the external address for this request to \fI<ip>\fR. It can be chained with another parent type. It's useful to set the external IP based on ACL or make it random.
|
||||||
|
.br
|
||||||
|
\fBextport\fR does not redirect the request; it sets the range the local port of outgoing connections is taken from, given as \fIFIRST-LAST\fR inclusive in place of the port argument, with 0.0.0.0 as the address, for example \fBparent 1000 extport 0.0.0.0 40000-40100\fR. Where the system can be asked to pick the port itself (Linux \fBIP_LOCAL_PORT_RANGE\fR) it does, otherwise a port is picked at random from the range and retried if it is already in use, up to ten times. A port which binds but whose pair with the destination is still closing from an earlier connection, which Windows refuses at the connect, is retried in the same way and out of the same ten tries, so a repeated connection to one destination does not fail for a port it has just used. On Linux the range has to lie within \fInet.ipv4.ip_local_port_range\fR, commonly 32768-60999: the kernel ignores a range outside it and picks an ordinary ephemeral port instead. If no port in the range can be bound, an ephemeral port is used rather than failing the connection. It can be chained with another parent type, and the access rule it belongs to decides which requests it applies to, so \fBallow * * * * UDPASSOC\fR followed by \fBparent 1000 extport 0.0.0.0 40000-40100\fR limits it to UDP associations. The range is applied when the outgoing connection is made, so a kept alive connection carrying several requests uses the rule that matched when it was opened.
|
||||||
|
.br
|
||||||
|
\fBintport\fR is the same for sockets bound on the side facing the client: the port a UDP association tells the client to send its datagrams to, and the FTP proxy data connection.
|
||||||
.br
|
.br
|
||||||
\fBtcp\fR simply redirect connection. TCP is always last in chain. This type of proxy is a simple TCP redirection, it does not support parent authentication.
|
\fBtcp\fR simply redirect connection. TCP is always last in chain. This type of proxy is a simple TCP redirection, it does not support parent authentication.
|
||||||
.br
|
.br
|
||||||
@@ -821,9 +980,16 @@ unless you know exactly you need it.
|
|||||||
.br
|
.br
|
||||||
\fBadmin\fR redirect request to local \'admin\' service (with -s parameter).
|
\fBadmin\fR redirect request to local \'admin\' service (with -s parameter).
|
||||||
.br
|
.br
|
||||||
\fBha\fR send HAProxy PROXY protocol v1 header to parent proxy. Must be the last
|
\fBha\fR send HAProxy PROXY protocol v1 header to the next parent proxy (or to
|
||||||
in the proxy chain. Useful for passing client IP information to the parent proxy.
|
the destination if \fBha\fR is used alone). Place \fBha\fR before the parent
|
||||||
Example: parent 1000 ha
|
that should receive the header; after the header is sent, negotiation of that
|
||||||
|
parent protocol continues (SOCKS, CONNECT, etc.). Useful for passing client IP
|
||||||
|
information to the parent proxy.
|
||||||
|
Example:
|
||||||
|
.br
|
||||||
|
parent 1000 ha 0.0.0.0 0
|
||||||
|
.br
|
||||||
|
parent 1000 socks5 parent.example.com 1080
|
||||||
.br
|
.br
|
||||||
Use "+" proxy only with \fBfakeresolve\fR option
|
Use "+" proxy only with \fBfakeresolve\fR option
|
||||||
.br
|
.br
|
||||||
@@ -847,6 +1013,9 @@ locally redirects to
|
|||||||
.B pop3
|
.B pop3
|
||||||
locally redirects to
|
locally redirects to
|
||||||
.B pop3p
|
.B pop3p
|
||||||
|
.B imap
|
||||||
|
locally redirects to
|
||||||
|
.B imapp
|
||||||
.B http
|
.B http
|
||||||
locally redirects to
|
locally redirects to
|
||||||
.B proxy
|
.B proxy
|
||||||
@@ -887,12 +1056,37 @@ local HTTP proxy parses requests and allows only GET and POST requests.
|
|||||||
.br
|
.br
|
||||||
Optional username and password are used to authenticate on parent
|
Optional username and password are used to authenticate on parent
|
||||||
proxy. Username of \'*\' means username must be supplied by user.
|
proxy. Username of \'*\' means username must be supplied by user.
|
||||||
|
.br
|
||||||
|
A parent which fails is taken out of the choice for the rest of that
|
||||||
|
connection, so the next attempt, see \fBparentretries\fR, goes to another
|
||||||
|
member of the group instead of the same parent again. Its share is spread over
|
||||||
|
the parents of the group which are left, in proportion to their weights.
|
||||||
|
.br
|
||||||
|
Weight 0 marks a fallback parent. Such a parent takes no share of the random
|
||||||
|
choice, and none of the share left over by a parent which failed, and is only
|
||||||
|
used once every weighted parent of its group has failed,
|
||||||
|
which is how a parent used only when another one is down is configured:
|
||||||
|
.br
|
||||||
|
allow *
|
||||||
|
.br
|
||||||
|
parent 1000 socks5 192.168.10.1 1080
|
||||||
|
.br
|
||||||
|
parent 0 socks5 192.168.20.1 1080
|
||||||
|
.br
|
||||||
|
Several fallbacks are tried in the order they are written. Reaching a fallback
|
||||||
|
costs an attempt, so \fBparentretries\fR has to be at least as large as the
|
||||||
|
number of parents to try.
|
||||||
|
.br
|
||||||
|
When every parent of a group has failed the request fails as well, rather
|
||||||
|
than being sent without a parent.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
.BR parentretries
|
.BR parentretries
|
||||||
\fI<number>\fR
|
\fI<number>\fR
|
||||||
.br
|
.br
|
||||||
Number of retries to connect to parent proxy. Default is 1.
|
Number of attempts to reach a parent proxy. Default is 2. Each attempt
|
||||||
|
picks a parent again, leaving out the ones which already failed, so this is
|
||||||
|
also the number of different parents a request may be tried through.
|
||||||
|
|
||||||
|
|
||||||
.br
|
.br
|
||||||
@@ -1088,6 +1282,54 @@ the format:
|
|||||||
Note: double quotes are required because the password contains a $ sign.
|
Note: double quotes are required because the password contains a $ sign.
|
||||||
|
|
||||||
.br
|
.br
|
||||||
|
.BR transparent
|
||||||
|
\fI[auto|netfilter|pf|socket]\fR
|
||||||
|
.br
|
||||||
|
Take the destination of a connection, both address and port, from the packet
|
||||||
|
filter that redirected it, instead of from the request. It applies to services declared after it, and
|
||||||
|
\fBnotransparent\fR turns it off again for the services after that. Built into the
|
||||||
|
binary since 1.0.1, and previously the separate TransparentPlugin.
|
||||||
|
.br
|
||||||
|
On Linux the kernel is asked, so \fBiptables\fR or \fBnftables\fR
|
||||||
|
redirection is enough. On the BSDs pf is asked through \fB/dev/pf\fR, which
|
||||||
|
3proxy must be able to read, so \fBrdr\fR rules work; a redirection that
|
||||||
|
leaves the destination on the socket is used where there is one, as
|
||||||
|
\fBdivert-to\fR on OpenBSD and \fBipfw fwd\fR on FreeBSD do. macOS ships no
|
||||||
|
header for pf and has neither of those, so the commands exist in a macOS build
|
||||||
|
but cannot be used.
|
||||||
|
.br
|
||||||
|
The mechanism is chosen automatically. The optional argument pins it for an
|
||||||
|
installation that has more than one: \fBauto\fR is the default,
|
||||||
|
\fBnetfilter\fR asks the Linux kernel, \fBpf\fR looks the connection up in
|
||||||
|
the packet filter, and \fBsocket\fR reads the address off the socket. A mode
|
||||||
|
the build has no code for is refused rather than ignored.
|
||||||
|
.br
|
||||||
|
A connection that reaches a \fBsocket\fR mode service without having been
|
||||||
|
redirected is refused: its destination is the address the service listens on,
|
||||||
|
and using that would send the service to itself.
|
||||||
|
.br
|
||||||
|
A redirected connection carries no destination of its own, so without this the
|
||||||
|
service uses whatever it would use otherwise: the \fBHost\fR header for an
|
||||||
|
HTTP request, or the address a port mapper was configured with. \fBtlspr\fR
|
||||||
|
receives nothing at all unless traffic is redirected to it or the clients
|
||||||
|
resolve names to it, and with a redirection it has the address as well as the
|
||||||
|
name from the handshake, which is what allows access rules to be written with
|
||||||
|
host names. With it, every service reaches the address the
|
||||||
|
client was trying to reach, and access rules, parents, limits and logging apply
|
||||||
|
to it as usual.
|
||||||
|
.br
|
||||||
|
The redirection rules must not match the connections the proxy itself makes to
|
||||||
|
those destinations, or the traffic returns to the proxy and loops. Give the
|
||||||
|
service an outgoing address with \fB-e\fR and exclude that address in the rules,
|
||||||
|
or run 3proxy as its own user and exclude that user. See the
|
||||||
|
.B TRANSPARENT PROXYING
|
||||||
|
section of the documentation for rules per platform.
|
||||||
|
.br
|
||||||
|
.BR notransparent
|
||||||
|
.br
|
||||||
|
Stop taking the destination from the packet filter for the services declared
|
||||||
|
after it.
|
||||||
|
|
||||||
.B flush
|
.B flush
|
||||||
.br
|
.br
|
||||||
empty the active access list. The access list must be flushed every time you create a
|
empty the active access list. The access list must be flushed every time you create a
|
||||||
@@ -1146,7 +1388,12 @@ for all threads.
|
|||||||
.BR chroot
|
.BR chroot
|
||||||
\fI<path>\fR [\fI<uid>\fR] [\fI<gid>\fR]
|
\fI<path>\fR [\fI<uid>\fR] [\fI<gid>\fR]
|
||||||
.br
|
.br
|
||||||
calls chroot(path) and sets gid/uid. Unix only. uid/gid supported since 0.9, can be numeric or username/groupname
|
calls chroot(path) and sets gid/uid. Unix only. uid/gid supported since 0.9, can be numeric or username/groupname.
|
||||||
|
The time zone and the syslog connection are set up before the call.
|
||||||
|
Plugins which read their own configuration or load modules while running need them inside the chroot:
|
||||||
|
PAM (\fI/etc/pam.d\fR and the modules it names, read for every authentication),
|
||||||
|
LDAP (\fIldap.conf\fR and, for ldaps, the CA certificates),
|
||||||
|
ODBC (\fIodbc.ini\fR, \fIodbcinst.ini\fR and the driver libraries, loaded again whenever the connection is reopened).
|
||||||
|
|
||||||
.br
|
.br
|
||||||
.BR stacksize
|
.BR stacksize
|
||||||
@@ -1161,6 +1408,19 @@ crash on request processing, try to set some positive value. You may start with
|
|||||||
stacksize 65536
|
stacksize 65536
|
||||||
and then find the minimal value for the service to work. If you experience
|
and then find the minimal value for the service to work. If you experience
|
||||||
memory shortage, you can try to experiment with negative values.
|
memory shortage, you can try to experiment with negative values.
|
||||||
|
.br
|
||||||
|
With SQL logging (log &ODBC_string) the value is automatically raised to
|
||||||
|
32768 if it is smaller, because ODBC drivers require more stack. A
|
||||||
|
.BR stacksize
|
||||||
|
command placed after the
|
||||||
|
.BR log
|
||||||
|
command overrides this.
|
||||||
|
.br
|
||||||
|
The base stack size the value is added to is 49152. On FreeBSD, NetBSD,
|
||||||
|
OpenBSD and DragonFly it is 65536, because libc functions such as vfprintf()
|
||||||
|
called by syslog() use significantly more stack there. The result is never
|
||||||
|
lowered below PTHREAD_STACK_MIN, so a large negative value can not disable
|
||||||
|
the thread stack.
|
||||||
|
|
||||||
.SH PLUGINS
|
.SH PLUGINS
|
||||||
|
|
||||||
@@ -1323,7 +1583,7 @@ Apply a rule for matching regular expression.
|
|||||||
Match and replace with rewrite expression.
|
Match and replace with rewrite expression.
|
||||||
.br
|
.br
|
||||||
.BR pcre_extend
|
.BR pcre_extend
|
||||||
\fIFILTER_ACTION [ACE]\fR
|
\fIACE\fR
|
||||||
.br
|
.br
|
||||||
Extend the ACL of the last pcre or pcre_rewrite command by adding an additional ACE.
|
Extend the ACL of the last pcre or pcre_rewrite command by adding an additional ACE.
|
||||||
.br
|
.br
|
||||||
@@ -1346,6 +1606,15 @@ PCRE_NOTEMPTY, PCRE_UTF8, PCRE_NO_AUTO_CAPTURE, PCRE_NO_UTF8_CHECK, PCRE_AUTO_CA
|
|||||||
PCRE_PARTIAL, PCRE_DFA_SHORTEST, PCRE_DFA_RESTART, PCRE_FIRSTLINE, PCRE_DUPNAMES,
|
PCRE_PARTIAL, PCRE_DFA_SHORTEST, PCRE_DFA_RESTART, PCRE_FIRSTLINE, PCRE_DUPNAMES,
|
||||||
PCRE_NEWLINE_CR, PCRE_NEWLINE_LF, PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANY, PCRE_NEWLINE_ANYCRLF,
|
PCRE_NEWLINE_CR, PCRE_NEWLINE_LF, PCRE_NEWLINE_CRLF, PCRE_NEWLINE_ANY, PCRE_NEWLINE_ANYCRLF,
|
||||||
PCRE_BSR_ANYCRLF, PCRE_BSR_UNICODE.
|
PCRE_BSR_ANYCRLF, PCRE_BSR_UNICODE.
|
||||||
|
.br
|
||||||
|
These options apply to every pattern the configuration compiles, the host
|
||||||
|
patterns of access rules and \fBhttp\fR rules included, so set them before the
|
||||||
|
rules which are to use them.
|
||||||
|
.br
|
||||||
|
Regular expressions are not only for these commands: a host name in the target
|
||||||
|
list of an access rule, and the host and URL of an \fBhttp\fR rule, take one
|
||||||
|
when it is written with a \fBpcre:\fR prefix. See \fBallow\fR and BUILT IN
|
||||||
|
HTTP SERVER.
|
||||||
|
|
||||||
.SS PCRE Parameters
|
.SS PCRE Parameters
|
||||||
TYPE - type of filtered data (comma-delimited list):
|
TYPE - type of filtered data (comma-delimited list):
|
||||||
@@ -1373,6 +1642,12 @@ REGEXP - PCRE (Perl) regular expression. Use * if no regexp matching is required
|
|||||||
REWRITE_EXPRESSION - substitution string. May contain Perl-style substrings
|
REWRITE_EXPRESSION - substitution string. May contain Perl-style substrings
|
||||||
$1, $2, etc. $0 means the whole matched string. \er and \en may be used
|
$1, $2, etc. $0 means the whole matched string. \er and \en may be used
|
||||||
to insert new lines; the string may be empty ("").
|
to insert new lines; the string may be empty ("").
|
||||||
|
.br
|
||||||
|
A rewritten request is what the server receives. The destination is chosen,
|
||||||
|
and the access rules are applied to it, before the filters run, so a rewrite
|
||||||
|
that names another host or changes the method is logged but not acted on:
|
||||||
|
the request is still sent where the access rules allowed. Rewriting the path
|
||||||
|
or the query works on a direct connection and through a parent alike.
|
||||||
|
|
||||||
ACE - access control entry (user names, source IPs, destination IPs, ports, etc.),
|
ACE - access control entry (user names, source IPs, destination IPs, ports, etc.),
|
||||||
identical to allow/deny/bandlimin commands. The regular expression is only
|
identical to allow/deny/bandlimin commands. The regular expression is only
|
||||||
@@ -1380,11 +1655,247 @@ matched if the ACL matches the connection data.
|
|||||||
Warning: Regular expressions don't require authentication and cannot replace
|
Warning: Regular expressions don't require authentication and cannot replace
|
||||||
authentication and/or allow/deny ACLs.
|
authentication and/or allow/deny ACLs.
|
||||||
|
|
||||||
|
.SH OPTIONAL SERVICES
|
||||||
|
The mail proxies and FTP are built when they are asked for, and are not in a
|
||||||
|
default build. \fBMAILPROXY=true\fR builds \fBpop3p\fR, \fBimapp\fR and
|
||||||
|
\fBsmtpp\fR, and \fBFTP=true\fR builds \fBftppr\fR and the \fBftp://\fR
|
||||||
|
scheme of the HTTP proxy, which a \fBproxy\fR service then still has to ask
|
||||||
|
for with \fB-Xftp\fR; with CMake the switches are
|
||||||
|
\fB-D3PROXY_USE_MAILPROXY=ON\fR and \fB-D3PROXY_USE_FTP=ON\fR. The standalone
|
||||||
|
binaries of those services are built with them and not without.
|
||||||
|
.br
|
||||||
|
A configuration naming a service which was not built is still read. The three
|
||||||
|
mail proxies become \fBtlspr\fR negotiating STARTTLS in that protocol, which
|
||||||
|
is what most of their use amounts to now that the mail protocols are used over
|
||||||
|
TLS, and a \fBparent\fR chain naming \fBpop3\fR, \fBimap\fR or \fBsmtp\fR
|
||||||
|
does the same. \fBftppr\fR is answered by nothing: a client reaching it is
|
||||||
|
turned away and the refusal logged, since there is no protocol to fall back on.
|
||||||
|
|
||||||
|
.SH BUILT IN HTTP SERVER
|
||||||
|
The \fBhttpsrv\fR service answers requests itself instead of forwarding them.
|
||||||
|
What it does with a request is decided by \fBhttp\fR rules, which are taken in
|
||||||
|
the order they are written: the first whose host and URL both match handles the
|
||||||
|
request. Rules belong to the service that follows them, the way access rules do,
|
||||||
|
and \fBadmin\fR is \fBhttpsrv\fR with a set of rules already in place.
|
||||||
|
|
||||||
|
.BR http
|
||||||
|
\fIOPERATION HOST URL [PARAMETERS]\fR
|
||||||
|
.br
|
||||||
|
Handle a request for \fIURL\fR on \fIHOST\fR with \fIOPERATION\fR. HOST is
|
||||||
|
matched against the Host header, URL against the path, with the query string
|
||||||
|
removed.
|
||||||
|
|
||||||
|
.SS Operations
|
||||||
|
.br
|
||||||
|
\fBfile\fR \fIPATH [TYPE [MAX-AGE [HEADERS [CODE]]]]\fR - send the file at PATH.
|
||||||
|
The file is handed to the socket by the system where it can do that (sendfile,
|
||||||
|
TransmitFile) and read here where it cannot, as when the connection carries TLS.
|
||||||
|
The arguments after PATH are described below, and each of them may be written as
|
||||||
|
\fB*\fR to leave it out.
|
||||||
|
.br
|
||||||
|
\fBcache\fR \fIPATH [TYPE [MAX-AGE [HEADERS [CODE]]]]\fR - the same, but the
|
||||||
|
file is read into memory on the first request and answered from there afterwards.
|
||||||
|
A file that has changed on disk is read again, and one larger than a megabyte is
|
||||||
|
sent as \fBfile\fR would. With a MAX-AGE the file is not looked at again for
|
||||||
|
that long: the rule has already told clients the file may be treated as
|
||||||
|
unchanged for that time, so the server treats its own copy the same way and a
|
||||||
|
request costs nothing but the copy out. Without one every request stats the
|
||||||
|
file, so a change is picked up at once.
|
||||||
|
.br
|
||||||
|
\fBreply\fR \fI[CODE [HEADERS]]\fR - answer with a status and nothing else.
|
||||||
|
CODE is the status to send, 200 without one. A status which carries no body of
|
||||||
|
its own (1xx, 204, 304) is sent without a length; anything else is sent with a
|
||||||
|
length of zero.
|
||||||
|
.br
|
||||||
|
\fBredir\fR \fI[CODE] LOCATION\fR - answer with a redirect. CODE is 301 or 302,
|
||||||
|
or any status from 300 to 399; without one, 302 is used.
|
||||||
|
.br
|
||||||
|
\fBrewrite\fR \fIPATH\fR - change the path of the request and hand it to the
|
||||||
|
rules that follow this one.
|
||||||
|
.br
|
||||||
|
\fBrewrite_host\fR \fIHOST\fR - the same for the host, which decides which of
|
||||||
|
the rules after it match. \fB$1\fR upwards stand for what the stars, or the
|
||||||
|
groups, of this rule\'s host pattern matched, the way they stand for those of
|
||||||
|
the URL in a \fBrewrite\fR. What is built has to be a host name; the name the
|
||||||
|
client sent is what access rules matched and what the log records.
|
||||||
|
.br
|
||||||
|
\fBecho\fR - answer with a description of the request: the method, path, query,
|
||||||
|
host, and the address and port it came from. For testing.
|
||||||
|
.br
|
||||||
|
\fBdata\fR \fI[size=N] [block=N] [status=N] [chunked=1] [delay=N]\fR - answer
|
||||||
|
with generated content of the size asked for. For testing.
|
||||||
|
.br
|
||||||
|
\fBproxypass\fR - hand the request to the proxy code, which fetches it the
|
||||||
|
way \fBproxy\fR would, see BOTH A SITE AND A PROXY.
|
||||||
|
.br
|
||||||
|
\fBadmin\fR, \fBadmin_counters\fR, \fBadmin_reload\fR, \fBadmin_services\fR -
|
||||||
|
the pages of the administration interface.
|
||||||
|
|
||||||
|
.SS What a rule adds to the answer
|
||||||
|
\fBTYPE\fR is the content type to answer with. Without it, or with \fB*\fR, the
|
||||||
|
type is worked out from the name of the file, see \fBhttp_content_type\fR.
|
||||||
|
.br
|
||||||
|
\fBMAX-AGE\fR is a number of seconds, and is sent as Cache-Control: max-age.
|
||||||
|
Without it, or with \fB*\fR, nothing is said about caching.
|
||||||
|
.br
|
||||||
|
\fBHEADERS\fR is one argument holding whole header lines, separated by a
|
||||||
|
backslash and an n \- the two characters, since a configuration line cannot
|
||||||
|
carry a line ending. Each becomes a real line ending in the answer. Quote the
|
||||||
|
argument if any header holds a space, which they usually do.
|
||||||
|
.br
|
||||||
|
\fBCODE\fR is the status to answer with instead of 200, which is how a file
|
||||||
|
serves as the body of an error page.
|
||||||
|
.br
|
||||||
|
A rule's headers and MAX-AGE go with whatever status that rule asked for. They
|
||||||
|
are not sent with a refusal the server itself decided on: a request for a file
|
||||||
|
which is not there is answered 404 by the server, not by the rule.
|
||||||
|
.br
|
||||||
|
\fBfile\fR and \fBcache\fR send Last-Modified, and answer a request carrying
|
||||||
|
If-Modified-Since with 304 and no body when the file has not changed since the
|
||||||
|
time it names. All three date formats HTTP allows are read; one which cannot be
|
||||||
|
read is treated as no date at all. A rule answering with a CODE of its own is
|
||||||
|
answering something other than the file, so it is never turned into a 304.
|
||||||
|
.br
|
||||||
|
http file * /err/** "/usr/local/web/404.html" text/html * "X-Served: static" 404
|
||||||
|
.br
|
||||||
|
http reply * /health** 200 "X-Health: ok"
|
||||||
|
.br
|
||||||
|
http reply * /down** 503 "Retry-After: 30"
|
||||||
|
|
||||||
|
.BR http_content_type
|
||||||
|
\fIEXTENSION TYPE\fR
|
||||||
|
.br
|
||||||
|
Answer for a file with that extension with that content type, in addition to
|
||||||
|
the types already known. The extension may be written with or without its dot.
|
||||||
|
A type named by a rule is used whatever this says, and a name the server knows
|
||||||
|
nothing about is answered as application/octet-stream.
|
||||||
|
.br
|
||||||
|
http_content_type .webp image/webp
|
||||||
|
|
||||||
|
.SS Patterns
|
||||||
|
A URL is matched with stars, or with a regular expression when it carries a
|
||||||
|
\fBpcre:\fR prefix (\fBregex:\fR is taken as well). A host is matched the way an
|
||||||
|
access list matches one, and takes the same prefix.
|
||||||
|
.br
|
||||||
|
\fB*\fR stands for any run of characters within one element of the path: it
|
||||||
|
does not cross a \fB/\fR, so a rule cannot reach into a directory it did not
|
||||||
|
name.
|
||||||
|
.br
|
||||||
|
\fB**\fR crosses them, and is what a rule which should match everything below a
|
||||||
|
point, or everything at all, is written with.
|
||||||
|
.br
|
||||||
|
Each star, and each group of a regular expression, is remembered in the order
|
||||||
|
it appears. \fB$1\fR upwards stand for them in the path or location a rule
|
||||||
|
builds, and \fB$0\fR for the whole request path.
|
||||||
|
.br
|
||||||
|
Outside quotes a dollar begins the name of a file to include, so an argument
|
||||||
|
holding one \- a path or location built with \fB$1\fR, a regular expression
|
||||||
|
anchored with \fB$\fR \- is written in quotes. \fB$$\fR stands for a single
|
||||||
|
dollar and is not read as an include either, which is how a dollar reaches a
|
||||||
|
rule as text.
|
||||||
|
|
||||||
|
.SS Both a site and a proxy
|
||||||
|
A request may arrive the way it arrives at a site, naming a path and a host in
|
||||||
|
the Host header, or the way it arrives at a proxy, naming the whole URL, or, for
|
||||||
|
a tunnel, the host alone with CONNECT. Both are read. A request in the proxy
|
||||||
|
form authenticates with Proxy-Authorization and is refused with 407, as a proxy
|
||||||
|
refuses one; a request in the site form uses Authorization and 401.
|
||||||
|
.br
|
||||||
|
What answers a request is still decided by the rules. \fBproxypass\fR is the
|
||||||
|
rule which answers by fetching, so a service can serve what it has and proxy the
|
||||||
|
rest:
|
||||||
|
.br
|
||||||
|
http file * /local/** "/usr/local/web/$1"
|
||||||
|
.br
|
||||||
|
http proxypass * /**
|
||||||
|
.br
|
||||||
|
httpsrv -p8080
|
||||||
|
.br
|
||||||
|
The same happens without a rule for it where an access rule redirects to the
|
||||||
|
local proxy, which is written as a chain of no address: the rules are asked
|
||||||
|
first, and a request none of them answers is fetched.
|
||||||
|
.br
|
||||||
|
allow *
|
||||||
|
.br
|
||||||
|
parent 1000 http 0.0.0.0 0
|
||||||
|
.br
|
||||||
|
allow *
|
||||||
|
.br
|
||||||
|
The second \fBallow\fR is what the proxy matches on the pass it makes itself:
|
||||||
|
a rule carrying the chain is not taken twice. Authentication happens twice for
|
||||||
|
the same reason, once for the service and once for the proxy, so a configuration
|
||||||
|
asking for credentials asks for them as a proxy does.
|
||||||
|
.br
|
||||||
|
The access rules are read from the top on both passes, and it is the second
|
||||||
|
pass which describes where the request is going. On the first one the service is
|
||||||
|
answering for itself, so the destination an address or a port is matched against
|
||||||
|
is the address the client connected to; the name from the request is matched on
|
||||||
|
both. On the second the destination is the one the request names, so rules
|
||||||
|
written with an address, a port or a name decide what the proxy is allowed to
|
||||||
|
fetch, and they decide it before the connection is made:
|
||||||
|
.br
|
||||||
|
allow *
|
||||||
|
.br
|
||||||
|
parent 1000 http 0.0.0.0 0
|
||||||
|
.br
|
||||||
|
allow * * * 80,443
|
||||||
|
.br
|
||||||
|
deny *
|
||||||
|
.br
|
||||||
|
Everything reaches the rules, and only ports 80 and 443 are fetched. A rule
|
||||||
|
before the one carrying the chain applies on both passes just the same, so a
|
||||||
|
\fBdeny\fR written there stops the request as well.
|
||||||
|
.br
|
||||||
|
The connection to the server is kept for the request after it, and closed when
|
||||||
|
the request after it goes somewhere else, or when the server has closed it in
|
||||||
|
the meantime. A tunnel is fetched by the proxy code as well, which means the
|
||||||
|
connection carrying it belongs to that request alone.
|
||||||
|
|
||||||
|
.SS Connections
|
||||||
|
An answer is sent as HTTP/1.1 to a client which asked in HTTP/1.1, and the
|
||||||
|
connection is kept for the next request unless the client sent
|
||||||
|
\fBConnection: close\fR. A 1.0 client gets a 1.0 answer, and the connection is
|
||||||
|
kept only when it asked with \fBConnection: keep-alive\fR.
|
||||||
|
.br
|
||||||
|
The connection is kept only when what was sent is framed exactly: every
|
||||||
|
operation but the administration pages states a length, or sends a chunked body
|
||||||
|
a 1.1 client can read, so the pages of \fBadmin\fR are always the last thing on
|
||||||
|
a connection. A request body which cannot be read to its end ends the connection
|
||||||
|
as well: one sent with \fBTransfer-Encoding\fR, which this server does not read,
|
||||||
|
and one longer than a megabyte, which it will not.
|
||||||
|
|
||||||
|
.SS Paths a rule builds
|
||||||
|
The path a rule builds is used as it is, so it is refused rather than corrected
|
||||||
|
when it is not a plain full path. A relative path is refused: it would be read
|
||||||
|
against whatever directory the service happens to be in. So is one holding
|
||||||
|
\fB.\fR or \fB..\fR as an element, a carriage return, a newline or a star. On
|
||||||
|
Windows a path must name a drive or a share, and is converted to the extended
|
||||||
|
\\\\?\\ form and opened through the wide interface, so a long path works.
|
||||||
|
.br
|
||||||
|
A request is checked before any of this: a path which decodes to one leaving
|
||||||
|
the tree is refused outright.
|
||||||
|
|
||||||
|
.SS Examples
|
||||||
|
.br
|
||||||
|
http file example.com /my/webpath/*.html "/usr/local/web/$1.html"
|
||||||
|
.br
|
||||||
|
http cache example.com "pcre:^/(.*)/pic/(.*)\.(gif|jpeg)$" "/usr/local/web/picts/$1/$2.$3"
|
||||||
|
.br
|
||||||
|
http redir * /old/** 301 "https://example.org/$1"
|
||||||
|
.br
|
||||||
|
http rewrite * /alias/** "/w/$1"
|
||||||
|
.br
|
||||||
|
http rewrite_host *.old.example ** "$1.new.example"
|
||||||
|
.br
|
||||||
|
http file * /static/** "/usr/local/web/static/$1"
|
||||||
|
.br
|
||||||
|
httpsrv -p8080
|
||||||
|
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
Report all bugs to
|
Report all bugs to
|
||||||
.BR 3proxy@3proxy.org
|
.BR 3proxy@3proxy.org
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
3proxy(8), 3proxy_crypt(8), proxy(8), ftppr(8), socks(8), pop3p(8), smtpp(8), tlspr(8), tcppm(8), udppm(8), syslogd(8),
|
3proxy(8), 3proxy_crypt(8), proxy(8), ftppr(8), socks(8), pop3p(8), imapp(8), smtpp(8), tlspr(8), tcppm(8), udppm(8), syslogd(8),
|
||||||
.br
|
.br
|
||||||
https://3proxy.org/
|
https://3proxy.org/
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
|
|||||||
+124
@@ -0,0 +1,124 @@
|
|||||||
|
.TH imapp "8" "July 2026" "3proxy 0.9" "Universal proxy server"
|
||||||
|
.SH NAME
|
||||||
|
.B imapp
|
||||||
|
\- IMAPv4 proxy gateway service
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.BR "imapp " [ -d ]
|
||||||
|
.IB \fR[ -l \fR[ \fR[ @ \fR] logfile \fR]]
|
||||||
|
.IB \fR[ -p port\fR]
|
||||||
|
.IB \fR[ -i internal_ip\fR]
|
||||||
|
.IB \fR[ -e external_ip\fR]
|
||||||
|
.IB \fR[ -h default_ip[:port]\fR]
|
||||||
|
.IB \fR[ -x ]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B imapp
|
||||||
|
is IMAPv4 (IMAP4rev1) gateway service to allow internal users to access external
|
||||||
|
IMAP servers.
|
||||||
|
.SH OPTIONS
|
||||||
|
.TP
|
||||||
|
.B -I
|
||||||
|
Inetd mode. Standalone service only.
|
||||||
|
.TP
|
||||||
|
.B -d
|
||||||
|
Daemonize. Detach service from console and run in the background.
|
||||||
|
.TP
|
||||||
|
.B -t
|
||||||
|
Be silenT. Do not log start/stop/accept error records.
|
||||||
|
.TP
|
||||||
|
.B -u
|
||||||
|
Never look for username authentication.
|
||||||
|
.TP
|
||||||
|
.B -e
|
||||||
|
External address. IP address of the interface the proxy should initiate connections
|
||||||
|
from.
|
||||||
|
By default, the system will decide which address to use in accordance
|
||||||
|
with the routing table.
|
||||||
|
.TP
|
||||||
|
.B \-ni\fIPATH\fR
|
||||||
|
(Linux only) Switch to the network namespace identified by
|
||||||
|
.I PATH
|
||||||
|
before opening the listening socket. The current namespace is saved and restored
|
||||||
|
immediately after binding, so outgoing connections run in the original namespace
|
||||||
|
unless
|
||||||
|
.B \-ne
|
||||||
|
is also given.
|
||||||
|
.TP
|
||||||
|
.B \-ne\fIPATH\fR
|
||||||
|
(Linux only) Switch to the network namespace identified by
|
||||||
|
.I PATH
|
||||||
|
after the listening socket has been bound (and after restoring from
|
||||||
|
.B \-ni
|
||||||
|
if applicable). Both options accept any namespace file path
|
||||||
|
(e.g.\& \fI/var/run/netns/myns\fR or \fI/proc/PID/ns/net\fR)
|
||||||
|
and require \fBCAP_SYS_ADMIN\fR.
|
||||||
|
.TP
|
||||||
|
.B -i
|
||||||
|
Internal address. IP address the proxy accepts connections to.
|
||||||
|
By default, connections to any interface are accepted. It\'s usually unsafe.
|
||||||
|
Unix domain sockets can be specified with
|
||||||
|
.I -iunix:/path/to/socket
|
||||||
|
syntax (e.g., -iunix:/var/run/imapp.sock). On Linux, abstract sockets use
|
||||||
|
.I -iunix:@socketname
|
||||||
|
syntax.
|
||||||
|
.TP
|
||||||
|
.B -p
|
||||||
|
Port. Port proxy listens for incoming connections. Default is 143.
|
||||||
|
.TP
|
||||||
|
.B -h
|
||||||
|
Default destination. It's used if the target address is not specified by the user.
|
||||||
|
.TP
|
||||||
|
.B -x
|
||||||
|
Disable STARTTLS support. STARTTLS is not announced in the CAPABILITY
|
||||||
|
response and the STARTTLS command is not accepted.
|
||||||
|
.TP
|
||||||
|
.B -l
|
||||||
|
Log. By default logging is to stdout. If
|
||||||
|
.I logfile
|
||||||
|
is specified logging is to file. Under Unix, if
|
||||||
|
.RI \' @ \'
|
||||||
|
precedes
|
||||||
|
.IR logfile ,
|
||||||
|
syslog is used for logging.
|
||||||
|
.TP
|
||||||
|
.B -S
|
||||||
|
Increase or decrease stack size. You may want to try something like -S8192 if you experience 3proxy
|
||||||
|
crashes.
|
||||||
|
.SH CLIENTS
|
||||||
|
You can use any MUA (Mail User Agent) with IMAPv4 support. Set the client to use
|
||||||
|
.I internal_ip
|
||||||
|
and
|
||||||
|
.IR port
|
||||||
|
as an IMAP server. The address of the real IMAP server must be configured as a part of
|
||||||
|
the IMAP username. The format for the username is
|
||||||
|
.IR username @ server ,
|
||||||
|
where
|
||||||
|
.I server
|
||||||
|
is the address of the IMAP server and
|
||||||
|
.I username
|
||||||
|
is the user\'s login on this IMAP server. The login itself may contain an \'@\' sign.
|
||||||
|
Supported client authentication methods are the LOGIN command, AUTHENTICATE PLAIN
|
||||||
|
and AUTHENTICATE LOGIN. With the server, the proxy authenticates using the method
|
||||||
|
chosen by the client if the server supports it (as advertised in the CAPABILITY
|
||||||
|
response); otherwise it falls back to AUTHENTICATE LOGIN, AUTHENTICATE PLAIN or
|
||||||
|
the LOGIN command, in this order of preference. Challenge-response authentication
|
||||||
|
(CRAM-MD5, etc.) is not supported, because it requires a challenge from the server
|
||||||
|
before we know which server to connect to.
|
||||||
|
When running as a 3proxy service (not as a standalone binary), STARTTLS is
|
||||||
|
supported and announced in the CAPABILITY response unless disabled with
|
||||||
|
.BR -x .
|
||||||
|
After the client issues STARTTLS, the connection is handled by
|
||||||
|
.BR tlspr (8):
|
||||||
|
the destination host is taken from the SNI of the client TLS handshake (or from
|
||||||
|
the -h option), the proxy performs STARTTLS negotiation with the destination
|
||||||
|
server, and then transparently passes TLS traffic between the client and the
|
||||||
|
server. If the destination server does not support STARTTLS, the TLS handshake
|
||||||
|
with the client fails.
|
||||||
|
.SH BUGS
|
||||||
|
Report all bugs to
|
||||||
|
.BR 3proxy@3proxy.org
|
||||||
|
.SH SEE ALSO
|
||||||
|
3proxy(8), ftppr(8), pop3p(8), proxy(8), smtpp(8), socks(8), tcppm(8), tlspr(8), udppm(8), syslogd(8),
|
||||||
|
.br
|
||||||
|
https://3proxy.org/
|
||||||
|
.SH AUTHORS
|
||||||
|
3proxy is designed by Vladimir Dubrovin <vlad@3proxy.org>
|
||||||
+15
@@ -9,6 +9,7 @@
|
|||||||
.IB \fR[ -i internal_ip\fR]
|
.IB \fR[ -i internal_ip\fR]
|
||||||
.IB \fR[ -e external_ip\fR]
|
.IB \fR[ -e external_ip\fR]
|
||||||
.IB \fR[ -h default_ip[:port]\fR]
|
.IB \fR[ -h default_ip[:port]\fR]
|
||||||
|
.IB \fR[ -x ]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B pop3p
|
.B pop3p
|
||||||
is POP3 gateway service to allow internal users to access external POP3
|
is POP3 gateway service to allow internal users to access external POP3
|
||||||
@@ -66,6 +67,10 @@ Port. Port proxy listens for incoming connections. Default is 110.
|
|||||||
.B -h
|
.B -h
|
||||||
Default destination. It's used if the target address is not specified by the user.
|
Default destination. It's used if the target address is not specified by the user.
|
||||||
.TP
|
.TP
|
||||||
|
.B -x
|
||||||
|
Disable STARTTLS (STLS) support. STLS is not announced in the CAPA response
|
||||||
|
and the STLS command is not accepted.
|
||||||
|
.TP
|
||||||
.B -l
|
.B -l
|
||||||
Log. By default logging is to stdout. If
|
Log. By default logging is to stdout. If
|
||||||
.I logfile
|
.I logfile
|
||||||
@@ -94,6 +99,16 @@ is the user\'s login on this POP3 server. The login itself may contain an \'@\'
|
|||||||
Only cleartext authentication is supported, because challenge-response
|
Only cleartext authentication is supported, because challenge-response
|
||||||
authentication (APOP, CRAM-MD5, etc.) requires a challenge from the server before
|
authentication (APOP, CRAM-MD5, etc.) requires a challenge from the server before
|
||||||
we know which server to connect to.
|
we know which server to connect to.
|
||||||
|
When running as a 3proxy service (not as a standalone binary), STLS is
|
||||||
|
supported and announced in the CAPA response unless disabled with
|
||||||
|
.BR -x .
|
||||||
|
After the client issues STLS, the connection is handled by
|
||||||
|
.BR tlspr (8):
|
||||||
|
the destination host is taken from the SNI of the client TLS handshake (or from
|
||||||
|
the -h option), the proxy performs STLS negotiation with the destination
|
||||||
|
server, and then transparently passes TLS traffic between the client and the
|
||||||
|
server. If the destination server does not support STLS, the TLS handshake
|
||||||
|
with the client fails.
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
Report all bugs to
|
Report all bugs to
|
||||||
.BR 3proxy@3proxy.org
|
.BR 3proxy@3proxy.org
|
||||||
|
|||||||
+16
-1
@@ -9,6 +9,7 @@
|
|||||||
.IB \fR[ -i internal_ip\fR]
|
.IB \fR[ -i internal_ip\fR]
|
||||||
.IB \fR[ -e external_ip\fR]
|
.IB \fR[ -e external_ip\fR]
|
||||||
.IB \fR[ -h default_ip[:port]\fR]
|
.IB \fR[ -h default_ip[:port]\fR]
|
||||||
|
.IB \fR[ -x ]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B smtpp
|
.B smtpp
|
||||||
is SMTP gateway service to allow internal users to access external SMTP
|
is SMTP gateway service to allow internal users to access external SMTP
|
||||||
@@ -61,11 +62,15 @@ syntax (e.g., -iunix:/var/run/smtpp.sock). On Linux, abstract sockets use
|
|||||||
syntax.
|
syntax.
|
||||||
.TP
|
.TP
|
||||||
.B -p
|
.B -p
|
||||||
Port. Port proxy listens for incoming connections. Default is 25.
|
Port. Port proxy listens for incoming connections. Default is 587.
|
||||||
.TP
|
.TP
|
||||||
.B -h
|
.B -h
|
||||||
Default destination. It's used if the target address is not specified by the user.
|
Default destination. It's used if the target address is not specified by the user.
|
||||||
.TP
|
.TP
|
||||||
|
.B -x
|
||||||
|
Disable STARTTLS support. STARTTLS is not announced in the EHLO response
|
||||||
|
and the STARTTLS command is not accepted.
|
||||||
|
.TP
|
||||||
.B -l
|
.B -l
|
||||||
Log. By default logging is to stdout. If
|
Log. By default logging is to stdout. If
|
||||||
.I logfile
|
.I logfile
|
||||||
@@ -95,6 +100,16 @@ is the user\'s login on this SMTP server. The login itself may contain an \'@\'
|
|||||||
Only cleartext authentication is supported, because challenge-response
|
Only cleartext authentication is supported, because challenge-response
|
||||||
authentication (CRAM-MD5, SPA, etc.) requires a challenge from the server before
|
authentication (CRAM-MD5, SPA, etc.) requires a challenge from the server before
|
||||||
we know which server to connect to.
|
we know which server to connect to.
|
||||||
|
When running as a 3proxy service (not as a standalone binary), STARTTLS is
|
||||||
|
supported and announced in the EHLO response unless disabled with
|
||||||
|
.BR -x .
|
||||||
|
After the client issues STARTTLS, the connection is handled by
|
||||||
|
.BR tlspr (8):
|
||||||
|
the destination host is taken from the SNI of the client TLS handshake (or from
|
||||||
|
the -h option), the proxy performs STARTTLS negotiation with the destination
|
||||||
|
server, and then transparently passes TLS traffic between the client and the
|
||||||
|
server. If the destination server does not support STARTTLS, the TLS handshake
|
||||||
|
with the client fails.
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
Report all bugs to
|
Report all bugs to
|
||||||
.BR 3proxy@3proxy.org
|
.BR 3proxy@3proxy.org
|
||||||
|
|||||||
+10
@@ -13,6 +13,7 @@
|
|||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B tlspr
|
.B tlspr
|
||||||
is an SNI gateway service (destination host is taken from TLS handshake). The destination port must be specified via the -P option (or it may be detected with the Transparent plugin).
|
is an SNI gateway service (destination host is taken from TLS handshake). The destination port must be specified via the -P option (or it may be detected with the Transparent plugin).
|
||||||
|
tlspr does not support user authentication; use ACLs by client IP or a parent proxy with authentication if access control is required.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.B -I
|
.B -I
|
||||||
@@ -78,6 +79,15 @@ TLS_CHECK_LEVEL. 0 (default) - allow non-TLS traffic to pass, 1 - require TLS, o
|
|||||||
.B -s
|
.B -s
|
||||||
Split the TLS Client HELLO packet across multiple TCP segments to make SNI-based DPI detection harder. An optional numeric value can follow (e.g. \fB-s1\fR) to control the splitting behaviour.
|
Split the TLS Client HELLO packet across multiple TCP segments to make SNI-based DPI detection harder. An optional numeric value can follow (e.g. \fB-s1\fR) to control the splitting behaviour.
|
||||||
.TP
|
.TP
|
||||||
|
.B -Ximap | -Xpop3 | -Xsmtp
|
||||||
|
STARTTLS mode for the given protocol. The proxy speaks the plaintext protocol
|
||||||
|
with the client (greeting, capability advertisement with STARTTLS only, STARTTLS
|
||||||
|
command), then, after the client issues STARTTLS and sends a TLS Client HELLO,
|
||||||
|
connects to the destination taken from SNI (default port 143/110/587), performs
|
||||||
|
STARTTLS negotiation with the destination server and transparently passes TLS
|
||||||
|
traffic. If the destination server does not support STARTTLS, the TLS handshake
|
||||||
|
with the client fails.
|
||||||
|
.TP
|
||||||
.B -l
|
.B -l
|
||||||
Log. By default logging is to stdout. If
|
Log. By default logging is to stdout. If
|
||||||
.I logfile
|
.I logfile
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ Content-type: text/html; charset=utf-8\n
|
|||||||
<A HREF='/C'>Счетчики</A><br><br>\n
|
<A HREF='/C'>Счетчики</A><br><br>\n
|
||||||
<A HREF='/R'>Перезагрузка конфигурации сервера</A><br><br>\n
|
<A HREF='/R'>Перезагрузка конфигурации сервера</A><br><br>\n
|
||||||
<A HREF='/S'>Запущенные сервисы</A><br><br>\n
|
<A HREF='/S'>Запущенные сервисы</A><br><br>\n
|
||||||
<A HREF='/F'>Настройка сервера</A>\n
|
|
||||||
</td><td>
|
</td><td>
|
||||||
<h2>%s %s Конфигурация</h2>
|
<h2>%s %s Конфигурация</h2>
|
||||||
[end]
|
[end]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=3proxy tiny proxy server
|
Description=3proxy tiny proxy server
|
||||||
Documentation=man:3proxy(1)
|
Documentation=man:3proxy(8) man:3proxy.cfg(5)
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
@@ -13,8 +13,15 @@ ExecReload=/bin/kill -SIGUSR1 $MAINPID
|
|||||||
KillMode=process
|
KillMode=process
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=60s
|
RestartSec=60s
|
||||||
LimitNOFILE=65536
|
# 3proxy uses one thread and two descriptors per connection (four for ftppr),
|
||||||
LimitNPROC=32768
|
# so it reaches these limits much earlier than event driven servers. They are
|
||||||
|
# ceilings only: the actual number of connections is governed by 'maxconn' in
|
||||||
|
# the configuration file. TasksMax must be set explicitly, systemd's
|
||||||
|
# DefaultTasksMax (15% of kernel.threads-max, e.g. ~9000) otherwise caps the
|
||||||
|
# number of threads, and thus connections, regardless of LimitNPROC.
|
||||||
|
LimitNOFILE=1048576
|
||||||
|
LimitNPROC=infinity
|
||||||
|
TasksMax=infinity
|
||||||
RuntimeDirectory=3proxy
|
RuntimeDirectory=3proxy
|
||||||
RuntimeDirectoryMode=0755
|
RuntimeDirectoryMode=0755
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,19 @@ if [ -f /etc/init.d/functions ]; then
|
|||||||
. /etc/init.d/functions
|
. /etc/init.d/functions
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# SysV init does not apply limits.conf consistently: start-stop-daemon does not
|
||||||
|
# open a PAM session, so pam_limits is not involved and the daemon inherits the
|
||||||
|
# limits of init. 3proxy needs two descriptors per connection (four for ftppr),
|
||||||
|
# so raise them here. Adjust to match 'maxconn' in the configuration file.
|
||||||
|
set_limits() {
|
||||||
|
ulimit -n 65536 2>/dev/null || ulimit -n 4096 2>/dev/null || true
|
||||||
|
ulimit -u 32768 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo -n "Starting 3Proxy: "
|
echo -n "Starting 3Proxy: "
|
||||||
|
set_limits
|
||||||
|
|
||||||
if [ ! -d /var/run/3proxy ]; then
|
if [ ! -d /var/run/3proxy ]; then
|
||||||
mkdir -p /var/run/3proxy
|
mkdir -p /var/run/3proxy
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2026 3proxy.org
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the BSD 3-Clause License.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=3proxy
|
||||||
|
PKG_VERSION:=1.0.0
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
# A trailing ? tells the download helper the URL is complete and PKG_SOURCE
|
||||||
|
# must not be appended to it.
|
||||||
|
PKG_SOURCE_URL:=https://codeload.github.com/3proxy/3proxy/tar.gz/refs/tags/$(PKG_VERSION)?
|
||||||
|
PKG_HASH:=35b07de1046f3aaeac4a7085101b7e5c453efa3527cbdc42a84690366c7ecfa8
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=Vladimir Dubrovin <vlad@3proxy.org>
|
||||||
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
|
PKG_LICENSE_FILES:=copying
|
||||||
|
PKG_CPE_ID:=cpe:/a:3proxy:3proxy
|
||||||
|
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
define Package/3proxy
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
SUBMENU:=Web Servers/Proxies
|
||||||
|
TITLE:=tiny free proxy server
|
||||||
|
URL:=https://3proxy.org/
|
||||||
|
DEPENDS:=+libopenssl +libpcre2
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/3proxy/description
|
||||||
|
3proxy is a tiny free proxy server supporting HTTP, HTTPS, FTP, SOCKS v4/v4a/v5,
|
||||||
|
POP3, SMTP, IMAP, TCP and UDP port mapping, with access control, bandwidth
|
||||||
|
limiting and traffic accounting.
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/3proxy/conffiles
|
||||||
|
/etc/config/3proxy
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Makefile.Linux appends to CFLAGS and LDFLAGS internally; the target flags have
|
||||||
|
# to be added rather than substituted, or the defines it relies on are lost.
|
||||||
|
define Build/Compile
|
||||||
|
$(MAKE) -C $(PKG_BUILD_DIR) -f Makefile.Linux \
|
||||||
|
CC="$(TARGET_CC)" \
|
||||||
|
EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
|
||||||
|
EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||||
|
PLUGINS=
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/3proxy/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/3proxy $(1)/usr/bin/3proxy
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
$(INSTALL_CONF) ./files/3proxy.config $(1)/etc/config/3proxy
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/3proxy.init $(1)/etc/init.d/3proxy
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,3proxy))
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
config 3proxy 'global'
|
||||||
|
option enabled '0'
|
||||||
|
option nscache '65536'
|
||||||
|
# option nscache6 '65536'
|
||||||
|
# static records, added to the cache; 0.0.0.0 blackholes a name
|
||||||
|
# list nsrecord 'ads.example.com 0.0.0.0'
|
||||||
|
option maxconn '128'
|
||||||
|
option auth 'iponly'
|
||||||
|
option log 'syslog'
|
||||||
|
# option timeouts '1 5 30 60 180 1800 15 60 15 5 5'
|
||||||
|
# list include '/etc/3proxy/extra.cfg'
|
||||||
|
list nserver '8.8.8.8'
|
||||||
|
list nserver '8.8.4.4'
|
||||||
|
# list user 'admin:CL:password'
|
||||||
|
# list extra_config 'timeouts 1 5 30 60 180 1800 15 60'
|
||||||
|
# access list used by services which do not define their own
|
||||||
|
list acl 'lan'
|
||||||
|
|
||||||
|
# Access rules are named sections referenced by services. The order of the
|
||||||
|
# references decides precedence: 3proxy stops at the first rule that matches.
|
||||||
|
config acl 'lan'
|
||||||
|
option action 'allow'
|
||||||
|
option src '192.168.1.0/24'
|
||||||
|
|
||||||
|
config acl 'deny_private'
|
||||||
|
option action 'deny'
|
||||||
|
option dst '10.0.0.0/8,172.16.0.0/12,192.168.0.0/16'
|
||||||
|
|
||||||
|
#config acl 'via_upstream'
|
||||||
|
# option action 'allow'
|
||||||
|
# list parent 'upstream'
|
||||||
|
|
||||||
|
# Parent proxies extend an allow rule to build a chain. Weights group them:
|
||||||
|
# parents whose weights sum to 1000 form one group and one is picked at random,
|
||||||
|
# several groups are chained in order.
|
||||||
|
#config parent 'upstream'
|
||||||
|
# option weight '1000'
|
||||||
|
# option type 'socks5'
|
||||||
|
# option ip '10.0.0.1'
|
||||||
|
# option port '1080'
|
||||||
|
# option username ''
|
||||||
|
# option password ''
|
||||||
|
|
||||||
|
config service 'proxy'
|
||||||
|
option enabled '0'
|
||||||
|
option type 'proxy'
|
||||||
|
option port '3128'
|
||||||
|
# option bind ''
|
||||||
|
# option external ''
|
||||||
|
# option extra ''
|
||||||
|
# option auth 'strong'
|
||||||
|
list acl 'deny_private'
|
||||||
|
list acl 'lan'
|
||||||
|
|
||||||
|
config service 'socks'
|
||||||
|
option enabled '0'
|
||||||
|
option type 'socks'
|
||||||
|
option port '1080'
|
||||||
|
list acl 'lan'
|
||||||
@@ -0,0 +1,460 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
START=50
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
|
CFGFILE=/var/etc/3proxy.cfg
|
||||||
|
PROG=/usr/bin/3proxy
|
||||||
|
|
||||||
|
# 3proxy.cfg is order dependent: authentication and access rules apply to the
|
||||||
|
# service lines that follow them, and the access list has to be flushed before
|
||||||
|
# each service. The file is written as one global block followed by one block
|
||||||
|
# per service.
|
||||||
|
|
||||||
|
acl_written=0
|
||||||
|
|
||||||
|
append_line() {
|
||||||
|
echo "$1" >> "$CFGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
append_include() {
|
||||||
|
echo "include $1" >> "$CFGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# The limiter directives carry their own ACL pattern rather than attaching to a
|
||||||
|
# preceding allow rule, and 3proxy defaults every omitted field to *, so the
|
||||||
|
# trailing wildcards are dropped again to keep the file readable.
|
||||||
|
# logformat takes a single argument, so a format containing spaces has to be
|
||||||
|
# quoted. Quotes already present in the UCI value are not doubled.
|
||||||
|
append_logformat() {
|
||||||
|
local fmt="$1"
|
||||||
|
|
||||||
|
case "$fmt" in
|
||||||
|
'"'*'"') ;;
|
||||||
|
*) fmt="\"$fmt\"" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "logformat $fmt" >> "$CFGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
limit_match() {
|
||||||
|
local users src dst ports ops weekdays periods out
|
||||||
|
|
||||||
|
config_get users "$1" users '*'
|
||||||
|
config_get src "$1" src '*'
|
||||||
|
config_get dst "$1" dst '*'
|
||||||
|
config_get ports "$1" ports '*'
|
||||||
|
config_get ops "$1" operations '*'
|
||||||
|
config_get weekdays "$1" weekdays '*'
|
||||||
|
config_get periods "$1" timeperiods '*'
|
||||||
|
|
||||||
|
out="$users $src $dst $ports $ops $weekdays $periods"
|
||||||
|
while [ "${out% \*}" != "$out" ]; do out="${out% \*}"; done
|
||||||
|
|
||||||
|
echo "$out"
|
||||||
|
}
|
||||||
|
|
||||||
|
append_limit() {
|
||||||
|
local type rate period number count_type limit match
|
||||||
|
|
||||||
|
config_get type "$1" type
|
||||||
|
|
||||||
|
case "$type" in
|
||||||
|
bandlimin|bandlimout|nobandlimin|nobandlimout|\
|
||||||
|
connlim|noconnlim|\
|
||||||
|
countin|countout|countall|nocountin|nocountout|nocountall) ;;
|
||||||
|
*)
|
||||||
|
echo "3proxy: limit '$1' has unknown type '$type', ignored" >&2
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
match=$(limit_match "$1")
|
||||||
|
|
||||||
|
case "$type" in
|
||||||
|
bandlimin|bandlimout)
|
||||||
|
config_get rate "$1" rate
|
||||||
|
[ -n "$rate" ] || {
|
||||||
|
echo "3proxy: limit '$1' needs a rate, ignored" >&2
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
echo "$type $rate $match" >> "$CFGFILE"
|
||||||
|
;;
|
||||||
|
connlim)
|
||||||
|
config_get rate "$1" rate
|
||||||
|
config_get period "$1" period 0
|
||||||
|
[ -n "$rate" ] || {
|
||||||
|
echo "3proxy: limit '$1' needs a rate, ignored" >&2
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
echo "$type $rate $period $match" >> "$CFGFILE"
|
||||||
|
;;
|
||||||
|
countin|countout|countall)
|
||||||
|
config_get number "$1" number
|
||||||
|
config_get count_type "$1" count_type
|
||||||
|
config_get limit "$1" limit
|
||||||
|
[ -n "$number" ] && [ -n "$count_type" ] && [ -n "$limit" ] || {
|
||||||
|
echo "3proxy: limit '$1' needs number, count_type and limit, ignored" >&2
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
echo "$type $number $count_type $limit $match" >> "$CFGFILE"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$type $match" >> "$CFGFILE"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
append_pcre_extend() {
|
||||||
|
echo "pcre_extend $1" >> "$CFGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
append_pcre() {
|
||||||
|
local match_type action regexp rewrite ace
|
||||||
|
|
||||||
|
config_get match_type "$1" match_type
|
||||||
|
config_get action "$1" action
|
||||||
|
config_get regexp "$1" regexp
|
||||||
|
config_get rewrite "$1" rewrite
|
||||||
|
config_get ace "$1" ace
|
||||||
|
|
||||||
|
[ -n "$match_type" ] && [ -n "$action" ] && [ -n "$regexp" ] || {
|
||||||
|
echo "3proxy: pcre '$1' needs match_type, action and regexp, ignored" >&2
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Catch bad values here: 3proxy rejects the whole configuration on an
|
||||||
|
# unknown type or action, which would leave the router without a proxy.
|
||||||
|
case "$action" in
|
||||||
|
allow|deny|dunno) ;;
|
||||||
|
*)
|
||||||
|
echo "3proxy: pcre '$1' action '$action' is not allow, deny or dunno, ignored" >&2
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
local part
|
||||||
|
for part in $(echo "$match_type" | tr ',' ' '); do
|
||||||
|
case "$part" in
|
||||||
|
request|cliheader|srvheader|clidata|srvdata) ;;
|
||||||
|
*)
|
||||||
|
echo "3proxy: pcre '$1' match_type '$part' is unknown, ignored" >&2
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "$rewrite" ]; then
|
||||||
|
echo "pcre_rewrite $match_type $action $regexp $rewrite${ace:+ $ace}" >> "$CFGFILE"
|
||||||
|
else
|
||||||
|
echo "pcre $match_type $action $regexp${ace:+ $ace}" >> "$CFGFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
config_list_foreach "$1" extend append_pcre_extend
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
append_nsrecord() {
|
||||||
|
set -- $1
|
||||||
|
if [ $# -ne 2 ]; then
|
||||||
|
echo "3proxy: nsrecord '$*' needs a hostname and an address, ignored" >&2
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "nsrecord $1 $2" >> "$CFGFILE"
|
||||||
|
nsrecord_written=1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
append_nserver() {
|
||||||
|
echo "nserver $1" >> "$CFGFILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
append_user() {
|
||||||
|
users="$users $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1 is the name of an acl section referenced by a service, or by the global
|
||||||
|
# section as the default access list.
|
||||||
|
append_acl() {
|
||||||
|
local action users src dst ports
|
||||||
|
|
||||||
|
config_get action "$1" action allow
|
||||||
|
config_get users "$1" users
|
||||||
|
config_get src "$1" src
|
||||||
|
config_get dst "$1" dst
|
||||||
|
config_get ports "$1" ports
|
||||||
|
|
||||||
|
case "$action" in
|
||||||
|
allow|deny) ;;
|
||||||
|
*)
|
||||||
|
echo "3proxy: acl '$1' has unknown action '$action', ignored" >&2
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "$action ${users:-*} ${src:-*} ${dst:-*} ${ports:-*}" >> "$CFGFILE"
|
||||||
|
acl_written=1
|
||||||
|
|
||||||
|
if [ "$action" = "allow" ]; then
|
||||||
|
config_list_foreach "$1" parent append_parent
|
||||||
|
else
|
||||||
|
config_get _parent "$1" parent
|
||||||
|
[ -z "$_parent" ] || echo "3proxy: acl '$1' is a deny rule, its parents are ignored" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# $1 is the name of a parent section referenced by an acl. "parent" extends the
|
||||||
|
# allow rule that precedes it, so these are emitted directly after their rule.
|
||||||
|
append_parent() {
|
||||||
|
local weight type ip port username password line
|
||||||
|
|
||||||
|
config_get weight "$1" weight 1000
|
||||||
|
config_get type "$1" type
|
||||||
|
config_get ip "$1" ip
|
||||||
|
config_get port "$1" port
|
||||||
|
config_get username "$1" username
|
||||||
|
config_get password "$1" password
|
||||||
|
|
||||||
|
[ -n "$type" ] && [ -n "$ip" ] && [ -n "$port" ] || {
|
||||||
|
echo "3proxy: parent '$1' needs type, ip and port, ignored" >&2
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
line="parent $weight $type $ip $port"
|
||||||
|
if [ -n "$username" ]; then
|
||||||
|
line="$line $username"
|
||||||
|
[ -n "$password" ] && line="$line $password"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$line" >> "$CFGFILE"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# TLS parameters that take a value. The UCI option name is the directive name.
|
||||||
|
SSL_VALUE_OPTIONS="ssl_server_cert ssl_server_key ssl_client_cert ssl_client_key
|
||||||
|
ssl_client_ciphersuites ssl_server_ciphersuites
|
||||||
|
ssl_client_cipher_list ssl_server_cipher_list
|
||||||
|
ssl_client_min_proto_version ssl_server_min_proto_version
|
||||||
|
ssl_client_max_proto_version ssl_server_max_proto_version
|
||||||
|
ssl_server_ca_file ssl_server_ca_key ssl_server_ca_dir ssl_server_ca_store
|
||||||
|
ssl_client_ca_file ssl_client_ca_dir ssl_client_ca_store
|
||||||
|
ssl_client_sni ssl_client_alpn ssl_client_mode ssl_certcache"
|
||||||
|
|
||||||
|
# The TLS switches apply to every service below them, so they leak from one
|
||||||
|
# service to the next unless turned back off. These track what is currently in
|
||||||
|
# effect - all off, matching the defaults - so a directive is written only when
|
||||||
|
# a service actually needs a different state.
|
||||||
|
ssl_state_mitm=0
|
||||||
|
ssl_state_server=0
|
||||||
|
ssl_state_client=0
|
||||||
|
ssl_state_client_verify=0
|
||||||
|
ssl_state_server_verify=0
|
||||||
|
|
||||||
|
# $1 section, $2 uci option, $3 state variable, $4 directive on, $5 directive off
|
||||||
|
append_ssl_toggle() {
|
||||||
|
local want have
|
||||||
|
|
||||||
|
config_get_bool want "$1" "$2" 0
|
||||||
|
have=$(eval echo \$$3)
|
||||||
|
|
||||||
|
[ "$want" = "$have" ] && return 0
|
||||||
|
|
||||||
|
if [ "$want" -gt 0 ]; then
|
||||||
|
echo "$4" >> "$CFGFILE"
|
||||||
|
else
|
||||||
|
echo "$5" >> "$CFGFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval "$3=$want"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
append_ssl() {
|
||||||
|
local opt value mitm server cert key cverify
|
||||||
|
|
||||||
|
for opt in $SSL_VALUE_OPTIONS; do
|
||||||
|
config_get value "$1" "$opt"
|
||||||
|
[ -n "$value" ] && echo "$opt $value" >> "$CFGFILE"
|
||||||
|
done
|
||||||
|
|
||||||
|
append_ssl_toggle "$1" ssl_mitm ssl_state_mitm ssl_mitm ssl_nomitm
|
||||||
|
append_ssl_toggle "$1" ssl_server ssl_state_server ssl_serv ssl_noserv
|
||||||
|
append_ssl_toggle "$1" ssl_client ssl_state_client ssl_cli ssl_nocli
|
||||||
|
append_ssl_toggle "$1" ssl_client_verify ssl_state_client_verify \
|
||||||
|
ssl_client_verify ssl_client_no_verify
|
||||||
|
append_ssl_toggle "$1" ssl_server_verify ssl_state_server_verify \
|
||||||
|
ssl_server_verify ssl_server_no_verify
|
||||||
|
|
||||||
|
config_get_bool mitm "$1" ssl_mitm 0
|
||||||
|
config_get_bool cverify "$1" ssl_client_verify 0
|
||||||
|
[ "$mitm" -gt 0 ] && [ "$cverify" -gt 0 ] || [ "$mitm" -eq 0 ] || \
|
||||||
|
echo "3proxy: service '$1' spoofs certificates without ssl_client_verify, upstream certificates are not checked" >&2
|
||||||
|
|
||||||
|
config_get_bool server "$1" ssl_server 0
|
||||||
|
if [ "$server" -gt 0 ]; then
|
||||||
|
config_get cert "$1" ssl_server_cert
|
||||||
|
config_get key "$1" ssl_server_key
|
||||||
|
[ -n "$cert" ] && [ -n "$key" ] || \
|
||||||
|
echo "3proxy: service '$1' requires TLS from clients but has no ssl_server_cert/ssl_server_key" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
append_service() {
|
||||||
|
local enabled type port bind external extra auth args
|
||||||
|
local bind_interface external_interface logformat
|
||||||
|
|
||||||
|
config_get_bool enabled "$1" enabled 0
|
||||||
|
[ "$enabled" -gt 0 ] || return 0
|
||||||
|
|
||||||
|
config_get type "$1" type
|
||||||
|
[ -n "$type" ] || {
|
||||||
|
echo "3proxy: service '$1' has no type, ignored" >&2
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
config_get port "$1" port
|
||||||
|
config_get bind "$1" bind
|
||||||
|
config_get external "$1" external
|
||||||
|
config_get extra "$1" extra
|
||||||
|
config_get bind_interface "$1" bind_interface
|
||||||
|
config_get external_interface "$1" external_interface
|
||||||
|
config_get logformat "$1" logformat
|
||||||
|
config_get auth "$1" auth "$global_auth"
|
||||||
|
|
||||||
|
echo "" >> "$CFGFILE"
|
||||||
|
echo "flush" >> "$CFGFILE"
|
||||||
|
[ -n "$auth" ] && echo "auth $auth" >> "$CFGFILE"
|
||||||
|
|
||||||
|
# Rules referenced by the service, in the order they are listed. A service
|
||||||
|
# without its own list falls back to the global one.
|
||||||
|
acl_written=0
|
||||||
|
config_list_foreach "$1" acl append_acl
|
||||||
|
[ "$acl_written" -gt 0 ] || config_list_foreach global acl append_acl
|
||||||
|
|
||||||
|
[ -n "$logformat" ] && append_logformat "$logformat"
|
||||||
|
|
||||||
|
append_ssl "$1"
|
||||||
|
|
||||||
|
args=""
|
||||||
|
[ -n "$port" ] && args="$args -p$port"
|
||||||
|
[ -n "$bind" ] && args="$args -i$bind"
|
||||||
|
[ -n "$external" ] && args="$args -e$external"
|
||||||
|
[ -n "$bind_interface" ] && args="$args -Di$bind_interface"
|
||||||
|
[ -n "$external_interface" ] && args="$args -De$external_interface"
|
||||||
|
[ -n "$extra" ] && args="$args $extra"
|
||||||
|
|
||||||
|
echo "$type$args" >> "$CFGFILE"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
write_config() {
|
||||||
|
local nscache nscache6 maxconn log timeouts fakeresolve logformat
|
||||||
|
local authcache_type authcache_time authcache_size
|
||||||
|
local counter_file counter_type counter_name pcre_options
|
||||||
|
|
||||||
|
mkdir -p "$(dirname "$CFGFILE")"
|
||||||
|
: > "$CFGFILE"
|
||||||
|
|
||||||
|
config_get nscache global nscache
|
||||||
|
config_get nscache6 global nscache6
|
||||||
|
config_get maxconn global maxconn
|
||||||
|
config_get global_auth global auth iponly
|
||||||
|
config_get log global log syslog
|
||||||
|
config_get timeouts global timeouts
|
||||||
|
config_get logformat global logformat
|
||||||
|
config_get_bool fakeresolve global fakeresolve 0
|
||||||
|
config_get authcache_type global authcache_type
|
||||||
|
config_get authcache_time global authcache_time
|
||||||
|
config_get authcache_size global authcache_size
|
||||||
|
config_get counter_file global counter_file
|
||||||
|
config_get counter_type global counter_type
|
||||||
|
config_get counter_name global counter_name
|
||||||
|
config_get pcre_options global pcre_options
|
||||||
|
|
||||||
|
config_list_foreach global nserver append_nserver
|
||||||
|
[ -n "$nscache" ] && echo "nscache $nscache" >> "$CFGFILE"
|
||||||
|
[ -n "$nscache6" ] && echo "nscache6 $nscache6" >> "$CFGFILE"
|
||||||
|
|
||||||
|
# Static records are added to the cache, so they have to come after it.
|
||||||
|
nsrecord_written=0
|
||||||
|
config_list_foreach global nsrecord append_nsrecord
|
||||||
|
[ "$nsrecord_written" -eq 0 ] || [ -n "$nscache$nscache6" ] || \
|
||||||
|
echo "3proxy: nsrecord needs nscache or nscache6 to be set" >&2
|
||||||
|
|
||||||
|
case "$log" in
|
||||||
|
syslog) echo "log" >> "$CFGFILE" ;;
|
||||||
|
none|"") ;;
|
||||||
|
*) echo "log $log" >> "$CFGFILE" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
users=""
|
||||||
|
config_list_foreach global user append_user
|
||||||
|
[ -n "$users" ] && echo "users$users" >> "$CFGFILE"
|
||||||
|
|
||||||
|
[ -n "$timeouts" ] && echo "timeouts $timeouts" >> "$CFGFILE"
|
||||||
|
[ "$fakeresolve" -gt 0 ] && echo "fakeresolve" >> "$CFGFILE"
|
||||||
|
[ -n "$logformat" ] && append_logformat "$logformat"
|
||||||
|
|
||||||
|
if [ -n "$authcache_type" ]; then
|
||||||
|
[ -n "$authcache_time" ] || authcache_time=600
|
||||||
|
echo "authcache $authcache_type $authcache_time${authcache_size:+ $authcache_size}" >> "$CFGFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$counter_file" ]; then
|
||||||
|
echo "counter $counter_file${counter_type:+ $counter_type}${counter_name:+ $counter_name}" >> "$CFGFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$pcre_options" ] && echo "pcre_options $pcre_options" >> "$CFGFILE"
|
||||||
|
|
||||||
|
# Both lists are order sensitive: 3proxy stops at the first match, so the
|
||||||
|
# exempting rules (nobandlimin and friends) have to be listed first.
|
||||||
|
config_list_foreach global pcre append_pcre
|
||||||
|
config_list_foreach global limit append_limit
|
||||||
|
|
||||||
|
config_list_foreach global include append_include
|
||||||
|
config_list_foreach global extra_config append_line
|
||||||
|
|
||||||
|
[ -n "$maxconn" ] && echo "maxconn $maxconn" >> "$CFGFILE"
|
||||||
|
|
||||||
|
config_foreach append_service service
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
local enabled
|
||||||
|
|
||||||
|
config_load 3proxy
|
||||||
|
config_get_bool enabled global enabled 0
|
||||||
|
|
||||||
|
[ "$enabled" -gt 0 ] || {
|
||||||
|
echo "3proxy is disabled in /etc/config/3proxy" >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
write_config
|
||||||
|
|
||||||
|
procd_open_instance
|
||||||
|
procd_set_param command "$PROG" "$CFGFILE"
|
||||||
|
procd_set_param file "$CFGFILE"
|
||||||
|
procd_set_param respawn
|
||||||
|
procd_set_param stdout 1
|
||||||
|
procd_set_param stderr 1
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger "3proxy"
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
Name: 3proxy
|
Name: 3proxy
|
||||||
Version: 0.9.7
|
Version: 1.0.2
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: 3proxy tiny proxy server
|
Summary: 3proxy tiny proxy server
|
||||||
License: GPL/LGPL/Apache/BSD
|
License: GPL/LGPL/Apache/BSD
|
||||||
@@ -9,6 +9,9 @@ Prefix: %{_prefix}
|
|||||||
Packager: z3APA3A
|
Packager: z3APA3A
|
||||||
Source: https://github.com/%{packager}/%{name}/archive/%{version}.tar.gz
|
Source: https://github.com/%{packager}/%{name}/archive/%{version}.tar.gz
|
||||||
|
|
||||||
|
%global debug_package %{nil}
|
||||||
|
%global __requires_exclude ^/(usr/)?bin/3proxy$
|
||||||
|
|
||||||
%description
|
%description
|
||||||
3proxy is lightweight yet powerful proxy server
|
3proxy is lightweight yet powerful proxy server
|
||||||
|
|
||||||
@@ -33,10 +36,7 @@ make clean
|
|||||||
%files
|
%files
|
||||||
/bin/3proxy
|
/bin/3proxy
|
||||||
/bin/3proxy_crypt
|
/bin/3proxy_crypt
|
||||||
/bin/3proxy_ftppr
|
|
||||||
/bin/3proxy_pop3p
|
|
||||||
/bin/3proxy_proxy
|
/bin/3proxy_proxy
|
||||||
/bin/3proxy_smtpp
|
|
||||||
/bin/3proxy_socks
|
/bin/3proxy_socks
|
||||||
/bin/3proxy_tcppm
|
/bin/3proxy_tcppm
|
||||||
/bin/3proxy_tlspr
|
/bin/3proxy_tlspr
|
||||||
|
|||||||
+69
-22
@@ -13,6 +13,12 @@ void ssl_install(void);
|
|||||||
#ifdef WITH_PCRE
|
#ifdef WITH_PCRE
|
||||||
void pcre_install(void);
|
void pcre_install(void);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WITH_TRANSPARENT
|
||||||
|
void transparent_install(void);
|
||||||
|
#endif
|
||||||
|
#ifdef WITH_HTTPSRV
|
||||||
|
void httpsrv_init(void);
|
||||||
|
#endif
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#ifndef NOPLUGINS
|
#ifndef NOPLUGINS
|
||||||
@@ -28,7 +34,6 @@ void pcre_install(void);
|
|||||||
|
|
||||||
FILE * confopen();
|
FILE * confopen();
|
||||||
extern unsigned char *strings[];
|
extern unsigned char *strings[];
|
||||||
extern FILE *writable;
|
|
||||||
extern struct counter_header cheader;
|
extern struct counter_header cheader;
|
||||||
extern struct counter_record crecord;
|
extern struct counter_record crecord;
|
||||||
|
|
||||||
@@ -69,13 +74,8 @@ void __stdcall CommandHandler( DWORD dwCommand )
|
|||||||
SetStatus( SERVICE_STOP_PENDING, 0, 1 );
|
SetStatus( SERVICE_STOP_PENDING, 0, 1 );
|
||||||
conf.timetoexit = 1;
|
conf.timetoexit = 1;
|
||||||
conf.paused++;
|
conf.paused++;
|
||||||
Sleep(2000);
|
/* ServiceMain() reports the service stopped once cyclestep() has
|
||||||
SetStatus( SERVICE_STOPPED, 0, 0 );
|
seen this and the services are done */
|
||||||
#ifdef WITH_ODBC
|
|
||||||
_3proxy_mutex_lock(&log_mutex);
|
|
||||||
close_sql();
|
|
||||||
_3proxy_mutex_unlock(&log_mutex);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case SERVICE_CONTROL_PAUSE:
|
case SERVICE_CONTROL_PAUSE:
|
||||||
SetStatus( SERVICE_PAUSE_PENDING, 0, 1 );
|
SetStatus( SERVICE_PAUSE_PENDING, 0, 1 );
|
||||||
@@ -101,6 +101,13 @@ void __stdcall ServiceMain(int argc, unsigned char* argv[] )
|
|||||||
SetStatus( SERVICE_START_PENDING, 0, 1 );
|
SetStatus( SERVICE_START_PENDING, 0, 1 );
|
||||||
SetStatus( SERVICE_RUNNING, 0, 0 );
|
SetStatus( SERVICE_RUNNING, 0, 0 );
|
||||||
cyclestep();
|
cyclestep();
|
||||||
|
#ifdef WITH_ODBC
|
||||||
|
_3proxy_mutex_lock(&log_mutex);
|
||||||
|
close_sql();
|
||||||
|
_3proxy_mutex_unlock(&log_mutex);
|
||||||
|
#endif
|
||||||
|
/* the last thing: the process may be ended once this is reported */
|
||||||
|
SetStatus( SERVICE_STOPPED, 0, 0 );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -235,6 +242,39 @@ void dumpcounters(struct trafcount *tlin, int counterd){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Lets the services finish before the process exits, for EXITWAIT ms at
|
||||||
|
most: each one waits for its connections, and a connection may hang on
|
||||||
|
its peer. Posts left over from reloads are consumed on the way, the
|
||||||
|
count decides. */
|
||||||
|
#define EXITWAIT 3000
|
||||||
|
static unsigned long nowms(void){
|
||||||
|
#ifdef _WIN32
|
||||||
|
return (unsigned long)GetTickCount();
|
||||||
|
#else
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
return (unsigned long)tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void waitservices(void){
|
||||||
|
unsigned long start = nowms(), passed;
|
||||||
|
|
||||||
|
for(;;){
|
||||||
|
int n;
|
||||||
|
|
||||||
|
_3proxy_mutex_lock(&runningservices_mutex);
|
||||||
|
n = runningservices;
|
||||||
|
_3proxy_mutex_unlock(&runningservices_mutex);
|
||||||
|
if(!n) return;
|
||||||
|
/* a clock set back makes this huge, which ends the wait as well */
|
||||||
|
passed = nowms() - start;
|
||||||
|
if(passed >= EXITWAIT) return;
|
||||||
|
if(_3proxy_sem_timedlock(serviceexited, (unsigned)(EXITWAIT - passed))) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cyclestep(void){
|
void cyclestep(void){
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
time_t minutecounter;
|
time_t minutecounter;
|
||||||
@@ -298,7 +338,7 @@ void cyclestep(void){
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dologname (tmpbuf, conf.logname, (conf.archiver)?conf.archiver[1]:NULL, conf.logtype, (conf.logtime - t * conf.rotate));
|
dologname (tmpbuf, conf.logname, (conf.archiver)?conf.archiver[1]:NULL, conf.logtype, (conf.logtime - (time_t)t * conf.rotate));
|
||||||
remove ((char *) tmpbuf);
|
remove ((char *) tmpbuf);
|
||||||
if(conf.archiver) {
|
if(conf.archiver) {
|
||||||
int i;
|
int i;
|
||||||
@@ -331,9 +371,7 @@ void cyclestep(void){
|
|||||||
if(conf.timetoexit){
|
if(conf.timetoexit){
|
||||||
conf.paused++;
|
conf.paused++;
|
||||||
doschedule();
|
doschedule();
|
||||||
usleep(SLEEPTIME*999);
|
waitservices();
|
||||||
usleep(SLEEPTIME*999);
|
|
||||||
usleep(SLEEPTIME*999);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +549,13 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
/* before readconfig() starts the services: a client gone while it is
|
||||||
|
written to is an error, not the end */
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
#endif
|
||||||
_3proxy_mutex_init(&config_mutex);
|
_3proxy_mutex_init(&config_mutex);
|
||||||
|
_3proxy_mutex_init(&runningservices_mutex);
|
||||||
_3proxy_mutex_init(&bandlim_mutex);
|
_3proxy_mutex_init(&bandlim_mutex);
|
||||||
_3proxy_mutex_init(&connlim_mutex);
|
_3proxy_mutex_init(&connlim_mutex);
|
||||||
_3proxy_mutex_init(&tc_mutex);
|
_3proxy_mutex_init(&tc_mutex);
|
||||||
@@ -519,15 +563,10 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int
|
|||||||
#ifndef NORADIUS
|
#ifndef NORADIUS
|
||||||
_3proxy_mutex_init(&rad_mutex);
|
_3proxy_mutex_init(&rad_mutex);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
if(_3proxy_sem_init_timed(serviceexited, 0, 0x7fffffff)){
|
||||||
conf.threadinit = CreateSemaphore(NULL, 1, 1, NULL);
|
|
||||||
if(!conf.threadinit){
|
|
||||||
fprintf(stderr, "semaphore init failed\n");
|
fprintf(stderr, "semaphore init failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
_3proxy_mutex_init(&conf.threadinit);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_SSL
|
#ifdef WITH_SSL
|
||||||
ssl_install();
|
ssl_install();
|
||||||
@@ -535,13 +574,22 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int
|
|||||||
#ifdef WITH_PCRE
|
#ifdef WITH_PCRE
|
||||||
pcre_install();
|
pcre_install();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WITH_TRANSPARENT
|
||||||
|
transparent_install();
|
||||||
|
#endif
|
||||||
|
#ifdef WITH_HTTPSRV
|
||||||
|
httpsrv_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
freeconf(&conf);
|
freeconf(&conf);
|
||||||
|
initcommands();
|
||||||
res = readconfig(fp);
|
res = readconfig(fp);
|
||||||
conf.version++;
|
conf.version++;
|
||||||
|
|
||||||
if(res) RETURN(res);
|
/* readconfig() names the failing line, which an exit status would cut
|
||||||
if(!writable){fclose(fp); fp = NULL;}
|
to 8 bits: a failed configuration exits with 1 */
|
||||||
|
if(res) RETURN(1);
|
||||||
|
fclose(fp); fp = NULL;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
@@ -565,7 +613,6 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int
|
|||||||
signal(SIGCONT, mysigpause);
|
signal(SIGCONT, mysigpause);
|
||||||
signal(SIGTERM, mysigterm);
|
signal(SIGTERM, mysigterm);
|
||||||
signal(SIGUSR1, mysigusr1);
|
signal(SIGUSR1, mysigusr1);
|
||||||
signal(SIGPIPE, SIG_IGN);
|
|
||||||
cyclestep();
|
cyclestep();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -573,6 +620,6 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int
|
|||||||
CLEARRETURN:
|
CLEARRETURN:
|
||||||
|
|
||||||
if(fp && fp != stdin) {fclose(fp); fp = NULL;}
|
if(fp && fp != stdin) {fclose(fp); fp = NULL;}
|
||||||
return 0;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
+44
-99
@@ -5,14 +5,7 @@
|
|||||||
please read License Agreement
|
please read License Agreement
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#include "libs/blake2.h"
|
#include "mdhash.h"
|
||||||
#ifdef WITH_SSL
|
|
||||||
#include <openssl/evp.h>
|
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
|
||||||
#include <openssl/params.h>
|
|
||||||
#include <openssl/core_names.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define MD5_SIZE 16
|
#define MD5_SIZE 16
|
||||||
@@ -28,11 +21,6 @@ static unsigned char itoa64[] =
|
|||||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
|
|
||||||
#if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
|
|
||||||
EVP_MD *md4_hash = NULL;
|
|
||||||
EVP_MD *md5_hash = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_crypt_to64(unsigned char *s, unsigned long v, int n)
|
_crypt_to64(unsigned char *s, unsigned long v, int n)
|
||||||
{
|
{
|
||||||
@@ -43,21 +31,13 @@ _crypt_to64(unsigned char *s, unsigned long v, int n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_SSL
|
|
||||||
unsigned char * ntpwdhash (unsigned char *szHash, const unsigned char *szPassword, int ctohex)
|
unsigned char * ntpwdhash (unsigned char *szHash, const unsigned char *szPassword, int ctohex)
|
||||||
{
|
{
|
||||||
unsigned char szUnicodePass[513];
|
unsigned char szUnicodePass[513];
|
||||||
unsigned int nPasswordLen;
|
unsigned int nPasswordLen;
|
||||||
EVP_MD_CTX *ctx;
|
unsigned int len = 16;
|
||||||
unsigned int len=sizeof(szUnicodePass);
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
mdh_ctx *ctx;
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
|
||||||
const EVP_MD *md4 = md4_hash;
|
|
||||||
#else
|
|
||||||
const EVP_MD *md4 = EVP_md4();
|
|
||||||
#endif
|
|
||||||
if(md4 == NULL) return NULL;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NT passwords are unicode. Convert plain text password
|
* NT passwords are unicode. Convert plain text password
|
||||||
@@ -71,15 +51,14 @@ unsigned char * ntpwdhash (unsigned char *szHash, const unsigned char *szPasswor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Encrypt Unicode password to a 16-byte MD4 hash */
|
/* Encrypt Unicode password to a 16-byte MD4 hash */
|
||||||
ctx = EVP_MD_CTX_new();
|
ctx = mdh_init(MDH_MD4, 16);
|
||||||
if(!ctx) return NULL;
|
if(!ctx) return NULL;
|
||||||
if(!EVP_DigestInit_ex(ctx, md4, NULL)){
|
mdh_update(ctx, szUnicodePass, (nPasswordLen<<1));
|
||||||
EVP_MD_CTX_free(ctx);
|
if(!mdh_final(ctx, szUnicodePass, &len)) {
|
||||||
|
mdh_free(ctx);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
EVP_DigestUpdate(ctx, szUnicodePass, (nPasswordLen<<1));
|
mdh_free(ctx);
|
||||||
EVP_DigestFinal_ex(ctx, szUnicodePass, &len);
|
|
||||||
EVP_MD_CTX_free(ctx);
|
|
||||||
if (ctohex){
|
if (ctohex){
|
||||||
tohex(szUnicodePass, szHash, 16);
|
tohex(szUnicodePass, szHash, 16);
|
||||||
}
|
}
|
||||||
@@ -87,7 +66,6 @@ unsigned char * ntpwdhash (unsigned char *szHash, const unsigned char *szPasswor
|
|||||||
memset(szUnicodePass, 0, sizeof szUnicodePass);
|
memset(szUnicodePass, 0, sizeof szUnicodePass);
|
||||||
return szHash;
|
return szHash;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsigned char *passwd){
|
unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsigned char *passwd){
|
||||||
@@ -100,57 +78,44 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
|
|||||||
int sl;
|
int sl;
|
||||||
unsigned long l;
|
unsigned long l;
|
||||||
|
|
||||||
#if defined(WITH_SSL)
|
|
||||||
#ifndef WITHMAIN
|
#ifndef WITHMAIN
|
||||||
if(salt[0] == '$' && salt[1] == '1' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) {
|
if(salt[0] == '$' && salt[1] == '1' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) {
|
||||||
EVP_MD_CTX *ctx, *ctx1;
|
mdh_ctx *ctx, *ctx1;
|
||||||
unsigned int len;
|
unsigned int len = MD5_SIZE;
|
||||||
int pl, i;
|
int pl, i;
|
||||||
|
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
|
||||||
const EVP_MD *md5 = md5_hash;
|
|
||||||
#else
|
|
||||||
const EVP_MD *md5 = EVP_md5();
|
|
||||||
#endif
|
|
||||||
if(md5 == NULL) {
|
|
||||||
*passwd = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
sp = salt +3;
|
sp = salt +3;
|
||||||
sl = (int)(ep - sp);
|
sl = (int)(ep - sp);
|
||||||
magic = (unsigned char *)"$1$";
|
magic = (unsigned char *)"$1$";
|
||||||
|
|
||||||
ctx = EVP_MD_CTX_new();
|
ctx = mdh_init(MDH_MD5, 16);
|
||||||
if(!ctx) {
|
if(!ctx) {
|
||||||
*passwd = 0;
|
*passwd = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
EVP_DigestInit_ex(ctx, md5, NULL);
|
|
||||||
|
|
||||||
/* The password first, since that is what is most unknown */
|
/* The password first, since that is what is most unknown */
|
||||||
EVP_DigestUpdate(ctx,pw,strlen((char *)pw));
|
mdh_update(ctx, pw, (unsigned int)strlen((char *)pw));
|
||||||
|
|
||||||
/* Then our magic string */
|
/* Then our magic string */
|
||||||
EVP_DigestUpdate(ctx,magic,strlen((char *)magic));
|
mdh_update(ctx, magic, (unsigned int)strlen((char *)magic));
|
||||||
|
|
||||||
/* Then the raw salt */
|
/* Then the raw salt */
|
||||||
EVP_DigestUpdate(ctx,sp,sl);
|
mdh_update(ctx, sp, (unsigned int)sl);
|
||||||
|
|
||||||
/* Then just as many unsigned characters of the MD5(pw,salt,pw) */
|
/* Then just as many unsigned characters of the MD5(pw,salt,pw) */
|
||||||
ctx1 = EVP_MD_CTX_new();
|
ctx1 = mdh_init(MDH_MD5, 16);
|
||||||
if(!ctx1) {
|
if(!ctx1) {
|
||||||
EVP_MD_CTX_free(ctx);
|
mdh_free(ctx);
|
||||||
*passwd = 0;
|
*passwd = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
EVP_DigestInit_ex(ctx1, md5, NULL);
|
mdh_update(ctx1, pw, (unsigned int)strlen((char *)pw));
|
||||||
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
|
mdh_update(ctx1, sp, (unsigned int)sl);
|
||||||
EVP_DigestUpdate(ctx1,sp,sl);
|
mdh_update(ctx1, pw, (unsigned int)strlen((char *)pw));
|
||||||
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
|
mdh_final(ctx1, final, &len);
|
||||||
EVP_DigestFinal_ex(ctx1,final,&len);
|
|
||||||
for(pl = (int)strlen((char *)pw); pl > 0; pl -= MD5_SIZE)
|
for(pl = (int)strlen((char *)pw); pl > 0; pl -= MD5_SIZE)
|
||||||
EVP_DigestUpdate(ctx,final,pl>MD5_SIZE ? MD5_SIZE : pl);
|
mdh_update(ctx, final, (unsigned int)(pl>MD5_SIZE ? MD5_SIZE : pl));
|
||||||
|
|
||||||
/* Don't leave anything around in vm they could use. */
|
/* Don't leave anything around in vm they could use. */
|
||||||
memset(final,0,sizeof final);
|
memset(final,0,sizeof final);
|
||||||
@@ -158,13 +123,13 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
|
|||||||
/* Then something really weird... */
|
/* Then something really weird... */
|
||||||
for (i = (int)strlen((char *)pw); i ; i >>= 1)
|
for (i = (int)strlen((char *)pw); i ; i >>= 1)
|
||||||
if(i&1)
|
if(i&1)
|
||||||
EVP_DigestUpdate(ctx, final, 1);
|
mdh_update(ctx, final, 1);
|
||||||
else
|
else
|
||||||
EVP_DigestUpdate(ctx, pw, 1);
|
mdh_update(ctx, pw, 1);
|
||||||
|
|
||||||
|
|
||||||
EVP_DigestFinal_ex(ctx,final,&len);
|
mdh_final(ctx, final, &len);
|
||||||
EVP_MD_CTX_free(ctx);
|
mdh_free(ctx);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* and now, just to make sure things don't run too fast
|
* and now, just to make sure things don't run too fast
|
||||||
@@ -172,43 +137,46 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
|
|||||||
* need 30 seconds to build a 1000 entry dictionary...
|
* need 30 seconds to build a 1000 entry dictionary...
|
||||||
*/
|
*/
|
||||||
for(i=0;i<1000;i++) {
|
for(i=0;i<1000;i++) {
|
||||||
EVP_MD_CTX_reset(ctx1);
|
mdh_free(ctx1);
|
||||||
EVP_DigestInit_ex(ctx1, md5, NULL);
|
ctx1 = mdh_init(MDH_MD5, 16);
|
||||||
|
if(!ctx1) { *passwd = 0; return NULL; }
|
||||||
if(i & 1)
|
if(i & 1)
|
||||||
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
|
mdh_update(ctx1, pw, (unsigned int)strlen((char *)pw));
|
||||||
else
|
else
|
||||||
EVP_DigestUpdate(ctx1,final,MD5_SIZE);
|
mdh_update(ctx1, final, MD5_SIZE);
|
||||||
|
|
||||||
if(i % 3)
|
if(i % 3)
|
||||||
EVP_DigestUpdate(ctx1,sp,sl);
|
mdh_update(ctx1, sp, (unsigned int)sl);
|
||||||
|
|
||||||
if(i % 7)
|
if(i % 7)
|
||||||
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
|
mdh_update(ctx1, pw, (unsigned int)strlen((char *)pw));
|
||||||
|
|
||||||
if(i & 1)
|
if(i & 1)
|
||||||
EVP_DigestUpdate(ctx1,final,MD5_SIZE);
|
mdh_update(ctx1, final, MD5_SIZE);
|
||||||
else
|
else
|
||||||
EVP_DigestUpdate(ctx1,pw,strlen((char *)pw));
|
mdh_update(ctx1, pw, (unsigned int)strlen((char *)pw));
|
||||||
EVP_DigestFinal_ex(ctx1,final,&len);
|
mdh_final(ctx1, final, &len);
|
||||||
}
|
}
|
||||||
EVP_MD_CTX_free(ctx1);
|
mdh_free(ctx1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
if(salt[0] == '$' && salt[1] == '3' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) {
|
if(salt[0] == '$' && salt[1] == '3' && salt[2] == '$' && (ep = (unsigned char *)strchr((char *)salt+3, '$'))) {
|
||||||
sp = salt +3;
|
sp = salt +3;
|
||||||
sl = (int)(ep - sp);
|
sl = (int)(ep - sp);
|
||||||
magic = (unsigned char *)"$3$";
|
magic = (unsigned char *)"$3$";
|
||||||
{
|
{
|
||||||
blake2b_state S;
|
mdh_ctx *bctx = mdh_init(MDH_BLAKE2, MD5_SIZE);
|
||||||
if(blake2b_init(&S, MD5_SIZE) != 0 ||
|
unsigned int blen = MD5_SIZE;
|
||||||
blake2b_update(&S, pw, strlen((char *)pw) + 1) != 0 ||
|
if(!bctx ||
|
||||||
blake2b_update(&S, sp, sl) != 0 ||
|
!mdh_update(bctx, pw, (unsigned int)(strlen((char *)pw) + 1)) ||
|
||||||
blake2b_final(&S, final, MD5_SIZE) != 0) {
|
!mdh_update(bctx, sp, (unsigned int)sl) ||
|
||||||
|
!mdh_final(bctx, final, &blen)) {
|
||||||
|
mdh_free(bctx);
|
||||||
*passwd = 0;
|
*passwd = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
mdh_free(bctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -238,9 +206,6 @@ unsigned char * mycrypt(const unsigned char *pw, const unsigned char *salt, unsi
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITHMAIN
|
#ifdef WITHMAIN
|
||||||
#if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
|
|
||||||
#include <openssl/provider.h>
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int main(int argc, char* argv[]){
|
int main(int argc, char* argv[]){
|
||||||
unsigned char buf1[128];
|
unsigned char buf1[128];
|
||||||
@@ -248,37 +213,17 @@ int main(int argc, char* argv[]){
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
if(argc < 2 || argc > 3) {
|
if(argc < 2 || argc > 3) {
|
||||||
fprintf(stderr, "usage: \n"
|
fprintf(stderr, "usage: \n"
|
||||||
#ifdef WITH_SSL
|
|
||||||
"\t%s <password>\n"
|
"\t%s <password>\n"
|
||||||
#endif
|
|
||||||
"\t%s <salt> <password>\n"
|
"\t%s <salt> <password>\n"
|
||||||
#ifdef WITH_SSL
|
|
||||||
"Performs NT crypt if no salt specified, BLAKE2 crypt with salt\n"
|
"Performs NT crypt if no salt specified, BLAKE2 crypt with salt\n"
|
||||||
#else
|
|
||||||
"Performs BLAKE2 crypt with salt\n"
|
|
||||||
#endif
|
|
||||||
,
|
,
|
||||||
#ifdef WITH_SSL
|
|
||||||
argv[0],
|
argv[0],
|
||||||
#endif
|
|
||||||
argv[0]);
|
argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#if defined(WITH_SSL) && OPENSSL_VERSION_NUMBER >= 0x30000000L
|
|
||||||
OSSL_PROVIDER_load(NULL, "legacy");
|
|
||||||
OSSL_PROVIDER_load(NULL, "default");
|
|
||||||
md4_hash = EVP_MD_fetch(NULL, "MD4", NULL);
|
|
||||||
if (md4_hash == NULL) {
|
|
||||||
fprintf(stderr, "Error fetching MD4\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(argc == 2) {
|
if(argc == 2) {
|
||||||
#ifdef WITH_SSL
|
|
||||||
{ unsigned char *nt = ntpwdhash(buf1, (unsigned char *)argv[1], 1);
|
{ unsigned char *nt = ntpwdhash(buf1, (unsigned char *)argv[1], 1);
|
||||||
if(nt) printf("NT:%s\n", nt); }
|
if(nt) printf("NT:%s\n", nt); }
|
||||||
#else
|
|
||||||
fprintf(stderr, "NT crypt not available (compiled without OpenSSL)\n");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unsigned char *cr;
|
unsigned char *cr;
|
||||||
|
|||||||
+52
-25
@@ -2,7 +2,7 @@
|
|||||||
# 3 proxy common Makefile
|
# 3 proxy common Makefile
|
||||||
#
|
#
|
||||||
|
|
||||||
all: $(BUILDDIR)3proxy$(EXESUFFICS) $(BUILDDIR)$(CRYPT_PREFIX)crypt$(EXESUFFICS) $(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS) $(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS) $(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS) $(BUILDDIR)$(PREFIX)tcppm$(EXESUFFICS) $(BUILDDIR)$(PREFIX)udppm$(EXESUFFICS) $(BUILDDIR)$(PREFIX)tlspr$(EXESUFFICS) $(BUILDDIR)$(PREFIX)socks$(EXESUFFICS) $(BUILDDIR)$(PREFIX)proxy$(EXESUFFICS) allplugins
|
all: $(BUILDDIR)3proxy$(EXESUFFICS) $(BUILDDIR)$(CRYPT_PREFIX)crypt$(EXESUFFICS) $(MAIL_EXES) $(FTP_EXES) $(BUILDDIR)$(PREFIX)tcppm$(EXESUFFICS) $(BUILDDIR)$(PREFIX)udppm$(EXESUFFICS) $(BUILDDIR)$(PREFIX)tlspr$(EXESUFFICS) $(BUILDDIR)$(PREFIX)socks$(EXESUFFICS) $(BUILDDIR)$(PREFIX)proxy$(EXESUFFICS) allplugins
|
||||||
|
|
||||||
sockmap$(OBJSUFFICS): sockmap.c proxy.h structures.h
|
sockmap$(OBJSUFFICS): sockmap.c proxy.h structures.h
|
||||||
$(CC) $(CFLAGS) sockmap.c
|
$(CC) $(CFLAGS) sockmap.c
|
||||||
@@ -13,6 +13,9 @@ udpsockmap$(OBJSUFFICS): udpsockmap.c proxy.h structures.h
|
|||||||
common$(OBJSUFFICS): common.c proxy.h structures.h
|
common$(OBJSUFFICS): common.c proxy.h structures.h
|
||||||
$(CC) $(CFLAGS) common.c
|
$(CC) $(CFLAGS) common.c
|
||||||
|
|
||||||
|
sem$(OBJSUFFICS): sem.c proxy.h structures.h
|
||||||
|
$(CC) $(CFLAGS) sem.c
|
||||||
|
|
||||||
plugins$(OBJSUFFICS): plugins.c proxy.h structures.h
|
plugins$(OBJSUFFICS): plugins.c proxy.h structures.h
|
||||||
$(CC) $(CFLAGS) plugins.c
|
$(CC) $(CFLAGS) plugins.c
|
||||||
|
|
||||||
@@ -31,6 +34,9 @@ proxy$(OBJSUFFICS): proxy.c proxy.h structures.h proxymain.c
|
|||||||
pop3p$(OBJSUFFICS): pop3p.c proxy.h structures.h proxymain.c
|
pop3p$(OBJSUFFICS): pop3p.c proxy.h structures.h proxymain.c
|
||||||
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)NOPORTMAP $(DEFINEOPTION)NOUDPMAIN pop3p.c
|
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)NOPORTMAP $(DEFINEOPTION)NOUDPMAIN pop3p.c
|
||||||
|
|
||||||
|
imapp$(OBJSUFFICS): imapp.c proxy.h structures.h proxymain.c
|
||||||
|
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)NOPORTMAP $(DEFINEOPTION)NOUDPMAIN imapp.c
|
||||||
|
|
||||||
smtpp$(OBJSUFFICS): smtpp.c proxy.h structures.h proxymain.c
|
smtpp$(OBJSUFFICS): smtpp.c proxy.h structures.h proxymain.c
|
||||||
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)NOPORTMAP $(DEFINEOPTION)NOUDPMAIN smtpp.c
|
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)NOPORTMAP $(DEFINEOPTION)NOUDPMAIN smtpp.c
|
||||||
|
|
||||||
@@ -41,7 +47,7 @@ tcppm$(OBJSUFFICS): tcppm.c proxy.h structures.h proxymain.c
|
|||||||
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)PORTMAP $(DEFINEOPTION)NOUDPMAIN tcppm.c
|
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)PORTMAP $(DEFINEOPTION)NOUDPMAIN tcppm.c
|
||||||
|
|
||||||
udppm$(OBJSUFFICS): udppm.c proxy.h structures.h proxymain.c
|
udppm$(OBJSUFFICS): udppm.c proxy.h structures.h proxymain.c
|
||||||
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)PORTMAP udppm.c
|
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)PORTMAP $(DEFINEOPTION)NOTCPMAIN udppm.c
|
||||||
|
|
||||||
tlspr$(OBJSUFFICS): tlspr.c proxy.h structures.h proxymain.c
|
tlspr$(OBJSUFFICS): tlspr.c proxy.h structures.h proxymain.c
|
||||||
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)PORTMAP $(DEFINEOPTION)NOUDPMAIN tlspr.c
|
$(CC) $(CFLAGS) $(DEFINEOPTION)WITHMAIN $(DEFINEOPTION)PORTMAP $(DEFINEOPTION)NOUDPMAIN tlspr.c
|
||||||
@@ -53,29 +59,32 @@ socks$(OBJSUFFICS): socks.c proxy.h structures.h proxymain.c
|
|||||||
3proxy$(OBJSUFFICS): 3proxy.c proxy.h structures.h
|
3proxy$(OBJSUFFICS): 3proxy.c proxy.h structures.h
|
||||||
$(CC) $(CFLAGS) 3proxy.c
|
$(CC) $(CFLAGS) 3proxy.c
|
||||||
|
|
||||||
$(BUILDDIR)$(PREFIX)proxy$(EXESUFFICS): sockmap$(OBJSUFFICS) proxy$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS)
|
$(BUILDDIR)$(PREFIX)proxy$(EXESUFFICS): sockmap$(OBJSUFFICS) proxy$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS)
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)proxy$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) proxy$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
|
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)proxy$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) proxy$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
|
||||||
|
|
||||||
$(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS): sockmap$(OBJSUFFICS) pop3p$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) $(COMPATLIBS)
|
$(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS): sockmap$(OBJSUFFICS) pop3p$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS) $(COMPATLIBS)
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) pop3p$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
|
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)pop3p$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) pop3p$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
|
||||||
|
|
||||||
$(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS): sockmap$(OBJSUFFICS) smtpp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) base64$(OBJSUFFICS) $(COMPATLIBS)
|
$(BUILDDIR)$(PREFIX)imapp$(EXESUFFICS): sockmap$(OBJSUFFICS) imapp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS) base64$(OBJSUFFICS) $(COMPATLIBS)
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) smtpp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) base64$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
|
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)imapp$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) imapp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) base64$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
|
||||||
|
|
||||||
$(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS): sockmap$(OBJSUFFICS) ftppr$(OBJSUFFICS) ftp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) $(COMPATLIBS)
|
$(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS): sockmap$(OBJSUFFICS) smtpp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS) base64$(OBJSUFFICS) $(COMPATLIBS)
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) ftppr$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
|
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)smtpp$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) smtpp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) base64$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
|
||||||
|
|
||||||
$(BUILDDIR)$(PREFIX)socks$(EXESUFFICS): sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) socks$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS)
|
$(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS): sockmap$(OBJSUFFICS) ftppr$(OBJSUFFICS) ftp$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS) $(COMPATLIBS)
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)socks$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) socks$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS)
|
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)ftppr$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) ftppr$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS) ftp$(OBJSUFFICS) $(COMPATLIBS) $(LIBS)
|
||||||
|
|
||||||
$(BUILDDIR)$(PREFIX)tcppm$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tcppm$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS)
|
$(BUILDDIR)$(PREFIX)socks$(EXESUFFICS): sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) socks$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS)
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)tcppm$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tcppm$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS)
|
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)socks$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) socks$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) $(LIBS)
|
||||||
|
|
||||||
$(BUILDDIR)$(PREFIX)udppm$(EXESUFFICS): sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) udppm$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) hash$(OBJSUFFICS)
|
$(BUILDDIR)$(PREFIX)tcppm$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tcppm$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS)
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)udppm$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) udppm$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) hash$(OBJSUFFICS) $(LIBS)
|
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)tcppm$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tcppm$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) $(LIBS)
|
||||||
|
|
||||||
$(BUILDDIR)$(PREFIX)tlspr$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tlspr$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS)
|
$(BUILDDIR)$(PREFIX)udppm$(EXESUFFICS): sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) udppm$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS) hash$(OBJSUFFICS)
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)tlspr$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tlspr$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) $(LIBS)
|
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)udppm$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) udppm$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) hash$(OBJSUFFICS) $(LIBS)
|
||||||
|
|
||||||
|
$(BUILDDIR)$(PREFIX)tlspr$(EXESUFFICS): sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tlspr$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS)
|
||||||
|
$(LN) $(LNOUT)$(BUILDDIR)$(PREFIX)tlspr$(EXESUFFICS) $(LDFLAGS) sockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) tlspr$(OBJSUFFICS) log$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) $(LIBS)
|
||||||
|
|
||||||
mainfunc$(OBJSUFFICS): proxy.h structures.h proxymain.c
|
mainfunc$(OBJSUFFICS): proxy.h structures.h proxymain.c
|
||||||
$(CC) $(COUT)mainfunc$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)MODULEMAINFUNC=mainfunc proxymain.c
|
$(CC) $(COUT)mainfunc$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)MODULEMAINFUNC=mainfunc proxymain.c
|
||||||
@@ -86,6 +95,9 @@ srvproxy$(OBJSUFFICS): proxy.c proxy.h structures.h
|
|||||||
srvpop3p$(OBJSUFFICS): pop3p.c proxy.h structures.h
|
srvpop3p$(OBJSUFFICS): pop3p.c proxy.h structures.h
|
||||||
$(CC) $(COUT)srvpop3p$(OBJSUFFICS) $(CFLAGS) pop3p.c
|
$(CC) $(COUT)srvpop3p$(OBJSUFFICS) $(CFLAGS) pop3p.c
|
||||||
|
|
||||||
|
srvimapp$(OBJSUFFICS): imapp.c proxy.h structures.h
|
||||||
|
$(CC) $(COUT)srvimapp$(OBJSUFFICS) $(CFLAGS) imapp.c
|
||||||
|
|
||||||
srvsmtpp$(OBJSUFFICS): smtpp.c proxy.h structures.h
|
srvsmtpp$(OBJSUFFICS): smtpp.c proxy.h structures.h
|
||||||
$(CC) $(COUT)srvsmtpp$(OBJSUFFICS) $(CFLAGS) smtpp.c
|
$(CC) $(COUT)srvsmtpp$(OBJSUFFICS) $(CFLAGS) smtpp.c
|
||||||
|
|
||||||
@@ -107,6 +119,12 @@ srvsocks$(OBJSUFFICS): socks.c proxy.h structures.h
|
|||||||
srvwebadmin$(OBJSUFFICS): webadmin.c proxy.h structures.h
|
srvwebadmin$(OBJSUFFICS): webadmin.c proxy.h structures.h
|
||||||
$(CC) $(COUT)srvwebadmin$(OBJSUFFICS) $(CFLAGS) webadmin.c
|
$(CC) $(COUT)srvwebadmin$(OBJSUFFICS) $(CFLAGS) webadmin.c
|
||||||
|
|
||||||
|
transparent$(OBJSUFFICS): transparent.c proxy.h structures.h
|
||||||
|
$(CC) $(COUT)transparent$(OBJSUFFICS) $(CFLAGS) transparent.c
|
||||||
|
|
||||||
|
srvhttpsrv$(OBJSUFFICS): httpsrv.c proxy.h structures.h
|
||||||
|
$(CC) $(COUT)srvhttpsrv$(OBJSUFFICS) $(CFLAGS) httpsrv.c
|
||||||
|
|
||||||
srvudppm$(OBJSUFFICS): udppm.c proxy.h structures.h
|
srvudppm$(OBJSUFFICS): udppm.c proxy.h structures.h
|
||||||
$(CC) $(COUT)srvudppm$(OBJSUFFICS) $(CFLAGS) udppm.c
|
$(CC) $(COUT)srvudppm$(OBJSUFFICS) $(CFLAGS) udppm.c
|
||||||
|
|
||||||
@@ -134,7 +152,7 @@ hashtables$(OBJSUFFICS): hashtables.c proxy.h structures.h libs/blake2.h
|
|||||||
resolve$(OBJSUFFICS): resolve.c proxy.h structures.h
|
resolve$(OBJSUFFICS): resolve.c proxy.h structures.h
|
||||||
$(CC) $(COUT)resolve$(OBJSUFFICS) $(CFLAGS) resolve.c
|
$(CC) $(COUT)resolve$(OBJSUFFICS) $(CFLAGS) resolve.c
|
||||||
|
|
||||||
authradius$(OBJSUFFICS): authradius.c proxy.h structures.h
|
authradius$(OBJSUFFICS): authradius.c proxy.h structures.h mdhash.h
|
||||||
$(CC) $(COUT)authradius$(OBJSUFFICS) $(CFLAGS) authradius.c
|
$(CC) $(COUT)authradius$(OBJSUFFICS) $(CFLAGS) authradius.c
|
||||||
|
|
||||||
conf$(OBJSUFFICS): conf.c proxy.h structures.h
|
conf$(OBJSUFFICS): conf.c proxy.h structures.h
|
||||||
@@ -146,17 +164,26 @@ log$(OBJSUFFICS): log.c proxy.h structures.h
|
|||||||
datatypes$(OBJSUFFICS): datatypes.c proxy.h structures.h
|
datatypes$(OBJSUFFICS): datatypes.c proxy.h structures.h
|
||||||
$(CC) $(COUT)datatypes$(OBJSUFFICS) $(CFLAGS) datatypes.c
|
$(CC) $(COUT)datatypes$(OBJSUFFICS) $(CFLAGS) datatypes.c
|
||||||
|
|
||||||
3proxy_crypt$(OBJSUFFICS): 3proxy_crypt.c libs/blake2.h
|
3proxy_crypt$(OBJSUFFICS): 3proxy_crypt.c libs/blake2.h mdhash.h
|
||||||
$(CC) $(COUT)3proxy_crypt$(OBJSUFFICS) $(CFLAGS) 3proxy_crypt.c
|
$(CC) $(COUT)3proxy_crypt$(OBJSUFFICS) $(CFLAGS) 3proxy_crypt.c
|
||||||
|
|
||||||
3proxy_cryptmain$(OBJSUFFICS): 3proxy_crypt.c libs/blake2.h
|
3proxy_cryptmain$(OBJSUFFICS): 3proxy_crypt.c libs/blake2.h mdhash.h
|
||||||
$(CC) $(COUT)3proxy_cryptmain$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)WITHMAIN 3proxy_crypt.c
|
$(CC) $(COUT)3proxy_cryptmain$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)WITHMAIN 3proxy_crypt.c
|
||||||
|
|
||||||
blake2$(OBJSUFFICS): libs/blake2b-ref.c
|
blake2$(OBJSUFFICS): libs/blake2b-ref.c
|
||||||
$(CC) $(COUT)blake2$(OBJSUFFICS) $(CFLAGS) libs/blake2b-ref.c
|
$(CC) $(COUT)blake2$(OBJSUFFICS) $(CFLAGS) libs/blake2b-ref.c
|
||||||
|
|
||||||
$(BUILDDIR)$(CRYPT_PREFIX)crypt$(EXESUFFICS): blake2$(OBJSUFFICS) 3proxy_cryptmain$(OBJSUFFICS) base64$(OBJSUFFICS)
|
mdhash$(OBJSUFFICS): mdhash.c mdhash.h proxy.h structures.h
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)$(CRYPT_PREFIX)crypt$(EXESUFFICS) $(LDFLAGS) blake2$(OBJSUFFICS) base64$(OBJSUFFICS) 3proxy_cryptmain$(OBJSUFFICS) $(LIBS)
|
$(CC) $(COUT)mdhash$(OBJSUFFICS) $(CFLAGS) mdhash.c
|
||||||
|
|
||||||
|
md4$(OBJSUFFICS): libs/md4.c libs/md4.h
|
||||||
|
$(CC) $(COUT)md4$(OBJSUFFICS) $(CFLAGS) libs/md4.c
|
||||||
|
|
||||||
|
md5$(OBJSUFFICS): libs/md5.c libs/md5.h
|
||||||
|
$(CC) $(COUT)md5$(OBJSUFFICS) $(CFLAGS) libs/md5.c
|
||||||
|
|
||||||
|
$(BUILDDIR)$(CRYPT_PREFIX)crypt$(EXESUFFICS): md4$(OBJSUFFICS) md5$(OBJSUFFICS) blake2$(OBJSUFFICS) 3proxy_cryptmain$(OBJSUFFICS) base64$(OBJSUFFICS) mdhash$(OBJSUFFICS)
|
||||||
|
$(LN) $(LNOUT)$(BUILDDIR)$(CRYPT_PREFIX)crypt$(EXESUFFICS) $(LDFLAGS) md4$(OBJSUFFICS) md5$(OBJSUFFICS) blake2$(OBJSUFFICS) base64$(OBJSUFFICS) mdhash$(OBJSUFFICS) 3proxy_cryptmain$(OBJSUFFICS) $(LIBS)
|
||||||
|
|
||||||
stringtable$(OBJSUFFICS): stringtable.c
|
stringtable$(OBJSUFFICS): stringtable.c
|
||||||
$(CC) $(COUT)stringtable$(OBJSUFFICS) $(CFLAGS) stringtable.c
|
$(CC) $(COUT)stringtable$(OBJSUFFICS) $(CFLAGS) stringtable.c
|
||||||
@@ -170,6 +197,6 @@ ssl$(OBJSUFFICS): ssl.c structures.h proxy.h ssl.h
|
|||||||
pcre$(OBJSUFFICS): pcre.c structures.h
|
pcre$(OBJSUFFICS): pcre.c structures.h
|
||||||
$(CC) $(COUT)pcre$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)WITH_PCRE pcre.c
|
$(CC) $(COUT)pcre$(OBJSUFFICS) $(CFLAGS) $(DEFINEOPTION)WITH_PCRE pcre.c
|
||||||
|
|
||||||
$(BUILDDIR)3proxy$(EXESUFFICS): 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvtlspr$(OBJSUFFICS) srvauto$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) auth$(OBJSUFFICS) acl$(OBJSUFFICS) limiter$(OBJSUFFICS) redirect$(OBJSUFFICS) authradius$(OBJSUFFICS) hash$(OBJSUFFICS) hashtables$(OBJSUFFICS) resolve$(OBJSUFFICS) sql$(OBJSUFFICS) conf$(OBJSUFFICS) log$(OBJSUFFICS) datatypes$(OBJSUFFICS) blake2$(OBJSUFFICS) 3proxy_crypt$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(SSL_OBJS) $(PCRE_OBJS) $(COMPATLIBS) $(VERSIONDEP)
|
$(BUILDDIR)3proxy$(EXESUFFICS): 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvimapp$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvtlspr$(OBJSUFFICS) srvauto$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) auth$(OBJSUFFICS) acl$(OBJSUFFICS) limiter$(OBJSUFFICS) redirect$(OBJSUFFICS) authradius$(OBJSUFFICS) hash$(OBJSUFFICS) hashtables$(OBJSUFFICS) resolve$(OBJSUFFICS) sql$(OBJSUFFICS) conf$(OBJSUFFICS) log$(OBJSUFFICS) datatypes$(OBJSUFFICS) md4$(OBJSUFFICS) md5$(OBJSUFFICS) blake2$(OBJSUFFICS) 3proxy_crypt$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) stringtable$(OBJSUFFICS) $(HTTPSRV_OBJS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) mdhash$(OBJSUFFICS) $(SSL_OBJS) $(PCRE_OBJS) $(TRANSPARENT_OBJS) $(COMPATLIBS) $(VERSIONDEP)
|
||||||
$(LN) $(LNOUT)$(BUILDDIR)3proxy$(EXESUFFICS) $(LDFLAGS) $(VERFILE) 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) auth$(OBJSUFFICS) acl$(OBJSUFFICS) limiter$(OBJSUFFICS) redirect$(OBJSUFFICS) authradius$(OBJSUFFICS) hash$(OBJSUFFICS) hashtables$(OBJSUFFICS) resolve$(OBJSUFFICS) sql$(OBJSUFFICS) conf$(OBJSUFFICS) datatypes$(OBJSUFFICS) srvauto$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvtlspr$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) log$(OBJSUFFICS) 3proxy_crypt$(OBJSUFFICS) blake2$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) stringtable$(OBJSUFFICS) srvwebadmin$(OBJSUFFICS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) $(SSL_OBJS) $(PCRE_OBJS) $(COMPATLIBS) $(LIBS) $(PCRE_LIBS)
|
$(LN) $(LNOUT)$(BUILDDIR)3proxy$(EXESUFFICS) $(LDFLAGS) $(VERFILE) 3proxy$(OBJSUFFICS) mainfunc$(OBJSUFFICS) auth$(OBJSUFFICS) acl$(OBJSUFFICS) limiter$(OBJSUFFICS) redirect$(OBJSUFFICS) authradius$(OBJSUFFICS) hash$(OBJSUFFICS) hashtables$(OBJSUFFICS) resolve$(OBJSUFFICS) sql$(OBJSUFFICS) conf$(OBJSUFFICS) datatypes$(OBJSUFFICS) srvauto$(OBJSUFFICS) srvproxy$(OBJSUFFICS) srvpop3p$(OBJSUFFICS) srvimapp$(OBJSUFFICS) srvsmtpp$(OBJSUFFICS) srvftppr$(OBJSUFFICS) srvsocks$(OBJSUFFICS) srvtcppm$(OBJSUFFICS) srvtlspr$(OBJSUFFICS) srvudppm$(OBJSUFFICS) sockmap$(OBJSUFFICS) udpsockmap$(OBJSUFFICS) sockgetchar$(OBJSUFFICS) common$(OBJSUFFICS) sem$(OBJSUFFICS) log$(OBJSUFFICS) 3proxy_crypt$(OBJSUFFICS) md4$(OBJSUFFICS) md5$(OBJSUFFICS) blake2$(OBJSUFFICS) base64$(OBJSUFFICS) ftp$(OBJSUFFICS) stringtable$(OBJSUFFICS) $(HTTPSRV_OBJS) srvdnspr$(OBJSUFFICS) plugins$(OBJSUFFICS) mdhash$(OBJSUFFICS) $(SSL_OBJS) $(PCRE_OBJS) $(TRANSPARENT_OBJS) $(COMPATLIBS) $(LIBS) $(PCRE_LIBS)
|
||||||
|
|
||||||
@@ -8,6 +8,247 @@
|
|||||||
|
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
|
|
||||||
|
/* The pattern engine lives here rather than in common.c: common.c is linked
|
||||||
|
into the standalone binaries as well, and those carry neither the regular
|
||||||
|
expression code this calls nor a use for a host pattern. */
|
||||||
|
/* Host lists in access rules have always accepted name, name*, *name and
|
||||||
|
*name*, with the leading and trailing star recorded as a match type rather
|
||||||
|
than kept in the string. The parser and the comparison are here so that
|
||||||
|
anything else matching a name against a pattern - the http command, and
|
||||||
|
whatever replaces the star with a regular expression later - behaves the same
|
||||||
|
way and gains the same syntax at the same time.
|
||||||
|
*/
|
||||||
|
/* A pattern written as a regular expression carries a prefix. Both spellings
|
||||||
|
are taken so a configuration reads the way its author thinks of it. */
|
||||||
|
static unsigned char * regexprefix(unsigned char *arg)
|
||||||
|
{
|
||||||
|
if(!strncmp((char *)arg, "pcre:", 5)) return arg + 5;
|
||||||
|
if(!strncmp((char *)arg, "regex:", 6)) return arg + 6;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Shared by every pattern the configuration can carry. Returns 0 on success. */
|
||||||
|
static int compileregex(struct hostname *h, unsigned char *pattern)
|
||||||
|
{
|
||||||
|
#ifdef WITH_PCRE
|
||||||
|
char err[256];
|
||||||
|
|
||||||
|
h->re = pcre_pattern_compile(pattern, err, sizeof(err));
|
||||||
|
if(!h->re){
|
||||||
|
fprintf(stderr, "Bad regular expression '%s': %s\n", pattern, err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
h->matchtype = MATCHREGEX;
|
||||||
|
h->name = (unsigned char *)strdup((char *)pattern);
|
||||||
|
return h->name? 0 : 1;
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "Regular expression '%s' needs a build with PCRE\n", pattern);
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int parsepattern(struct hostname *h, unsigned char *arg)
|
||||||
|
{
|
||||||
|
int arglen;
|
||||||
|
unsigned char *pattern;
|
||||||
|
|
||||||
|
h->re = NULL;
|
||||||
|
if((pattern = regexprefix(arg))) return compileregex(h, pattern);
|
||||||
|
|
||||||
|
arglen = (int)strlen((char *)arg);
|
||||||
|
h->matchtype = 3;
|
||||||
|
pattern = arg;
|
||||||
|
|
||||||
|
if(arglen && pattern[arglen-1] == '*'){
|
||||||
|
arglen--;
|
||||||
|
pattern[arglen] = 0;
|
||||||
|
h->matchtype ^= MATCHEND;
|
||||||
|
}
|
||||||
|
if(arglen && pattern[0] == '*'){
|
||||||
|
pattern++;
|
||||||
|
arglen--;
|
||||||
|
h->matchtype ^= MATCHBEGIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
h->name = (unsigned char *)strdup((char *)pattern);
|
||||||
|
return h->name? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Matches str against a pattern and reports the part a star stood for. Where a
|
||||||
|
pattern has a star at both ends the trailing one is reported, since that is
|
||||||
|
the part following the text that was matched. An exact pattern leaves an
|
||||||
|
empty span. */
|
||||||
|
int patternmatchpos(const struct hostname *h, const unsigned char *str, int *start, int *len)
|
||||||
|
{
|
||||||
|
int lname, lstr, pos = 0, match = 0;
|
||||||
|
char *found;
|
||||||
|
|
||||||
|
if(!h->name || !str) return 0;
|
||||||
|
if(h->matchtype == MATCHREGEX || h->matchtype == MATCHGLOB){
|
||||||
|
struct capture caps[MAXCAPTURES];
|
||||||
|
|
||||||
|
if(!patternmatchcaps(h, str, caps, NULL)) return 0;
|
||||||
|
if(start) *start = caps[1].start;
|
||||||
|
if(len) *len = caps[1].len;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
lname = (int)strlen((char *)h->name);
|
||||||
|
lstr = (int)strlen((char *)str);
|
||||||
|
|
||||||
|
switch(h->matchtype){
|
||||||
|
case 0:
|
||||||
|
#ifndef _WIN32
|
||||||
|
found = strcasestr((char *)str, (char *)h->name);
|
||||||
|
#else
|
||||||
|
found = strstr((char *)str, (char *)h->name);
|
||||||
|
#endif
|
||||||
|
if(found){
|
||||||
|
match = 1;
|
||||||
|
pos = (int)(found - (char *)str) + lname;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
if(!strncasecmp((char *)str, (char *)h->name, lname)){
|
||||||
|
match = 1;
|
||||||
|
pos = lname;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
if(lstr >= lname &&
|
||||||
|
!strncasecmp((char *)str + (lstr - lname), (char *)h->name, lname)){
|
||||||
|
match = 1;
|
||||||
|
pos = 0;
|
||||||
|
if(start) *start = 0;
|
||||||
|
if(len) *len = lstr - lname;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if(!strcasecmp((char *)str, (char *)h->name)){
|
||||||
|
match = 1;
|
||||||
|
pos = lstr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!match) return 0;
|
||||||
|
|
||||||
|
if(start) *start = pos;
|
||||||
|
if(len) *len = lstr - pos;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int patternmatch(const struct hostname *h, const unsigned char *str)
|
||||||
|
{
|
||||||
|
return patternmatchcaps(h, str, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Match a glob, recording what each star stood for.
|
||||||
|
|
||||||
|
A single star stands for any run of characters within one element of the
|
||||||
|
path, so it stops at a slash; a double star crosses them. Stars are
|
||||||
|
numbered in the order they appear, which is how a template refers to them.
|
||||||
|
*/
|
||||||
|
static int globmatch(const unsigned char *pat, const unsigned char *str,
|
||||||
|
const unsigned char *subject, struct capture *caps, int maxcaps, int star)
|
||||||
|
{
|
||||||
|
while(*pat){
|
||||||
|
if(*pat == '*'){
|
||||||
|
int crosses = (pat[1] == '*');
|
||||||
|
const unsigned char *rest = pat + (crosses? 2 : 1);
|
||||||
|
int len;
|
||||||
|
|
||||||
|
for(len = 0; ; len++){
|
||||||
|
if(star < maxcaps && caps){
|
||||||
|
caps[star].start = (int)(str - subject);
|
||||||
|
caps[star].len = len;
|
||||||
|
}
|
||||||
|
if(globmatch(rest, str + len, subject, caps, maxcaps, star + 1)) return 1;
|
||||||
|
if(!str[len]) return 0;
|
||||||
|
if(!crosses && str[len] == '/') return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(*pat != *str) return 0;
|
||||||
|
pat++;
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
return *str == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Match a pattern of any kind and report what its stars or groups stood for.
|
||||||
|
caps may be NULL when only the yes or no answer is wanted. */
|
||||||
|
int patternmatchcaps(const struct hostname *h, const unsigned char *str,
|
||||||
|
struct capture *caps, int *ncaps)
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
if(ncaps) *ncaps = 0;
|
||||||
|
if(!h || !str) return 0;
|
||||||
|
|
||||||
|
if(h->matchtype == MATCHREGEX){
|
||||||
|
#ifdef WITH_PCRE
|
||||||
|
struct capture local[MAXCAPTURES];
|
||||||
|
|
||||||
|
n = pcre_pattern_match(h->re, str, caps? caps : local, MAXCAPTURES);
|
||||||
|
if(ncaps) *ncaps = n;
|
||||||
|
return n > 0;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if(h->matchtype == MATCHGLOB){
|
||||||
|
struct capture local[MAXCAPTURES];
|
||||||
|
struct capture *use = caps? caps : local;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0; i < MAXCAPTURES; i++){
|
||||||
|
use[i].start = 0;
|
||||||
|
use[i].len = 0;
|
||||||
|
}
|
||||||
|
use[0].start = 0;
|
||||||
|
use[0].len = (int)strlen((char *)str);
|
||||||
|
if(!h->name) return 0;
|
||||||
|
if(!globmatch(h->name, str, str, use, MAXCAPTURES, 1)) return 0;
|
||||||
|
if(ncaps){
|
||||||
|
for(n = MAXCAPTURES - 1; n > 0 && !use[n].len && !use[n].start; n--);
|
||||||
|
*ncaps = n + 1;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the star at one end or both, as an access rule has always written it */
|
||||||
|
if(caps){
|
||||||
|
int start = 0, len = 0;
|
||||||
|
|
||||||
|
if(!patternmatchpos(h, str, &start, &len)) return 0;
|
||||||
|
caps[0].start = 0;
|
||||||
|
caps[0].len = (int)strlen((char *)str);
|
||||||
|
caps[1].start = start;
|
||||||
|
caps[1].len = len;
|
||||||
|
if(ncaps) *ncaps = 2;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return patternmatchpos(h, str, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A URL in an http rule: stars anywhere, or a regular expression. */
|
||||||
|
int parsepathpattern(struct hostname *h, unsigned char *arg)
|
||||||
|
{
|
||||||
|
unsigned char *pattern;
|
||||||
|
|
||||||
|
h->re = NULL;
|
||||||
|
if((pattern = regexprefix(arg))) return compileregex(h, pattern);
|
||||||
|
|
||||||
|
h->matchtype = MATCHGLOB;
|
||||||
|
h->name = (unsigned char *)strdup((char *)arg);
|
||||||
|
return h->name? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
int IPInentry(struct sockaddr *sa, struct iplist *ipentry){
|
int IPInentry(struct sockaddr *sa, struct iplist *ipentry){
|
||||||
int addrlen;
|
int addrlen;
|
||||||
unsigned char *ip, *ipf, *ipt;
|
unsigned char *ip, *ipf, *ipt;
|
||||||
@@ -36,6 +277,8 @@ int ACLmatches(struct ace* acentry, struct clientparam * param){
|
|||||||
struct hostname * hstentry=NULL;
|
struct hostname * hstentry=NULL;
|
||||||
int i;
|
int i;
|
||||||
int match = 0;
|
int match = 0;
|
||||||
|
int dstdep = 0;
|
||||||
|
int preauth = (param->preauth == 1 && acentry->action <= REDIRECT);
|
||||||
|
|
||||||
username = param->username?param->username:(unsigned char *)"-";
|
username = param->username?param->username:(unsigned char *)"-";
|
||||||
if(acentry->src) {
|
if(acentry->src) {
|
||||||
@@ -45,7 +288,10 @@ int ACLmatches(struct ace* acentry, struct clientparam * param){
|
|||||||
}
|
}
|
||||||
if(!ipentry) return 0;
|
if(!ipentry) return 0;
|
||||||
}
|
}
|
||||||
if((acentry->dst && (!SAISNULL(¶m->req) || param->operation==BIND)) || (acentry->dstnames && param->hostname)) {
|
if(preauth && (acentry->dst || acentry->dstnames)) {
|
||||||
|
dstdep = 1;
|
||||||
|
}
|
||||||
|
else if((acentry->dst && (!SAISNULL(¶m->req) || param->operation==BIND)) || (acentry->dstnames && param->hostname)) {
|
||||||
for(ipentry = acentry->dst; ipentry; ipentry = ipentry->next)
|
for(ipentry = acentry->dst; ipentry; ipentry = ipentry->next)
|
||||||
if(IPInentry((struct sockaddr *)¶m->req, ipentry)) {
|
if(IPInentry((struct sockaddr *)¶m->req, ipentry)) {
|
||||||
break;
|
break;
|
||||||
@@ -57,43 +303,17 @@ int ACLmatches(struct ace* acentry, struct clientparam * param){
|
|||||||
}
|
}
|
||||||
while(i > 5 && param->hostname[i-1] == '.') param->hostname[i-1] = 0;
|
while(i > 5 && param->hostname[i-1] == '.') param->hostname[i-1] = 0;
|
||||||
for(hstentry = acentry->dstnames; hstentry; hstentry = hstentry->next){
|
for(hstentry = acentry->dstnames; hstentry; hstentry = hstentry->next){
|
||||||
int lname, lhost;
|
if(patternmatch(hstentry, param->hostname)) match = 1;
|
||||||
switch(hstentry->matchtype){
|
|
||||||
case 0:
|
|
||||||
#ifndef _WIN32
|
|
||||||
if(strcasestr((char *)param->hostname, (char *)hstentry->name)) match = 1;
|
|
||||||
#else
|
|
||||||
if(strstr((char *)param->hostname, (char *)hstentry->name)) match = 1;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
if(!strncasecmp((char *)param->hostname, (char *)hstentry->name, strlen((char *)hstentry->name)))
|
|
||||||
match = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
lname = strlen((char *)hstentry->name);
|
|
||||||
lhost = strlen((char *)param->hostname);
|
|
||||||
if(lhost > lname){
|
|
||||||
if(!strncasecmp((char *)param->hostname + (lhost - lname),
|
|
||||||
(char *)hstentry->name,
|
|
||||||
lname))
|
|
||||||
match = 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if(!strcasecmp((char *)param->hostname, (char *)hstentry->name)) match = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(match) break;
|
if(match) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!ipentry && !hstentry) return 0;
|
if(!ipentry && !hstentry) return 0;
|
||||||
}
|
}
|
||||||
if(acentry->ports && (*SAPORT(¶m->req) || param->operation == BIND)) {
|
if(preauth && acentry->ports) {
|
||||||
|
dstdep = 1;
|
||||||
|
}
|
||||||
|
else if(acentry->ports && (*SAPORT(¶m->req) || param->operation == BIND)) {
|
||||||
for (portentry = acentry->ports; portentry; portentry = portentry->next)
|
for (portentry = acentry->ports; portentry; portentry = portentry->next)
|
||||||
if(ntohs(*SAPORT(¶m->req)) >= portentry->startport &&
|
if(ntohs(*SAPORT(¶m->req)) >= portentry->startport &&
|
||||||
ntohs(*SAPORT(¶m->req)) <= portentry->endport) {
|
ntohs(*SAPORT(¶m->req)) <= portentry->endport) {
|
||||||
@@ -125,6 +345,10 @@ int ACLmatches(struct ace* acentry, struct clientparam * param){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(acentry->weight && (acentry->weight < param->weight)) return 0;
|
if(acentry->weight && (acentry->weight < param->weight)) return 0;
|
||||||
|
if(dstdep) {
|
||||||
|
param->dstindep = 0;
|
||||||
|
return acentry->action != DENY;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,6 +356,7 @@ int ACLmatches(struct ace* acentry, struct clientparam * param){
|
|||||||
int checkACL(struct clientparam * param){
|
int checkACL(struct clientparam * param){
|
||||||
struct ace* acentry;
|
struct ace* acentry;
|
||||||
|
|
||||||
|
if(param->preauth == 1) param->dstindep = 1;
|
||||||
if(!param->srv->acl) {
|
if(!param->srv->acl) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -150,7 +375,12 @@ int checkACL(struct clientparam * param){
|
|||||||
if(param->redirected && acentry->chains && SAISNULL(&acentry->chains->addr) && !*SAPORT(&acentry->chains->addr)) {
|
if(param->redirected && acentry->chains && SAISNULL(&acentry->chains->addr) && !*SAPORT(&acentry->chains->addr)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(param->remsock != INVALID_SOCKET && (param->operation != UDPASSOC || param->ctrlsocksrv != INVALID_SOCKET)) {
|
param->lastace = acentry;
|
||||||
|
if(param->preauth) {
|
||||||
|
applyportranges(param, acentry);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if((param->operation == UDPASSOC)? (param->ctrlsocksrv != INVALID_SOCKET) : (param->remsock != INVALID_SOCKET)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
for(; i < conf.parentretries; i++){
|
for(; i < conf.parentretries; i++){
|
||||||
@@ -159,11 +389,44 @@ int checkACL(struct clientparam * param){
|
|||||||
if(!res) break;
|
if(!res) break;
|
||||||
if(param->remsock != INVALID_SOCKET) param->srv->so._closesocket(param->sostate, param->remsock);
|
if(param->remsock != INVALID_SOCKET) param->srv->so._closesocket(param->sostate, param->remsock);
|
||||||
param->remsock = INVALID_SOCKET;
|
param->remsock = INVALID_SOCKET;
|
||||||
|
if(param->ctrlsocksrv != INVALID_SOCKET) {
|
||||||
|
param->srv->so._closesocket(param->sostate, param->ctrlsocksrv);
|
||||||
|
param->ctrlsocksrv = INVALID_SOCKET;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
param->lastace = acentry;
|
||||||
return acentry->action;
|
return acentry->action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char * aceaction (int action){
|
||||||
|
switch (action) {
|
||||||
|
case ALLOW:
|
||||||
|
case REDIRECT:
|
||||||
|
return "allow";
|
||||||
|
case DENY:
|
||||||
|
return "deny";
|
||||||
|
case BANDLIM:
|
||||||
|
return "bandlim";
|
||||||
|
case NOBANDLIM:
|
||||||
|
return "nobandlim";
|
||||||
|
case COUNTIN:
|
||||||
|
return "countin";
|
||||||
|
case NOCOUNTIN:
|
||||||
|
return "nocountin";
|
||||||
|
case COUNTOUT:
|
||||||
|
return "countout";
|
||||||
|
case NOCOUNTOUT:
|
||||||
|
return "nocountout";
|
||||||
|
case COUNTALL:
|
||||||
|
return "countall";
|
||||||
|
case NOCOUNTALL:
|
||||||
|
return "nocountall";
|
||||||
|
default:
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
+46
-15
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
#include "libs/blake2.h"
|
#include "mdhash.h"
|
||||||
|
|
||||||
void initbandlims(struct clientparam *param);
|
void initbandlims(struct clientparam *param);
|
||||||
|
|
||||||
@@ -18,7 +18,14 @@ int alwaysauth(struct clientparam * param){
|
|||||||
|
|
||||||
|
|
||||||
if(conf.connlimiter && !param->connlim && startconnlims(param)) return 10;
|
if(conf.connlimiter && !param->connlim && startconnlims(param)) return 10;
|
||||||
|
#ifdef WITH_HTTPSRV
|
||||||
|
/* The http server answers the request itself, so authorization must not
|
||||||
|
try to reach a destination that does not exist. A request it has handed
|
||||||
|
to another child does have one, and that child needs it opened. */
|
||||||
|
res = (param->srv->service == S_HTTPSRV && !param->onerequest)? 0 : doconnect(param);
|
||||||
|
#else
|
||||||
res = doconnect(param);
|
res = doconnect(param);
|
||||||
|
#endif
|
||||||
if(!res){
|
if(!res){
|
||||||
if(conf.bandlimfunc && (conf.bandlimiter||conf.bandlimiterout)){
|
if(conf.bandlimfunc && (conf.bandlimiter||conf.bandlimiterout)){
|
||||||
_3proxy_mutex_lock(&bandlim_mutex);
|
_3proxy_mutex_lock(&bandlim_mutex);
|
||||||
@@ -80,7 +87,7 @@ int cacheauth(struct clientparam * param){
|
|||||||
((type & 4) && !param->password) ||
|
((type & 4) && !param->password) ||
|
||||||
(
|
(
|
||||||
(type & 1) && *SAFAMILY(¶m->sincr) != AF_INET
|
(type & 1) && *SAFAMILY(¶m->sincr) != AF_INET
|
||||||
#ifndef NOIPv6
|
#ifndef NOIPV6
|
||||||
&& *SAFAMILY(¶m->sincr) != AF_INET6
|
&& *SAFAMILY(¶m->sincr) != AF_INET6
|
||||||
#endif
|
#endif
|
||||||
) || (!hashresolv(&auth_table, param, &ac, &ttl))) {
|
) || (!hashresolv(&auth_table, param, &ac, &ttl))) {
|
||||||
@@ -102,15 +109,16 @@ int cacheauth(struct clientparam * param){
|
|||||||
*(SAFAMILY(¶m->sinsl)) = ac.sinsl_family;
|
*(SAFAMILY(¶m->sinsl)) = ac.sinsl_family;
|
||||||
memcpy(SAADDR(¶m->sinsl), ac.sinsl_addr, SAADDRLEN(¶m->sinsl));
|
memcpy(SAADDR(¶m->sinsl), ac.sinsl_addr, SAADDRLEN(¶m->sinsl));
|
||||||
}
|
}
|
||||||
|
if(param->preauth == 1 && param->srv->acl) param->dstindep = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int doauth(struct clientparam * param){
|
int doauth(struct clientparam * param){
|
||||||
int res = 0;
|
int res = 0;
|
||||||
struct auth *authfuncs;
|
struct auth *authfuncs;
|
||||||
char * tmp;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if(param->preauth == 1 && !param->srv->acl) param->dstindep = 1;
|
||||||
for(authfuncs=param->srv->authfuncs; authfuncs; authfuncs=authfuncs->next){
|
for(authfuncs=param->srv->authfuncs; authfuncs; authfuncs=authfuncs->next){
|
||||||
res = authfuncs->authenticate?(*authfuncs->authenticate)(param):0;
|
res = authfuncs->authenticate?(*authfuncs->authenticate)(param):0;
|
||||||
if(!res) {
|
if(!res) {
|
||||||
@@ -125,7 +133,7 @@ int doauth(struct clientparam * param){
|
|||||||
ac.username[63] = 0;
|
ac.username[63] = 0;
|
||||||
}
|
}
|
||||||
if(*SAFAMILY(¶m->sincr) == AF_INET
|
if(*SAFAMILY(¶m->sincr) == AF_INET
|
||||||
#ifndef NOIPv6
|
#ifndef NOIPV6
|
||||||
|| *SAFAMILY(¶m->sincr) == AF_INET6
|
|| *SAFAMILY(¶m->sincr) == AF_INET6
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
@@ -134,7 +142,7 @@ int doauth(struct clientparam * param){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(*SAFAMILY(¶m->sinsl) == AF_INET
|
if(*SAFAMILY(¶m->sinsl) == AF_INET
|
||||||
#ifndef NOIPv6
|
#ifndef NOIPV6
|
||||||
|| *SAFAMILY(¶m->sinsl) == AF_INET6
|
|| *SAFAMILY(¶m->sinsl) == AF_INET6
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
@@ -149,7 +157,7 @@ int doauth(struct clientparam * param){
|
|||||||
if(ret > 9) return ret;
|
if(ret > 9) return ret;
|
||||||
}
|
}
|
||||||
if(!res){
|
if(!res){
|
||||||
ret = alwaysauth(param);
|
ret = (param->preauth == 2)? 0 : alwaysauth(param);
|
||||||
if (param->afterauthfilters){
|
if (param->afterauthfilters){
|
||||||
FILTER_ACTION action;
|
FILTER_ACTION action;
|
||||||
|
|
||||||
@@ -216,8 +224,25 @@ int dnsauth(struct clientparam * param){
|
|||||||
return param->username? 0:3;
|
return param->username? 0:3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ctmemcmp(const void *a, const void *b, size_t len){
|
||||||
|
const unsigned char *pa = (const unsigned char *)a, *pb = (const unsigned char *)b;
|
||||||
|
unsigned char diff = 0;
|
||||||
|
size_t i;
|
||||||
|
for(i = 0; i < len; i++) diff |= (unsigned char)(pa[i] ^ pb[i]);
|
||||||
|
return diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ctstrcmp(const char *a, const char *b, size_t maxlen){
|
||||||
|
unsigned char diff = 0;
|
||||||
|
size_t i;
|
||||||
|
for(i = 0; i < maxlen; i++){
|
||||||
|
diff |= (unsigned char)((unsigned char)a[i] ^ (unsigned char)b[i]);
|
||||||
|
if(!a[i] && !b[i]) break;
|
||||||
|
}
|
||||||
|
return diff;
|
||||||
|
}
|
||||||
|
|
||||||
int strongauth(struct clientparam * param){
|
int strongauth(struct clientparam * param){
|
||||||
static char dummy;
|
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
char pass[256] = {0};
|
char pass[256] = {0};
|
||||||
|
|
||||||
@@ -229,27 +254,33 @@ int strongauth(struct clientparam * param){
|
|||||||
int pwlen = strlen((char *)param->password);
|
int pwlen = strlen((char *)param->password);
|
||||||
if(pwlen > 255) pwlen = 255;
|
if(pwlen > 255) pwlen = 255;
|
||||||
if((unsigned)pwlen < pwl_table.recsize) {
|
if((unsigned)pwlen < pwl_table.recsize) {
|
||||||
if(!strncmp(pass + 1, (char *)param->password, pwl_table.recsize - 1)) return 0;
|
memset(buf, 0, pwl_table.recsize - 1);
|
||||||
|
memcpy(buf, param->password, pwlen);
|
||||||
|
if(!ctmemcmp(pass + 1, buf, pwl_table.recsize - 1)) return 0;
|
||||||
} else {
|
} else {
|
||||||
blake2b_state S;
|
mdh_ctx *bctx;
|
||||||
unsigned hashsz;
|
unsigned hashsz;
|
||||||
|
unsigned int blen;
|
||||||
hashsz = pwl_table.recsize - 1 < 64 ? pwl_table.recsize - 1 : 64;
|
hashsz = pwl_table.recsize - 1 < 64 ? pwl_table.recsize - 1 : 64;
|
||||||
memset(buf, 0, pwl_table.recsize - 1);
|
memset(buf, 0, pwl_table.recsize - 1);
|
||||||
blake2b_init(&S, hashsz);
|
bctx = mdh_init(MDH_BLAKE2, hashsz);
|
||||||
blake2b_update(&S, param->password, pwlen + 1);
|
if(!bctx) return 6;
|
||||||
blake2b_final(&S, buf, hashsz);
|
mdh_update(bctx, param->password, pwlen + 1);
|
||||||
if(!memcmp(pass + 1, buf, pwl_table.recsize - 1)) return 0;
|
blen = hashsz;
|
||||||
|
mdh_final(bctx, buf, &blen);
|
||||||
|
mdh_free(bctx);
|
||||||
|
if(!ctmemcmp(pass + 1, buf, pwl_table.recsize - 1)) return 0;
|
||||||
}
|
}
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
case CR:
|
case CR:
|
||||||
if (mycrypt(param->password, (unsigned char *)pass + 1, buf) &&
|
if (mycrypt(param->password, (unsigned char *)pass + 1, buf) &&
|
||||||
!strcmp(pass + 1, (char *)buf))
|
!ctstrcmp(pass + 1, (char *)buf, sizeof(pass) - 1))
|
||||||
return 0;
|
return 0;
|
||||||
else return 7;
|
else return 7;
|
||||||
#ifdef WITH_SSL
|
#ifdef WITH_SSL
|
||||||
case NT:
|
case NT:
|
||||||
if(ntpwdhash(buf, param->password, 1) && !strcmp(pass + 1, (char *)buf)) return 0;
|
if(ntpwdhash(buf, param->password, 1) && !ctstrcmp(pass + 1, (char *)buf, sizeof(pass) - 1)) return 0;
|
||||||
else return 8;
|
else return 8;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|||||||
+9
-31
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#ifndef NORADIUS
|
#ifndef NORADIUS
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
#include <openssl/evp.h>
|
#include "mdhash.h"
|
||||||
|
|
||||||
#define AUTH_VECTOR_LEN 16
|
#define AUTH_VECTOR_LEN 16
|
||||||
#define MAX_STRING_LEN 254
|
#define MAX_STRING_LEN 254
|
||||||
@@ -174,36 +174,15 @@ void md5_calc(unsigned char *output, unsigned char *input,
|
|||||||
unsigned int inputlen);
|
unsigned int inputlen);
|
||||||
|
|
||||||
|
|
||||||
char *strNcpy(char *dest, const char *src, int n)
|
|
||||||
{
|
|
||||||
if (n > 0)
|
|
||||||
strncpy(dest, src, n);
|
|
||||||
else
|
|
||||||
n = 1;
|
|
||||||
dest[n - 1] = 0;
|
|
||||||
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
|
||||||
extern EVP_MD *md4_hash;
|
|
||||||
extern EVP_MD *md5_hash;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void md5_calc(unsigned char *output, unsigned char *input,
|
void md5_calc(unsigned char *output, unsigned char *input,
|
||||||
unsigned int inlen)
|
unsigned int inlen)
|
||||||
{
|
{
|
||||||
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
|
mdh_ctx *ctx = mdh_init(MDH_MD5, 16);
|
||||||
unsigned int len = 0;
|
unsigned int len = 16;
|
||||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
if(!ctx) return;
|
||||||
EVP_DigestInit_ex(ctx, md5_hash, NULL);
|
mdh_update(ctx, input, inlen);
|
||||||
#else
|
mdh_final(ctx, output, &len);
|
||||||
EVP_DigestInit_ex(ctx, EVP_md5(), NULL);
|
mdh_free(ctx);
|
||||||
#endif
|
|
||||||
EVP_DigestUpdate(ctx, input, inlen);
|
|
||||||
EVP_DigestFinal_ex(ctx, output, &len);
|
|
||||||
EVP_MD_CTX_free(ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -318,14 +297,12 @@ int radsend(struct clientparam * param, int auth, int stop){
|
|||||||
unsigned char *ptr;
|
unsigned char *ptr;
|
||||||
int total_length;
|
int total_length;
|
||||||
int len;
|
int len;
|
||||||
int op;
|
|
||||||
PROXYSOCKADDRTYPE saremote;
|
PROXYSOCKADDRTYPE saremote;
|
||||||
struct pollfd fds[1];
|
struct pollfd fds[1];
|
||||||
char vector[AUTH_VECTOR_LEN];
|
char vector[AUTH_VECTOR_LEN];
|
||||||
radius_packet_t packet, rpacket;
|
radius_packet_t packet, rpacket;
|
||||||
SASIZETYPE salen;
|
SASIZETYPE salen;
|
||||||
int data_len;
|
int data_len;
|
||||||
uint8_t *vendor_len;
|
|
||||||
int count=0;
|
int count=0;
|
||||||
uint8_t *attr;
|
uint8_t *attr;
|
||||||
long vendor=0;
|
long vendor=0;
|
||||||
@@ -401,6 +378,7 @@ int radsend(struct clientparam * param, int auth, int stop){
|
|||||||
if(conf.stringtable){
|
if(conf.stringtable){
|
||||||
*ptr++ = PW_NAS_IDENTIFIER;
|
*ptr++ = PW_NAS_IDENTIFIER;
|
||||||
len = strlen((char *)conf.stringtable[SERVICES+param->service]);
|
len = strlen((char *)conf.stringtable[SERVICES+param->service]);
|
||||||
|
if(len > 253) len = 253;
|
||||||
*ptr++ = (2 + len);
|
*ptr++ = (2 + len);
|
||||||
memcpy(ptr, conf.stringtable[SERVICES+param->service], len);
|
memcpy(ptr, conf.stringtable[SERVICES+param->service], len);
|
||||||
ptr += len;
|
ptr += len;
|
||||||
@@ -426,6 +404,7 @@ int radsend(struct clientparam * param, int auth, int stop){
|
|||||||
if(param->hostname){
|
if(param->hostname){
|
||||||
*ptr++ = PW_CALLED_STATION_ID;
|
*ptr++ = PW_CALLED_STATION_ID;
|
||||||
len = strlen((char *)param->hostname);
|
len = strlen((char *)param->hostname);
|
||||||
|
if(len > 253) len = 253;
|
||||||
*ptr++ = (2 + len);
|
*ptr++ = (2 + len);
|
||||||
memcpy(ptr, param->hostname, len);
|
memcpy(ptr, param->hostname, len);
|
||||||
ptr += len;
|
ptr += len;
|
||||||
@@ -621,7 +600,6 @@ int radsend(struct clientparam * param, int auth, int stop){
|
|||||||
|
|
||||||
attr = rpacket.data;
|
attr = rpacket.data;
|
||||||
count = total_length - 20;
|
count = total_length - 20;
|
||||||
vendor_len = 0;
|
|
||||||
|
|
||||||
while (count >= 2) {
|
while (count >= 2) {
|
||||||
if (!vendor && attr[0] == 0) {
|
if (!vendor && attr[0] == 0) {
|
||||||
|
|||||||
+4
-3
@@ -21,16 +21,17 @@ void * autochild(struct clientparam* param) {
|
|||||||
if (len != 1){
|
if (len != 1){
|
||||||
param->res = 801;
|
param->res = 801;
|
||||||
dolog(param, (unsigned char *)"");
|
dolog(param, (unsigned char *)"");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
if(*param->clibuf == 4 || *param->clibuf == 5) {
|
if(*param->clibuf == 4 || *param->clibuf == 5) {
|
||||||
param->service = S_SOCKS;
|
param->service = S_SOCKS;
|
||||||
return sockschild(param);
|
return (void *)sockschild;
|
||||||
}
|
}
|
||||||
if(*param->clibuf == 22) {
|
if(*param->clibuf == 22) {
|
||||||
param->service = S_TLSPR;
|
param->service = S_TLSPR;
|
||||||
return tlsprchild(param);
|
return (void *)tlsprchild;
|
||||||
}
|
}
|
||||||
param->service = S_PROXY;
|
param->service = S_PROXY;
|
||||||
return proxychild(param);
|
return (void *)proxychild;
|
||||||
}
|
}
|
||||||
|
|
||||||
+9
-2
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
static const unsigned char base64digits[] =
|
static const unsigned char base64digits[] =
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
@@ -23,8 +24,10 @@ static const unsigned char base64val[] = {
|
|||||||
};
|
};
|
||||||
#define DECODE64(c) ((c > 32 && c<127)? base64val[(int)c] : BAD)
|
#define DECODE64(c) ((c > 32 && c<127)? base64val[(int)c] : BAD)
|
||||||
|
|
||||||
unsigned char* en64 (const unsigned char *in, unsigned char *out, int inlen)
|
unsigned char* en64 (const unsigned char *in, unsigned char *out, int inlen, int outsize)
|
||||||
{
|
{
|
||||||
|
if (inlen < 0 || inlen > (INT_MAX - 2) || outsize < 1) return NULL;
|
||||||
|
if (((inlen + 2) / 3) > ((outsize - 1) / 4)) return NULL;
|
||||||
for (; inlen > 0; inlen -= 3, in+=3)
|
for (; inlen > 0; inlen -= 3, in+=3)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -42,6 +45,7 @@ int de64 (const char *in, char *out, int maxlen)
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
register unsigned char digit1, digit2, digit3, digit4;
|
register unsigned char digit1, digit2, digit3, digit4;
|
||||||
|
|
||||||
|
if (maxlen < 0) return(-1);
|
||||||
if (in[0] == '+' && in[1] == ' ')
|
if (in[0] == '+' && in[1] == ' ')
|
||||||
in += 2;
|
in += 2;
|
||||||
if (*in == '\r')
|
if (*in == '\r')
|
||||||
@@ -61,20 +65,23 @@ int de64 (const char *in, char *out, int maxlen)
|
|||||||
if (digit4 != '=' && DECODE64(digit4) == BAD)
|
if (digit4 != '=' && DECODE64(digit4) == BAD)
|
||||||
return(-1);
|
return(-1);
|
||||||
in += 4;
|
in += 4;
|
||||||
|
if (len >= maxlen) return (len);
|
||||||
*out++ = (DECODE64(digit1) << 2) | (DECODE64(digit2) >> 4);
|
*out++ = (DECODE64(digit1) << 2) | (DECODE64(digit2) >> 4);
|
||||||
++len;
|
++len;
|
||||||
if (digit3 != '=')
|
if (digit3 != '=')
|
||||||
{
|
{
|
||||||
|
if (len >= maxlen) return (len);
|
||||||
*out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2);
|
*out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2);
|
||||||
++len;
|
++len;
|
||||||
if (digit4 != '=')
|
if (digit4 != '=')
|
||||||
{
|
{
|
||||||
|
if (len >= maxlen) return (len);
|
||||||
*out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4);
|
*out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4);
|
||||||
++len;
|
++len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while
|
} while
|
||||||
(*in && *in != '\r' && digit4 != '=' && (maxlen-=4) >= 4);
|
(*in && *in != '\r' && digit4 != '=');
|
||||||
|
|
||||||
return (len);
|
return (len);
|
||||||
}
|
}
|
||||||
|
|||||||
+226
-48
@@ -9,6 +9,48 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
|
/* returns 0 on success, 1 if atyp is not supported for family, 2 if the
|
||||||
|
address is null. The address is set in both the 0 and the 2 case. */
|
||||||
|
int socks5_setaddr(int family, int atyp, const unsigned char *addr, PROXYSOCKADDRTYPE *sa){
|
||||||
|
int i, len = 4;
|
||||||
|
|
||||||
|
memset(sa, 0, sizeof(*sa));
|
||||||
|
if(atyp == 4){
|
||||||
|
#ifdef NOIPV6
|
||||||
|
return 1;
|
||||||
|
#else
|
||||||
|
if(family == 4) return 1;
|
||||||
|
len = 16;
|
||||||
|
*SAFAMILY(sa) = AF_INET6;
|
||||||
|
memcpy(SAADDR(sa), addr, 16);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifndef NOIPV6
|
||||||
|
else if(family == 6){
|
||||||
|
unsigned char prefix[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255};
|
||||||
|
|
||||||
|
*SAFAMILY(sa) = AF_INET6;
|
||||||
|
memcpy(SAADDR(sa), prefix, 12);
|
||||||
|
memcpy(12 + (unsigned char *)SAADDR(sa), addr, 4);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
*SAFAMILY(sa) = AF_INET;
|
||||||
|
memcpy(SAADDR(sa), addr, 4);
|
||||||
|
}
|
||||||
|
for(i = 0; i < len && !addr[i]; i++);
|
||||||
|
return (i == len)? 2 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <sched.h>
|
||||||
|
|
||||||
|
int switch_ns(struct srvparam *srv, int target_fd) {
|
||||||
|
if(target_fd < 0) return 0;
|
||||||
|
if(srv->saved_nsfd >= 0 && setns(srv->saved_nsfd, CLONE_NEWNET)) return -1;
|
||||||
|
return setns(target_fd, CLONE_NEWNET);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
char * copyright = COPYRIGHT;
|
char * copyright = COPYRIGHT;
|
||||||
@@ -17,6 +59,8 @@ char * copyright = COPYRIGHT;
|
|||||||
# define MYRAND_ARC4RANDOM 1
|
# define MYRAND_ARC4RANDOM 1
|
||||||
#elif defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 36)))
|
#elif defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 36)))
|
||||||
# define MYRAND_ARC4RANDOM 1
|
# define MYRAND_ARC4RANDOM 1
|
||||||
|
#elif defined(__GLIBC__) && ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 25)))
|
||||||
|
# define MYRAND_FALLBACK 1
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
# define MYRAND_GETRANDOM 1
|
# define MYRAND_GETRANDOM 1
|
||||||
# include <sys/random.h>
|
# include <sys/random.h>
|
||||||
@@ -128,16 +172,24 @@ int timeouts[12] = {
|
|||||||
60, /* CHAIN_TO */
|
60, /* CHAIN_TO */
|
||||||
15, /* CONNECT_TO */
|
15, /* CONNECT_TO */
|
||||||
5, /* CONNBACK_TO */
|
5, /* CONNBACK_TO */
|
||||||
0,
|
5, /* LINGER_TO */
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
struct extparam conf = {
|
#ifndef _WIN32
|
||||||
#ifdef _WIN32
|
/* PTHREAD_STACK_MIN is 128K on glibc/aarch64 and glibc/powerpc and may be
|
||||||
.threadinit = NULL,
|
a sysconf() call with _GNU_SOURCE. pthread_attr_setstacksize() fails with
|
||||||
#else
|
EINVAL below it and the thread silently gets the 8M system default stack.
|
||||||
.threadinit = 0,
|
*/
|
||||||
|
size_t threadstacksize(int extra){
|
||||||
|
long size = BASESTACKSIZE + TLSSTACKSIZE + extra;
|
||||||
|
|
||||||
|
if(size < (long)PTHREAD_STACK_MIN) size = (long)PTHREAD_STACK_MIN;
|
||||||
|
return (size_t)size;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct extparam conf = {
|
||||||
.timeouts = timeouts,
|
.timeouts = timeouts,
|
||||||
.acl = NULL,
|
.acl = NULL,
|
||||||
.conffile = NULL,
|
.conffile = NULL,
|
||||||
@@ -153,7 +205,7 @@ struct extparam conf = {
|
|||||||
.paused = 0,
|
.paused = 0,
|
||||||
.archiverc = 0,
|
.archiverc = 0,
|
||||||
.demon = 0,
|
.demon = 0,
|
||||||
.maxchild = 500,
|
.maxchild = DEFAULT_MAXCHILD,
|
||||||
.backlog = 0,
|
.backlog = 0,
|
||||||
.needreload = 0,
|
.needreload = 0,
|
||||||
.timetoexit = 0,
|
.timetoexit = 0,
|
||||||
@@ -335,7 +387,6 @@ int
|
|||||||
return shutdown(s, how);
|
return shutdown(s, how);
|
||||||
}
|
}
|
||||||
int WINAPI def_closesocket(void* state, SOCKET s){
|
int WINAPI def_closesocket(void* state, SOCKET s){
|
||||||
usleep(SLEEPTIME);
|
|
||||||
return closesocket(s);
|
return closesocket(s);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -375,11 +426,18 @@ int
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* a peer gone is an error of the send, not SIGPIPE, where the system can
|
||||||
|
say so for a call: SIGPIPE is ignored too, for TLS and splice() */
|
||||||
|
#ifdef MSG_NOSIGNAL
|
||||||
|
#define SENDFLAGS MSG_NOSIGNAL
|
||||||
|
#else
|
||||||
|
#define SENDFLAGS 0
|
||||||
|
#endif
|
||||||
ssize_t def_send(void* state, SOCKET s, const void *msg, size_t len, int flags){
|
ssize_t def_send(void* state, SOCKET s, const void *msg, size_t len, int flags){
|
||||||
return send(s, msg, len, flags);
|
return send(s, msg, len, flags | SENDFLAGS);
|
||||||
}
|
}
|
||||||
ssize_t def_sendto(void* state, SOCKET s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen){
|
ssize_t def_sendto(void* state, SOCKET s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen){
|
||||||
return sendto(s, msg, len, flags, to, tolen);
|
return sendto(s, msg, len, flags | SENDFLAGS, to, tolen);
|
||||||
}
|
}
|
||||||
ssize_t def_recv(void* state, SOCKET s, void *buf, size_t len, int flags){
|
ssize_t def_recv(void* state, SOCKET s, void *buf, size_t len, int flags){
|
||||||
return recv(s, buf, len, flags);
|
return recv(s, buf, len, flags);
|
||||||
@@ -497,6 +555,19 @@ int parsehostname(char *hostname, struct clientparam *param, uint16_t port){
|
|||||||
if(se){
|
if(se){
|
||||||
*se = 0;
|
*se = 0;
|
||||||
}
|
}
|
||||||
|
if(!*hostname){
|
||||||
|
if(sp){
|
||||||
|
port = atoi(sp+1);
|
||||||
|
*sp = ':';
|
||||||
|
}
|
||||||
|
*SAPORT(¶m->req) = htons(port);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(strlen(hostname + (se!=0)) > 253){
|
||||||
|
if(se) *se = ']';
|
||||||
|
if(sp) *sp = ':';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if(hostname != (char *)param->hostname){
|
if(hostname != (char *)param->hostname){
|
||||||
if(param->hostname) free(param->hostname);
|
if(param->hostname) free(param->hostname);
|
||||||
param->hostname = (unsigned char *)strdup(hostname + (se!=0));
|
param->hostname = (unsigned char *)strdup(hostname + (se!=0));
|
||||||
@@ -551,14 +622,14 @@ int parseconnusername(char *username, struct clientparam *param, int extpasswd,
|
|||||||
if(!username || !*username) return 1;
|
if(!username || !*username) return 1;
|
||||||
if ((sb=strchr(username, conf.delimchar)) == NULL){
|
if ((sb=strchr(username, conf.delimchar)) == NULL){
|
||||||
if(!param->hostname && param->remsock == INVALID_SOCKET) return 2;
|
if(!param->hostname && param->remsock == INVALID_SOCKET) return 2;
|
||||||
if(param->hostname)parsehostname((char *)param->hostname, param, port);
|
if(param->hostname)parsehostname((char *)param->hostname, param, *SAPORT(¶m->req)? ntohs(*SAPORT(¶m->req)) : port);
|
||||||
return parseusername(username, param, extpasswd);
|
return parseusername(username, param, extpasswd);
|
||||||
}
|
}
|
||||||
while ((se=strchr(sb+1, conf.delimchar)))sb=se;
|
while ((se=strchr(sb+1, conf.delimchar)))sb=se;
|
||||||
*(sb) = 0;
|
*(sb) = 0;
|
||||||
if(parseusername(username, param, extpasswd)) return 3;
|
if(parseusername(username, param, extpasswd)) return 3;
|
||||||
*(sb) = conf.delimchar;
|
*(sb) = conf.delimchar;
|
||||||
if(parsehostname(sb+1, param, port)) return 4;
|
if(parsehostname(sb+1, param, *SAPORT(¶m->req)? ntohs(*SAPORT(¶m->req)) : port)) return 4;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,6 +656,55 @@ int connectwithpoll(struct clientparam *param, SOCKET sock, struct sockaddr *sa,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Number of ports tried before giving up when the range has to be searched by
|
||||||
|
* hand. The kernel option picks a free port itself and needs no retries. */
|
||||||
|
#define RANGETRIES 10
|
||||||
|
|
||||||
|
static int bindrange(struct clientparam *param, SOCKET sock, PROXYSOCKADDRTYPE *sa, uint32_t range, int *tries);
|
||||||
|
|
||||||
|
/* -Di / -De: ties a socket to the interface asked for, for TCP and UDP alike.
|
||||||
|
Where the option is set per protocol, family is the one of the address the
|
||||||
|
socket will be bound to. */
|
||||||
|
int bindtodevice(struct sockfuncs *sf, void *state, SOCKET sock, const char *device, int family){
|
||||||
|
if(!device) return 0;
|
||||||
|
#if defined SO_BINDTODEVICE
|
||||||
|
if(sf->_setsockopt(state, sock, SOL_SOCKET, SO_BINDTODEVICE, device, strlen(device) + 1))
|
||||||
|
return 1;
|
||||||
|
#elif defined IP_BOUND_IF
|
||||||
|
{
|
||||||
|
int idx;
|
||||||
|
idx = if_nametoindex(device);
|
||||||
|
if(!idx || (family == AF_INET && sf->_setsockopt(state, sock, IPPROTO_IP, IP_BOUND_IF, &idx, sizeof(idx))))
|
||||||
|
return 1;
|
||||||
|
#ifndef NOIPV6
|
||||||
|
#ifndef IPV6_BOUND_IF
|
||||||
|
#define IPV6_BOUND_IF 125
|
||||||
|
#endif
|
||||||
|
if(family == AF_INET6 && sf->_setsockopt(state, sock, IPPROTO_IPV6, IPV6_BOUND_IF, &idx, sizeof(idx))) return 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the external side, a socket to be bound to sinsl */
|
||||||
|
int extbindtodevice(struct clientparam *param, SOCKET sock){
|
||||||
|
#if defined SO_BINDTODEVICE || defined IP_BOUND_IF
|
||||||
|
return bindtodevice(¶m->srv->so, param->sostate, sock, param->srv->obindtodevice, *SAFAMILY(¶m->sinsl));
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the internal side, a socket to be bound to sincl */
|
||||||
|
int intbindtodevice(struct clientparam *param, SOCKET sock){
|
||||||
|
#if defined SO_BINDTODEVICE || defined IP_BOUND_IF
|
||||||
|
return bindtodevice(¶m->srv->so, param->sostate, sock, param->srv->ibindtodevice, *SAFAMILY(¶m->sincl));
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int doconnect(struct clientparam * param){
|
int doconnect(struct clientparam * param){
|
||||||
SASIZETYPE size;
|
SASIZETYPE size;
|
||||||
|
|
||||||
@@ -594,13 +714,17 @@ int doconnect(struct clientparam * param){
|
|||||||
|
|
||||||
if (param->operation == ADMIN || (( param->operation == DNSRESOLVE || param->operation == BIND || param->operation == UDPASSOC) && !param->redirected))
|
if (param->operation == ADMIN || (( param->operation == DNSRESOLVE || param->operation == BIND || param->operation == UDPASSOC) && !param->redirected))
|
||||||
return 0;
|
return 0;
|
||||||
|
if (param->operation == UDPASSOC && param->ctrlsocksrv != INVALID_SOCKET) return 0;
|
||||||
if (param->remsock != INVALID_SOCKET){
|
if (param->remsock != INVALID_SOCKET){
|
||||||
if(param->operation == UDPASSOC) return 0;
|
if(param->operation == UDPASSOC) return 0;
|
||||||
size = sizeof(param->sinsr);
|
size = sizeof(param->sinsr);
|
||||||
if(param->srv->so._getpeername(param->sostate, param->remsock, (struct sockaddr *)¶m->sinsr, &size)==-1) {return (14);}
|
if(param->srv->so._getpeername(param->sostate, param->remsock, (struct sockaddr *)¶m->sinsr, &size)==-1) {return (14);}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct linger lg = {1,conf.timeouts[SINGLEBYTE_S]};
|
#ifndef _WIN32
|
||||||
|
struct linger lg = {1,conf.timeouts[LINGER_TO]};
|
||||||
|
#endif
|
||||||
|
int tries = RANGETRIES;
|
||||||
|
|
||||||
if(SAISNULL(¶m->sinsr)){
|
if(SAISNULL(¶m->sinsr)){
|
||||||
if(SAISNULL(¶m->req)) {
|
if(SAISNULL(¶m->req)) {
|
||||||
@@ -610,6 +734,7 @@ int doconnect(struct clientparam * param){
|
|||||||
memcpy(SAADDR(¶m->sinsr), SAADDR(¶m->req), SAADDRLEN(¶m->req));
|
memcpy(SAADDR(¶m->sinsr), SAADDR(¶m->req), SAADDRLEN(¶m->req));
|
||||||
}
|
}
|
||||||
if(!*SAPORT(¶m->sinsr))*SAPORT(¶m->sinsr) = *SAPORT(¶m->req);
|
if(!*SAPORT(¶m->sinsr))*SAPORT(¶m->sinsr) = *SAPORT(¶m->req);
|
||||||
|
for(;;){
|
||||||
if ((param->remsock=param->srv->so._socket(param->sostate, SASOCK(¶m->sinsr), SOCK_STREAM,
|
if ((param->remsock=param->srv->so._socket(param->sostate, SASOCK(¶m->sinsr), SOCK_STREAM,
|
||||||
#ifdef WITH_UN
|
#ifdef WITH_UN
|
||||||
*SAFAMILY(¶m->sinsr) == AF_UNIX? 0 :
|
*SAFAMILY(¶m->sinsr) == AF_UNIX? 0 :
|
||||||
@@ -628,50 +753,34 @@ int doconnect(struct clientparam * param){
|
|||||||
param->sinsl = param->srv->extsa;
|
param->sinsl = param->srv->extsa;
|
||||||
}
|
}
|
||||||
*SAPORT(¶m->sinsl) = 0;
|
*SAPORT(¶m->sinsl) = 0;
|
||||||
setopts(param->remsock, param->srv->srvsockopts);
|
setopts(param->remsock, ¶m->srv->srvsockopts);
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
/* not on Windows, see the accepting side in proxymain.c */
|
||||||
param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
|
param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
|
||||||
#ifdef REUSE
|
|
||||||
{
|
|
||||||
int opt;
|
|
||||||
|
|
||||||
#ifdef SO_REUSEADDR
|
|
||||||
opt = 1;
|
|
||||||
param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(int));
|
|
||||||
#endif
|
|
||||||
#ifdef SO_REUSEPORT
|
|
||||||
opt = 1;
|
|
||||||
param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_REUSEPORT, (unsigned char *)&opt, sizeof(int));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if defined SO_BINDTODEVICE
|
|
||||||
if(param->srv->obindtodevice) {
|
|
||||||
if(param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_BINDTODEVICE, param->srv->obindtodevice, strlen(param->srv->obindtodevice) + 1))
|
|
||||||
return 12;
|
|
||||||
}
|
|
||||||
#elif defined IP_BOUND_IF
|
|
||||||
if(param->srv->obindtodevice) {
|
|
||||||
int idx;
|
|
||||||
idx = if_nametoindex(param->srv->obindtodevice);
|
|
||||||
if(!idx || (*SAFAMILY(¶m->sinsl) == AF_INET && param->srv->so._setsockopt(param->sostate, param->remsock, IPPROTO_IP, IP_BOUND_IF, &idx, sizeof(idx))))
|
|
||||||
return 12;
|
|
||||||
#ifndef NOIPV6
|
|
||||||
if(*SAFAMILY(¶m->sinsl) == AF_INET6 && param->srv->so._setsockopt(param->sostate, param->remsock, IPPROTO_IPV6, IPV6_BOUND_IF, &idx, sizeof(idx))) return 12;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
if(extbindtodevice(param, param->remsock)) return 12;
|
||||||
#ifdef WITH_UN
|
#ifdef WITH_UN
|
||||||
if(*SAFAMILY(¶m->sinsl) != AF_UNIX)
|
if(*SAFAMILY(¶m->sinsl) != AF_UNIX)
|
||||||
#endif
|
#endif
|
||||||
if(param->srv->so._bind(param->sostate, param->remsock, (struct sockaddr*)¶m->sinsl, SASIZE(¶m->sinsl))==-1) {
|
if(bindrange(param, param->remsock, ¶m->sinsl, param->extport, &tries)==-1) {
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param->operation >= 256 || (param->operation & CONNECT) || param->redirected){
|
if(!(param->operation >= 256 || (param->operation & CONNECT) || param->redirected)) break;
|
||||||
if(connectwithpoll(param, param->remsock,(struct sockaddr *)¶m->sinsr,SASIZE(¶m->sinsr),conf.timeouts[CONNECT_TO])) {
|
if(!connectwithpoll(param, param->remsock,(struct sockaddr *)¶m->sinsr,SASIZE(¶m->sinsr),conf.timeouts[CONNECT_TO])) break;
|
||||||
return 13;
|
/* The port was free to bind, but the pair it makes with the destination
|
||||||
}
|
is still closing from an earlier connection through the same range,
|
||||||
|
which Windows refuses. Another port out of the range may do. Anything
|
||||||
|
else is the destination's own answer, and is not worth a second port.
|
||||||
|
The ports come out of the allowance the bind is already spending, so
|
||||||
|
the range is not searched any harder than one bind would search it and
|
||||||
|
the attempts parentretries makes are not multiplied. Counted here as
|
||||||
|
well, since the kernel option hands out a port without spending any of
|
||||||
|
the allowance. */
|
||||||
|
if(!param->extport || errno != EADDRINUSE || --tries <= 0) return 13;
|
||||||
|
param->srv->so._closesocket(param->sostate, param->remsock);
|
||||||
|
param->remsock = INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
size = sizeof(param->sinsl);
|
size = sizeof(param->sinsl);
|
||||||
if(param->srv->so._getsockname(param->sostate, param->remsock, (struct sockaddr *)¶m->sinsl, &size)==-1) {return (15);}
|
if(param->srv->so._getsockname(param->sostate, param->remsock, (struct sockaddr *)¶m->sinsl, &size)==-1) {return (15);}
|
||||||
@@ -685,6 +794,57 @@ int doconnect(struct clientparam * param){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Bind sock to sa, taking the local port from the range if one is set. The
|
||||||
|
* range is packed as first | last << 16.
|
||||||
|
*
|
||||||
|
* IP_LOCAL_PORT_RANGE leaves the choice to the kernel, which knows which ports
|
||||||
|
* are free. Where the option does not exist, or the kernel refuses it, or the
|
||||||
|
* address family is not one it covers, pick a port at random instead and retry
|
||||||
|
* on failure, since the one picked may already be taken.
|
||||||
|
*
|
||||||
|
* *tries is how many ports may still be taken out of the range. A caller which
|
||||||
|
* has to come back for another port, because the one it was given turned out
|
||||||
|
* to be unusable for the connection it wanted, carries the same count along
|
||||||
|
* and so cannot spend more attempts than one call would.
|
||||||
|
*/
|
||||||
|
static int bindrange(struct clientparam *param, SOCKET sock, PROXYSOCKADDRTYPE *sa, uint32_t range, int *tries)
|
||||||
|
{
|
||||||
|
uint16_t first, last;
|
||||||
|
|
||||||
|
if(!range) return param->srv->so._bind(param->sostate, sock, (struct sockaddr *)sa, SASIZE(sa));
|
||||||
|
|
||||||
|
#ifdef IP_LOCAL_PORT_RANGE
|
||||||
|
if(*SAFAMILY(sa) == AF_INET &&
|
||||||
|
!param->srv->so._setsockopt(param->sostate, sock, IPPROTO_IP, IP_LOCAL_PORT_RANGE,
|
||||||
|
(char *)&range, sizeof(range))){
|
||||||
|
*SAPORT(sa) = 0;
|
||||||
|
return param->srv->so._bind(param->sostate, sock, (struct sockaddr *)sa, SASIZE(sa));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
first = (uint16_t)(range & 0xffff);
|
||||||
|
last = (uint16_t)(range >> 16);
|
||||||
|
|
||||||
|
while(*tries > 0){
|
||||||
|
(*tries)--;
|
||||||
|
*SAPORT(sa) = htons((uint16_t)(first + (myrand() % (unsigned)(last - first + 1))));
|
||||||
|
if(!param->srv->so._bind(param->sostate, sock, (struct sockaddr *)sa, SASIZE(sa))) return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Every port tried was taken. Fall back to an ephemeral one, which is
|
||||||
|
what the kernel option above does when it cannot honour the range, so
|
||||||
|
an exhausted range behaves the same way on every platform. */
|
||||||
|
*SAPORT(sa) = 0;
|
||||||
|
return param->srv->so._bind(param->sostate, sock, (struct sockaddr *)sa, SASIZE(sa));
|
||||||
|
}
|
||||||
|
|
||||||
|
int bindwithrange(struct clientparam *param, SOCKET sock, PROXYSOCKADDRTYPE *sa, uint32_t range)
|
||||||
|
{
|
||||||
|
int tries = RANGETRIES;
|
||||||
|
|
||||||
|
return bindrange(param, sock, sa, range, &tries);
|
||||||
|
}
|
||||||
|
|
||||||
int scanaddr(const unsigned char *s, uint32_t * ip, uint32_t * mask) {
|
int scanaddr(const unsigned char *s, uint32_t * ip, uint32_t * mask) {
|
||||||
unsigned d1, d2, d3, d4, m;
|
unsigned d1, d2, d3, d4, m;
|
||||||
int res;
|
int res;
|
||||||
@@ -867,3 +1027,21 @@ uint32_t getip46(int family, unsigned char *name, struct sockaddr *sa){
|
|||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int hascap(const unsigned char *line, const char *cap){
|
||||||
|
int len = (int)strlen(cap);
|
||||||
|
for(; *line; line++) if(!strncasecmp((char *)line, cap, len)) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getmultiline(struct clientparam *param, DIRECTION which, unsigned char *buf, int bufsize, const char *cap, int *found){
|
||||||
|
int i;
|
||||||
|
do {
|
||||||
|
i = sockgetlinebuf(param, which, buf, bufsize, '\n', conf.timeouts[STRING_L]);
|
||||||
|
if(i > 0 && cap && found && !*found){
|
||||||
|
buf[i] = 0;
|
||||||
|
if(hascap(buf, cap)) *found = 1;
|
||||||
|
}
|
||||||
|
} while (i > 3 && buf[3] == '-');
|
||||||
|
return i;
|
||||||
|
}
|
||||||
+652
-148
File diff suppressed because it is too large.
Load diff
+3
-12
@@ -61,13 +61,6 @@ static void pr_ip(struct node *node, CBFUNC cbf, void*cb){
|
|||||||
if(node->value)(*cbf)(cb, buf, myinet_ntop(AF_INET, node -> value, buf, 4));
|
if(node->value)(*cbf)(cb, buf, myinet_ntop(AF_INET, node -> value, buf, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NOIPV6
|
|
||||||
static void pr_ip6(struct node *node, CBFUNC cbf, void*cb){
|
|
||||||
char buf[64];
|
|
||||||
if(node->value)(*cbf)(cb, buf, myinet_ntop(AF_INET6, node -> value, buf, 16));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void pr_sa(struct node *node, CBFUNC cbf, void*cb){
|
static void pr_sa(struct node *node, CBFUNC cbf, void*cb){
|
||||||
#ifdef NOIPV6
|
#ifdef NOIPV6
|
||||||
if(node->value)pr_ip(node, cbf, cb);
|
if(node->value)pr_ip(node, cbf, cb);
|
||||||
@@ -398,8 +391,6 @@ static void * ef_ace_next(struct node * node){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char * aceaction (int action);
|
|
||||||
|
|
||||||
static void * ef_ace_type(struct node * node){
|
static void * ef_ace_type(struct node * node){
|
||||||
return aceaction(((struct ace *)node->value) -> action);
|
return aceaction(((struct ace *)node->value) -> action);
|
||||||
}
|
}
|
||||||
@@ -523,7 +514,7 @@ static void * ef_server_next(struct node * node){
|
|||||||
|
|
||||||
static void * ef_server_type(struct node * node){
|
static void * ef_server_type(struct node * node){
|
||||||
int service = ((struct srvparam *)node->value) -> service;
|
int service = ((struct srvparam *)node->value) -> service;
|
||||||
return (service>=0 && service < 15)? (void *)conf.stringtable[SERVICES + service] : (void *)"unknown";
|
return (service>=0 && service < MAX_SERVICE)? (void *)conf.stringtable[SERVICES + service] : (void *)"unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * ef_server_child(struct node * node){
|
static void * ef_server_child(struct node * node){
|
||||||
@@ -682,7 +673,7 @@ static void * ef_client_next(struct node * node){
|
|||||||
|
|
||||||
static void * ef_client_type(struct node * node){
|
static void * ef_client_type(struct node * node){
|
||||||
int service = ((struct clientparam *)node->value) -> service;
|
int service = ((struct clientparam *)node->value) -> service;
|
||||||
return (service>=0 && service < 15)? (void *)conf.stringtable[SERVICES + service] : (void *)"unknown";
|
return (service>=0 && service < MAX_SERVICE)? (void *)conf.stringtable[SERVICES + service] : (void *)"unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * ef_client_operation(struct node * node){
|
static void * ef_client_operation(struct node * node){
|
||||||
@@ -811,7 +802,7 @@ static struct property prop_pwlist[] = {
|
|||||||
static struct property prop_chain[] = {
|
static struct property prop_chain[] = {
|
||||||
{"addr", ef_chain_addr, TYPE_SA, "parent address"},
|
{"addr", ef_chain_addr, TYPE_SA, "parent address"},
|
||||||
{"type", ef_chain_type, TYPE_STRING, "parent type"},
|
{"type", ef_chain_type, TYPE_STRING, "parent type"},
|
||||||
{"weight", ef_chain_weight, TYPE_SHORT, "parent weight 0-1000"},
|
{"weight", ef_chain_weight, TYPE_INTEGER, "parent weight, 1000000000 is the whole share, 0 is a fallback"},
|
||||||
{"user", ef_chain_user, TYPE_STRING, "parent login"},
|
{"user", ef_chain_user, TYPE_STRING, "parent login"},
|
||||||
{"password", ef_chain_password, TYPE_PASSWORD, "parent password"},
|
{"password", ef_chain_password, TYPE_PASSWORD, "parent password"},
|
||||||
{"secure", ef_chain_secure, TYPE_INTEGER, "secure mode"},
|
{"secure", ef_chain_secure, TYPE_INTEGER, "secure mode"},
|
||||||
|
|||||||
+64
-12
@@ -15,6 +15,12 @@
|
|||||||
|
|
||||||
#define BUFSIZE 16384
|
#define BUFSIZE 16384
|
||||||
|
|
||||||
|
/* An answer to the query asked: our id, a response, and the question
|
||||||
|
byte for byte. */
|
||||||
|
static int dnsanswer(const unsigned char *buf, int len, const unsigned char *q, int qend){
|
||||||
|
return len >= qend && buf[0] == q[0] && buf[1] == q[1] && (buf[2] & 0x80) &&
|
||||||
|
buf[4] == q[4] && buf[5] == q[5] && !memcmp(buf + 12, q + 12, qend - 12);
|
||||||
|
}
|
||||||
|
|
||||||
void * dnsprchild(struct clientparam* param) {
|
void * dnsprchild(struct clientparam* param) {
|
||||||
uint32_t ip = 0;
|
uint32_t ip = 0;
|
||||||
@@ -25,6 +31,7 @@ void * dnsprchild(struct clientparam* param) {
|
|||||||
SASIZETYPE size;
|
SASIZETYPE size;
|
||||||
int res, i;
|
int res, i;
|
||||||
int len;
|
int len;
|
||||||
|
int semlocked = 1;
|
||||||
unsigned type=0;
|
unsigned type=0;
|
||||||
uint32_t ttl;
|
uint32_t ttl;
|
||||||
unsigned char addr[16];
|
unsigned char addr[16];
|
||||||
@@ -34,15 +41,17 @@ void * dnsprchild(struct clientparam* param) {
|
|||||||
|
|
||||||
|
|
||||||
if(!(bbuf = malloc(BUFSIZE+2))){
|
if(!(bbuf = malloc(BUFSIZE+2))){
|
||||||
param->srv->fds.events = POLLIN;
|
|
||||||
RETURN (21);
|
RETURN (21);
|
||||||
}
|
}
|
||||||
buf = bbuf+2;
|
buf = bbuf+2;
|
||||||
size = sizeof(param->sincr);
|
|
||||||
i = param->srv->so._recvfrom(param->sostate, param->srv->srvsock, (char *)buf, BUFSIZE, 0, (struct sockaddr *)¶m->sincr, &size);
|
|
||||||
size = sizeof(param->sinsl);
|
size = sizeof(param->sinsl);
|
||||||
getsockname(param->srv->srvsock, (struct sockaddr *)¶m->sincl, &size);
|
getsockname(param->srv->srvsock, (struct sockaddr *)¶m->sincl, &size);
|
||||||
#ifdef _WIN32
|
i = param->srv->udplen;
|
||||||
|
if(i > BUFSIZE) i = BUFSIZE;
|
||||||
|
memcpy(buf, param->srv->udpbuf, i);
|
||||||
|
_3proxy_sem_unlock(udpinit);
|
||||||
|
semlocked = 0;
|
||||||
|
#if defined(_WIN32) && !defined(SHARE_UDP_SOCKET)
|
||||||
if((param->clisock=param->srv->so._socket(param->sostate, AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET) {
|
if((param->clisock=param->srv->so._socket(param->sostate, AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == INVALID_SOCKET) {
|
||||||
RETURN(818);
|
RETURN(818);
|
||||||
}
|
}
|
||||||
@@ -53,9 +62,10 @@ void * dnsprchild(struct clientparam* param) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
/* The reply has to come from the address the query was sent to, which
|
||||||
|
is the listening socket. */
|
||||||
param->clisock = param->srv->srvsock;
|
param->clisock = param->srv->srvsock;
|
||||||
#endif
|
#endif
|
||||||
param->srv->fds.events = POLLIN;
|
|
||||||
|
|
||||||
if(i < 0) {
|
if(i < 0) {
|
||||||
RETURN(813);
|
RETURN(813);
|
||||||
@@ -82,7 +92,19 @@ void * dnsprchild(struct clientparam* param) {
|
|||||||
*s2 = (len - (int)(s2 - buf)) - 1;
|
*s2 = (len - (int)(s2 - buf)) - 1;
|
||||||
|
|
||||||
type = ((unsigned)buf[len+1])*256 + (unsigned)buf[len+2];
|
type = ((unsigned)buf[len+1])*256 + (unsigned)buf[len+2];
|
||||||
if((type==0x01 || type==0x1c) && !param->srv->s_option){
|
if(type==0x01 && param->srv->fakeip){
|
||||||
|
ip = 1;
|
||||||
|
ttl = 3600;
|
||||||
|
*(uint32_t *)addr = param->srv->fakeip;
|
||||||
|
}
|
||||||
|
#ifndef NOIPV6
|
||||||
|
else if(type==0x1c && *(uint32_t *)param->srv->fakeip6){
|
||||||
|
ip = 1;
|
||||||
|
ttl = 3600;
|
||||||
|
memcpy(addr, param->srv->fakeip6, 16);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else if((type==0x01 || type==0x1c) && !param->srv->s_option){
|
||||||
ip = udpresolve((type==0x1c)?AF_INET6:AF_INET, (unsigned char *)host, addr, &ttl, param, 0);
|
ip = udpresolve((type==0x1c)?AF_INET6:AF_INET, (unsigned char *)host, addr, &ttl, param, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,8 +128,8 @@ void * dnsprchild(struct clientparam* param) {
|
|||||||
len+=(type==1?16:28);
|
len+=(type==1?16:28);
|
||||||
}
|
}
|
||||||
else if(type == 0x0c) {
|
else if(type == 0x0c) {
|
||||||
unsigned a, b, c, d;
|
unsigned a = 0, b = 0, c = 0, d = 0;
|
||||||
sscanf(host, "%u.%u.%u.%u", &a, &b, &c, &d);
|
if(sscanf(host, "%u.%u.%u.%u", &a, &b, &c, &d) != 4) a = b = c = d = 0;
|
||||||
ip = htonl((d<<24) ^ (c<<16) ^ (b<<8) ^ a);
|
ip = htonl((d<<24) ^ (c<<16) ^ (b<<8) ^ a);
|
||||||
if(*SAFAMILY(¶m->sincl) == AF_INET && ip == *(uint32_t *)SAADDR(¶m->sincl)){
|
if(*SAFAMILY(¶m->sincl) == AF_INET && ip == *(uint32_t *)SAADDR(¶m->sincl)){
|
||||||
buf[2] = 0x85;
|
buf[2] = 0x85;
|
||||||
@@ -130,12 +152,26 @@ void * dnsprchild(struct clientparam* param) {
|
|||||||
else ip = 0;
|
else ip = 0;
|
||||||
}
|
}
|
||||||
if(!ip && numservers){
|
if(!ip && numservers){
|
||||||
|
/* the question, to check the answer against; the name server is
|
||||||
|
asked under an id of our own, the client's put back in its answer */
|
||||||
|
unsigned char question[1024], cid[2];
|
||||||
|
int qend = (len < i)? len : i;
|
||||||
|
unsigned short id = (unsigned short)myrand();
|
||||||
|
PROXYSOCKADDRTYPE from;
|
||||||
|
time_t deadline;
|
||||||
|
int to;
|
||||||
|
|
||||||
|
cid[0] = buf[0];
|
||||||
|
cid[1] = buf[1];
|
||||||
|
buf[0] = (unsigned char)(id >> 8);
|
||||||
|
buf[1] = (unsigned char)(id & 0xff);
|
||||||
|
memcpy(question, buf, qend);
|
||||||
if((param->remsock=param->srv->so._socket(param->sostate, SASOCK(&nservers[0].addr), nservers[0].usetcp? SOCK_STREAM:SOCK_DGRAM, nservers[0].usetcp?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {
|
if((param->remsock=param->srv->so._socket(param->sostate, SASOCK(&nservers[0].addr), nservers[0].usetcp? SOCK_STREAM:SOCK_DGRAM, nservers[0].usetcp?IPPROTO_TCP:IPPROTO_UDP)) == INVALID_SOCKET) {
|
||||||
RETURN(818);
|
RETURN(818);
|
||||||
}
|
}
|
||||||
memset(¶m->sinsl, 0, sizeof(param->sinsl));
|
memset(¶m->sinsl, 0, sizeof(param->sinsl));
|
||||||
*SAFAMILY(¶m->sinsl) = *SAFAMILY(&nservers[0].addr);
|
*SAFAMILY(¶m->sinsl) = *SAFAMILY(&nservers[0].addr);
|
||||||
if(param->srv->so._bind(param->sostate, param->remsock,(struct sockaddr *)¶m->sinsl,SASIZE(¶m->sinsl))) {
|
if(bindwithrange(param, param->remsock, ¶m->sinsl, param->extport)) {
|
||||||
RETURN(819);
|
RETURN(819);
|
||||||
}
|
}
|
||||||
param->sinsr = nservers[0].addr;
|
param->sinsr = nservers[0].addr;
|
||||||
@@ -158,10 +194,22 @@ void * dnsprchild(struct clientparam* param) {
|
|||||||
}
|
}
|
||||||
param->statscli64 += i;
|
param->statscli64 += i;
|
||||||
param->nwrites++;
|
param->nwrites++;
|
||||||
len = sockrecvfrom(param, param->remsock, (struct sockaddr *)¶m->sinsr, buf, BUFSIZE, conf.timeouts[DNS_TO]*1000);
|
/* over UDP only an answer from the name server asked is taken, any
|
||||||
|
other read past while the time for it lasts */
|
||||||
|
deadline = time(NULL) + conf.timeouts[DNS_TO];
|
||||||
|
for(;;){
|
||||||
|
to = (int)(deadline - time(NULL));
|
||||||
|
if(to <= 0) RETURN(821);
|
||||||
|
len = sockrecvfrom(param, param->remsock, (struct sockaddr *)&from, buf, BUFSIZE, to*1000);
|
||||||
if(len <= 13) {
|
if(len <= 13) {
|
||||||
RETURN(821);
|
RETURN(821);
|
||||||
}
|
}
|
||||||
|
if(nservers[0].usetcp) break;
|
||||||
|
if(*SAFAMILY(&from) == *SAFAMILY(¶m->sinsr) &&
|
||||||
|
!memcmp(SAADDR(&from), SAADDR(¶m->sinsr), SAADDRLEN(¶m->sinsr)) &&
|
||||||
|
*SAPORT(&from) == *SAPORT(¶m->sinsr) &&
|
||||||
|
dnsanswer(buf, len, question, qend)) break;
|
||||||
|
}
|
||||||
param->statssrv64 += len;
|
param->statssrv64 += len;
|
||||||
param->nreads++;
|
param->nreads++;
|
||||||
if(nservers[0].usetcp) {
|
if(nservers[0].usetcp) {
|
||||||
@@ -172,7 +220,10 @@ void * dnsprchild(struct clientparam* param) {
|
|||||||
len -= 2;
|
len -= 2;
|
||||||
if(len < us) len += sockgetlinebuf(param, SERVER, buf+len, us - len, 0, conf.timeouts[SINGLEBYTE_L]);
|
if(len < us) len += sockgetlinebuf(param, SERVER, buf+len, us - len, 0, conf.timeouts[SINGLEBYTE_L]);
|
||||||
if(len != us) RETURN(832);
|
if(len != us) RETURN(832);
|
||||||
|
if(!dnsanswer(buf, len, question, qend)) RETURN(834);
|
||||||
}
|
}
|
||||||
|
buf[0] = cid[0];
|
||||||
|
buf[1] = cid[1];
|
||||||
if(buf[6] || buf[7]){
|
if(buf[6] || buf[7]){
|
||||||
if(socksendto(param, param->clisock, (struct sockaddr *)¶m->sincr, buf, len, conf.timeouts[SINGLEBYTE_L]*1000) != len){
|
if(socksendto(param, param->clisock, (struct sockaddr *)¶m->sincr, buf, len, conf.timeouts[SINGLEBYTE_L]*1000) != len){
|
||||||
RETURN(822);
|
RETURN(822);
|
||||||
@@ -191,6 +242,7 @@ void * dnsprchild(struct clientparam* param) {
|
|||||||
|
|
||||||
CLEANRET:
|
CLEANRET:
|
||||||
|
|
||||||
|
if(semlocked) _3proxy_sem_unlock(udpinit);
|
||||||
if(param->res!=813){
|
if(param->res!=813){
|
||||||
sprintf((char *)buf, "%04x/%s/",
|
sprintf((char *)buf, "%04x/%s/",
|
||||||
(unsigned)type,
|
(unsigned)type,
|
||||||
@@ -202,10 +254,10 @@ CLEANRET:
|
|||||||
}
|
}
|
||||||
if(bbuf)free(bbuf);
|
if(bbuf)free(bbuf);
|
||||||
if(host)free(host);
|
if(host)free(host);
|
||||||
#ifndef _WIN32
|
#if !defined(_WIN32) || defined(SHARE_UDP_SOCKET)
|
||||||
|
/* The socket belongs to the service, so the caller must not close it. */
|
||||||
param->clisock = INVALID_SOCKET;
|
param->clisock = INVALID_SOCKET;
|
||||||
#endif
|
#endif
|
||||||
freeparam(param);
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
|
|
||||||
|
#ifdef WITH_FTP
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read one FTP server response, skipping continuation lines (lines whose
|
* Read one FTP server response, skipping continuation lines (lines whose
|
||||||
* 4th character is '-' per RFC 959). Returns the line length on success,
|
* 4th character is '-' per RFC 959). Returns the line length on success,
|
||||||
@@ -249,3 +251,5 @@ SOCKET ftpcommand(struct clientparam *param, unsigned char * command, unsigned c
|
|||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
+32
-3
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
|
|
||||||
|
#ifdef WITH_FTP
|
||||||
|
|
||||||
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
|
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
|
||||||
#define BUFSIZE 2048
|
#define BUFSIZE 2048
|
||||||
|
|
||||||
@@ -21,14 +23,18 @@ void * ftpprchild(struct clientparam* param) {
|
|||||||
SOCKET sc = INVALID_SOCKET, ss = INVALID_SOCKET, clidatasock = INVALID_SOCKET;
|
SOCKET sc = INVALID_SOCKET, ss = INVALID_SOCKET, clidatasock = INVALID_SOCKET;
|
||||||
SASIZETYPE sasize;
|
SASIZETYPE sasize;
|
||||||
char * req = NULL;
|
char * req = NULL;
|
||||||
|
#ifndef _WIN32
|
||||||
struct linger lg;
|
struct linger lg;
|
||||||
|
#endif
|
||||||
struct pollfd fds;
|
struct pollfd fds;
|
||||||
|
|
||||||
if(!(buf = malloc(BUFSIZE))) RETURN(876);
|
if(!(buf = malloc(BUFSIZE))) RETURN(876);
|
||||||
param->ctrlsock = param->clisock;
|
param->ctrlsock = param->clisock;
|
||||||
param->operation = CONNECT;
|
param->operation = CONNECT;
|
||||||
|
#ifndef _WIN32
|
||||||
lg.l_onoff = 1;
|
lg.l_onoff = 1;
|
||||||
lg.l_linger = conf.timeouts[STRING_L];;
|
lg.l_linger = conf.timeouts[STRING_L];
|
||||||
|
#endif
|
||||||
if(socksend(param, param->ctrlsock, (unsigned char *)"220 Ready\r\n", 11, conf.timeouts[STRING_S])!=11) {RETURN (801);}
|
if(socksend(param, param->ctrlsock, (unsigned char *)"220 Ready\r\n", 11, conf.timeouts[STRING_S])!=11) {RETURN (801);}
|
||||||
for(;;){
|
for(;;){
|
||||||
i = sockgetlinebuf(param, CLIENT, buf, BUFSIZE - 10, '\n', conf.timeouts[CONNECTION_S]);
|
i = sockgetlinebuf(param, CLIENT, buf, BUFSIZE - 10, '\n', conf.timeouts[CONNECTION_S]);
|
||||||
@@ -64,6 +70,13 @@ void * ftpprchild(struct clientparam* param) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (!strncasecmp((char *)buf, "PASS ", 5)){
|
else if (!strncasecmp((char *)buf, "PASS ", 5)){
|
||||||
|
/* The user name carries the server to log in to, and it arrives
|
||||||
|
with USER. Without it there is nothing to log in to, and what
|
||||||
|
follows would read the name and the host as if there were. */
|
||||||
|
if(!param->hostname || !param->extusername){
|
||||||
|
socksend(param, param->ctrlsock, (unsigned char *)"503 Login with USER first\r\n", 27, conf.timeouts[STRING_S]);
|
||||||
|
RETURN(805);
|
||||||
|
}
|
||||||
param->extpassword = (unsigned char *)strdup((char *)buf+5);
|
param->extpassword = (unsigned char *)strdup((char *)buf+5);
|
||||||
inbuf = BUFSIZE;
|
inbuf = BUFSIZE;
|
||||||
res = ftplogin(param, (char *)buf, &inbuf);
|
res = ftplogin(param, (char *)buf, &inbuf);
|
||||||
@@ -120,8 +133,9 @@ void * ftpprchild(struct clientparam* param) {
|
|||||||
clidatasock = INVALID_SOCKET;
|
clidatasock = INVALID_SOCKET;
|
||||||
}
|
}
|
||||||
if ((clidatasock=socket(SASOCK(¶m->sincl), SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {RETURN(821);}
|
if ((clidatasock=socket(SASOCK(¶m->sincl), SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {RETURN(821);}
|
||||||
|
if(intbindtodevice(param, clidatasock)){RETURN(822);}
|
||||||
*SAPORT(¶m->sincl) = 0;
|
*SAPORT(¶m->sincl) = 0;
|
||||||
if(param->srv->so._bind(param->sostate, clidatasock, (struct sockaddr *)¶m->sincl, SASIZE(¶m->sincl))){RETURN(822);}
|
if(bindwithrange(param, clidatasock, ¶m->sincl, param->intport)){RETURN(822);}
|
||||||
if (pasv) {
|
if (pasv) {
|
||||||
if(param->srv->so._listen(param->sostate, clidatasock, 1)) {RETURN(823);}
|
if(param->srv->so._listen(param->sostate, clidatasock, 1)) {RETURN(823);}
|
||||||
sasize = sizeof(param->sincl);
|
sasize = sizeof(param->sincl);
|
||||||
@@ -252,8 +266,11 @@ void * ftpprchild(struct clientparam* param) {
|
|||||||
}
|
}
|
||||||
sc = param->remsock;
|
sc = param->remsock;
|
||||||
param->remsock = ss;
|
param->remsock = ss;
|
||||||
|
#ifndef _WIN32
|
||||||
|
/* not on Windows, see the accepting side in proxymain.c */
|
||||||
param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
|
param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
|
||||||
param->srv->so._setsockopt(param->sostate, clidatasock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
|
param->srv->so._setsockopt(param->sostate, clidatasock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
|
||||||
|
#endif
|
||||||
param->clisock = clidatasock;
|
param->clisock = clidatasock;
|
||||||
res = mapsocket(param, conf.timeouts[CONNECTION_S]);
|
res = mapsocket(param, conf.timeouts[CONNECTION_S]);
|
||||||
if(param->remsock != INVALID_SOCKET) {
|
if(param->remsock != INVALID_SOCKET) {
|
||||||
@@ -325,7 +342,6 @@ CLEANRET:
|
|||||||
}
|
}
|
||||||
if(req) free(req);
|
if(req) free(req);
|
||||||
if(buf) free(buf);
|
if(buf) free(buf);
|
||||||
freeparam(param);
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,3 +355,16 @@ struct proxydef childdef = {
|
|||||||
};
|
};
|
||||||
#include "proxymain.c"
|
#include "proxymain.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Built without FTP support. The service and the redirect naming it are
|
||||||
|
still known, so a configuration carrying them is read rather than
|
||||||
|
refused, and a client reaching one is turned away. */
|
||||||
|
void * ftpprchild(struct clientparam * param){
|
||||||
|
param->res = 878;
|
||||||
|
dolog(param, (unsigned char *)"ftp support is not built in");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
+7
-9
@@ -36,7 +36,6 @@ void destroyhashtable(struct hashtable *ht){
|
|||||||
|
|
||||||
int inithashtable(struct hashtable *ht, unsigned tablesize, unsigned poolsize, unsigned growlimit){
|
int inithashtable(struct hashtable *ht, unsigned tablesize, unsigned poolsize, unsigned growlimit){
|
||||||
unsigned i;
|
unsigned i;
|
||||||
clock_t c;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
struct timeb tb;
|
struct timeb tb;
|
||||||
@@ -48,7 +47,6 @@ int inithashtable(struct hashtable *ht, unsigned tablesize, unsigned poolsize, u
|
|||||||
struct timezone tz;
|
struct timezone tz;
|
||||||
gettimeofday(&tb, &tz);
|
gettimeofday(&tb, &tz);
|
||||||
#endif
|
#endif
|
||||||
c = clock();
|
|
||||||
|
|
||||||
if(tablesize < 2 || poolsize < tablesize || growlimit < poolsize) return 1;
|
if(tablesize < 2 || poolsize < tablesize || growlimit < poolsize) return 1;
|
||||||
if(ht->ihashtable){
|
if(ht->ihashtable){
|
||||||
@@ -72,9 +70,9 @@ int inithashtable(struct hashtable *ht, unsigned tablesize, unsigned poolsize, u
|
|||||||
_3proxy_mutex_init(&ht->hash_mutex);
|
_3proxy_mutex_init(&ht->hash_mutex);
|
||||||
_3proxy_mutex_lock(&ht->hash_mutex);
|
_3proxy_mutex_lock(&ht->hash_mutex);
|
||||||
}
|
}
|
||||||
if(!(ht->ihashtable = malloc(tablesize * sizeof(uint32_t)))
|
if(!(ht->ihashtable = malloc((size_t)tablesize * sizeof(uint32_t)))
|
||||||
|| !(ht->hashvalues = malloc(poolsize * (sizeof(struct hashentry) + ht->recsize - 4)))
|
|| !(ht->hashvalues = malloc((size_t)poolsize * (sizeof(struct hashentry) + ht->recsize - 4)))
|
||||||
|| !(ht->hashhashvalues = malloc(poolsize * ht->hash_size))
|
|| !(ht->hashhashvalues = malloc((size_t)poolsize * ht->hash_size))
|
||||||
){
|
){
|
||||||
free(ht->ihashtable);
|
free(ht->ihashtable);
|
||||||
ht->ihashtable = NULL;
|
ht->ihashtable = NULL;
|
||||||
@@ -128,13 +126,13 @@ static void hashgrow(struct hashtable *ht){
|
|||||||
if(ht->ihashempty) return;
|
if(ht->ihashempty) return;
|
||||||
if(ht->poolsize >= ht->growlimit) return;
|
if(ht->poolsize >= ht->growlimit) return;
|
||||||
if(newsize > ht->growlimit) newsize = ht->growlimit;
|
if(newsize > ht->growlimit) newsize = ht->growlimit;
|
||||||
newvalues = realloc(ht->hashvalues, newsize * (sizeof(struct hashentry) + ht->recsize - 4));
|
newvalues = realloc(ht->hashvalues, (size_t)newsize * (sizeof(struct hashentry) + ht->recsize - 4));
|
||||||
if(!newvalues) return;
|
if(!newvalues) return;
|
||||||
ht->hashvalues = newvalues;
|
ht->hashvalues = newvalues;
|
||||||
newvalues = realloc(ht->hashhashvalues, newsize * ht->hash_size);
|
newvalues = realloc(ht->hashhashvalues, (size_t)newsize * ht->hash_size);
|
||||||
if(!newvalues) return;
|
if(!newvalues) return;
|
||||||
ht->hashhashvalues = newvalues;
|
ht->hashhashvalues = newvalues;
|
||||||
memset(ht->hashvalues + (ht->poolsize * (sizeof(struct hashentry) + ht->recsize - 4)), 0, (newsize - ht->poolsize) * (sizeof(struct hashentry) + ht->recsize - 4));
|
memset(ht->hashvalues + ((size_t)ht->poolsize * (sizeof(struct hashentry) + ht->recsize - 4)), 0, (size_t)(newsize - ht->poolsize) * (sizeof(struct hashentry) + ht->recsize - 4));
|
||||||
for(i = ht->poolsize + 1; i < newsize; i++) {
|
for(i = ht->poolsize + 1; i < newsize; i++) {
|
||||||
hvalue(ht,i)->inext = i+1;
|
hvalue(ht,i)->inext = i+1;
|
||||||
}
|
}
|
||||||
@@ -169,7 +167,6 @@ static void hashgrow(struct hashtable *ht){
|
|||||||
void hashadd(struct hashtable *ht, void* name, void* value, time_t expires){
|
void hashadd(struct hashtable *ht, void* name, void* value, time_t expires){
|
||||||
uint32_t hen, he;
|
uint32_t hen, he;
|
||||||
uint32_t *hep;
|
uint32_t *hep;
|
||||||
int overwrite = 0;
|
|
||||||
uint8_t hash[MAX_HASH_SIZE];
|
uint8_t hash[MAX_HASH_SIZE];
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
uint32_t last = 0;
|
uint32_t last = 0;
|
||||||
@@ -197,6 +194,7 @@ void hashadd(struct hashtable *ht, void* name, void* value, time_t expires){
|
|||||||
|
|
||||||
if(!ht->ihashempty){
|
if(!ht->ihashempty){
|
||||||
hashgrow(ht);
|
hashgrow(ht);
|
||||||
|
index = hashindex(ht, ht->tablesize, hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ht->ihashempty){
|
if(ht->ihashempty){
|
||||||
|
|||||||
+24
-30
@@ -1,18 +1,21 @@
|
|||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
#include "libs/blake2.h"
|
#include "mdhash.h"
|
||||||
|
|
||||||
|
|
||||||
static void char_index2hash(const struct hashtable *ht, void *index, uint8_t *hash){
|
static void char_index2hash(const struct hashtable *ht, void *index, uint8_t *hash){
|
||||||
blake2b_state S;
|
|
||||||
int len;
|
int len;
|
||||||
|
unsigned int blen;
|
||||||
|
|
||||||
len = strlen((const char*)index);
|
len = strlen((const char*)index);
|
||||||
memset(hash, 0, ht->hash_size);
|
memset(hash, 0, ht->hash_size);
|
||||||
if(len <= ht->hash_size) memcpy(hash, index, len);
|
if(len <= ht->hash_size) memcpy(hash, index, len);
|
||||||
else {
|
else {
|
||||||
blake2b_init(&S, ht->hash_size);
|
mdh_ctx *bctx = mdh_init(MDH_BLAKE2, ht->hash_size);
|
||||||
blake2b_update(&S, index, strlen((const char*)index) + 1);
|
if(!bctx) return;
|
||||||
blake2b_final(&S, hash, ht->hash_size);
|
mdh_update(bctx, index, (unsigned int)(strlen((const char*)index) + 1));
|
||||||
|
blen = ht->hash_size;
|
||||||
|
mdh_final(bctx, hash, &blen);
|
||||||
|
mdh_free(bctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,10 +26,9 @@ static void param2hash_add(const struct hashtable *ht, void *index, uint8_t *has
|
|||||||
}
|
}
|
||||||
|
|
||||||
void param2hash_search(const struct hashtable *ht, void *index, uint8_t *hash){
|
void param2hash_search(const struct hashtable *ht, void *index, uint8_t *hash){
|
||||||
blake2b_state S;
|
|
||||||
struct clientparam *param = (struct clientparam *)index;
|
struct clientparam *param = (struct clientparam *)index;
|
||||||
unsigned type = param->srv->authcachetype;
|
unsigned type = param->srv->authcachetype;
|
||||||
int len = 0, oplen = 0, acllen = 0, ulen = 0, plen = 0, hlen = 0, a1len = 0, a2len = 0, a3len = 0, p1len=0, p2len = 0;
|
int oplen = 0, acllen = 0, ulen = 0, plen = 0, hlen = 0, a1len = 0, a2len = 0, a3len = 0, p1len=0, p2len = 0;
|
||||||
|
|
||||||
|
|
||||||
if((type & 2) && param->username) ulen = strlen((const char *)param->username) + 1;
|
if((type & 2) && param->username) ulen = strlen((const char *)param->username) + 1;
|
||||||
@@ -55,33 +57,25 @@ void param2hash_search(const struct hashtable *ht, void *index, uint8_t *hash){
|
|||||||
if((type & 2048)){ memcpy(hash + offset, SAPORT(¶m->srv->intsa), p2len); offset += 2; }
|
if((type & 2048)){ memcpy(hash + offset, SAPORT(¶m->srv->intsa), p2len); offset += 2; }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
blake2b_init(&S, ht->hash_size);
|
mdh_ctx *bctx = mdh_init(MDH_BLAKE2, ht->hash_size);
|
||||||
if((type & 2) && param->username)blake2b_update(&S, param->username, ulen);
|
unsigned int blen = ht->hash_size;
|
||||||
if((type & 4) && param->password)blake2b_update(&S, param->password, plen);
|
if(!bctx) { memcpy(param->hash, hash, ht->hash_size); return; }
|
||||||
if((type & 1) && !(type & 8))blake2b_update(&S, SAADDR(¶m->sincr), a1len);
|
if((type & 2) && param->username)mdh_update(bctx, param->username, ulen);
|
||||||
if((type & 16))blake2b_update(&S, ¶m->srv->acl, acllen);
|
if((type & 4) && param->password)mdh_update(bctx, param->password, plen);
|
||||||
if((type & 64))blake2b_update(&S, SAADDR(¶m->req), a2len);
|
if((type & 1) && !(type & 8))mdh_update(bctx, SAADDR(¶m->sincr), a1len);
|
||||||
if((type & 128))blake2b_update(&S, SAPORT(¶m->req), 2);
|
if((type & 16))mdh_update(bctx, ¶m->srv->acl, acllen);
|
||||||
if((type & 256) && param->hostname)blake2b_update(&S, param->hostname, hlen);
|
if((type & 64))mdh_update(bctx, SAADDR(¶m->req), a2len);
|
||||||
if((type & 512))blake2b_update(&S, ¶m->operation, sizeof(param->operation));
|
if((type & 128))mdh_update(bctx, SAPORT(¶m->req), 2);
|
||||||
if((type & 1024))blake2b_update(&S, SAADDR(¶m->srv->intsa), a3len);
|
if((type & 256) && param->hostname)mdh_update(bctx, param->hostname, hlen);
|
||||||
if((type & 2048))blake2b_update(&S, SAPORT(¶m->srv->intsa), 2);
|
if((type & 512))mdh_update(bctx, ¶m->operation, sizeof(param->operation));
|
||||||
blake2b_final(&S, hash, ht->hash_size);
|
if((type & 1024))mdh_update(bctx, SAADDR(¶m->srv->intsa), a3len);
|
||||||
|
if((type & 2048))mdh_update(bctx, SAPORT(¶m->srv->intsa), 2);
|
||||||
|
mdh_final(bctx, hash, &blen);
|
||||||
|
mdh_free(bctx);
|
||||||
}
|
}
|
||||||
memcpy(param->hash, hash, ht->hash_size);
|
memcpy(param->hash, hash, ht->hash_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void udpparam2hash(const struct hashtable *ht, void *index, uint8_t *hash){
|
|
||||||
struct clientparam *param = (struct clientparam *)index;
|
|
||||||
blake2b_state S;
|
|
||||||
blake2b_init(&S, ht->hash_size);
|
|
||||||
blake2b_update(&S, SAADDR(¶m->srv->intsa), SAADDRLEN(¶m->srv->intsa));
|
|
||||||
blake2b_update(&S, SAPORT(¶m->srv->intsa), 2);
|
|
||||||
blake2b_update(&S, SAADDR(¶m->sincr), SAADDRLEN(¶m->sincr));
|
|
||||||
blake2b_update(&S, SAPORT(¶m->sincr), 2);
|
|
||||||
blake2b_final(&S, hash, ht->hash_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct hashtable dns_table = {char_index2hash, char_index2hash, 4, 32};
|
struct hashtable dns_table = {char_index2hash, char_index2hash, 4, 32};
|
||||||
struct hashtable dns6_table = {char_index2hash, char_index2hash, 16, 32};
|
struct hashtable dns6_table = {char_index2hash, char_index2hash, 16, 32};
|
||||||
struct hashtable auth_table = {param2hash_add, param2hash_search, sizeof(struct authcache), 64};
|
struct hashtable auth_table = {param2hash_add, param2hash_search, sizeof(struct authcache), 64};
|
||||||
|
|||||||
+1640
File diff suppressed because it is too large.
Load diff
+266
@@ -0,0 +1,266 @@
|
|||||||
|
/*
|
||||||
|
3APA3A simplest proxy server
|
||||||
|
(c) 2002-2026 by Vladimir Dubrovin <vlad@3proxy.org>
|
||||||
|
|
||||||
|
please read License Agreement
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "proxy.h"
|
||||||
|
|
||||||
|
#ifdef WITH_IMAPP
|
||||||
|
|
||||||
|
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
|
||||||
|
|
||||||
|
#define CL_LOGINCMD 0
|
||||||
|
#define CL_PLAIN 1
|
||||||
|
#define CL_LOGIN 2
|
||||||
|
|
||||||
|
#define CAP_PLAIN 1
|
||||||
|
#define CAP_LOGIN 2
|
||||||
|
|
||||||
|
#ifdef WITHMAIN
|
||||||
|
#define NOSTARTTLS 1
|
||||||
|
#else
|
||||||
|
#define NOSTARTTLS param->srv->nostarttls
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void * imappchild(struct clientparam* param) {
|
||||||
|
int i=0, res, method=CL_LOGINCMD, caps=0;
|
||||||
|
unsigned char buf[2048];
|
||||||
|
unsigned char srvbuf[1024];
|
||||||
|
unsigned char ibuf[2048];
|
||||||
|
unsigned char tag[64];
|
||||||
|
unsigned char ub[320];
|
||||||
|
unsigned char pb[320];
|
||||||
|
unsigned char *se, *cmd, *user, *pass, *p1, *p2;
|
||||||
|
|
||||||
|
*tag = 0;
|
||||||
|
i = sprintf((char *)buf, "* OK [CAPABILITY IMAP4rev1%s AUTH=PLAIN AUTH=LOGIN] IMAP4rev1 Proxy Ready\r\n", NOSTARTTLS?"":" STARTTLS");
|
||||||
|
if(socksend(param, param->clisock, buf, i, conf.timeouts[STRING_S])!=i) {RETURN (691);}
|
||||||
|
for(;;){
|
||||||
|
i = sockgetlinebuf(param, CLIENT, buf, sizeof(buf) - 10, '\n', conf.timeouts[STRING_S]);
|
||||||
|
if(i < 4) {RETURN(692);}
|
||||||
|
buf[i] = 0;
|
||||||
|
if ((se=(unsigned char *)strchr((char *)buf, '\r'))) *se = 0;
|
||||||
|
if (!(se=(unsigned char *)strchr((char *)buf, ' ')) || (se - buf) >= (int)(sizeof(tag) - 1)) {RETURN(692);}
|
||||||
|
memcpy(tag, buf, se - buf);
|
||||||
|
tag[se - buf] = 0;
|
||||||
|
cmd = se + 1;
|
||||||
|
if(!strncasecmp((char *)cmd, "LOGOUT", 6)){
|
||||||
|
socksend(param, param->clisock, (unsigned char *)"* BYE\r\n", 7, conf.timeouts[STRING_S]);
|
||||||
|
sprintf((char *)buf, "%.60s OK LOGOUT completed\r\n", (char *)tag);
|
||||||
|
socksend(param, param->clisock, buf, (int)strlen((char *)buf), conf.timeouts[STRING_S]);
|
||||||
|
RETURN(0);
|
||||||
|
}
|
||||||
|
if(!strncasecmp((char *)cmd, "CAPABILITY", 10)){
|
||||||
|
i = sprintf((char *)buf, "* CAPABILITY IMAP4rev1%s AUTH=PLAIN AUTH=LOGIN\r\n", NOSTARTTLS?"":" STARTTLS");
|
||||||
|
socksend(param, param->clisock, buf, i, conf.timeouts[STRING_S]);
|
||||||
|
sprintf((char *)buf, "%.60s OK CAPABILITY completed\r\n", (char *)tag);
|
||||||
|
socksend(param, param->clisock, buf, (int)strlen((char *)buf), conf.timeouts[STRING_S]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#ifndef WITHMAIN
|
||||||
|
if(!strncasecmp((char *)cmd, "STARTTLS", 8) && !param->srv->nostarttls){
|
||||||
|
sprintf((char *)buf, "%.60s OK Begin TLS negotiation\r\n", (char *)tag);
|
||||||
|
if(socksend(param, param->clisock, buf, (int)strlen((char *)buf), conf.timeouts[STRING_S]) <= 0) {RETURN(698);}
|
||||||
|
param->clientstarttls = S_IMAPP;
|
||||||
|
if(!param->srv->targetport) param->srv->targetport = htons(143);
|
||||||
|
return (void *)tlsprchild;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if(!strncasecmp((char *)cmd, "LOGIN ", 6)){
|
||||||
|
user = cmd + 6;
|
||||||
|
if(*user == '"') {
|
||||||
|
user++;
|
||||||
|
if (!(se=(unsigned char *)strchr((char *)user, '"'))) {RETURN(693);}
|
||||||
|
*se = 0;
|
||||||
|
pass = se + 1;
|
||||||
|
if(*pass == ' ') pass++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!(se=(unsigned char *)strchr((char *)user, ' '))) {RETURN(693);}
|
||||||
|
*se = 0;
|
||||||
|
pass = se + 1;
|
||||||
|
}
|
||||||
|
if(strlen((char *)user) >= sizeof(ub) || strlen((char *)pass) >= sizeof(pb)) {RETURN(693);}
|
||||||
|
strcpy((char *)ub, (char *)user);
|
||||||
|
strcpy((char *)pb, (char *)pass);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!strncasecmp((char *)cmd, "AUTHENTICATE PLAIN", 18)){
|
||||||
|
method = CL_PLAIN;
|
||||||
|
se = cmd + 18;
|
||||||
|
if(*se == ' ') se++; else se = NULL;
|
||||||
|
if(!se || !*se){
|
||||||
|
if(socksend(param, param->clisock, (unsigned char *)"+ \r\n", 4, conf.timeouts[STRING_S])!=4) {RETURN(698);}
|
||||||
|
i = sockgetlinebuf(param, CLIENT, buf, sizeof(buf) - 10, '\n', conf.timeouts[STRING_S]);
|
||||||
|
if(i < 1) {RETURN(698);}
|
||||||
|
buf[i] = 0;
|
||||||
|
if ((se=(unsigned char *)strchr((char *)buf, '\r'))) *se = 0;
|
||||||
|
se = buf;
|
||||||
|
}
|
||||||
|
i = de64(se, ibuf, (int)sizeof(ibuf) - 1);
|
||||||
|
if(i < 3) {RETURN(693);}
|
||||||
|
ibuf[i] = 0;
|
||||||
|
p1 = (unsigned char *)memchr(ibuf, 0, i);
|
||||||
|
if(!p1 || p1 == ibuf + i - 1) {RETURN(693);}
|
||||||
|
p2 = (unsigned char *)memchr(p1 + 1, 0, i - (int)(p1 + 1 - ibuf));
|
||||||
|
if(p2){
|
||||||
|
user = p1 + 1;
|
||||||
|
pass = p2 + 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
user = ibuf;
|
||||||
|
pass = p1 + 1;
|
||||||
|
}
|
||||||
|
if(strlen((char *)user) >= sizeof(ub) || strlen((char *)pass) >= sizeof(pb)) {RETURN(693);}
|
||||||
|
strcpy((char *)ub, (char *)user);
|
||||||
|
strcpy((char *)pb, (char *)pass);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!strncasecmp((char *)cmd, "AUTHENTICATE LOGIN", 18)){
|
||||||
|
method = CL_LOGIN;
|
||||||
|
se = cmd + 18;
|
||||||
|
if(*se == ' ') se++; else se = NULL;
|
||||||
|
if(se && *se){
|
||||||
|
i = de64(se, ub, (int)sizeof(ub) - 1);
|
||||||
|
if(i < 0) {RETURN(693);}
|
||||||
|
ub[i] = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(socksend(param, param->clisock, (unsigned char *)"+ VXNlcm5hbWU6\r\n", 16, conf.timeouts[STRING_S])!=16) {RETURN(698);}
|
||||||
|
i = sockgetlinebuf(param, CLIENT, buf, sizeof(buf) - 10, '\n', conf.timeouts[STRING_S]);
|
||||||
|
if(i < 1) {RETURN(698);}
|
||||||
|
buf[i] = 0;
|
||||||
|
if ((se=(unsigned char *)strchr((char *)buf, '\r'))) *se = 0;
|
||||||
|
i = de64(buf, ub, (int)sizeof(ub) - 1);
|
||||||
|
if(i < 0) {RETURN(693);}
|
||||||
|
ub[i] = 0;
|
||||||
|
}
|
||||||
|
if(socksend(param, param->clisock, (unsigned char *)"+ UGFzc3dvcmQ6\r\n", 16, conf.timeouts[STRING_S])!=16) {RETURN(698);}
|
||||||
|
i = sockgetlinebuf(param, CLIENT, buf, sizeof(buf) - 10, '\n', conf.timeouts[STRING_S]);
|
||||||
|
if(i < 1) {RETURN(698);}
|
||||||
|
buf[i] = 0;
|
||||||
|
if ((se=(unsigned char *)strchr((char *)buf, '\r'))) *se = 0;
|
||||||
|
i = de64(buf, pb, (int)sizeof(pb) - 1);
|
||||||
|
if(i < 0) {RETURN(693);}
|
||||||
|
pb[i] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sprintf((char *)buf, "%.60s BAD need LOGIN first\r\n", (char *)tag);
|
||||||
|
socksend(param, param->clisock, buf, (int)strlen((char *)buf), conf.timeouts[STRING_S]);
|
||||||
|
}
|
||||||
|
if(parseconnusername((char *)ub, param, 0, 143)){RETURN(694);}
|
||||||
|
if(*pb && !param->password) param->password = (unsigned char *)strdup((char *)pb);
|
||||||
|
param->operation = CONNECT;
|
||||||
|
res = (*param->srv->authfunc)(param);
|
||||||
|
if(res) {RETURN(res);}
|
||||||
|
i = sockgetlinebuf(param, SERVER, srvbuf, sizeof(srvbuf) - 1, '\n', conf.timeouts[STRING_L]);
|
||||||
|
if( i < 4 ) {RETURN(695);}
|
||||||
|
srvbuf[i] = 0;
|
||||||
|
if(strncasecmp((char *)srvbuf, "* OK", 4)){RETURN(696);}
|
||||||
|
if((se = (unsigned char *)strstr((char *)srvbuf, "[CAPABILITY "))){
|
||||||
|
if(hascap(se, "AUTH=PLAIN")) caps |= CAP_PLAIN;
|
||||||
|
if(hascap(se, "AUTH=LOGIN")) caps |= CAP_LOGIN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(socksend(param, param->remsock, (unsigned char *)"zz CAPABILITY\r\n", 15, conf.timeouts[STRING_S])!=15) {RETURN(697);}
|
||||||
|
for(;;){
|
||||||
|
i = sockgetlinebuf(param, SERVER, srvbuf, sizeof(srvbuf) - 1, '\n', conf.timeouts[STRING_L]);
|
||||||
|
if(i < 3) {RETURN(697);}
|
||||||
|
srvbuf[i] = 0;
|
||||||
|
if(!strncasecmp((char *)srvbuf, "* CAPABILITY", 12)){
|
||||||
|
if(hascap(srvbuf, "AUTH=PLAIN")) caps |= CAP_PLAIN;
|
||||||
|
if(hascap(srvbuf, "AUTH=LOGIN")) caps |= CAP_LOGIN;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(!strncasecmp((char *)srvbuf, "zz ", 3)) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(method == CL_PLAIN && !(caps & CAP_PLAIN)) method = (caps & CAP_LOGIN)? CL_LOGIN : CL_LOGINCMD;
|
||||||
|
else if(method == CL_LOGIN && !(caps & CAP_LOGIN)) method = (caps & CAP_PLAIN)? CL_PLAIN : CL_LOGINCMD;
|
||||||
|
else if(method == CL_LOGINCMD && caps) method = (caps & CAP_PLAIN)? CL_PLAIN : CL_LOGIN;
|
||||||
|
if(method == CL_PLAIN){
|
||||||
|
i = (int)strlen((char *)param->extusername);
|
||||||
|
res = (int)strlen((char *)pb);
|
||||||
|
if(i + res + 2 > (int)sizeof(ibuf)) {RETURN(693);}
|
||||||
|
ibuf[0] = 0;
|
||||||
|
memcpy(ibuf + 1, param->extusername, i);
|
||||||
|
ibuf[i + 1] = 0;
|
||||||
|
memcpy(ibuf + i + 2, pb, res);
|
||||||
|
if(!en64(ibuf, srvbuf, i + res + 2, (int)sizeof(srvbuf))) {RETURN(693);}
|
||||||
|
if( socksend(param, param->remsock, tag, (int)strlen((char *)tag), conf.timeouts[STRING_S]) <= 0 ||
|
||||||
|
socksend(param, param->remsock, (unsigned char *)" AUTHENTICATE PLAIN ", 20, conf.timeouts[STRING_S])!= 20 ||
|
||||||
|
socksend(param, param->remsock, srvbuf, (int)strlen((char *)srvbuf), conf.timeouts[STRING_S]) <= 0 ||
|
||||||
|
socksend(param, param->remsock, (unsigned char *)"\r\n", 2, conf.timeouts[STRING_S])!=2)
|
||||||
|
{RETURN(699);}
|
||||||
|
}
|
||||||
|
else if(method == CL_LOGIN){
|
||||||
|
if( socksend(param, param->remsock, tag, (int)strlen((char *)tag), conf.timeouts[STRING_S]) <= 0 ||
|
||||||
|
socksend(param, param->remsock, (unsigned char *)" AUTHENTICATE LOGIN\r\n", 21, conf.timeouts[STRING_S])!= 21)
|
||||||
|
{RETURN(699);}
|
||||||
|
i = sockgetlinebuf(param, SERVER, srvbuf, sizeof(srvbuf) - 1, '\n', conf.timeouts[STRING_L]);
|
||||||
|
if(i < 1 || *srvbuf != '+') {RETURN(699);}
|
||||||
|
if(!en64(param->extusername, ibuf, (int)strlen((char *)param->extusername), (int)sizeof(ibuf))) {RETURN(693);}
|
||||||
|
if( socksend(param, param->remsock, ibuf, (int)strlen((char *)ibuf), conf.timeouts[STRING_S]) <= 0 ||
|
||||||
|
socksend(param, param->remsock, (unsigned char *)"\r\n", 2, conf.timeouts[STRING_S])!=2)
|
||||||
|
{RETURN(699);}
|
||||||
|
i = sockgetlinebuf(param, SERVER, srvbuf, sizeof(srvbuf) - 1, '\n', conf.timeouts[STRING_L]);
|
||||||
|
if(i < 1 || *srvbuf != '+') {RETURN(699);}
|
||||||
|
if(!en64(pb, ibuf, (int)strlen((char *)pb), (int)sizeof(ibuf))) {RETURN(693);}
|
||||||
|
if( socksend(param, param->remsock, ibuf, (int)strlen((char *)ibuf), conf.timeouts[STRING_S]) <= 0 ||
|
||||||
|
socksend(param, param->remsock, (unsigned char *)"\r\n", 2, conf.timeouts[STRING_S])!=2)
|
||||||
|
{RETURN(699);}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if( socksend(param, param->remsock, tag, (int)strlen((char *)tag), conf.timeouts[STRING_S]) <= 0 ||
|
||||||
|
socksend(param, param->remsock, (unsigned char *)" LOGIN ", 7, conf.timeouts[STRING_S])!= 7 ||
|
||||||
|
socksend(param, param->remsock, param->extusername, (int)strlen((char *)param->extusername), conf.timeouts[STRING_S]) <= 0 ||
|
||||||
|
socksend(param, param->remsock, (unsigned char *)" ", 1, conf.timeouts[STRING_S])!= 1 ||
|
||||||
|
socksend(param, param->remsock, pb, (int)strlen((char *)pb), conf.timeouts[STRING_S]) <= 0 ||
|
||||||
|
socksend(param, param->remsock, (unsigned char *)"\r\n", 2, conf.timeouts[STRING_S])!=2)
|
||||||
|
{RETURN(699);}
|
||||||
|
}
|
||||||
|
param->statscli64 += (uint64_t)(strlen((char *)tag) + strlen((char *)param->extusername) + strlen((char *)pb) + 11);
|
||||||
|
param->nwrites++;
|
||||||
|
RETURN (mapsocket(param, 180));
|
||||||
|
CLEANRET:
|
||||||
|
|
||||||
|
if(param->hostname&¶m->extusername) {
|
||||||
|
sprintf((char *)buf, "%.128s@%.128s%c%hu", param->extusername, param->hostname, (*SAPORT(¶m->sinsr)==143)?0:':', ntohs(*SAPORT(¶m->sinsr)));
|
||||||
|
dolog(param, buf);
|
||||||
|
}
|
||||||
|
else dolog(param, NULL);
|
||||||
|
if(param->clisock != INVALID_SOCKET) {
|
||||||
|
if ((param->res > 0 && param->res < 100) || (param->res > 691 && param->res <700)) {
|
||||||
|
sprintf((char *)buf, "%.60s NO proxy error\r\n", *tag? (char *)tag : "*");
|
||||||
|
socksend(param, param->clisock, buf, (int)strlen((char *)buf),conf.timeouts[STRING_S]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WITHMAIN
|
||||||
|
struct proxydef childdef = {
|
||||||
|
imappchild,
|
||||||
|
143,
|
||||||
|
0,
|
||||||
|
S_IMAPP,
|
||||||
|
" -hdefault_host[:port] - use this host and port as default if no host specified\n -x - disable STARTTLS\n"
|
||||||
|
|
||||||
|
};
|
||||||
|
#include "proxymain.c"
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Built without this proxy of its own. The command and the redirect
|
||||||
|
naming it are the STARTTLS proxy speaking that protocol, which
|
||||||
|
negotiates the same way and passes the session on: what "tlspr -Ximap"
|
||||||
|
does, under the name a configuration already uses. */
|
||||||
|
void * imappchild(struct clientparam * param){
|
||||||
|
param->starttls = S_IMAPP;
|
||||||
|
return (void *)tlsprchild;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -13,6 +13,12 @@
|
|||||||
https://blake2.net.
|
https://blake2.net.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(WITH_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_BLAKE2B
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -377,3 +383,5 @@ fail:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* !HAVE_BLAKE2B */
|
||||||
+276
@@ -0,0 +1,276 @@
|
|||||||
|
/*
|
||||||
|
* This is an OpenSSL API compatible (but not ABI compatible) implementation
|
||||||
|
* of the RSA Data Security, Inc. MD4 Message-Digest Algorithm (RFC 1320).
|
||||||
|
*
|
||||||
|
* Homepage:
|
||||||
|
* https://openwall.info/wiki/people/solar/software/public-domain-source-code/md4
|
||||||
|
*
|
||||||
|
* Author:
|
||||||
|
* Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
|
||||||
|
*
|
||||||
|
* This software was written by Alexander Peslyak in 2001. No copyright is
|
||||||
|
* claimed, and the software is hereby placed in the public domain.
|
||||||
|
* In case this attempt to disclaim copyright and place the software in the
|
||||||
|
* public domain is deemed null and void, then the software is
|
||||||
|
* Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
|
||||||
|
* general public under the following terms:
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted.
|
||||||
|
*
|
||||||
|
* There's ABSOLUTELY NO WARRANTY, express or implied.
|
||||||
|
*
|
||||||
|
* (This is a heavily cut-down "BSD license".)
|
||||||
|
*
|
||||||
|
* This differs from Colin Plumb's older public domain implementation in that
|
||||||
|
* no exactly 32-bit integer data type is required (any 32-bit or wider
|
||||||
|
* unsigned integer data type will do), there's no compile-time endianness
|
||||||
|
* configuration, and the function prototypes match OpenSSL's. No code from
|
||||||
|
* Colin Plumb's implementation has been reused; this comment merely compares
|
||||||
|
* the properties of the two independent implementations.
|
||||||
|
*
|
||||||
|
* The primary goals of this implementation are portability and ease of use.
|
||||||
|
* It is meant to be fast, but not as fast as possible. Some known
|
||||||
|
* optimizations are not included to reduce source code size and avoid
|
||||||
|
* compile-time configuration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(WITH_WOLFSSL)
|
||||||
|
#include <wolfssl/options.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(WITH_WOLFSSL) || defined(NO_MD4)
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "md4.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The basic MD4 functions.
|
||||||
|
*
|
||||||
|
* F and G are optimized compared to their RFC 1320 definitions, with the
|
||||||
|
* optimization for F borrowed from Colin Plumb's MD5 implementation.
|
||||||
|
*/
|
||||||
|
#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
|
||||||
|
#define G(x, y, z) (((x) & ((y) | (z))) | ((y) & (z)))
|
||||||
|
#define H(x, y, z) ((x) ^ (y) ^ (z))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The MD4 transformation for all three rounds.
|
||||||
|
*/
|
||||||
|
#define STEP(f, a, b, c, d, x, s) \
|
||||||
|
(a) += f((b), (c), (d)) + (x); \
|
||||||
|
(a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s))));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SET reads 4 input bytes in little-endian byte order and stores them in a
|
||||||
|
* properly aligned word in host byte order.
|
||||||
|
*
|
||||||
|
* The check for little-endian architectures that tolerate unaligned memory
|
||||||
|
* accesses is just an optimization. Nothing will break if it fails to detect
|
||||||
|
* a suitable architecture.
|
||||||
|
*
|
||||||
|
* Unfortunately, this optimization may be a C strict aliasing rules violation
|
||||||
|
* if the caller's data buffer has effective type that cannot be aliased by
|
||||||
|
* MD4_u32plus. In practice, this problem may occur if these MD4 routines are
|
||||||
|
* inlined into a calling function, or with future and dangerously advanced
|
||||||
|
* link-time optimizations. For the time being, keeping these MD4 routines in
|
||||||
|
* their own translation unit avoids the problem.
|
||||||
|
*/
|
||||||
|
#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
|
||||||
|
#define SET(n) \
|
||||||
|
(*(MD4_u32plus *)&ptr[(n) * 4])
|
||||||
|
#define GET(n) \
|
||||||
|
SET(n)
|
||||||
|
#else
|
||||||
|
#define SET(n) \
|
||||||
|
(ctx->block[(n)] = \
|
||||||
|
(MD4_u32plus)ptr[(n) * 4] | \
|
||||||
|
((MD4_u32plus)ptr[(n) * 4 + 1] << 8) | \
|
||||||
|
((MD4_u32plus)ptr[(n) * 4 + 2] << 16) | \
|
||||||
|
((MD4_u32plus)ptr[(n) * 4 + 3] << 24))
|
||||||
|
#define GET(n) \
|
||||||
|
(ctx->block[(n)])
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This processes one or more 64-byte data blocks, but does NOT update the bit
|
||||||
|
* counters. There are no alignment requirements.
|
||||||
|
*/
|
||||||
|
static const void *body(MD4_CTX *ctx, const void *data, size_t size)
|
||||||
|
{
|
||||||
|
const unsigned char *ptr;
|
||||||
|
MD4_u32plus a, b, c, d;
|
||||||
|
MD4_u32plus saved_a, saved_b, saved_c, saved_d;
|
||||||
|
const MD4_u32plus ac1 = 0x5a827999, ac2 = 0x6ed9eba1;
|
||||||
|
|
||||||
|
ptr = (const unsigned char *)data;
|
||||||
|
|
||||||
|
a = ctx->a;
|
||||||
|
b = ctx->b;
|
||||||
|
c = ctx->c;
|
||||||
|
d = ctx->d;
|
||||||
|
|
||||||
|
do {
|
||||||
|
saved_a = a;
|
||||||
|
saved_b = b;
|
||||||
|
saved_c = c;
|
||||||
|
saved_d = d;
|
||||||
|
|
||||||
|
/* Round 1 */
|
||||||
|
STEP(F, a, b, c, d, SET(0), 3)
|
||||||
|
STEP(F, d, a, b, c, SET(1), 7)
|
||||||
|
STEP(F, c, d, a, b, SET(2), 11)
|
||||||
|
STEP(F, b, c, d, a, SET(3), 19)
|
||||||
|
STEP(F, a, b, c, d, SET(4), 3)
|
||||||
|
STEP(F, d, a, b, c, SET(5), 7)
|
||||||
|
STEP(F, c, d, a, b, SET(6), 11)
|
||||||
|
STEP(F, b, c, d, a, SET(7), 19)
|
||||||
|
STEP(F, a, b, c, d, SET(8), 3)
|
||||||
|
STEP(F, d, a, b, c, SET(9), 7)
|
||||||
|
STEP(F, c, d, a, b, SET(10), 11)
|
||||||
|
STEP(F, b, c, d, a, SET(11), 19)
|
||||||
|
STEP(F, a, b, c, d, SET(12), 3)
|
||||||
|
STEP(F, d, a, b, c, SET(13), 7)
|
||||||
|
STEP(F, c, d, a, b, SET(14), 11)
|
||||||
|
STEP(F, b, c, d, a, SET(15), 19)
|
||||||
|
|
||||||
|
/* Round 2 */
|
||||||
|
STEP(G, a, b, c, d, GET(0) + ac1, 3)
|
||||||
|
STEP(G, d, a, b, c, GET(4) + ac1, 5)
|
||||||
|
STEP(G, c, d, a, b, GET(8) + ac1, 9)
|
||||||
|
STEP(G, b, c, d, a, GET(12) + ac1, 13)
|
||||||
|
STEP(G, a, b, c, d, GET(1) + ac1, 3)
|
||||||
|
STEP(G, d, a, b, c, GET(5) + ac1, 5)
|
||||||
|
STEP(G, c, d, a, b, GET(9) + ac1, 9)
|
||||||
|
STEP(G, b, c, d, a, GET(13) + ac1, 13)
|
||||||
|
STEP(G, a, b, c, d, GET(2) + ac1, 3)
|
||||||
|
STEP(G, d, a, b, c, GET(6) + ac1, 5)
|
||||||
|
STEP(G, c, d, a, b, GET(10) + ac1, 9)
|
||||||
|
STEP(G, b, c, d, a, GET(14) + ac1, 13)
|
||||||
|
STEP(G, a, b, c, d, GET(3) + ac1, 3)
|
||||||
|
STEP(G, d, a, b, c, GET(7) + ac1, 5)
|
||||||
|
STEP(G, c, d, a, b, GET(11) + ac1, 9)
|
||||||
|
STEP(G, b, c, d, a, GET(15) + ac1, 13)
|
||||||
|
|
||||||
|
/* Round 3 */
|
||||||
|
STEP(H, a, b, c, d, GET(0) + ac2, 3)
|
||||||
|
STEP(H, d, a, b, c, GET(8) + ac2, 9)
|
||||||
|
STEP(H, c, d, a, b, GET(4) + ac2, 11)
|
||||||
|
STEP(H, b, c, d, a, GET(12) + ac2, 15)
|
||||||
|
STEP(H, a, b, c, d, GET(2) + ac2, 3)
|
||||||
|
STEP(H, d, a, b, c, GET(10) + ac2, 9)
|
||||||
|
STEP(H, c, d, a, b, GET(6) + ac2, 11)
|
||||||
|
STEP(H, b, c, d, a, GET(14) + ac2, 15)
|
||||||
|
STEP(H, a, b, c, d, GET(1) + ac2, 3)
|
||||||
|
STEP(H, d, a, b, c, GET(9) + ac2, 9)
|
||||||
|
STEP(H, c, d, a, b, GET(5) + ac2, 11)
|
||||||
|
STEP(H, b, c, d, a, GET(13) + ac2, 15)
|
||||||
|
STEP(H, a, b, c, d, GET(3) + ac2, 3)
|
||||||
|
STEP(H, d, a, b, c, GET(11) + ac2, 9)
|
||||||
|
STEP(H, c, d, a, b, GET(7) + ac2, 11)
|
||||||
|
STEP(H, b, c, d, a, GET(15) + ac2, 15)
|
||||||
|
|
||||||
|
a += saved_a;
|
||||||
|
b += saved_b;
|
||||||
|
c += saved_c;
|
||||||
|
d += saved_d;
|
||||||
|
|
||||||
|
ptr += 64;
|
||||||
|
} while (size -= 64);
|
||||||
|
|
||||||
|
ctx->a = a;
|
||||||
|
ctx->b = b;
|
||||||
|
ctx->c = c;
|
||||||
|
ctx->d = d;
|
||||||
|
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MD4_Init(MD4_CTX *ctx)
|
||||||
|
{
|
||||||
|
ctx->a = 0x67452301;
|
||||||
|
ctx->b = 0xefcdab89;
|
||||||
|
ctx->c = 0x98badcfe;
|
||||||
|
ctx->d = 0x10325476;
|
||||||
|
|
||||||
|
ctx->lo = 0;
|
||||||
|
ctx->hi = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MD4_Update(MD4_CTX *ctx, const void *data, size_t size)
|
||||||
|
{
|
||||||
|
MD4_u32plus saved_lo;
|
||||||
|
size_t used, available;
|
||||||
|
|
||||||
|
saved_lo = ctx->lo;
|
||||||
|
if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
|
||||||
|
ctx->hi++;
|
||||||
|
ctx->hi += (MD4_u32plus)(size >> 29);
|
||||||
|
|
||||||
|
used = saved_lo & 0x3f;
|
||||||
|
|
||||||
|
if (used) {
|
||||||
|
available = 64 - used;
|
||||||
|
|
||||||
|
if (size < available) {
|
||||||
|
memcpy(&ctx->buffer[used], data, size);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(&ctx->buffer[used], data, available);
|
||||||
|
data = (const unsigned char *)data + available;
|
||||||
|
size -= available;
|
||||||
|
body(ctx, ctx->buffer, 64);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size >= 64) {
|
||||||
|
data = body(ctx, data, size & ~(size_t)0x3f);
|
||||||
|
size &= 0x3f;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(ctx->buffer, data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define OUT(dst, src) \
|
||||||
|
(dst)[0] = (unsigned char)(src); \
|
||||||
|
(dst)[1] = (unsigned char)((src) >> 8); \
|
||||||
|
(dst)[2] = (unsigned char)((src) >> 16); \
|
||||||
|
(dst)[3] = (unsigned char)((src) >> 24);
|
||||||
|
|
||||||
|
void MD4_Final(unsigned char *result, MD4_CTX *ctx)
|
||||||
|
{
|
||||||
|
size_t used, available;
|
||||||
|
|
||||||
|
used = ctx->lo & 0x3f;
|
||||||
|
|
||||||
|
ctx->buffer[used++] = 0x80;
|
||||||
|
|
||||||
|
available = 64 - used;
|
||||||
|
|
||||||
|
if (available < 8) {
|
||||||
|
memset(&ctx->buffer[used], 0, available);
|
||||||
|
body(ctx, ctx->buffer, 64);
|
||||||
|
used = 0;
|
||||||
|
available = 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&ctx->buffer[used], 0, available - 8);
|
||||||
|
|
||||||
|
ctx->lo <<= 3;
|
||||||
|
OUT(&ctx->buffer[56], ctx->lo)
|
||||||
|
OUT(&ctx->buffer[60], ctx->hi)
|
||||||
|
|
||||||
|
body(ctx, ctx->buffer, 64);
|
||||||
|
|
||||||
|
OUT(&result[0], ctx->a)
|
||||||
|
OUT(&result[4], ctx->b)
|
||||||
|
OUT(&result[8], ctx->c)
|
||||||
|
OUT(&result[12], ctx->d)
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !WITH_WOLFSSL || NO_MD4 */
|
||||||
Loaded 100 of 173 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user