CentOSにて/etc/shadowで使うsalt付きSHA-512生成方法

KickstartとかChefとかを使っていると、
ユーザーのパスワードを事前にハッシュ化しておきたい時が
たびたび出てくるんだけど、毎回調べているような気がしたのでメモ

検索すると

How to create SHA512 password hashes on command line

とかがヒットして中身を読むと、

「mkpasswdコマンドで生成できるよ!ただしDebian系のwhoisパッケージに含まれている物だけど」

ということらしく、素直には作成できないみたい。。

試しにCentOS6で利用できるmkpasswdが含まれているパッケージを検索してみる

[vagrant@localhost ~]$ yum provides "*/mkpasswd"
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
base/filelists_db                                                                                                                                                                                                                                       | 5.9 MB     00:01
extras/filelists_db                                                                                                                                                                                                                                     |  11 kB     00:00
updates/filelists_db                                                                                                                                                                                                                                    | 1.1 MB     00:00
expect-5.44.1.15-5.el6_4.x86_64 : A program-script interaction and testing utility
Repo        : base
Matched from:
Filename    : /usr/bin/mkpasswd

expectパッケージにあるらしいので入れて、インストールしてmanを見てみる

MKPASSWD(1)                                                        MKPASSWD(1)

NAME
       mkpasswd - generate new password, optionally apply it to a user

SYNOPSIS
       mkpasswd [ args ] [ user ]

INTRODUCTION
       mkpasswd generates passwords and can apply them automatically to users.  mkpasswd is based on the code from Chapter 23 of the O’Reilly book "Exploring Expect".

USAGE
       With no arguments, mkpasswd returns a new password.

            mkpasswd

       With a user name, mkpasswd assigns a new password to the user.

            mkpasswd don

       The passwords are randomly generated according to the flags below.

FLAGS
       The -l flag defines the length of the password.  The default is 9.  The following example creates a 20 character password.

            mkpasswd -l 20

       The -d flag defines the minimum number of digits that must be in the password.  The default is 2.  The following example creates a password with at least 3 digits.

            mkpasswd -d 3

       The -c flag defines the minimum number of lowercase alphabetic characters that must be in the password.  The default is 2.

       The -C flag defines the minimum number of uppercase alphabetic characters that must be in the password.  The default is 2.

       The -s flag defines the minimum number of special characters that must be in the password.  The default is 1.

       The -p flag names a program to set the password.  By default, /etc/yppasswd is used if present, otherwise /bin/passwd is used.

       The  -2 flag causes characters to be chosen so that they alternate between right and left hands (qwerty-style), making it harder for anyone watching passwords being entered.  This can also make it easier for a password-guessing program.

       The -v flag causes the password-setting interaction to be visible.  By default, it is suppressed.

EXAMPLE
       The following example creates a 15-character password that contains at least 3 digits and 5 uppercase characters.

            mkpasswd -l 15 -d 3 -C 5

SEE ALSO
       "Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" by Don Libes, O’Reilly and Associates, January 1995.

AUTHOR
       Don Libes, National Institute of Standards and Technology

       mkpasswd is in the public domain.  NIST and I would appreciate credit if this program or parts of it are used.

                                22 August 1994                     MKPASSWD(1)

このコマンド自体はO’reilly社が出版しているExploring Expectという本の23章にあるスクリプトを元に作られたらしい。
そして上のサイトにで紹介されていた-mオプションはやっぱりない。。
諦めて他の選択肢を探してみると以下のサイトでgrub-cryptコマンドを使う方法が載っていた

How to create an SHA-512 hashed password for shadow?

試してみる

[vagrant@localhost ~]$ grub-crypt
Password: <= password
Retype password: <= password
$6$oU4dUcT2N1R6NnnV$vuYHtUU6AcUeClQvtwTkuLYwTpQ1QBhLU6.TtLgeAoPebuzfRX244dj/.0XBYnF9eNR1URd5ck.9xCQhDzCyl.

確かにできた。

これでいいとも思ったけどmkpasswdでもできるようにしてみたかったので
Ubuntuのwhoisのtarボールをごにょごにょしてみようと思った

まずはtarボールをダウンロードしておく

[vagrant@localhost ~]$ wget https://launchpad.net/ubuntu/+archive/primary/+files/whois_5.0.26.tar.xz
--2014-02-01 14:32:01--  https://launchpad.net/ubuntu/+archive/primary/+files/whois_5.0.26.tar.xz
Resolving launchpad.net... 91.189.89.223, 91.189.89.222
Connecting to launchpad.net|91.189.89.223|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://launchpadlibrarian.net/145138175/whois_5.0.26.tar.xz [following]
--2014-02-01 14:32:02--  https://launchpadlibrarian.net/145138175/whois_5.0.26.tar.xz
Resolving launchpadlibrarian.net... 91.189.89.229, 91.189.89.228
Connecting to launchpadlibrarian.net|91.189.89.229|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 72508 (71K) [application/octet-stream]
Saving to: “whois_5.0.26.tar.xz”

100%[==================================================>] 72,508      80.6K/s   in 0.9s

2014-02-01 14:32:04 (80.6 KB/s) - “whois_5.0.26.tar.xz” saved [72508/72508]

展開してみる

[vagrant@localhost ~]$ tar xvf whois_5.0.26.tar.xz
whois-5.0.26/
whois-5.0.26/as_del_list
whois-5.0.26/whois.conf.5
whois-5.0.26/ip_del_list
whois-5.0.26/whois.1
whois-5.0.26/mkpasswd.1
whois-5.0.26/README
whois-5.0.26/debian/
whois-5.0.26/debian/source/
whois-5.0.26/debian/source/options
whois-5.0.26/debian/source/format
whois-5.0.26/debian/copyright
whois-5.0.26/debian/compat
whois-5.0.26/debian/changelog
whois-5.0.26/debian/rules
whois-5.0.26/debian/control
whois-5.0.26/simple_recode.h
whois-5.0.26/as32_del_list
whois-5.0.26/COPYING
whois-5.0.26/make_as32_del.pl
whois-5.0.26/make_as_del.pl
whois-5.0.26/utils.h
whois-5.0.26/make_servers_charset.pl
whois-5.0.26/config.h
whois-5.0.26/ip6_del_list
whois-5.0.26/mkpasswd.c
whois-5.0.26/whois.spec
whois-5.0.26/po/
whois-5.0.26/po/fr.po
whois-5.0.26/po/es.po
whois-5.0.26/po/it.po
whois-5.0.26/po/pl.po
whois-5.0.26/po/fi.po
whois-5.0.26/po/zh_CN.po
whois-5.0.26/po/el.po
whois-5.0.26/po/pt_BR.po
whois-5.0.26/po/de.po
whois-5.0.26/po/cs.po
whois-5.0.26/po/eu.po
whois-5.0.26/po/ja.po
whois-5.0.26/po/da.po
whois-5.0.26/po/Makefile
whois-5.0.26/po/no.po
whois-5.0.26/po/ru.po
whois-5.0.26/make_ip6_del.pl
whois-5.0.26/whois.h
whois-5.0.26/whois.conf
whois-5.0.26/Makefile
whois-5.0.26/data.h
whois-5.0.26/make_tld_serv.pl
whois-5.0.26/whois.c
whois-5.0.26/simple_recode.c
whois-5.0.26/ripe-mail
whois-5.0.26/tld_serv_list
whois-5.0.26/make_ip_del.pl
whois-5.0.26/servers_charset_list
whois-5.0.26/utils.c

