mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-07 02:05:49 +08:00
NTLM authentication of proxy clients was gone but for what was left of it: the 407 answer offering NTLM before Basic (12, under NOCRYPT, which nothing else used) and the one for its handshake (13), sent by nothing, and the prototypes of genchallenge() and mschap(), defined nowhere. The strings after them in proxy_stringtable move up two: 403 with <pre> is 12, 503 13, 401 of the FTP server 14, 100 Continue 15. rus.3ps, StringsPlugin's translation, follows: the two strings go, the 403 with <pre> is UTF-8 as the rest, the XML of the running services has its Content-disposition, and the table of counters the columns of its rows (Action and #/Description were one). NT: passwords, MD4 hashes as Windows keeps them, stay. The documents no longer tell to give proxy -n to turn off NTLM. Plugin binary compatibility: a plugin indexing proxy_stringtable finds the strings from 12 on two places earlier, and a .3ps file of its own with the NTLM strings has two more than 3proxy (StringsPlugin warns). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
216 lines
7.8 KiB
Makefile
216 lines
7.8 KiB
Makefile
#
|
|
# 3 proxy Makefile for GCC/Linux/Cygwin
|
|
#
|
|
# add -DWITH_ODBC to CFLAGS and -lodbc to LIBS to compile with ODBC
|
|
# 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/
|
|
PREFIX ?= 3proxy_
|
|
CRYPT_PREFIX ?= $(PREFIX)
|
|
CC ?= gcc
|
|
|
|
CFLAGS ?= -O3 -flto
|
|
CFLAGS += -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -D_THREAD_SAFE -D_REENTRANT -DWITH_NETFILTER -D WITH_UN
|
|
COUT = -o
|
|
LN ?= ${CC}
|
|
DCFLAGS ?= -fPIC
|
|
LDFLAGS ?= -O3 -flto
|
|
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
|
|
DLSUFFICS = .ld.so
|
|
# -lpthreads may be reuqired on some platforms instead of -pthreads
|
|
LIBSPREFIX = -l
|
|
LIBSSUFFIX =
|
|
LNOUT = -o
|
|
EXESUFFICS =
|
|
OBJSUFFICS = .o
|
|
DEFINEOPTION = -D
|
|
COMPFILES = *~
|
|
REMOVECOMMAND = rm -f
|
|
AFTERCLEAN = (find . -type f -name "*.o" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
|
|
TYPECOMMAND = cat
|
|
COMPATLIBS =
|
|
MAKEFILE = Makefile.Linux
|
|
# PamAuth requires libpam, you may require pam-devel package to be installed
|
|
# SSLPlugin requires -lcrypto -lssl
|
|
#LIBS = -lcrypto -lssl -ldl
|
|
#PLUGINS = StringsPlugin TrafficPlugin PamAuth LdapPlugin
|
|
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)
|
|
LDFLAGS += -static
|
|
CFLAGS += -DNOPLUGINS -DNOSTDRESOLVE
|
|
ZLIB = -lz -lzstd
|
|
PLUGINS =
|
|
PAM_CHECK = false
|
|
else
|
|
LIBS += -ldl
|
|
endif
|
|
ifeq ($(LIBSTATIC), true)
|
|
STATIC_PREFIX = -Wl,-Bstatic
|
|
STATIC_SUFFIX = -Wl,-Bdynamic
|
|
ZLIB = -lz -lzstd
|
|
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) -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)
|
|
LIBS += $(STATIC_PREFIX) $(ZLIB) -lcrypto -lssl $(STATIC_SUFFIX)
|
|
CFLAGS += -DWITH_SSL
|
|
SSL_OBJS = ssllib$(OBJSUFFICS) ssl$(OBJSUFFICS)
|
|
else
|
|
ZLIB :=
|
|
endif
|
|
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)
|
|
CFLAGS += -DWITH_PCRE
|
|
PCRE_OBJS = pcre$(OBJSUFFICS)
|
|
PCRE_LIBS = $(STATIC_PREFIX) -lpcre2-8 $(STATIC_SUFFIX)
|
|
endif
|
|
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)
|
|
PLUGINS += PamAuth
|
|
endif
|
|
include Makefile.inc
|
|
|
|
allplugins:
|
|
@list='$(PLUGINS)'; for p in $$list; do cp Makefile Makefile.var plugins/$$p; cd plugins/$$p ; make ; cd ../.. ; done
|
|
|
|
DESTDIR ?=
|
|
prefix ?=
|
|
exec_prefix ?= $(prefix)
|
|
man_prefix ?= /usr/share
|
|
chroot_prefix ?= /usr/local
|
|
|
|
INSTALL ?= /usr/bin/install
|
|
INSTALL_BIN = $(INSTALL) -m 755
|
|
INSTALL_DATA = $(INSTALL) -m 644
|
|
INSTALL_OBJS = bin/3proxy \
|
|
bin/$(CRYPT_PREFIX)crypt \
|
|
bin/$(PREFIX)proxy \
|
|
bin/$(PREFIX)socks \
|
|
bin/$(PREFIX)tcppm \
|
|
bin/$(PREFIX)tlspr \
|
|
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_INCHROOT = scripts/3proxy.cfg.inchroot
|
|
|
|
INSTALL_CFG_OBJS2 = counters bandlimiters
|
|
|
|
INSTALL_INITD_SCRIPT = scripts/init.d/3proxy.in
|
|
INSTALL_SYSTEMD_SCRIPT = scripts/3proxy.service.in
|
|
|
|
CHROOTDIR = $(DESTDIR)$(chroot_prefix)/3proxy
|
|
CHROOTREL = ../..$(chroot_prefix)/3proxy
|
|
MANDIR5 = $(DESTDIR)$(man_prefix)/man/man5
|
|
MANDIR8 = $(DESTDIR)$(man_prefix)/man/man8
|
|
BINDIR = $(DESTDIR)$(exec_prefix)/bin
|
|
ETCDIR = $(DESTDIR)/etc/3proxy
|
|
INITDDIR = $(DESTDIR)/etc/init.d
|
|
LOGBASE = $(DESTDIR)/var/log
|
|
LOGDIR = $(LOGBASE)/3proxy
|
|
INSTALL_CFG_DEST = $(ETCDIR)/conf
|
|
SYSTEMDDIR = $(DESTDIR)/usr/lib/systemd/system/
|
|
|
|
install-bin:
|
|
$(INSTALL_BIN) -d $(BINDIR)
|
|
$(INSTALL_BIN) -s $(INSTALL_OBJS) $(BINDIR)
|
|
$(INSTALL_BIN) -s bin/*.ld.so $(CHROOTDIR)/libexec
|
|
$(INSTALL_BIN) scripts/add3proxyuser.sh.in $(BINDIR)/add3proxyuser
|
|
|
|
install-etc-dir:
|
|
$(INSTALL_BIN) -d $(ETCDIR)
|
|
|
|
install-chroot-dir:
|
|
$(INSTALL_BIN) -d $(CHROOTDIR)
|
|
$(INSTALL_BIN) -d $(CHROOTDIR)/conf
|
|
$(INSTALL_BIN) -d $(CHROOTDIR)/logs
|
|
$(INSTALL_BIN) -d $(CHROOTDIR)/count
|
|
$(INSTALL_BIN) -d $(CHROOTDIR)/libexec
|
|
|
|
install-etc-default-config: install-chroot-dir
|
|
if [ ! -d $(INSTALL_CFG_DEST) ]; then \
|
|
ln -s $(CHROOTREL)/conf $(INSTALL_CFG_DEST); \
|
|
$(INSTALL_BIN) $(INSTALL_CFG) $(ETCDIR)/3proxy.cfg; \
|
|
$(INSTALL_BIN) $(INSTALL_CFG_INCHROOT) $(INSTALL_CFG_DEST)/3proxy.cfg; \
|
|
fi
|
|
|
|
install-etc: install-etc-dir install-etc-default-config
|
|
for file in $(INSTALL_CFG_OBJS2); \
|
|
do \
|
|
touch $(INSTALL_CFG_DEST)/$$file; chmod 0600 $(INSTALL_CFG_DEST)/$$file; \
|
|
done;
|
|
|
|
install-man:
|
|
$(INSTALL_BIN) -d $(MANDIR5)
|
|
$(INSTALL_BIN) -d $(MANDIR8)
|
|
$(INSTALL_DATA) man/3proxy.cfg.5 $(MANDIR5)
|
|
$(INSTALL_DATA) man/3proxy.8 $(MANDIR8)
|
|
for f in proxy socks pop3p imapp smtpp ftppr tcppm udppm tlspr; do \
|
|
if [ -f man/$$f.8 ] && [ -f bin/$(PREFIX)$$f ]; then $(INSTALL_DATA) man/$$f.8 $(MANDIR8)/$(PREFIX)$$f.8; fi; \
|
|
done
|
|
$(INSTALL_DATA) man/3proxy_crypt.8 $(MANDIR8)/$(CRYPT_PREFIX)crypt.8
|
|
|
|
install-init:
|
|
$(INSTALL_BIN) -d $(SYSTEMDDIR)
|
|
sed -e 's|@CMAKE_INSTALL_FULL_BINDIR@|$(exec_prefix)/bin|g' -e 's|@CMAKE_INSTALL_FULL_SYSCONFDIR@|/etc|g' $(INSTALL_SYSTEMD_SCRIPT) > $(SYSTEMDDIR)/3proxy.service
|
|
$(INSTALL_BIN) -d $(INITDDIR)
|
|
$(INSTALL_BIN) $(INSTALL_INITD_SCRIPT) $(INITDDIR)/3proxy
|
|
|
|
install-log:
|
|
$(INSTALL_BIN) -d $(LOGBASE)
|
|
@if [ ! -d $(LOGDIR) ]; then \
|
|
ln -s $(CHROOTREL)/logs $(LOGDIR);\
|
|
fi
|
|
|
|
install: install-chroot-dir install-bin install-etc install-log install-man install-init
|
|
@if [ "$(DESTDIR)" = "" ]; then \
|
|
sh debian/preinst; \
|
|
sh debian/postinst; \
|
|
fi
|