🔗 使用 eCAP 从带有 Squid 的图像中剥离 EXIF
作者:Yuri Voinov
🔗 目录
由于 EXIF 可用于跟踪,因此最好移除上传到网络的图像和文档中的元数据。为此,您可以使用此 重新设计和改进的适配器(来自 原始版本 的分支)。
🔗 构建 eCAP EXIF 适配器
注意:此适配器对其依赖项至关重要。由于存储库经常包含旧版本,因此建议尽可能从最新的源代码构建依赖项,如下所示。
首先,构建并安装依赖项
#### Dependencies (for PoDoFo)
## Fontconfig
## Freetype2
##
## On Solaris install this:
## CSWlibfreetype-dev
## CSWlibfreetype6
## CSWfontconfig-dev
## CSWfontconfig
##
## Debian dependencies:
## apt-get install exiv2 libtag1v5 libtag1-dev libzip4 libzip-dev libpodofo0.9.6 libpodofo-dev
## Note: Always use as fresh dependencies packages as possible.
----------------------------------------------------------------------------------------------------
*** Build libtag
## 64 bit
mkdir build
cd build
CC=/opt/csw/bin/gcc CXXFLAGS=-m64 cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=TRUE ..
## 32 bit
mkdir build
cd build
CC=/opt/csw/bin/gcc CXXFLAGS=-m32 cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS:BOOL=TRUE ..
make -j8
make install
----------------------------------------------------------------------------------------------------
*** Build libzip
## 64 bit
mkdir build
cd build
CC=/opt/csw/bin/gcc CFLAGS=-m64 cmake ..
## 32 bit
mkdir build
cd build
CC=/opt/csw/bin/gcc CFLAGS=-m32 cmake ..
make -j8
make install
----------------------------------------------------------------------------------------------------
*** Build exiv
## Note: Use DevStudio on Solaris
## 64 bit
mkdir build
cd build
CFLAGS=-m64 CXXFLAGS=-m64 LDFLAGS='-lsocket -lnsl' cmake ..
## 32 bit
mkdir build
cd build
CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS='-lsocket -lnsl' cmake ..
make -j8
make install
----------------------------------------------------------------------------------------------------
*** Build PoDoFo
## 64 bit
## Note: FREETYPE_INCLUDE_DIR and FREETYPE_LIBRARY depends from your system. Adjust it.
mkdir podofo-build
cd podofo-build
CC=/opt/csw/bin/gcc CFLAGS=-m64 CXXFLAGS=-m64 cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local" \
-DCMAKE_BUILD_TYPE=RELEASE \
-DFREETYPE_LIBRARY="/opt/csw/lib" \
-DFREETYPE_INCLUDE_DIR="/opt/csw/include/freetype2" \
-DPODOFO_BUILD_LIB_ONLY:BOOL=TRUE \
-DPODOFO_BUILD_SHARED:BOOL=TRUE \
-DPODOFO_BUILD_STATIC:BOOL=TRUE ..
make -j8
make install
确保所有共享库都已安装。
注意:根据您的设置,使用正确的编译器完整路径。上面的命令是我的系统特定的。
然后,构建并安装适配器
*** Build ecap-exif
## Note: /opt/csw/include is Solaris. Adjust it.
## Note: Optimization level -O3 enabled by default.
./configure 'CXXFLAGS=-m64 -mtune=native' 'LDFLAGS=-L/usr/local/lib' 'CPPFLAGS=-I/usr/local/include/podofo -I/usr/local/include -I/opt/csw/include'
or
./configure 'CXXFLAGS=-m32 -mtune=native' 'LDFLAGS=-L/usr/local/lib' 'CPPFLAGS=-I/usr/local/include/podofo -I/usr/local/include -I/opt/csw/include'
make -j8
make install-strip
注意:运行前,请确保所有依赖项都已通过 ldd -d 命令检查过。任何依赖项函数/库上都不应有悬空引用。
🔗 适配器配置
适配器通过 squid.conf 中的 ecap_service 参数进行配置。
支持的配置参数
tmp_filename_format
Set the format of temporary files that will be processed
by the adapter.
memory_filesize_limit
Files with size greater than limit will be stored in temporary
disk storage, otherwise processing will be done in RAM.
exclude_types
List of semicolon seprated MIME types which shouldn't be
handled by adapter.
🔗 Squid 配置文件
像这样粘贴配置文件
ecap_enable on
loadable_modules /usr/local/lib/ecap_adapter_exif.so
ecap_service eReqmod reqmod_precache bypass=off ecap://www.thecacheworks.com/exif-filter
adaptation_service_set reqFilter eReqmod
adaptation_access reqFilter allow all
最后,重新启动您的 Squid 并享受。
使用以下命令记录调试消息
debug_options ALL,1 93,9
为确保适配器正常工作,请使用 此网站。只需在上传前检查原始图像,然后通过代理将其上传到任何社交媒体,下载后再次检查元数据。如果没有元数据 - 说明一切运行正常。
⚠️ Disclaimer: Any example presented here is provided "as-is" with no support
or guarantee of suitability. If you have any further questions about
these examples please email the squid-users mailing list.
类别: ConfigExample
导航:网站搜索、网站页面、类别、🔼 向上