由salt执行时,rsync身份验证失败

时间:2018-07-09 15:34:31

标签: rsync salt salt-stack

Rsync在没有密码文件的情况下可以通过salt正常运行,但是今天添加密码文件后,它不再起作用:

# salt 10.10.70.202 rsync.rsync rsync://10.10.81.71:9999/test /tmp/test/ delete=True passwordfile=/etc/rsync.passwd
10.10.70.202:
    ----------
    pid:
        105711
    retcode:
        5
    stderr:
        @ERROR: auth failed on module test
        rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.9]
    stdout:
ERROR: Minions returned with non-zero exit code

它正在使用salt rsync模块,通过bash命令运行的结果相同:

# salt 10.10.70.202 cmd.run '/usr/bin/rsync -avz --delete rsync://10.10.81.71:9999/test /tmp/test/ --password-file=/etc/rsync.passwd'
10.10.70.202:
    @ERROR: auth failed on module test
    rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.9]
ERROR: Minions returned with non-zero exit code

但是,当我在rsync客户端本地计算机(10.10.70.202)上执行同一命令时,该命令正常工作:

#/usr/bin/rsync -avz --delete rsync://10.10.81.71:9999/test /tmp/test/ --password-file=/etc/rsync.passwd
receiving incremental file list

sent 54 bytes  received 108 bytes  324.00 bytes/sec
total size is 0  speedup is 0.00

Rsync服务器配置(10.10.81.71):

# cat /etc/rsyncd.conf
pid file = /var/run/rsyncd.pid
port = 9999
address = 10.10.81.71
uid = root
gid = root
use chroot = no
read only = no
max connections = 20
lock file = /var/run/rsync.lock
log file = /var/log/rsync.log
#motd file = /etc/rsyncd/rsyncd.motd
timeout = 300
auth users = root
secrets file = /etc/rsyncd.secrets

[test]
path = /tmp/test/
read only = no

# cat /etc/rsyncd.secrets
root:applepen

Rsync客户端配置(10.10.70.202):

# ls -l /etc/rsync.passwd 
-rw------- 1 root root 9 Jul  9 22:47 /etc/rsync.passwd

# cat /etc/rsync.passwd 
applepen

当密码不正确时,错误消息与rsync相同,因此我猜想它是否与salt有关,但未读取正确的密码文件内容:

# echo 'foobar' > /etc/rsync.passwd 
# /usr/bin/rsync -avz --delete rsync://10.10.81.71:9999/test /tmp/test/ --password-file=/etc/rsync.passwd
@ERROR: auth failed on module test
rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.9]

我还检查了salt rsync模块,找不到有用的信息。
盐版本:

# salt --versions-report
           Salt: 2015.5.11
         Python: 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
         Jinja2: unknown
       M2Crypto: 0.20.2
 msgpack-python: 0.4.6
   msgpack-pure: Not Installed
       pycrypto: 2.0.1
        libnacl: Not Installed
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.3.1
           RAET: Not Installed
            ZMQ: 3.2.5
           Mako: Not Installed
        Tornado: Not Installed
        timelib: Not Installed
       dateutil: Not Installed

任何建议都非常感谢!

[更新] 我部署了另一个带有最新Salt版本的Salt环境,仍然可以重现该问题,可能是功能错误,决定将该问题升级到Saltstack。

# salt --versions-report
Salt Version:
           Salt: 2018.3.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.13 (default, Mar 30 2018, 15:31:59)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: centos 6.5 Final
         locale: UTF-8
        machine: x86_64
        release: 2.6.32-431.11.25.el6.ucloud.x86_64
         system: Linux
        version: CentOS 6.5 Final

[更新]

打开#48517来跟踪此问题。

1 个答案:

答案 0 :(得分:0)

通过设置salt内部的环境变量,salt没有将密码文件内容或环境变量spark_config <- spark_config() spark_config$spark.executor.memory <- "11G" spark_config$`sparklyr.shell.driver-memory` <- "11G" spark_config$spark.dynamicAllocation.enabled <- FALSE spark_config$`spark.yarn.executor.memoryOverhead` <- "1G" spark_config$spark.executor.instances <- 32 sc <- spark_connect(master = "yarn-client", config = spark_config) 传递给rsync来解决此问题,这导致rsync身份验证失败。

RSYNC_PASSWORD