AlmaLinux10 openssl 設定

               AlmaLinux10 openssl 設定
**********************************************************************

AlmaLinux 10におけるOpenSSL設定は、主に/etc/pki/tls/openssl.cnfファイルの編集と、OpenSSLコマンドを使用した証明書管理で行われます。最新のセキュリティ要件(TLS 1.2/1.3)に基づき、暗号スイートや証明書発行(CSR、自己署名証明書)の定義を行います。パッケージインストールにはdnfを使用します。

基本設定手順
インストール確認 (最新バージョンがプリインストールされている場合が多い)
bash
sudo dnf install openssl

root@falcon21:~# dnf -y reinstall openssl
再インストール中 : openssl-1:3.5.1-7.el10_1.alma.1.x86_64 1/2
整理 : openssl-1:3.5.1-7.el10_1.alma.1.x86_64 2/2
scriptletの実行中: openssl-1:3.5.1-7.el10_1.alma.1.x86_64 2/2

再インストール済み:
openssl-1:3.5.1-7.el10_1.alma.1.x86_64

完了しました!

——————-

設定ファイルの編集
/etc/pki/tls/openssl.cnfを必要に応じて編集し、デフォルトの暗号化方式([ v3_ca ]セクションなど)を修正します


証明書の生成
秘密鍵とCSRを生成し、安全な場所に保管します。
bash
# 秘密鍵の生成 (例: 3072ビット RSA)
openssl genrsa -out private.key 3072

# CSRの作成
openssl req -new -key private.key -out request.csr -config /etc/pki/tls/openssl.cnf


主な設定項目
ファイルパス: /etc/pki/tls/openssl.cnf
証明書保管場所: /etc/pki/tls/certs/
秘密鍵保管場所: /etc/pki/tls/private/

最新のセキュリティ標準(例:MinProtocol = TLSv1.2)に従い、構成ファイルを調整してください。 OpenStandia?【NRI】、note。

 
**********************************************************************

AlmaLinux 10(Red Hat Enterprise Linux 10 互換)における OpenSSL の設定は、これまでのバージョン(AlmaLinux 8/9)と同様に、パッケージ管理ツール dnf を使用した管理と、/etc/pki/tls/ 配下での構成が基本となります。
特に AlmaLinux 10 では、標準で OpenSSL 3.x 系が採用されており、耐量子計算機暗号 (PQC) への対応など、次世代のセキュリティ基準が導入されています


1. インストールとバージョン確認
通常、AlmaLinux 10 には標準でインストールされていますが、最新の状態にするには以下のコマンドを実行します。
インストール/更新: sudo dnf install openssl
バージョン確認: openssl version

root@falcon21:~# openssl version
OpenSSL 3.5.1 1 Jul 2025 (Library: OpenSSL 3.5.1 1 Jul 2025)


2. 主な設定ファイルとディレクトリ
設定や証明書の配置場所は以下の通りです。
メイン設定ファイル: /etc/pki/tls/openssl.cnf

システム全体のデフォルト設定(暗号化アルゴリズムの優先順位など)を管理します。
秘密鍵の配置先: /etc/pki/tls/private/
証明書の配置先: /etc/pki/tls/certs/


3. 暗号化ポリシーの管理 (Crypto Policies)
AlmaLinux 10 では、個別の openssl.cnf を編集するよりも、システム全体の暗号化ポリシー (update-crypto-policies) を使用して、OS 全体のセキュリティレベルを一括設定することが推奨されます。

現在のポリシー確認: update-crypto-policies –show

ポリシーの変更例 (DEFAULT への設定): sudo update-crypto-policies –set DEFAULT
より厳格な設定が必要な場合は FUTURE、互換性優先の場合は LEGACY を指定しますが、セキュリティ向上のため DEFAULT 以上が推奨されます。


4. 一般的な操作コマンド例
OpenSSL を使用した証明書作成などの基本操作は以下の通りです。
秘密鍵の生成: openssl genrsa -out server.key 2048
CSR(証明書署名要求)の生成: openssl req -new -key server.key -out server.csr
自己署名証明書の作成: openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt


