アルパインLinuxでパッチして、実行する方法


私は暗号技師やセキュリティエンジニアではないので、私のプロジェクトの暗号最高の練習を検討する時間が来たとき、私は無知にエントロピーテストユーティリティを探しました.後にいくつかのスキムリスト、私は私のサイトを設定した1つの良いことを聞いていた-何かと呼ばれるdieharder .

中臣タワーはCLI?デジタルジョンマクレーン?私はそれを追跡し、もっと学ぶ必要がありました.

ディーヴー?


DiehardはCLIエントロピーテストユーティリティですRobert G. Brown at Duke University . これは、ランダムなデータを計算するシステムのパフォーマンスを測定することができますいくつかの厳密なテストを実装します.非常に簡素化するためには、はるかに超えて行く/dev/urandom . 「完璧だ」と思った.「それをつかまえて、いいものとして入れましょう」
残念ながら、インストール手順に従ってコンパイルが失敗しました.解決策を見つけようとすると、CentOSやUbuntu専用のスレッドだけが古くなった.そこで、アルパインで自分でコンパイルする方法を決めました.

救助へ


幸いにも、必要な変更は簡単ですし、組み込みストリームエディタを使用して行うことができますsed . 欠落typedef と行方不明者define 定数はコンパイルが成功するために必要なものです.必要な依存関係の名前を変更します.
更なるADOなしで、ここでは、インストール、パッチ、コンパイル、およびこのユーティリティは、アルパインで実行する方法です!
#!/bin/sh

# Install static packages.
apk add \
  apk-tools-static \
  busybox-static

# Install packages needed to compile DieHarder.
apk.static -U add \
  chrpath \
  gsl \
  gsl-dev \
  haveged \
  libtool \
  make \
  rng-tools \
  rpm-dev \
  build-base

# Create a valid build tree for RPM.
mkdir -pm 0700 \
~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

# Point to the 'rpmbuild' path in the macro file.
echo '%_topdir %(echo $HOME)/rpmbuild' >> ~/.rpmmacros

# Create a path of your choice to install into.
mkdir -pm 0700 /your/install/path
chown root:root /your/install/path

# Download the latest version of dieharder.
wget -c \
http://webhome.phy.duke.edu/~rgb/General/dieharder/dieharder.tgz -O - | \
tar -xz -C /your/install/path/

# Set current directory to the top level of the build
# extracted from the tarball.
cd /your/install/path/*

# Generate makefiles and compilation resources.
./autogen.sh

# ---- Patch dieharder.spec file.

# Patch line 16 to point to 'gsl-dev' package.
sed -i \
'16s/.*/chrpath gsl-dev/' \
./dieharder.spec

# Patch line 129 to prevent 'macro expanded' error.
sed -i '129s/.*/# /' ./dieharder.spec

# ---- Patch libdieharder.h file.

# Insert new line to define 'M_PI' constant.
sed -i \
'66i #define M_PI    3.14159265358979323846' \
./include/dieharder/libdieharder.h

# Insert new line to create 'uint' typedef.
sed -i \
'262i typedef unsigned int uint;' \
./include/dieharder/libdieharder.h

# Compile dieharder.
make install

# Run all tests in dieharder.
dieharder -a
これはdieharder 3.31.1 を実行しているHashicorp Vaultdocker-compose . 結果は異なる場合があります.
希望これはあなたの暗号化プロジェクトでは、読書のおかげであなたを助ける!