首页 > 解决方案 > 客户端主机被拒绝:找不到您的反向主机名

问题描述

可以发送但不能从 Gmail 接收。Postfix 在 3.6.2 上,操作系统是 Ubuntu 18.04。

我正在尝试在我的 Postfix 服务器上设置 chroot。我使用了examples\chroot-setupLINUX2中的脚本。本文提到了我的确切问题,但对脚本的调整没有任何作用:https ://titanwolf.org/Network/Articles/Article?AID=34a1b4ec-6d41-44f7-a914-e822d6b61351#gsc.tab=0 (它似乎被翻译了,而且很差。)

运行 LINUX2 脚本后,lib 和 lib64 ( /var/spool/postfix ) 为空。我需要的库在我的系统上,但有些在 /lib/x86_64-linux-gnu/ 中,另一些在/usr/lib/x86_64-linux-gnu中。文件名似乎也有所不同。即使我将两个文件夹都复制到 lib64 并重新启动 Postfix,我仍然无法接收。当然,如果我从 smtp 中删除 chroot,它就可以正常工作。

标签: postfix-mtachrootreverse-dns

解决方案


我意识到我正在从正确的目录复制到 chroot 中的错误目录。这是完整的工作脚本,我的更改由两边的三个 # 表示:

#! /bin/sh

CP="cp -p"

cond_copy() {
  # find files as per pattern in $1
  # if any, copy to directory $2
  dir=`dirname "$1"`
  pat=`basename "$1"`
  ### Added a slash to $dir ###
  lr=`find "$dir/" -maxdepth 1 -name "$pat"`
  if test ! -d "$2" ; then exit 1 ; fi
  if test "x$lr" != "x" ; then $CP $1 "$2" ; fi
} 

set -e
umask 022

POSTFIX_DIR=${POSTFIX_DIR-/var/spool/postfix}
cd ${POSTFIX_DIR}

mkdir -p etc lib usr/lib/zoneinfo lib/x86_64-linux-gnu usr/lib/x86_64-linux-gnu
test -d /lib64 && mkdir -p lib64

# find localtime (SuSE 5.3 does not have /etc/localtime)
lt=/etc/localtime
if test ! -f $lt ; then lt=/usr/lib/zoneinfo/localtime ; fi
if test ! -f $lt ; then lt=/usr/share/zoneinfo/localtime ; fi
if test ! -f $lt ; then echo "cannot find localtime" ; exit 1 ; fi
rm -f etc/localtime

# copy localtime and some other system files into the chroot's etc
$CP -f $lt /etc/services /etc/resolv.conf /etc/nsswitch.conf etc
$CP -f /etc/host.conf /etc/hosts /etc/passwd etc
ln -s -f /etc/localtime usr/lib/zoneinfo

### My "fix" for Ubuntu. ###
if test -d /lib/x86_64-linux-gnu; then
  cond_copy '/lib/x86_64-linux-gnu/libnss_*.so*' lib/x86_64-linux-gnu
  cond_copy '/lib/x86_64-linux-gnu/libresolv.so*' lib/x86_64-linux-gnu
  cond_copy '/lib/x86_64-linux-gnu/libdb.so*' lib/x86_64-linux-gnu
fi
if test -d /usr/lib/x86_64-linux-gnu; then
  cond_copy '/usr/lib/x86_64-linux-gnu/libnss_*.so*' usr/lib/x86_64-linux-gnu
  cond_copy '/usr/lib/x86_64-linux-gnu/libresolv.so*' usr/lib/x86_64-linux-gnu
  cond_copy '/usr/lib/x86_64-linux-gnu/libdb.so*' usr/lib/x86_64-linux-gnu
fi
### End fix ###

postfix reload

推荐阅读