**********************************************************************

root@falcon21:~# openssl version
OpenSSL 3.5.1 1 Jul 2025 (Library: OpenSSL 3.5.1 1 Jul 2025)

root@falcon21:~# update-crypto-policies –show
DEFAULT


秘密鍵の生成:
root@falcon21:~# openssl genrsa -des3 2048 > falcon21.space.key
Enter PEM pass phrase: o90okm,.loss
Verify failure
40977A87107F0000:error:1400006B:UI routines:UI_process:processing error:crypto/ui/ui_lib.c:552:while reading strings
40977A87107F0000:error:0480006D:PEM routines:PEM_def_callback:problems getting password:crypto/pem/pem_lib.c:62:
40977A87107F0000:error:07880109:common libcrypto routines:do_ui_passphrase:interrupted or cancelled:crypto/passphrase.c:178:
40977A87107F0000:error:1C80009F:Provider routines:p8info_to_encp8:unable to get passphrase:providers/implementations/encode_decode/encode_key2any.c:123:

CSR(証明書署名要求)の生成:
root@falcon21:~# openssl req -new -key server.key -out falcon21.space.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [XX]:JP
State or Province Name (full name) []:Gifu
Locality Name (eg, city) [Default City]:Anpachi
Organization Name (eg, company) [Default Company Ltd]:falcon21
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server’s hostname) []:falcon21.space
Email Address []:root@falcon21.space

Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:ol.,mko09oss
An optional company name []:


CSRの内容を確認
root@falcon21:~# openssl req -text -noout -in falcon21.space.csr

41:2f Exponent: 65537 (0x10001) Attributes: challengePassword :ol.,mko09oss Requested Extensions: Signature Algorithm: sha256WithRSAEncryption Signature Value: 5b:c7:95:5c:a7:e9:10:da:3b:d2:c2:e7:f9:68:4e:28:2d:ce: 8e:e9:0b:60:cc:c4:c7:34:58:db:17:90:26:eb:ef:1a:c7:63: 37:dd:2e:17:fb:6f:a1:be:99:56:3c:ab:e8:7f:f3:bd:f0:d8: c4:64:85:c9:38:76:e8:f3:c7:d5:95:1e:b8:88:c5:02:fd:a2: 50:6c:86:ac:ac:2f:77:98:a4:8e:ad:03:92:53:75:74:64:ca: 85:ea:23:5b:1e:36:e0:22:e2:e1:38:e3:05:e8:8c:90:c8:b9: 73:e1:aa:b4:1d:f8:92:c4:32:1f:3b:a3:ac:6f:b2:a6:5e:ad: 73:7b:df:18:d5:20:74:d7:ff:b4:ea:e8:33:df:7a:52:d3:de: e5:67:0b:28:c6:a9:b2:4a:1f:d3:82:47:c9:12:09:6e:8d:5e: bc:dd:02:da:d9:63:ad:50:64:05:49:f5:5b:9e:21:52:0c:99: d7:08:fc:1c:9d:62:f6:89:17:26:cb:c6:ce:12:20:46:11:63: 1d:0b:2b:ac:12:90:ae:84:56:df:c0:33:9d:5a:0b:ea:e9:96: 42:1f:95:88:45:d7:3c:50:c1:c6:e9:42:7a:78:60:82:10:4e: 6e:57:0f:79:79:54:b6:3a:28:84:f1:37:47:e3:d8:ad:e8:d8: f1:89:e0:34

root@falcon21:~# systemctl restart httpd


5. AlmaLinux 10 の特筆点:耐量子暗号 (PQC)
AlmaLinux 10 では、将来的な量子コンピュータによる解読リスクに備え、耐量子計算機暗号 (PQC) を試用・設定できる環境が整い始めています。特定のアルゴリズムを利用する場合は、OpenSSL のプロバイダ設定が必要になることがあります