ん?specファイルがあるぞ・・
パッケージ化できそう、ということで試してみる。
rpmdevtoolsとかDevelopment Toolsは導入済みの想定で

[vagrant@localhost ~]$ rpmbuild -ta whois_5.0.26.tar.xz
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.8B3dM3
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/vagrant/rpmbuild/BUILD
+ rm -rf whois-5.0.26
+ /usr/bin/xz -dc /home/vagrant/whois_5.0.26.tar.xz
+ /bin/tar -xvvf -
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/
-rw-r--r-- 0/0            1509 2013-06-11 22:45 whois-5.0.26/as_del_list
-rw-r--r-- 0/0            1301 2013-04-10 15:25 whois-5.0.26/whois.conf.5
-rw-r--r-- 0/0            6718 2013-03-30 01:31 whois-5.0.26/ip_del_list
-rw-r--r-- 0/0            7275 2013-04-10 15:26 whois-5.0.26/whois.1
-rw-r--r-- 0/0            1623 2013-03-30 01:31 whois-5.0.26/mkpasswd.1
-rw-r--r-- 0/0             939 2013-03-31 23:27 whois-5.0.26/README
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/debian/
drwxr-xr-x 0/0               0 2013-03-30 01:31 whois-5.0.26/debian/source/
-rw-r--r-- 0/0              15 2013-03-30 01:31 whois-5.0.26/debian/source/options
-rw-r--r-- 0/0              13 2013-03-30 01:31 whois-5.0.26/debian/source/format
-rw-r--r-- 0/0             206 2013-03-30 01:31 whois-5.0.26/debian/copyright
-rw-r--r-- 0/0               2 2013-03-30 01:31 whois-5.0.26/debian/compat
-rw-r--r-- 0/0           44292 2013-07-16 23:06 whois-5.0.26/debian/changelog
-rwxr-xr-x 0/0            1194 2013-03-31 23:28 whois-5.0.26/debian/rules
-rw-r--r-- 0/0             750 2013-04-18 01:29 whois-5.0.26/debian/control
-rw-r--r-- 0/0             333 2013-03-30 01:31 whois-5.0.26/simple_recode.h
-rw-r--r-- 0/0             213 2013-03-30 01:31 whois-5.0.26/as32_del_list
-rw-r--r-- 0/0           18092 2013-03-30 01:31 whois-5.0.26/COPYING
-rwxr-xr-x 0/0             405 2013-03-30 01:31 whois-5.0.26/make_as32_del.pl
-rwxr-xr-x 0/0             325 2013-03-30 01:31 whois-5.0.26/make_as_del.pl
-rw-r--r-- 0/0            1204 2013-03-30 01:31 whois-5.0.26/utils.h
-rwxr-xr-x 0/0             326 2013-03-30 01:31 whois-5.0.26/make_servers_charset.pl
-rw-r--r-- 0/0            2092 2013-07-16 23:06 whois-5.0.26/config.h
-rw-r--r-- 0/0            1048 2013-03-30 01:31 whois-5.0.26/ip6_del_list
-rw-r--r-- 0/0           12374 2013-04-10 15:25 whois-5.0.26/mkpasswd.c
-rw-r--r-- 0/0            2091 2013-07-16 23:06 whois-5.0.26/whois.spec
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/po/
-rw-r--r-- 0/0           11257 2013-05-10 03:12 whois-5.0.26/po/fr.po
-rw-r--r-- 0/0           14132 2013-04-18 01:29 whois-5.0.26/po/es.po
-rw-r--r-- 0/0           10263 2013-04-18 01:29 whois-5.0.26/po/it.po
-rw-r--r-- 0/0           10713 2013-04-18 01:29 whois-5.0.26/po/pl.po
-rw-r--r-- 0/0           11948 2013-04-18 01:29 whois-5.0.26/po/fi.po
-rw-r--r-- 0/0           12272 2013-04-18 01:29 whois-5.0.26/po/zh_CN.po
-rw-r--r-- 0/0           15201 2013-04-18 01:29 whois-5.0.26/po/el.po
-rw-r--r-- 0/0           12209 2013-04-18 01:29 whois-5.0.26/po/pt_BR.po
-rw-r--r-- 0/0           11045 2013-05-10 03:12 whois-5.0.26/po/de.po
-rw-r--r-- 0/0           11042 2013-04-18 01:29 whois-5.0.26/po/cs.po
-rw-r--r-- 0/0           13156 2013-04-18 01:29 whois-5.0.26/po/eu.po
-rw-r--r-- 0/0           12641 2013-04-18 01:29 whois-5.0.26/po/ja.po
-rw-r--r-- 0/0           10337 2013-04-18 01:29 whois-5.0.26/po/da.po
-rw-r--r-- 0/0            1298 2013-03-30 01:31 whois-5.0.26/po/Makefile
-rw-r--r-- 0/0           10311 2013-04-18 01:29 whois-5.0.26/po/no.po
-rw-r--r-- 0/0           13351 2013-04-18 01:29 whois-5.0.26/po/ru.po
-rwxr-xr-x 0/0             759 2013-03-30 01:31 whois-5.0.26/make_ip6_del.pl
-rw-r--r-- 0/0            1690 2013-04-10 15:25 whois-5.0.26/whois.h
-rw-r--r-- 0/0             382 2013-03-30 01:31 whois-5.0.26/whois.conf
-rw-r--r-- 0/0            3151 2013-04-10 15:25 whois-5.0.26/Makefile
-rw-r--r-- 0/0            4605 2013-03-31 06:10 whois-5.0.26/data.h
-rwxr-xr-x 0/0             399 2013-03-30 01:31 whois-5.0.26/make_tld_serv.pl
-rw-r--r-- 0/0           30713 2013-04-10 15:26 whois-5.0.26/whois.c
-rw-r--r-- 0/0            4946 2013-03-30 01:31 whois-5.0.26/simple_recode.c
-rw-r--r-- 0/0            2941 2013-03-30 01:31 whois-5.0.26/ripe-mail
-rw-r--r-- 0/0           11709 2013-07-16 23:06 whois-5.0.26/tld_serv_list
-rwxr-xr-x 0/0             549 2013-03-30 01:31 whois-5.0.26/make_ip_del.pl
-rw-r--r-- 0/0            1357 2013-05-10 03:12 whois-5.0.26/servers_charset_list
-rw-r--r-- 0/0            2350 2013-03-30 01:31 whois-5.0.26/utils.c
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd whois-5.0.26
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.llgXHX
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ cd whois-5.0.26
+ LANG=C
+ export LANG
+ unset DISPLAY
+ make 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' HAVE_LIBIDN=1 HAVE_ICONV=1
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -MM -MG *.c > Makefile.depend
perl -w make_ip_del.pl < ip_del_list > ip_del.h
perl -w make_ip6_del.pl < ip6_del_list > ip6_del.h
perl -w make_as_del.pl < as_del_list > as_del.h
perl -w make_as32_del.pl < as32_del_list > as32_del.h
perl -w make_tld_serv.pl < tld_serv_list > tld_serv.h
perl -w make_servers_charset.pl < servers_charset_list > servers_charset.h
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c whois.c
whois.c:35:18: error: idna.h: No such file or directory
whois.c: In function 'normalize_domain':
whois.c:982: warning: implicit declaration of function 'idna_to_ascii_lz'
whois.c:982: error: 'IDNA_SUCCESS' undeclared (first use in this function)
whois.c:982: error: (Each undeclared identifier is reported only once
whois.c:982: error: for each function it appears in.)
make: *** [whois.o] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.llgXHX (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.llgXHX (%build)
[vagrant@localhost ~]$ rpmdev-setuptree
[vagrant@localhost ~]$ rpmbuild -ta whois_5.0.26.tar.xz
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.J2U2ne
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/vagrant/rpmbuild/BUILD
+ rm -rf whois-5.0.26
+ /usr/bin/xz -dc /home/vagrant/whois_5.0.26.tar.xz
+ /bin/tar -xvvf -
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/
-rw-r--r-- 0/0            1509 2013-06-11 22:45 whois-5.0.26/as_del_list
-rw-r--r-- 0/0            1301 2013-04-10 15:25 whois-5.0.26/whois.conf.5
-rw-r--r-- 0/0            6718 2013-03-30 01:31 whois-5.0.26/ip_del_list
-rw-r--r-- 0/0            7275 2013-04-10 15:26 whois-5.0.26/whois.1
-rw-r--r-- 0/0            1623 2013-03-30 01:31 whois-5.0.26/mkpasswd.1
-rw-r--r-- 0/0             939 2013-03-31 23:27 whois-5.0.26/README
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/debian/
drwxr-xr-x 0/0               0 2013-03-30 01:31 whois-5.0.26/debian/source/
-rw-r--r-- 0/0              15 2013-03-30 01:31 whois-5.0.26/debian/source/options
-rw-r--r-- 0/0              13 2013-03-30 01:31 whois-5.0.26/debian/source/format
-rw-r--r-- 0/0             206 2013-03-30 01:31 whois-5.0.26/debian/copyright
-rw-r--r-- 0/0               2 2013-03-30 01:31 whois-5.0.26/debian/compat
-rw-r--r-- 0/0           44292 2013-07-16 23:06 whois-5.0.26/debian/changelog
-rwxr-xr-x 0/0            1194 2013-03-31 23:28 whois-5.0.26/debian/rules
-rw-r--r-- 0/0             750 2013-04-18 01:29 whois-5.0.26/debian/control
-rw-r--r-- 0/0             333 2013-03-30 01:31 whois-5.0.26/simple_recode.h
-rw-r--r-- 0/0             213 2013-03-30 01:31 whois-5.0.26/as32_del_list
-rw-r--r-- 0/0           18092 2013-03-30 01:31 whois-5.0.26/COPYING
-rwxr-xr-x 0/0             405 2013-03-30 01:31 whois-5.0.26/make_as32_del.pl
-rwxr-xr-x 0/0             325 2013-03-30 01:31 whois-5.0.26/make_as_del.pl
-rw-r--r-- 0/0            1204 2013-03-30 01:31 whois-5.0.26/utils.h
-rwxr-xr-x 0/0             326 2013-03-30 01:31 whois-5.0.26/make_servers_charset.pl
-rw-r--r-- 0/0            2092 2013-07-16 23:06 whois-5.0.26/config.h
-rw-r--r-- 0/0            1048 2013-03-30 01:31 whois-5.0.26/ip6_del_list
-rw-r--r-- 0/0           12374 2013-04-10 15:25 whois-5.0.26/mkpasswd.c
-rw-r--r-- 0/0            2091 2013-07-16 23:06 whois-5.0.26/whois.spec
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/po/
-rw-r--r-- 0/0           11257 2013-05-10 03:12 whois-5.0.26/po/fr.po
-rw-r--r-- 0/0           14132 2013-04-18 01:29 whois-5.0.26/po/es.po
-rw-r--r-- 0/0           10263 2013-04-18 01:29 whois-5.0.26/po/it.po
-rw-r--r-- 0/0           10713 2013-04-18 01:29 whois-5.0.26/po/pl.po
-rw-r--r-- 0/0           11948 2013-04-18 01:29 whois-5.0.26/po/fi.po
-rw-r--r-- 0/0           12272 2013-04-18 01:29 whois-5.0.26/po/zh_CN.po
-rw-r--r-- 0/0           15201 2013-04-18 01:29 whois-5.0.26/po/el.po
-rw-r--r-- 0/0           12209 2013-04-18 01:29 whois-5.0.26/po/pt_BR.po
-rw-r--r-- 0/0           11045 2013-05-10 03:12 whois-5.0.26/po/de.po
-rw-r--r-- 0/0           11042 2013-04-18 01:29 whois-5.0.26/po/cs.po
-rw-r--r-- 0/0           13156 2013-04-18 01:29 whois-5.0.26/po/eu.po
-rw-r--r-- 0/0           12641 2013-04-18 01:29 whois-5.0.26/po/ja.po
-rw-r--r-- 0/0           10337 2013-04-18 01:29 whois-5.0.26/po/da.po
-rw-r--r-- 0/0            1298 2013-03-30 01:31 whois-5.0.26/po/Makefile
-rw-r--r-- 0/0           10311 2013-04-18 01:29 whois-5.0.26/po/no.po
-rw-r--r-- 0/0           13351 2013-04-18 01:29 whois-5.0.26/po/ru.po
-rwxr-xr-x 0/0             759 2013-03-30 01:31 whois-5.0.26/make_ip6_del.pl
-rw-r--r-- 0/0            1690 2013-04-10 15:25 whois-5.0.26/whois.h
-rw-r--r-- 0/0             382 2013-03-30 01:31 whois-5.0.26/whois.conf
-rw-r--r-- 0/0            3151 2013-04-10 15:25 whois-5.0.26/Makefile
-rw-r--r-- 0/0            4605 2013-03-31 06:10 whois-5.0.26/data.h
-rwxr-xr-x 0/0             399 2013-03-30 01:31 whois-5.0.26/make_tld_serv.pl
-rw-r--r-- 0/0           30713 2013-04-10 15:26 whois-5.0.26/whois.c
-rw-r--r-- 0/0            4946 2013-03-30 01:31 whois-5.0.26/simple_recode.c
-rw-r--r-- 0/0            2941 2013-03-30 01:31 whois-5.0.26/ripe-mail
-rw-r--r-- 0/0           11709 2013-07-16 23:06 whois-5.0.26/tld_serv_list
-rwxr-xr-x 0/0             549 2013-03-30 01:31 whois-5.0.26/make_ip_del.pl
-rw-r--r-- 0/0            1357 2013-05-10 03:12 whois-5.0.26/servers_charset_list
-rw-r--r-- 0/0            2350 2013-03-30 01:31 whois-5.0.26/utils.c
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd whois-5.0.26
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.0dZSw2
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ cd whois-5.0.26
+ LANG=C
+ export LANG
+ unset DISPLAY
+ make 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' HAVE_LIBIDN=1 HAVE_ICONV=1
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -MM -MG *.c > Makefile.depend
perl -w make_ip_del.pl < ip_del_list > ip_del.h
perl -w make_ip6_del.pl < ip6_del_list > ip6_del.h
perl -w make_as_del.pl < as_del_list > as_del.h
perl -w make_as32_del.pl < as32_del_list > as32_del.h
perl -w make_tld_serv.pl < tld_serv_list > tld_serv.h
perl -w make_servers_charset.pl < servers_charset_list > servers_charset.h
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c whois.c
whois.c:35:18: error: idna.h: No such file or directory
whois.c: In function 'normalize_domain':
whois.c:982: warning: implicit declaration of function 'idna_to_ascii_lz'
whois.c:982: error: 'IDNA_SUCCESS' undeclared (first use in this function)
whois.c:982: error: (Each undeclared identifier is reported only once
whois.c:982: error: for each function it appears in.)
make: *** [whois.o] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.0dZSw2 (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.0dZSw2 (%build)

idna.hが足りないと怒られたので探してみる

[vagrant@localhost ~]$ yum provides "**/idna.h"
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
libidn-devel-1.18-2.el6.i686 : Development files for the libidn library
Repo        : base
Matched from:
Filename    : /usr/include/idna.h



libidn-devel-1.18-2.el6.x86_64 : Development files for the libidn library
Repo        : base
Matched from:
Filename    : /usr/include/idna.h

あったのでlibidn-develをインストール

[vagrant@localhost ~]$ sudo yum install libidn-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.tsukuba.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libidn-devel.x86_64 0:1.18-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                            Arch                         Version                           Repository                  Size
====================================================================================================================================
Installing:
 libidn-devel                       x86_64                       1.18-2.el6                        base                       137 k

Transaction Summary
====================================================================================================================================
Install       1 Package(s)

Total download size: 137 k
Installed size: 403 k
Is this ok [y/N]: y
Downloading Packages:
libidn-devel-1.18-2.el6.x86_64.rpm                                                                           | 137 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libidn-devel-1.18-2.el6.x86_64                                                                                   1/1
  Verifying  : libidn-devel-1.18-2.el6.x86_64                                                                                   1/1

Installed:
  libidn-devel.x86_64 0:1.18-2.el6

Complete!

もっかいrpmbuild

[vagrant@localhost ~]$ rpmbuild -ta whois_5.0.26.tar.xz
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.LucUC6
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/vagrant/rpmbuild/BUILD
+ rm -rf whois-5.0.26
+ /usr/bin/xz -dc /home/vagrant/whois_5.0.26.tar.xz
+ /bin/tar -xvvf -
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/
-rw-r--r-- 0/0            1509 2013-06-11 22:45 whois-5.0.26/as_del_list
-rw-r--r-- 0/0            1301 2013-04-10 15:25 whois-5.0.26/whois.conf.5
-rw-r--r-- 0/0            6718 2013-03-30 01:31 whois-5.0.26/ip_del_list
-rw-r--r-- 0/0            7275 2013-04-10 15:26 whois-5.0.26/whois.1
-rw-r--r-- 0/0            1623 2013-03-30 01:31 whois-5.0.26/mkpasswd.1
-rw-r--r-- 0/0             939 2013-03-31 23:27 whois-5.0.26/README
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/debian/
drwxr-xr-x 0/0               0 2013-03-30 01:31 whois-5.0.26/debian/source/
-rw-r--r-- 0/0              15 2013-03-30 01:31 whois-5.0.26/debian/source/options
-rw-r--r-- 0/0              13 2013-03-30 01:31 whois-5.0.26/debian/source/format
-rw-r--r-- 0/0             206 2013-03-30 01:31 whois-5.0.26/debian/copyright
-rw-r--r-- 0/0               2 2013-03-30 01:31 whois-5.0.26/debian/compat
-rw-r--r-- 0/0           44292 2013-07-16 23:06 whois-5.0.26/debian/changelog
-rwxr-xr-x 0/0            1194 2013-03-31 23:28 whois-5.0.26/debian/rules
-rw-r--r-- 0/0             750 2013-04-18 01:29 whois-5.0.26/debian/control
-rw-r--r-- 0/0             333 2013-03-30 01:31 whois-5.0.26/simple_recode.h
-rw-r--r-- 0/0             213 2013-03-30 01:31 whois-5.0.26/as32_del_list
-rw-r--r-- 0/0           18092 2013-03-30 01:31 whois-5.0.26/COPYING
-rwxr-xr-x 0/0             405 2013-03-30 01:31 whois-5.0.26/make_as32_del.pl
-rwxr-xr-x 0/0             325 2013-03-30 01:31 whois-5.0.26/make_as_del.pl
-rw-r--r-- 0/0            1204 2013-03-30 01:31 whois-5.0.26/utils.h
-rwxr-xr-x 0/0             326 2013-03-30 01:31 whois-5.0.26/make_servers_charset.pl
-rw-r--r-- 0/0            2092 2013-07-16 23:06 whois-5.0.26/config.h
-rw-r--r-- 0/0            1048 2013-03-30 01:31 whois-5.0.26/ip6_del_list
-rw-r--r-- 0/0           12374 2013-04-10 15:25 whois-5.0.26/mkpasswd.c
-rw-r--r-- 0/0            2091 2013-07-16 23:06 whois-5.0.26/whois.spec
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/po/
-rw-r--r-- 0/0           11257 2013-05-10 03:12 whois-5.0.26/po/fr.po
-rw-r--r-- 0/0           14132 2013-04-18 01:29 whois-5.0.26/po/es.po
-rw-r--r-- 0/0           10263 2013-04-18 01:29 whois-5.0.26/po/it.po
-rw-r--r-- 0/0           10713 2013-04-18 01:29 whois-5.0.26/po/pl.po
-rw-r--r-- 0/0           11948 2013-04-18 01:29 whois-5.0.26/po/fi.po
-rw-r--r-- 0/0           12272 2013-04-18 01:29 whois-5.0.26/po/zh_CN.po
-rw-r--r-- 0/0           15201 2013-04-18 01:29 whois-5.0.26/po/el.po
-rw-r--r-- 0/0           12209 2013-04-18 01:29 whois-5.0.26/po/pt_BR.po
-rw-r--r-- 0/0           11045 2013-05-10 03:12 whois-5.0.26/po/de.po
-rw-r--r-- 0/0           11042 2013-04-18 01:29 whois-5.0.26/po/cs.po
-rw-r--r-- 0/0           13156 2013-04-18 01:29 whois-5.0.26/po/eu.po
-rw-r--r-- 0/0           12641 2013-04-18 01:29 whois-5.0.26/po/ja.po
-rw-r--r-- 0/0           10337 2013-04-18 01:29 whois-5.0.26/po/da.po
-rw-r--r-- 0/0            1298 2013-03-30 01:31 whois-5.0.26/po/Makefile
-rw-r--r-- 0/0           10311 2013-04-18 01:29 whois-5.0.26/po/no.po
-rw-r--r-- 0/0           13351 2013-04-18 01:29 whois-5.0.26/po/ru.po
-rwxr-xr-x 0/0             759 2013-03-30 01:31 whois-5.0.26/make_ip6_del.pl
-rw-r--r-- 0/0            1690 2013-04-10 15:25 whois-5.0.26/whois.h
-rw-r--r-- 0/0             382 2013-03-30 01:31 whois-5.0.26/whois.conf
-rw-r--r-- 0/0            3151 2013-04-10 15:25 whois-5.0.26/Makefile
-rw-r--r-- 0/0            4605 2013-03-31 06:10 whois-5.0.26/data.h
-rwxr-xr-x 0/0             399 2013-03-30 01:31 whois-5.0.26/make_tld_serv.pl
-rw-r--r-- 0/0           30713 2013-04-10 15:26 whois-5.0.26/whois.c
-rw-r--r-- 0/0            4946 2013-03-30 01:31 whois-5.0.26/simple_recode.c
-rw-r--r-- 0/0            2941 2013-03-30 01:31 whois-5.0.26/ripe-mail
-rw-r--r-- 0/0           11709 2013-07-16 23:06 whois-5.0.26/tld_serv_list
-rwxr-xr-x 0/0             549 2013-03-30 01:31 whois-5.0.26/make_ip_del.pl
-rw-r--r-- 0/0            1357 2013-05-10 03:12 whois-5.0.26/servers_charset_list
-rw-r--r-- 0/0            2350 2013-03-30 01:31 whois-5.0.26/utils.c
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd whois-5.0.26
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.Fi8hj5
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ cd whois-5.0.26
+ LANG=C
+ export LANG
+ unset DISPLAY
+ make 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' HAVE_LIBIDN=1 HAVE_ICONV=1
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -MM -MG *.c > Makefile.depend
perl -w make_ip_del.pl < ip_del_list > ip_del.h
perl -w make_ip6_del.pl < ip6_del_list > ip6_del.h
perl -w make_as_del.pl < as_del_list > as_del.h
perl -w make_as32_del.pl < as32_del_list > as32_del.h
perl -w make_tld_serv.pl < tld_serv_list > tld_serv.h
perl -w make_servers_charset.pl < servers_charset_list > servers_charset.h
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c whois.c
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c utils.c
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c simple_recode.c
cc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -o whois whois.o utils.o simple_recode.o -lidn
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c mkpasswd.c
cc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -o mkpasswd mkpasswd.o utils.o -lcrypt
cd po && make
make[1]: Entering directory `/home/vagrant/rpmbuild/BUILD/whois-5.0.26/po'
xgettext --default-domain=whois \
          --add-comments --keyword=_ --keyword=N_ ../whois.c ../mkpasswd.c
if cmp -s whois.po whois.pot; then \
          rm -f whois.po; \
        else \
          mv whois.po whois.pot; \
        fi
msgfmt --statistics --check --verbose --output-file=cs.mo cs.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=da.mo da.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=de.mo de.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=el.mo el.po
21 translated messages, 7 fuzzy translations, 2 untranslated messages.
msgfmt --statistics --check --verbose --output-file=es.mo es.po
29 translated messages, 1 untranslated message.
msgfmt --statistics --check --verbose --output-file=eu.mo eu.po
18 translated messages, 10 fuzzy translations, 2 untranslated messages.
msgfmt --statistics --check --verbose --output-file=fi.mo fi.po
29 translated messages, 1 untranslated message.
msgfmt --statistics --check --verbose --output-file=fr.mo fr.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=it.mo it.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=ja.mo ja.po
21 translated messages, 7 fuzzy translations, 2 untranslated messages.
msgfmt --statistics --check --verbose --output-file=no.mo no.po
5 translated messages, 4 fuzzy translations, 21 untranslated messages.
msgfmt --statistics --check --verbose --output-file=pl.mo pl.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=pt_BR.mo pt_BR.po
23 translated messages, 5 fuzzy translations, 2 untranslated messages.
msgfmt --statistics --check --verbose --output-file=ru.mo ru.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=zh_CN.mo zh_CN.po
26 translated messages, 3 fuzzy translations, 1 untranslated message.
make[1]: Leaving directory `/home/vagrant/rpmbuild/BUILD/whois-5.0.26/po'
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.sfJzC6
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ '[' /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64 '!=' / ']'
+ rm -rf /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
++ dirname /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
+ mkdir -p /home/vagrant/rpmbuild/BUILDROOT
+ mkdir /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
+ cd whois-5.0.26
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
+ mkdir -p /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/bin
+ mkdir -p /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/share/man/man1
+ make install BASEDIR=/home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64 prefix=/usr/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//bin/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man1/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man5/
install -m 0755 whois /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//bin/
install -m 0644 whois.1 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man1/
install -m 0644 whois.conf.5 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man5/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//bin/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man1/
install -m 0755 mkpasswd /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//bin/
install -m 0644 mkpasswd.1 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man1/
cd po && make install
make[1]: Entering directory `/home/vagrant/rpmbuild/BUILD/whois-5.0.26/po'
for n in cs.mo da.mo de.mo el.mo es.mo eu.mo fi.mo fr.mo it.mo ja.mo no.mo pl.mo pt_BR.mo ru.mo zh_CN.mo; do \
            l=`basename $n .mo`; \
            install -m 755 -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/locale/$l; \
            install -m 755 -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/locale/$l/LC_MESSAGES; \
            install -m 644 $n /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/locale/$l/LC_MESSAGES/whois.mo; \
        done
make[1]: Leaving directory `/home/vagrant/rpmbuild/BUILD/whois-5.0.26/po'
+ gzip /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/share/man/man1/mkpasswd.1 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/share/man/man1/whois.1 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/share/man/man5/whois.conf.5
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /home/vagrant/rpmbuild/BUILD/whois-5.0.26
extracting debug info from /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/bin/whois
extracting debug info from /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/bin/mkpasswd
112 blocks
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: whois-5.0.26-1.x86_64
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libcrypt.so.1()(64bit) libcrypt.so.1(GLIBC_2.2.5)(64bit) libidn.so.11()(64bit) libidn.so.11(LIBIDN_1.0)(64bit) rtld(GNU_HASH)
Processing files: whois-debuginfo-5.0.26-1.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
error: Installed (but unpackaged) file(s) found:
   /usr/share/man/man5/whois.conf.5.gz


RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/share/man/man5/whois.conf.5.gz

今度はパッケージに含められていないファイルがあると怒られたのでspecファイルを修正して追加しておく
diffは以下の通り

[vagrant@localhost ~]$ diff -u rpmbuild/SPECS/whois.spec.orig rpmbuild/SPECS/whois.spec
--- rpmbuild/SPECS/whois.spec.orig      2014-02-01 14:45:55.635763491 +0000
+++ rpmbuild/SPECS/whois.spec   2014-02-01 14:52:37.768872710 +0000
@@ -38,6 +38,7 @@
 %{prefix}/bin/mkpasswd
 %doc %{prefix}/share/man/man1/whois.1.gz
 %doc %{prefix}/share/man/man1/mkpasswd.1.gz
+%doc %{prefix}/share/man/man5/whois.conf.5.gz
 %lang(cs) %{prefix}/share/locale/cs/LC_MESSAGES/whois.mo
 %lang(da) %{prefix}/share/locale/da/LC_MESSAGES/whois.mo
 %lang(de) %{prefix}/share/locale/de/LC_MESSAGES/whois.mo

今度はこの編集したspecファイルを使って再ビルド

[vagrant@localhost ~]$ cp whois_5.0.26.tar.xz rpmbuild/SOURCES/
[vagrant@localhost ~]$ rpmbuild -ba rpmbuild/SPECS/whois.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.WnDd2E
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/vagrant/rpmbuild/BUILD
+ rm -rf whois-5.0.26
+ /usr/bin/xz -dc /home/vagrant/rpmbuild/SOURCES/whois_5.0.26.tar.xz
+ /bin/tar -xvvf -
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/
-rw-r--r-- 0/0            1509 2013-06-11 22:45 whois-5.0.26/as_del_list
-rw-r--r-- 0/0            1301 2013-04-10 15:25 whois-5.0.26/whois.conf.5
-rw-r--r-- 0/0            6718 2013-03-30 01:31 whois-5.0.26/ip_del_list
-rw-r--r-- 0/0            7275 2013-04-10 15:26 whois-5.0.26/whois.1
-rw-r--r-- 0/0            1623 2013-03-30 01:31 whois-5.0.26/mkpasswd.1
-rw-r--r-- 0/0             939 2013-03-31 23:27 whois-5.0.26/README
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/debian/
drwxr-xr-x 0/0               0 2013-03-30 01:31 whois-5.0.26/debian/source/
-rw-r--r-- 0/0              15 2013-03-30 01:31 whois-5.0.26/debian/source/options
-rw-r--r-- 0/0              13 2013-03-30 01:31 whois-5.0.26/debian/source/format
-rw-r--r-- 0/0             206 2013-03-30 01:31 whois-5.0.26/debian/copyright
-rw-r--r-- 0/0               2 2013-03-30 01:31 whois-5.0.26/debian/compat
-rw-r--r-- 0/0           44292 2013-07-16 23:06 whois-5.0.26/debian/changelog
-rwxr-xr-x 0/0            1194 2013-03-31 23:28 whois-5.0.26/debian/rules
-rw-r--r-- 0/0             750 2013-04-18 01:29 whois-5.0.26/debian/control
-rw-r--r-- 0/0             333 2013-03-30 01:31 whois-5.0.26/simple_recode.h
-rw-r--r-- 0/0             213 2013-03-30 01:31 whois-5.0.26/as32_del_list
-rw-r--r-- 0/0           18092 2013-03-30 01:31 whois-5.0.26/COPYING
-rwxr-xr-x 0/0             405 2013-03-30 01:31 whois-5.0.26/make_as32_del.pl
-rwxr-xr-x 0/0             325 2013-03-30 01:31 whois-5.0.26/make_as_del.pl
-rw-r--r-- 0/0            1204 2013-03-30 01:31 whois-5.0.26/utils.h
-rwxr-xr-x 0/0             326 2013-03-30 01:31 whois-5.0.26/make_servers_charset.pl
-rw-r--r-- 0/0            2092 2013-07-16 23:06 whois-5.0.26/config.h
-rw-r--r-- 0/0            1048 2013-03-30 01:31 whois-5.0.26/ip6_del_list
-rw-r--r-- 0/0           12374 2013-04-10 15:25 whois-5.0.26/mkpasswd.c
-rw-r--r-- 0/0            2091 2013-07-16 23:06 whois-5.0.26/whois.spec
drwxr-xr-x 0/0               0 2013-07-16 23:07 whois-5.0.26/po/
-rw-r--r-- 0/0           11257 2013-05-10 03:12 whois-5.0.26/po/fr.po
-rw-r--r-- 0/0           14132 2013-04-18 01:29 whois-5.0.26/po/es.po
-rw-r--r-- 0/0           10263 2013-04-18 01:29 whois-5.0.26/po/it.po
-rw-r--r-- 0/0           10713 2013-04-18 01:29 whois-5.0.26/po/pl.po
-rw-r--r-- 0/0           11948 2013-04-18 01:29 whois-5.0.26/po/fi.po
-rw-r--r-- 0/0           12272 2013-04-18 01:29 whois-5.0.26/po/zh_CN.po
-rw-r--r-- 0/0           15201 2013-04-18 01:29 whois-5.0.26/po/el.po
-rw-r--r-- 0/0           12209 2013-04-18 01:29 whois-5.0.26/po/pt_BR.po
-rw-r--r-- 0/0           11045 2013-05-10 03:12 whois-5.0.26/po/de.po
-rw-r--r-- 0/0           11042 2013-04-18 01:29 whois-5.0.26/po/cs.po
-rw-r--r-- 0/0           13156 2013-04-18 01:29 whois-5.0.26/po/eu.po
-rw-r--r-- 0/0           12641 2013-04-18 01:29 whois-5.0.26/po/ja.po
-rw-r--r-- 0/0           10337 2013-04-18 01:29 whois-5.0.26/po/da.po
-rw-r--r-- 0/0            1298 2013-03-30 01:31 whois-5.0.26/po/Makefile
-rw-r--r-- 0/0           10311 2013-04-18 01:29 whois-5.0.26/po/no.po
-rw-r--r-- 0/0           13351 2013-04-18 01:29 whois-5.0.26/po/ru.po
-rwxr-xr-x 0/0             759 2013-03-30 01:31 whois-5.0.26/make_ip6_del.pl
-rw-r--r-- 0/0            1690 2013-04-10 15:25 whois-5.0.26/whois.h
-rw-r--r-- 0/0             382 2013-03-30 01:31 whois-5.0.26/whois.conf
-rw-r--r-- 0/0            3151 2013-04-10 15:25 whois-5.0.26/Makefile
-rw-r--r-- 0/0            4605 2013-03-31 06:10 whois-5.0.26/data.h
-rwxr-xr-x 0/0             399 2013-03-30 01:31 whois-5.0.26/make_tld_serv.pl
-rw-r--r-- 0/0           30713 2013-04-10 15:26 whois-5.0.26/whois.c
-rw-r--r-- 0/0            4946 2013-03-30 01:31 whois-5.0.26/simple_recode.c
-rw-r--r-- 0/0            2941 2013-03-30 01:31 whois-5.0.26/ripe-mail
-rw-r--r-- 0/0           11709 2013-07-16 23:06 whois-5.0.26/tld_serv_list
-rwxr-xr-x 0/0             549 2013-03-30 01:31 whois-5.0.26/make_ip_del.pl
-rw-r--r-- 0/0            1357 2013-05-10 03:12 whois-5.0.26/servers_charset_list
-rw-r--r-- 0/0            2350 2013-03-30 01:31 whois-5.0.26/utils.c
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd whois-5.0.26
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.c94fuF
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ cd whois-5.0.26
+ LANG=C
+ export LANG
+ unset DISPLAY
+ make 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' HAVE_LIBIDN=1 HAVE_ICONV=1
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -MM -MG *.c > Makefile.depend
perl -w make_ip_del.pl < ip_del_list > ip_del.h
perl -w make_ip6_del.pl < ip6_del_list > ip6_del.h
perl -w make_as_del.pl < as_del_list > as_del.h
perl -w make_as32_del.pl < as32_del_list > as32_del.h
perl -w make_tld_serv.pl < tld_serv_list > tld_serv.h
perl -w make_servers_charset.pl < servers_charset_list > servers_charset.h
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c whois.c
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c utils.c
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c simple_recode.c
cc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -o whois whois.o utils.o simple_recode.o -lidn
cc -DHAVE_LIBIDN -DHAVE_ICONV  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c mkpasswd.c
cc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -o mkpasswd mkpasswd.o utils.o -lcrypt
cd po && make
make[1]: Entering directory `/home/vagrant/rpmbuild/BUILD/whois-5.0.26/po'
xgettext --default-domain=whois \
          --add-comments --keyword=_ --keyword=N_ ../whois.c ../mkpasswd.c
if cmp -s whois.po whois.pot; then \
          rm -f whois.po; \
        else \
          mv whois.po whois.pot; \
        fi
msgfmt --statistics --check --verbose --output-file=cs.mo cs.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=da.mo da.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=de.mo de.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=el.mo el.po
21 translated messages, 7 fuzzy translations, 2 untranslated messages.
msgfmt --statistics --check --verbose --output-file=es.mo es.po
29 translated messages, 1 untranslated message.
msgfmt --statistics --check --verbose --output-file=eu.mo eu.po
18 translated messages, 10 fuzzy translations, 2 untranslated messages.
msgfmt --statistics --check --verbose --output-file=fi.mo fi.po
29 translated messages, 1 untranslated message.
msgfmt --statistics --check --verbose --output-file=fr.mo fr.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=it.mo it.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=ja.mo ja.po
21 translated messages, 7 fuzzy translations, 2 untranslated messages.
msgfmt --statistics --check --verbose --output-file=no.mo no.po
5 translated messages, 4 fuzzy translations, 21 untranslated messages.
msgfmt --statistics --check --verbose --output-file=pl.mo pl.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=pt_BR.mo pt_BR.po
23 translated messages, 5 fuzzy translations, 2 untranslated messages.
msgfmt --statistics --check --verbose --output-file=ru.mo ru.po
30 translated messages.
msgfmt --statistics --check --verbose --output-file=zh_CN.mo zh_CN.po
26 translated messages, 3 fuzzy translations, 1 untranslated message.
make[1]: Leaving directory `/home/vagrant/rpmbuild/BUILD/whois-5.0.26/po'
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.TljUrI
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ '[' /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64 '!=' / ']'
+ rm -rf /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
++ dirname /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
+ mkdir -p /home/vagrant/rpmbuild/BUILDROOT
+ mkdir /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
+ cd whois-5.0.26
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
+ mkdir -p /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/bin
+ mkdir -p /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/share/man/man1
+ make install BASEDIR=/home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64 prefix=/usr/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//bin/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man1/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man5/
install -m 0755 whois /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//bin/
install -m 0644 whois.1 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man1/
install -m 0644 whois.conf.5 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man5/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//bin/
install -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man1/
install -m 0755 mkpasswd /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//bin/
install -m 0644 mkpasswd.1 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/man/man1/
cd po && make install
make[1]: Entering directory `/home/vagrant/rpmbuild/BUILD/whois-5.0.26/po'
for n in cs.mo da.mo de.mo el.mo es.mo eu.mo fi.mo fr.mo it.mo ja.mo no.mo pl.mo pt_BR.mo ru.mo zh_CN.mo; do \
            l=`basename $n .mo`; \
            install -m 755 -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/locale/$l; \
            install -m 755 -d /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/locale/$l/LC_MESSAGES; \
            install -m 644 $n /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr//share/locale/$l/LC_MESSAGES/whois.mo; \
        done
make[1]: Leaving directory `/home/vagrant/rpmbuild/BUILD/whois-5.0.26/po'
+ gzip /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/share/man/man1/mkpasswd.1 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/share/man/man1/whois.1 /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/share/man/man5/whois.conf.5
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /home/vagrant/rpmbuild/BUILD/whois-5.0.26
extracting debug info from /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/bin/whois
extracting debug info from /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64/usr/bin/mkpasswd
112 blocks
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: whois-5.0.26-1.x86_64
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) libcrypt.so.1()(64bit) libcrypt.so.1(GLIBC_2.2.5)(64bit) libidn.so.11()(64bit) libidn.so.11(LIBIDN_1.0)(64bit) rtld(GNU_HASH)
Processing files: whois-debuginfo-5.0.26-1.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
Wrote: /home/vagrant/rpmbuild/SRPMS/whois-5.0.26-1.src.rpm
Wrote: /home/vagrant/rpmbuild/RPMS/x86_64/whois-5.0.26-1.x86_64.rpm
Wrote: /home/vagrant/rpmbuild/RPMS/x86_64/whois-debuginfo-5.0.26-1.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.MIlVw2
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ cd whois-5.0.26
+ rm -rf /home/vagrant/rpmbuild/BUILDROOT/whois-5.0.26-1.x86_64
+ exit 0

できた!ということで早速入れてみる

[vagrant@localhost ~]$ sudo yum localinstall rpmbuild/RPMS/x86_64/whois-5.0.26-1.x86_64.rpm
Loaded plugins: fastestmirror, security
Setting up Local Package Process
Examining rpmbuild/RPMS/x86_64/whois-5.0.26-1.x86_64.rpm: whois-5.0.26-1.x86_64
Marking rpmbuild/RPMS/x86_64/whois-5.0.26-1.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: ftp.tsukuba.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package whois.x86_64 0:5.0.26-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                   Arch                       Version                      Repository                                  Size
====================================================================================================================================
Installing:
 whois                     x86_64                     5.0.26-1                     /whois-5.0.26-1.x86_64                     159 k

Transaction Summary
====================================================================================================================================
Install       1 Package(s)

Total size: 159 k
Installed size: 159 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test


Transaction Check Error:
  file /usr/bin/mkpasswd from install of whois-5.0.26-1.x86_64 conflicts with file from package expect-5.44.1.15-5.el6_4.x86_64
  file /usr/share/man/man1/mkpasswd.1.gz from install of whois-5.0.26-1.x86_64 conflicts with file from package expect-5.44.1.15-5.el6_4.x86_64

Error Summary
-------------

おっとexpectを入れてあったのを忘れていた。。
jwhois入れいている人はこれもかぶるので削除する必要があるはず
さくっと消して改めてインストールする

[vagrant@localhost ~]$ sudo yum remove expect
Loaded plugins: fastestmirror, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package expect.x86_64 0:5.44.1.15-5.el6_4 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                     Arch                        Version                                   Repository                  Size
====================================================================================================================================
Removing:
 expect                      x86_64                      5.44.1.15-5.el6_4                         @base                      553 k

Transaction Summary
====================================================================================================================================
Remove        1 Package(s)

Installed size: 553 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : expect-5.44.1.15-5.el6_4.x86_64                                                                                  1/1
  Verifying  : expect-5.44.1.15-5.el6_4.x86_64                                                                                  1/1

Removed:
  expect.x86_64 0:5.44.1.15-5.el6_4

Complete!
[vagrant@localhost ~]$ sudo yum localinstall rpmbuild/RPMS/x86_64/whois-5.0.26-1.x86_64.rpm
Loaded plugins: fastestmirror, security
Setting up Local Package Process
Examining rpmbuild/RPMS/x86_64/whois-5.0.26-1.x86_64.rpm: whois-5.0.26-1.x86_64
Marking rpmbuild/RPMS/x86_64/whois-5.0.26-1.x86_64.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: ftp.tsukuba.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package whois.x86_64 0:5.0.26-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================
 Package                   Arch                       Version                      Repository                                  Size
====================================================================================================================================
Installing:
 whois                     x86_64                     5.0.26-1                     /whois-5.0.26-1.x86_64                     159 k

Transaction Summary
====================================================================================================================================
Install       1 Package(s)

Total size: 159 k
Installed size: 159 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : whois-5.0.26-1.x86_64                                                                                            1/1
  Verifying  : whois-5.0.26-1.x86_64                                                                                            1/1

Installed:
  whois.x86_64 0:5.0.26-1

Complete!

これでおk
使ってみよう

[vagrant@localhost ~]$ mkpasswd -m sha-512
Password: <= password
$6$sD6jlK0etJfb$L4Mdood9uq42Bn7pYA6IvSeC6e7TfsQ6UTD0GK4TuAXJh5jb4FgKJv7CdSfYk1UtBNRXngOTxabolGibuqv//0

おぉ、できたできた
grub-crypt使えば簡単だけど遊びでやってみて楽しかったかも

あとパッケージ情報を読んで知ったけどDebian系のやつはRFC 954を元に
新たに書き直されたwhoisらしい

[vagrant@localhost ~]$ rpm -qi whois
Name        : whois                        Relocations: /usr
Version     : 5.0.26                            Vendor: Marco d'Itri <md@linux.it>
Release     : 1                             Build Date: Sat 01 Feb 2014 02:53:01 PM UTC
Install Date: Sat 01 Feb 2014 02:55:46 PM UTC      Build Host: localhost
Group       : Applications/Internet         Source RPM: whois-5.0.26-1.src.rpm
Size        : 163010                           License: GPL
Signature   : (none)
Summary     : Enhanced WHOIS client
Description :
This is a new whois (RFC 954) client rewritten from scratch.
It is derived from and compatible with the usual BSD and RIPE whois(1)
programs.
It is intelligent and can automatically select the appropriate whois
server for most queries.

ではでは~

コメント