RPM验证与数字签名(Verify/Signature)

摘自:https://blog.csdn.net/rhel_admin/article/details/32382391

2014年06月19日 23:17:42
阅读数:2798

RPM验证:

使用RPM数据库(/var/lib/rpm)的内容来比对目前Linux系统RPM软件文件,查看是否有改动。

简单的用法:


  1. $rpm -Va #验证系统所有RPM包
  2. $rpm -V 已安装的RPM包 #验证指定的RPM包
  3. $rpm -Vf 某个RPM包文件 #验证这个文件
  4. $rpm -Vf /etc/yum.conf
  5. S.5....T. c /etc/yum.conf
  6. $

现在来简单的解释一下验证后的输出,输出一般来说有两部分;

表示文件的9个属性信息

  • S file Size differs 文件大小是否被改动
  • M Mode differs(includes permissions and file type) 文件的属性和类型是否被改动
  • 5 MD5 sum differs MD5内容是否被改动
  • D Device major/minor number mismatch 设备的主/次代码是否被改动
  • L readLink(2) path mismatch Link路径是否被改动
  • U User ownership differs 文件的所有人是否被改动
  • G Group ownership differs 文件的组是否被改动
  • T mTime differs 文件的修改是否是否被改动
  • P caPabilities differ

表示文件格式的信息

  • c %config configuration file 配置文件
  • d %doc documentation file 文档文件
  • g %ghost file 通常是该文件不会被某个燃机所包含 较少发生
  • l %license license file 许可证文件
  • r %readme readme file 自述文件

RPM数字签名:

这里主要从制作RPM的时候加入数字签名,这里用的是GPG。

这里简单说明一下GPG与PGP不同之处。来自与Fedora_RPM_documentation

GPG and PGP? Acronyms Explained
The RPM documentation uses GPG and PGP pretty much interchangeably, so much so, in fact, that you may think these are typographical errors. Not so.
PGP stands for Pretty Good Privacy. Invented by Phil Zimmerman, PGP was originally invented to encrypt e-mail to allow for private communication. Based on a public-key cryptography algorithm, PGP also supports encrypted digital signatures. These signatures allow you to verify that a package you have downloaded really comes from the vendor you think it does. You do this by using the vendor’s public key.
GPG stands for GNU Privacy Guard, a free, open-source implementation of PGP from the GNU project. GPG aims to be compatible with the OpenPGP Internet standard as defined in RFC 2440. It started when a number of developers wanted a free implementation. One such free implementation, GPG, allows Linux vendors such as Red Hat to include PGP in their products. So, in a sense, GPG provides PGP.
PGP has a long and somewhat troubled history as an open-source product and as a commercial product. See www.philzimmermann.com for background on PGP and its long history. See www.gnupg.org for more details on GPG.

手动生成数字签名可查看官网:https://www.gentoo.org/doc/zh_cn/gnupg-user.xml 两个注意事项

  1. 创建数字认证之前要确保gpg-agent在运行,因为需要它穿件一个socket或者pipe用于连接 $gpg-agent --daemon --use-standard-socket
  2. 创建数字认证的时候不要用su之后的用户 如果用的话gpg-agent将会失败 gpg-agent fails to launch/usr/bin/pinentry (which in turn decides whether to launchpinentry-curses, or a QT or GTK equivalent).

一旦有了数字认证key,就可以在制作RPM的时候设置相关数字签名宏。添加下面的代码到$HOME/.rpmmacros


  1. %_signature gpg
  2. %_gpg_path /home/xxx/.gnupg
  3. %_gpg_name xxx <email address>
  4. %_gpgbin /usr/bin/gpg

这样就可以在制作RPM包的时候加上--sign参数来加上数字签名。

$rpmbuild -ba --sign xxx.spec

也可以对现有的RPM包增加数字签名。

$rpm --addsign package.rpm

也可以对现有的RPM修改数字签名。

$rpm --resign package.rpm 

验证一个RPM包的数字签名


  1. $rpm -K -v package.rpm
  2. $rpm -K -vv package.rpm

