You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning

简介: su -s /bin/sh -c "glance-manage db_sync" glance/usr/lib64/python2.6/site-packages/Crypto/Util/number.

su -s /bin/sh -c "glance-manage db_sync" glance
/usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning                                                                             : Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing                                                                              attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid                                                                              timing attack vulnerability.", PowmInsecureWarning)
[root@controller ~]# rpm -ivh libgmp
error: open of libgmp failed: No such file or directory

  undefined symbol: rpl_malloc

export ac_cv_func_malloc_0_nonnull=yes

CentOS 编译安装 PyCrypto

 

来自:http://bugcharmer.blogspot.com/2012/07/building-pycrypto-on-amazon-ec2.html

Step 1 - Install gcc/make

$ sudo yum install gcc$ sudo yum install make

That was easy.

Step 2 - Install the GNU MP Arithmetic Library

$ wget ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2$ bunzip2 gmp-5.0.5.tar.bz2$ cd gmp-5.0.5$ sudo ./configure$ sudo make$ sudo make check$ sudo make install$ cd 

Still not too bad.

Step 3 - Install MPIR

$ wget http://www.mpir.org/mpir-2.5.1.tar.bz2$ bunzip mpir-2.5.1.tar.bz2$ cd mpir-2.5.1$ sudo ./configure$ sudo make$ sudo make check$ sudo make install $ cd

Everything worked up through here.

Intermission

There are two problems you’ll run into if you try to build PyCrypto at this point: errors from missing header files and, once you resolve those, runtime errors complaining about an undefined symbol for rpl_malloc. Let’s fix that.

Step 4 - Install the Python development headers

$ sudo yum install python-devel

Easy fix.

Step 5 - Download PyCrypto

$ wget http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz $ tar xzvf pycrypto-2.6.tar.gz$ cd pycrypto-2.6

Step 6 - Edit the configure script

$ [favorite editor] configure

Find the this section of the script (I added line numbers):

:   if test $ac_cv_func_malloc_0_nonnull = yes; then::  :   $as_echo "#define HAVE MALLOC 1" >> confdefs.h:  :   else:       $as_echo "define HAVE_MALLOC 0" >> confdefs.h: :   case " $LIBOBJS " in:   *" malloc.$ac_objext "* ) ;;:   *) LIBOBJS = "$LIBOBJS malloc.$ac_objext":  ;;:  esac:; :  $as_echo "define malloc rpl_malloc" >>confdefs.h::  fi

Keep line 3867, but comment out the rest. Save and exit.

or

$ export ac_cv_func_malloc_0_nonnull=yes

The problem is that when you try to build PyCrypto, autotools thinks that we’re using rpl_malloc instead of malloc. I’m not sure how to fix this problem the right way, but this hack will get rid of the check and just have it use malloc. If someone knows the right way to fix this, please say something in the comments and I’ll update this post.

否则会有如下错误:

ImportError: /usr/local/lib/python2.6/dist-packages/pycrypto-2.6-py2.6-linux-x86_64.egg/Crypto/Cipher/_AES.so: undefined symbol: rpl_malloc

Step 7 - Build PyCrypto

$ python setup.py build$ sudo python.setup.py install

Step 8 - Test PyCrypto

$ python>>> from Crypto.Cipher import AES

If this works, you should be good to go.

If it fails, you did something wrong. You can either rm -r pycrypto-2.6 and re-extract the archive or just rm -r the build folder then grep for anything that says “rpl_malloc” and comment it out. Also edit config.status and change ‘D[“HAVE_MALLOC”]=” 0”’ to say ‘=” 1”’. This is what I did the first time, but when I decided to write this up I started over to try to get it right from the start.

Have fun.

 

目录
相关文章
|
SQL 机器学习/深度学习 存储
七大经典技术场景!Apache Flink 在多维领域应用的 40+ 实践案例
随着 Apache Flink 自身的发展,越来越多的企业选择 Apache Flink 应用于自身的业务场景,如底层平台建设、实时数仓、实时推荐、实时分析、实时大屏、风控、数据湖等场景中,解决实时计算的需求。
七大经典技术场景!Apache Flink 在多维领域应用的 40+ 实践案例
|
存储 Java C语言
lua变量、数据类型、if判断条件和数据结构table以及【lua 函数】
lua变量、数据类型、if判断条件和数据结构table以及【lua 函数】
269 0
|
前端开发 JavaScript 数据处理
前端新手指南:如何解决JavaScript导出CSV文件不完整的问题
【6月更文挑战第4天】在JavaScript中处理CSV文件时,需要特别注意一些特殊字符,例如逗号、双引号、换行符等。这些字符可能会影响CSV文件的解析,导致数据错乱。
427 0
|
机器学习/深度学习 监控 API
基于云计算的机器学习模型部署与优化
【8月更文第17天】随着云计算技术的发展,越来越多的数据科学家和工程师开始使用云平台来部署和优化机器学习模型。本文将介绍如何在主要的云计算平台上部署机器学习模型,并讨论模型优化策略,如模型压缩、超参数调优以及分布式训练。
1664 2
|
XML 前端开发 IDE
在 Compose 中使用 Jetpack 组件库
Jeptack Compose 主要目的是提高 UI 层的开发效率,但一个完整项目还少不了逻辑层、数据层的配合。幸好 Jetpack 中不少组件库已经与 Compose 进行了适配。
1184 0
|
关系型数据库 Java MySQL
从0开始部署阿里云服务器(萌新必看)
搭建阿里云服务器涉及购买、控制台介绍及配置。购买时可选择免费试用或直接购买,根据需求选择计费方式和地区。在服务器控制台,可找到实例并进行远程连接。配置包括Java环境,卸载OpenJDK,下载安装Java,配置环境变量。接着配置Tomcat,下载对应版本,解压并启动,确保防火墙允许8080端口。最后配置MySQL,安装,设置密码,更新远程访问权限。整个过程旨在提供一个基础的云服务器配置指南。
3248 1
|
数据采集 监控 调度
C#网络爬虫之TianyaCrawler实战经验分享
C#网络爬虫之TianyaCrawler实战经验分享
|
SQL 关系型数据库 MySQL
如何自动填充creatTime和updateTime两种字段
如何自动填充creatTime和updateTime两种字段
420 0
|
关系型数据库 MySQL 数据库
MySQL 8 全局变量的修改持久化 set persist
在8之前的版本中,对于全局变量的修改,其只会影响其内存值,而不会持久化到配置文件中。数据库重启,又会恢复成修改前的值。从8开始,可通过SET PERSIST命令将全局变量的修改持久化到配置文件中。
556 0
|
存储 Kubernetes 数据安全/隐私保护
K8S | Config应用配置
不论是应用还是运行层面的配置,都会涉及到一个基本的逻辑:配置可以抽取出来单独管理,在流程中直接引入该配置即可;
386 0