在Ubuntu 12.04.3 LTS 上安装salt-minion后,启动服务时报错。
经过摸索,终于把这个问题解决了,方法提供出来,给有需要的同学。
基本信息
root@HKNTT32-232:/var/log/salt# salt-minion --versions-report
Salt: 2014.1.4
Python: 2.7.3 (default, Sep 26 2013, 20:03:06)
Jinja2: 2.6
M2Crypto: Not Installed
msgpack-python: 0.1.10
msgpack-pure: Not Installed
pycrypto: 2.6.1
PyYAML: 3.10
PyZMQ: 13.0.0
ZMQ: 3.2.2
日志
/var/log/salt/minion
2014-06-04 16:07:27,624 [salt.log.setup ][ERROR ] An un-handled exception was caught by salt's global exception handler:
NameError: global name 'RSA' is not defined
Traceback (most recent call last):
File "/usr/bin/salt-minion", line 14, in
salt_minion()
File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 35, in salt_minion
minion.start()
File "/usr/lib/pymodules/python2.7/salt/__init__.py", line 221, in start
self.prepare()
File "/usr/lib/pymodules/python2.7/salt/__init__.py", line 209, in prepare
self.minion = salt.minion.Minion(self.config)
File "/usr/lib/pymodules/python2.7/salt/minion.py", line 544, in __init__
self.authenticate(timeout, safe)
File "/usr/lib/pymodules/python2.7/salt/minion.py", line 1063, in authenticate
self.tok = auth.gen_token('salt')
File "/usr/lib/pymodules/python2.7/salt/crypt.py", line 232, in gen_token
return self.get_keys().private_encrypt(clear_tok, 5)
File "/usr/lib/pymodules/python2.7/salt/crypt.py", line 223, in get_keys
self.opts.get('user'))
File "/usr/lib/pymodules/python2.7/salt/crypt.py", line 96, in gen_keys
gen = RSA.gen_key(keysize, 65537, callback=lambda x, y, z: None)
NameError: global name 'RSA' is not defined
原因是 M2Crypto openssl 1.0里的没有添加sslv2 , M2Crypto在封装的时候会报错。 这就需要把这个补丁打上。
-
#!/bin/bash
-
PATCH="
-
--- SWIG/_ssl.i 2011-01-15 20:10:06.000000000 +0100
-
+++ SWIG/_ssl.i 2012-06-17 17:39:05.292769292 +0200
-
@@ -48,8 +48,10 @@
-
%rename(ssl_get_alert_desc_v) SSL_alert_desc_string_long;
-
extern const char *SSL_alert_desc_string_long(int);
-
-
+#ifndef OPENSSL_NO_SSL2
-
%rename(sslv2_method) SSLv2_method;
-
extern SSL_METHOD *SSLv2_method(void);
-
+#endif
-
%rename(sslv3_method) SSLv3_method;
-
extern SSL_METHOD *SSLv3_method(void);
-
%rename(sslv23_method) SSLv23_method;"
-
-
pip install --download="." m2crypto==0.21.1
-
tar -xf M2Crypto-*.tar.gz
-
rm M2Crypto-*.tar.gz
-
cd M2Crypto-*
-
echo "$PATCH" | patch -p0
-
python setup.py install
阅读(4191) | 评论(1) | 转发(1) |