RPM验证与数字签名(Verify/Signature)的更多相关文章

  1. Azure Service Bus 中的身份验证方式 Shared Access Signature

    var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...

  2. 安装mysql警告 warning: mysql-community-server-5.7.19-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

    摘自:https://www.cnblogs.com/royfans/p/7243641.html 红帽安装rpm安装MySQL时爆出警告: 警告:MySQL-server-5.5.46-1.linu ...

  3. warning: mysql-community-libs-5.7.11-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5

    1.错误描写叙述 [root@ mysql]# rpm -ivh mysql-community-libs-5.7.11-1.el7.x86_64.rpm warning: mysql-communi ...

  4. 警告:MySQL-server-5.6.26-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY

    警告:MySQL-server--.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY 错误:依赖检测失败: /usr/bin/ ...

  5. rpm安装软件时提示warning: *.rpm: Header V3 RSA/SHA256 Signature, keykey ID c105b9de

    在RedHat下有时候用rpm安装软件是会出现下面则中错误 1.安装时提示:warning: *.rpm: Header V3 RSA/SHA256 Signature, keykey ID c105 ...

  6. Java 添加、验证PDF 数字签名

    在设置文档内容保护的方法中,除了对文档加密.添加水印外,应用数字签名也是一种有效防伪手段.数字签名的文件比较容易验证,并且具有较高的权威性和可信度.在PDF文档中,有可直接添加或验证数字签名的功能方法 ...

  7. 密码学初级教程(六)数字签名 Digital Signature

    密码学家工具箱中的6个重要的工具: 对称密码 公钥密码 单向散列函数 消息认证码 数字签名 伪随机数生成器 提问: 有了消息认证码为什么还要有数字签名? 因为消息认证码无法防止否认.消息认证码可以识别 ...

  8. (转)Python rsa 签名与验证 sign and verify

    转自:http://wawehi.blog.163.com/blog/static/143780306201371361120515/ 网上一搜一大把的 python rsa 相关的东西,python ...

  9. 表单验证控件Verify.js

    自己工作常用到表单录入验证,就顺手写了一个验证控件,刚开始写得很烂.多年后翻出来,又优化了一下,增加了一些功能.拿出来分享分享. 主要功能就是表单的录入验证. * 1.当录入框必填时,在控件后生成红色 ...

随机推荐

  1. APP登录的机制

    1.APP每次发送请求时,都会发送header给服务器,服务器去校验传过来的信息是否正确:校验成功后登录成功,若传入的信息不符合该用户的信息则服务器判断,传给APP登录失败 每次的请求都会传入上图中的 ...

  2. SQL Server数据文件迁移

    需求:源SQL Server安装目录及数据目录 与 目标SQL Server安装目录及数据目录 完全不同. 步骤: 1.拷贝源数据目录下需要移植的库文件(rpBrInfo_TA.mdf.rpBrInf ...

  3. 【机器学习】集成学习之xgboost的sklearn版XGBClassifier使用教程

    XGBClassifier是xgboost的sklearn版本.代码完整的展示了使用xgboost建立模型的过程,并比较xgboost和randomForest的性能. # -*- coding: u ...

  4. Arc066_F Contest with Drinks Hard

    传送门 题目大意 有一个长为$N$的序列$A$,你要构造一个长为$N$的$01$序列使得$01$序列全部由$1$组成的子串个数$-$两个序列的对应位置两两乘积之和最大,每次独立的询问给定$pos,x$ ...

  5. Directx 9 VS2015环境搭建

    安装好Directx9 sdk和vs2015后 打开vs,新建项目 --> c++项目  -->win32控制台应用程序-->空项目 创建项目后,右键项目属性, 包含目录 D:\Pr ...

  6. 关于C语言字符串函数使用的一点心得

    就字符串的拼接函数为例strcat. 原型:extern char *strcat(char *dest,char *src);用法:#include <string.h> 功能:把src ...

  7. Filebeat 5.x 日志收集器 安装和配置

    Filebeat 5.x版本 风来了.fox 1.下载和安装 https://www.elastic.co/downloads/beats/filebeat 这里选择 LINUX 64-BIT 即方式 ...

  8. 第二篇 Mysql常用操作记录(转载)

    我们在创建网站的时候,一般需要用到数据库.考虑到安全性,建议使用非root用户.常用命令如下: 1.新建用户 //登录MYSQL@>mysql -u root -p@>密码//创建用户my ...

  9. Mongodb 副本集的节点详细操作

    副本集操作 官方文档:https://docs.mongodb.com/v3.2/reference/method/js-replication/ 1 rs.add(){ _id: <int&g ...

  10. RabbitMQ 消息队列 安装及使用

    RabbitMQ 消息队列安装: linux版本:CentOS 7 安装第一步:先关闭防火墙 1.Centos7.x关闭防火墙 [root@rabbitmq /]# systemctl stop fi ...