Windows Serverによるファイルサーバー移行のメモ


Windows Serverを移行する時に現状の設定を確認する必要がある。

その際に確認しといた方が良さそうな項目についてのメモ

1) ネットワーク設定

Active Directoryに参加するだろうからある程度はなんとかなるだろうけど・・・

DNSサーバの順序あたりは確認しておいた方がいい

「ipconfig /all」
「netsh interface ipv4 show config」

NICチーミング設定がされてるかどうか、されている場合は「チーミングモード」「負荷分散モード」と「スタンバイアダプターの設定有無」を確認

2) Windowsファイアウォール設定

これもActive Directory側から操作されてるかもしれないけど確認

「受信の規則」にある追加されたっぽい設定を確認

コマンドの場合

「netsh advfirewall show allprofiles」でプロファイル確認
「netsh advfirewall show currentprofile」で現在有効になってるプロファイル確認
「netsh advfirewall firewall show rule name=all」で設定出力

3) 共有設定

コンピュータの管理を起動して共有確認
 「コンピュータの管理」の[システムツール]-[共有フォルダー]-[共有]の内容を確認
 各共有のプロパティを開き、「共有のアクセス許可」と「セキュリティ」を確認

「net share」で共有一覧を表示
「net share 共有名」で各共有の詳細を確認
「Get-SmbShare」で共有一覧表示
「Get-SmbShare|Get-SmbShareAccess」で各共有のアクセス権限表示
「Get-SmbShare|Format-List」共有一覧の詳細出力
「Get-SmbShare|Get-SmbShareAccess|Format-List」アクセス権限表示の詳細出力

共有をコマンドで設定する場合

net share "share"="D:\share"  /GRANT:"BUILTIN\Administrators,FULL" /GRANT:"Everyone,FULL"

4) クォータ設定

クォータ設定は2種類あるので注意が必要

ファイルサーバーリソースマネージャを起動して「クォータ」の内容を確認
 対象ディレクトリと適用されている”クォータテンプレート”の内容
  制限値, ハード/ソフト, 通知設定

「dirquota template list」でテンプレート一覧を表示
「dirquota template list /list-n」でテンプレートを通知設定込みで表示
「dirquota autoquota list」で自動適用クォータを確認

ドライブプロパティのクォータ設定を確認
 各ドライブのプロパティを開き、クォータタブの内容を確認

「fsutil volume list」でドライブ名を確認
「fsutil quota query ドライブ名」で確認

コマンドで設定する場合
旧サーバでtemplateをexportして、新サーバでimportして、各quotaを設定

dirquota template export /file:ファイル名
dirquota template import /file:ファイル名
dirquota quota add /Path:"D:\share" /sourcetemplate:"10 GB 制限"

5) シャドウコピー設定

ドライブプロパティのシャドウコピー設定を確認
 各ドライブのプロパティを開き、シャドウコピータブの内容を確認

コマンドの場合、スケジュール実行についてはタスクスケジューラで行っているのでschtasksコマンドでの確認が必要になることに注意

「vssadmin list shadows」で現在存在しているシャドウコピーを確認
「vssadmin list shadowstorage」でシャドウコピーの保存先を確認
「vssadmin list volumes」でディスクのIDを確認
「schtasks /query /xml」で一覧をXML形式で出力し、名前が"ShadowCopyVolume~"のものの内容を確認

6) タスクスケジューラ設定

タスクスケジューラを起動して設定を確認
 タスクスケジューラライブラリに登録されているタスク一覧を確認
 それぞれのタスクの詳細を確認

「schtasks /query /fo list」で一覧を表示
「schtasks /query /xml」で一覧をXML形式で表示

rocobopyでのファイル同期

robocopyのオプション

「/mir /copyall /R:1 /W:1」でいける場合が多い

EFSRAW対応の場合は「/COPYALL /MIR /B /EFSRAW /R:1 /W:1」

Windowsサーバ上で監査設定があって、コピー先が監査非対応の場合は「/E /B /copy:DATSO /R:1 /W:1」かなぁ?

「 /NP」オプションを付けて進捗表示なしにしてもよい

最初は「/MIR」ではなく「/B /E」で実行して、指定誤りによる誤削除がないようにする、というのも1つの手。

これは /MIR か /PURGE を指定すると、コピー元にないファイルは削除されるが、コピー先のディレクトリ指定を誤って既存データのあるディレクトリを指定してしまうと削除されるため。

robocopyを実行するバッチファイルの作成例

@echo off
set TIME2=%TIME: =0%
set LOGDATE=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%-%TIME2:~0,2%%TIME2:~3,2%

robocopy \\旧FS\share  \\新FS\share /mir /copyall /R:0 /W:0 /LOG+:D:\LOGS\share-%LOGDATE%.txt

代表的なrobocopyエラーコードと対処一覧

エラー 2 (0x00000002)→指定したフォルダが存在しない
エラー 5 (0x00000005)→アクセス権がない。robocopyに/Bオプションを付ける
エラー 31 (0x0000001F)→コピー先に元と同じNTFSセキュリティ設定が行えない(OS制約などの可能性)
エラー 32 (0x00000020)→ファイルがアプリケーションからロックされているのでアプリを閉じる
エラー 64 (0x00000040)→指定した共有にアクセスできない
エラー 87 (0x00000057)→指定した共有にアクセスするためのユーザ名/パスワード指定が誤っている
エラー 112(0x00000070)→コピー先容量が足らない

CVE-2022-38023適用後 NetAppがActive Directoryに参加できない


いままでも「SMB2 Enabled for DC Connections設定に起因する接続できない問題」というのがあったが、先日話題になった「Active Directoryサーバのセキュリティ強化アップデート(CVE-2022-38023)に伴うONTAPファイルサーバへの影響」で、2023年7月以降のActive Directory環境ではONTAP をCIFSに新規作成しようとした場合にエラーがでる、という問題が出ていた。

Is AES Encryption Enabled設定」と「AES session key enabled for NetLogon channel設定」の2つの設定を変更する必要がある。

前者はONTAP 9.12.1から初期値変更、後者はONTAP 9.10.1から初期値変更となっているので、最近導入している場合は問題が発生しないのだが、以前のバージョンからアップデートしているような環境の場合は以前の値のままとなっているため注意が必要となっている。

その1: Is AES Encryption Enabled 設定

以前からONTAPを使っていてアップデートしているような環境では、SMB内部接続での暗号化形式でAESを使わない、という設定になっているせいで、下記の様なエラーとなる。

netapp9101::> vserver cifs create -vserver svm3 -cifs-server svm3 -domain adosakana.local

In order to create an Active Directory machine account for the CIFS server, you must supply the name and password of a Windows account with
sufficient privileges to add computers to the "CN=Computers" container within the "ADOSAKANA.LOCAL" domain.

Enter the user name: administrator

Enter the password:

Error: Machine account creation procedure failed
  [    47] Loaded the preliminary configuration.
  [   130] Created a machine account in the domain
  [   130] SID to name translations of Domain Users and Admins
           completed successfully
  [   131] Successfully connected to ip 172.17.44.49, port 88 using
           TCP
  [   142] Successfully connected to ip 172.17.44.49, port 464 using
           TCP
  [   233] Kerberos password set for 'SVM3$@ADOSAKANA.LOCAL' succeeded
  [   233] Set initial account password
  [   244] Successfully connected to ip 172.17.44.49, port 445 using
           TCP
  [   276] Successfully connected to ip 172.17.44.49, port 88 using
           TCP
  [   311] Successfully authenticated with DC
           adserver.adosakana.local
  [   324] Unable to connect to NetLogon service on
           adserver.adosakana.local (Error:
           RESULT_ERROR_GENERAL_FAILURE)
**[   324] FAILURE: Unable to make a connection
**         (NetLogon:ADOSAKANA.LOCAL), result: 3
  [   324] Unable to make a NetLogon connection to
           adserver.adosakana.local using the new machine account
  [   346] Deleted existing account
           'CN=SVM3,CN=Computers,DC=adosakana,DC=local'

Error: command failed: Failed to create the Active Directory machine account "SVM3". Reason: general failure.

netapp9101::>

この問題はマニュアルの「Enable or disable AES encryption for Kerberos-based communication」に記載されているように「is-aes-encryption-enabled」設定をtrueに変更することで解決する。

netapp9101::> vserver cifs security modify -vserver svm3 -is-aes-encryption-enabled true
netapp9101::> vserver cifs security show -fields is-aes-encryption-enabled
vserver is-aes-encryption-enabled
------- -------------------------
Cluster -
Snapmirror-WAN
        -
netapp9101
        -
netapp9101-01
        -
svm0    true
svm2    false
svm3    true
7 entries were displayed.

netapp9101::>

その2: AES session key enabled for NetLogon channel 設定

上記を設定しても、下記の様なエラーとなった。

netapp9101::> vserver cifs create -vserver svm3 -cifs-server svm3 -domain vm2.adosakana.local

In order to create an Active Directory machine account for the CIFS server, you must supply the name and password of
a Windows account with sufficient privileges to add computers to the "CN=Computers" container within the
"ADOSAKANA.LOCAL" domain.

Enter the user name: administrator

Enter the password:

Error: Machine account creation procedure failed
  [    43] Loaded the preliminary configuration.
  [   133] Created a machine account in the domain
  [   133] SID to name translations of Domain Users and Admins
           completed successfully
  [   134] Successfully connected to ip 172.17.44.49, port 88 using
           TCP
  [   144] Successfully connected to ip 172.17.44.49, port 464 using
           TCP
  [   226] Kerberos password set for 'SVM3$@ADOSAKANA.LOCAL' succeeded
  [   226] Set initial account password
  [   253] Successfully connected to ip 172.17.44.49, port 445 using
           TCP
  [   284] Successfully connected to ip 172.17.44.49, port 88 using
           TCP
  [   316] Successfully authenticated with DC
           adserver.adosakana.local
  [   323] Encountered NT error (NT_STATUS_PENDING) for SMB command
           Read
  [   327] Unable to connect to NetLogon service on
           adserver.adosakana.local (Error:
           RESULT_ERROR_GENERAL_FAILURE)
**[   327] FAILURE: Unable to make a connection
**         (NetLogon:ADOSAKANA.LOCAL), result: 3
  [   327] Unable to make a NetLogon connection to
           adserver.adosakana.local using the new machine account
  [   344] Deleted existing account
           'CN=SVM3,CN=Computers,DC=ADOSAKANA,DC=local'

Error: command failed: Failed to create the Active Directory machine account "SVM3". Reason: general failure.

netapp9101::>

この状況となった環境のActive Directoryサーバはsambaで作成しているため /usr/local/samba/var/log.samba を確認してみると下記のエラーがでていた。

[2023/10/20 14:48:22.301935,  0] ../../source4/rpc_server/netlogon/dcerpc_netlogon.c:281(dcesrv_netr_ServerAuthenticate3_check_downgrade)
  CVE-2022-38023: client_account[SVM3$] computer_name[SVM3] schannel_type[2] client_negotiate_flags[0x741ff] real_account[SVM3$] NT_STATUS_DOWNGRADE_DETECTED reject_des[0] reject_md5[1]
[2023/10/20 14:48:22.302215,  0] ../../source4/rpc_server/netlogon/dcerpc_netlogon.c:291(dcesrv_netr_ServerAuthenticate3_check_downgrade)
  CVE-2022-38023: Check if option 'server reject md5 schannel:SVM3$ = no' might be needed for a legacy client.
[2023/10/20 14:48:22.304539,  0] ../../source4/rpc_server/netlogon/dcerpc_netlogon.c:281(dcesrv_netr_ServerAuthenticate3_check_downgrade)
  CVE-2022-38023: client_account[SVM3$] computer_name[SVM3] schannel_type[2] client_negotiate_flags[0x701ff] real_account[SVM3$] NT_STATUS_DOWNGRADE_DETECTED reject_des[1] reject_md5[1]
[2023/10/20 14:48:22.304600,  0] ../../source4/rpc_server/netlogon/dcerpc_netlogon.c:291(dcesrv_netr_ServerAuthenticate3_check_downgrade)
  CVE-2022-38023: Check if option 'server reject md5 schannel:SVM3$ = no' might be needed for a legacy client.
[2023/10/20 14:48:22.304638,  0] ../../source4/rpc_server/netlogon/dcerpc_netlogon.c:298(dcesrv_netr_ServerAuthenticate3_check_downgrade)
  CVE-2022-38023: Check if option 'allow nt4 crypto:SVM3$ = yes' might be needed for a legacy client.

もしやkerneberosではなくNTLMで接続されてたりする?と lm-compatibility-level をkrb に設定しても同じ結果となった。

netapp9101::> vserver cifs security modify -vserver svm3 -lm-compatibility-level krb

netapp9101::> vserver cifs security show -fields lm-compatibility-level
vserver lm-compatibility-level
------- ----------------------
Cluster -
Snapmirror-WAN -
netapp9101 -
netapp9101-01 -
svm0    lm-ntlm-ntlmv2-krb
svm2    lm-ntlm-ntlmv2-krb
svm3    krb
7 entries were displayed.

netapp9101::>

さらに調べると「Configure Active Directory domain controller access overview」に、Netlogon にAESを使いたい場合は「aes-enabled-for-netlogon-channel」をtrueに設定する、と書いてあった

netapp9101::> vserver cifs security show -fields aes-enabled-for-netlogon-channel
vserver aes-enabled-for-netlogon-channel
------- --------------------------------
Cluster -
Snapmirror-WAN -
netapp9101 -
netapp9101-01 -
svm0    false
svm2    false
svm3    false
7 entries were displayed.

netapp9101::> vserver cifs security modify -vserver svm3 -aes-enabled-for-netlogon-channel true

netapp9101::> vserver cifs security show -fields aes-enabled-for-netlogon-channel
vserver aes-enabled-for-netlogon-channel
------- --------------------------------
Cluster -
Snapmirror-WAN -
netapp9101 -
netapp9101-01 -
svm0    false
svm2    false
svm3    true
7 entries were displayed.

netapp9101::>

設定変更後に再実行したところ、Active Directory参加に成功した。

netapp9101::> vserver cifs create -vserver svm3 -cifs-server svm3 -domain adosakana.local

In order to create an Active Directory machine account for the CIFS server, you must supply the name and password of
a Windows account with sufficient privileges to add computers to the "CN=Computers" container within the
"ADOSAKANA.LOCAL" domain.

Enter the user name: administrator

Enter the password:

Notice: SMB1 protocol version is obsolete and considered insecure. Therefore it is deprecated and disabled on this
CIFS server. Support for SMB1 might be removed in a future release. If required, use the (privilege: advanced)
"vserver cifs options modify -vserver svm3 -smb1-enabled true" to enable it.

netapp9101::>

↑のSMB1を有効にするかどうか、というところについては、複合機の出力先として指定されている、とか、LinuxサーバからCIFSでマウントしている、とか、Windowsワークグループからアクセスしている、という場合には有効にする、というような形となる。

Windows Server 2012R2に .Net Framework 3.5が追加できない場合の解決方法


実験するためWindows Server 2012R2を新規インストールして、まずはWindows Updateを全部適用してから、いろいろ設定していこう!と行ってみたところ思わぬところで問題が発生した。

結論を先に書いておくと「.NET Framework 3.5, 4.6.1, 4.7, 4.7.1, 4.7.2, 4.8 のセキュリティおよび品質ロールアップ」がインストールされていることが原因であるため

・Windows Updateを実施する前に追加すれば問題は発生しない
・Windows Update完了後に問題が発生した場合は「.NET Framework 3.5, 4.6.1, 4.7, 4.7.1, 4.7.2, 4.8 のセキュリティおよび品質ロールアップ」をアンインストールする

のどちらかを行うことで、インストールに成功するようになった。

ただ、.NET Frameworkのパッチの内部的な仕組みに気がつかないとアンインストールできないので、原因が知られていない、という状態でした。

問題の検証

Windows Updateが一通り終わったあとで、今回の実験対象のソフトウェアは.NET Framework 3.5が必要だな、と追加しようとしたらエラーとなった。

「代替ソースパスを指定」からDVD内のsources\sxs\を指定

で、エラー

このとき、イベントログのWindowsログの「Setup」に「パッケージ Microsoft .NET Framework 3.0の更新 NetFx3 を有効にできませんでした。 状態 0x800f0906。」と出ている

「0x800f0906」で調べると「.NET Framework 3.5 の展開エラーと解決手順」が出てくるが、コレではなかった。

[MS14-046] Windows 8.1 および Windows Server 2012 R2 用の .NET Framework 3.5 のセキュリティ更新プログラムについて (2014 年 8 月 12 日)」に以下の記載がある

Microsoft .NET Framework 3.5 用のセキュリティ更新プログラム 2966828 (マイクロソフト セキュリティ情報 MS14-046 に記載されています) をインストールした後、[Windows の機能] で Microsoft .NET Framework 3.5 のオプションの機能を初めて有効にしようとしたときに、機能がインストールされないことがあります。Microsoft .NET Framework 3.5 の機能を追加する前にインストールを “段階的に実行” した場合にこのエラーが発生することがあります。
この問題を解決するには、更新プログラム 3005628 をインストールします。
この問題を回避する方法の詳細については、以下のサポート技術情報番号をクリックしてください。
3002547Windows 8、Windows Server 2012、Windows 8.1、または Windows Server 2012 R2 でセキュリティ更新プログラム 2966827 または 2966828 をインストールした後に Microsoft .NET Framework 3.5 のオプションの Windows 機能を有効化できないことがある

更新プログラム 3005628「Windows 8、Windows 8.1、Windows Server 2012、および Windows Server 2012 R2 上の .NET Framework 3.5 の更新プログラム」の説明を読むと、原因としては、.NET Framework 3.5がインストールされていないのに、.NET Framework 3.5に関する更新プログラムがインストールされていることが原因である模様。

しかし、2023年9月現在では更新プログラム3005628 を適用してみたが効力はなかった。

更新履歴をみると「.NET Framework 3.5, 4.6.1, 4.7, 4.7.1, 4.7.2, 4.8 のセキュリティおよび品質ロールアップ」がある。

しかし、インストールされた更新プログラムを確認すると、.NET Framework関連のパッチがないのでインストールできないように見える。

ただ、調べたところwusaコマンドを使うとアンインストールできそうな感じだったので「wusa /uninstall /kb:5030184」でアンインストールを試みたが「インストールされていない」と表示される。

2023 年 9 月 12 日 – Windows Server 2012 R2 用 .NET Framework 3.5、4.6.2、4.7、4.7.1、4.7.2、4.8 のセキュリティおよび品質ロールアップ (KB5030184)」を確認すると、実はこの更新プログラム「Windows Server 2012 R2 用 .NET Framework 3.5 のセキュリティおよび品質ロールアップについて (KB5029915)」「Windows Server 2012 R2 用 .NET Framework 4.6.2、4.7、4.7.1、4.7.2 のセキュリティおよび品質ロールアップについて (KB5029916)」「Windows Server 2012 R2 用 .NET Framework 4.8 のセキュリティおよび品質ロールアップについて (KB5029917)」の3本だてらしい。

更新履歴上にこの3つは載ってないけど、試してみるかと「wusa /uninstall /kb:5029915」を実行すると、アンインストールに成功した。

おや?と思って、先ほどのインストールされた更新プログラム画像を再確認するとKB5029915がいた・・・

なるほど・・・「更新履歴」と「インストールされた更新プログラム」とで表示されるKB番号が別なのか・・・

で・・・これで大丈夫かな?と、.Net 3.5追加を試してみたらエラーになった。

もう一度更新一覧を確認しなおすともう1つ「.NET Framework 3.5, 4.6.1, 4.7, 4.7.1, 4.7.2, 4.8 のセキュリティおよび品質ロールアップ」があった

そちらは「2023 年 8 月 8 日 – Windows Server 2012 R2 用 .NET Framework 3.5、4.6.2、4.7、4.7.1、4.7.2、4.8 のセキュリティおよび品質ロールアップ (KB5029653)」で、「Windows Server 2012 R2 用 .NET Framework 3.5 のセキュリティおよび品質ロールアップについて (KB5028970)」「Windows Server 2012 R2 用 .NET Framework 4.6.2、4.7、4.7.1、4.7.2 のセキュリティおよび品質ロールアップについて (KB5028962)」「Windows Server 2012 R2 用 .NET Framework 4.8 のセキュリティおよび品質ロールアップについて (KB5028957)」なので、「wusa /uninstall /kb:5028970」でアンインストールを実行。

もしくは「インストールされた更新プログラム」から「Microsoft Windows (KB5028970)の更新プログラム」を右クリックして「アンインストール」でも大丈夫です。

役割と機能の追加から「.NET Framework 3.5」を実施してみたところ、今度は成功した。

この状態で新しくインストールされる更新プログラムを確認したところ、.NET 3.5専用のものの他に、先ほど.NET 3.5用のみアンインストールしたKB5030184もインストールされること、ということが確認出来た。

で、実際に適用したあとに、履歴一覧を確認するとKB5030184 が2回適用されていることが確認できた。

Windows Updateしたらsamba ADへの接続がおかしくなった


sambaで作ったsamba AD環境がある。

最近、新しい仮想マシン作ってドメイン参加したあと、PowerShellで「Test-ComputerSecureChannel」を実行したら「False」と出た。

repairしても状況が変わらない

(ADサーバと該当マシン間の通信がセキュアチャネルを使って行われていないという状態)

いまつかっているsambaバージョンを確認すると4.18.2

# /usr/local/samba/sbin/smbd --version
Version 4.18.2
#

sambaのリリース履歴を見るとNetAppでも問題になったセキュリティ修正関連での修正が出ている。

CVE-2023-34967CVE-2022-2127CVE-2023-34968CVE-2023-34966 and CVE-2023-3347.

直接のバグとしては「Bug 15418 – secure channel faulty since Windows 10/11 update 07/2023」が該当している模様

バグであるならアップデートするしかないな、というわけで、samba 4.18.5へアップデート

展開して、make;make install; systemctl restart samba-ad-dc っと

# /usr/local/samba/sbin/smbd --version
Version 4.18.5
#

で、repairすると、今度は成功しました

Oracle Linux 9でWordPressサーバを立てる


Oracle Linux 9でwordpressサーバをたてる、という記事を2022年9月に書き始めたのですが、Oracle Linux 9用のEPELレポジトリにfail2banが含まれていなかっため、sshへの簡単な対策が行えないため書くのを中断していました。

2023年7月25日の更新でfail2banが収録されたようなので、改めて手順を作成してみます

準備1: Oracle Cloud用手順

準備1-1: IPv6アドレス割り当て:Oracle Cloudコンソール側

Oracle Cloudのコンソールを開いて、インスタンスにIPv6アドレスを割り当てます。

また、割り当てられたIPv6アドレスを確認します。

準備1-2: インスタンス側操作

Oracle Linux 9のイメージではIPv6が有効化されていたので、特に設定する必要はありませんでした。

準備2: 一般的な前準備

準備2-1: 日本時間にする

日本に住んでいる場合、日本時間表記の方が使いやすいので、OSも日本時間表示に設定する。

$ sudo timedatectl set-timezone Japan
$ 

準備2-2: パッケージを最新にアップデートする

現時点でインストール済みパッケージを最新にします。

Oracle Linux 9ではyum updateではなくdnf updateとなります。アップデート後は再起動します。(yumコマンドでも動きます)

$ sudo dnf update -y
<略>
$ sudo reboot

手順2-3:日本語Locale対応

ja_JP.UTF-8など日本語Localeで設定した際、「Failed to set locale, defaulting to C.UTF-8」というメッセージが出力される場合があります。

その場合は日本語Localeを追加インストールします。

$ sudo dnf install langpacks-ja glibc-langpack-ja
<略>
$

手順3: EPELレポジトリの追加

EPELレポジトリを使うので、使用できるようにします。

Oracle Linux 8と異なり、Oracle-Linux-9.2-2023.08.31-0 ではOracle CloudのOS管理下にレポジトリ管理が委託されていませんでした。

手順3-1:レポジトリの状態を確認

現状のレポジトリ設定状況を「sudo dnf repolist –all」を実行して確認します。

出力内に「This system is receiving updates from OSMS server.」という文字がなければこの手順で実行できます。

$ sudo dnf repolist --all
repo id                      repo name                                  status
ol9_MODRHCK                  Latest RHCK with fixes from Oracle for Ora disabled
ol9_RDMA                     Oracle Linux 9 (x86_64) RDMA               disabled
ol9_UEKR7                    Oracle Linux 9 UEK Release 7 (x86_64)      enabled
ol9_addons                   Oracle Linux 9 Addons (x86_64)             enabled
ol9_appstream                Oracle Linux 9 Application Stream Packages enabled
ol9_baseos_latest            Oracle Linux 9 BaseOS Latest (x86_64)      enabled
ol9_codeready_builder        Oracle Linux 9 CodeReady Builder (x86_64)  disabled
ol9_developer                Oracle Linux 9 Development Packages (x86_6 disabled
ol9_developer_EPEL           Oracle Linux 9 EPEL Packages for Developme disabled
ol9_developer_UEKR7          Developer Preview of UEK Release 7 (x86_64 disabled
ol9_developer_kvm_utils      Oracle Linux 9 KVM Utilities for Developme disabled
ol9_distro_builder           Oracle Linux 9 Distro Builder (x86_64) - ( disabled
ol9_ksplice                  Ksplice for Oracle Linux 9 (x86_64)        enabled
ol9_kvm_utils                Oracle Linux 9 KVM Utilities (x86_64)      disabled
ol9_oci_included             Oracle Linux 9 OCI Included Packages (x86_ enabled
ol9_u0_baseos_base           Oracle Linux 9 BaseOS GA (x86_64)          disabled
ol9_u1_baseos_base           Oracle Linux 9.1 BaseOS (x86_64)           disabled
ol9_u2_baseos_base           Oracle Linux 9.2 BaseOS (x86_64)           disabled
ol9_x86_64_userspace_ksplice Ksplice aware userspace packages for Oracl disabled
$

有効化するために「sudo dnf config-manager –set-enabled ol9_developer_EPEL」を実行します。

$ sudo dnf config-manager --set-enabled ol9_developer_EPEL
$ sudo dnf repolist --all
repo id                      repo name                                  status
ol9_MODRHCK                  Latest RHCK with fixes from Oracle for Ora disabled
ol9_RDMA                     Oracle Linux 9 (x86_64) RDMA               disabled
ol9_UEKR7                    Oracle Linux 9 UEK Release 7 (x86_64)      enabled
ol9_addons                   Oracle Linux 9 Addons (x86_64)             enabled
ol9_appstream                Oracle Linux 9 Application Stream Packages enabled
ol9_baseos_latest            Oracle Linux 9 BaseOS Latest (x86_64)      enabled
ol9_codeready_builder        Oracle Linux 9 CodeReady Builder (x86_64)  disabled
ol9_developer                Oracle Linux 9 Development Packages (x86_6 disabled
ol9_developer_EPEL           Oracle Linux 9 EPEL Packages for Developme enabled
ol9_developer_UEKR7          Developer Preview of UEK Release 7 (x86_64 disabled
ol9_developer_kvm_utils      Oracle Linux 9 KVM Utilities for Developme disabled
ol9_distro_builder           Oracle Linux 9 Distro Builder (x86_64) - ( disabled
ol9_ksplice                  Ksplice for Oracle Linux 9 (x86_64)        enabled
ol9_kvm_utils                Oracle Linux 9 KVM Utilities (x86_64)      disabled
ol9_oci_included             Oracle Linux 9 OCI Included Packages (x86_ enabled
ol9_u0_baseos_base           Oracle Linux 9 BaseOS GA (x86_64)          disabled
ol9_u1_baseos_base           Oracle Linux 9.1 BaseOS (x86_64)           disabled
ol9_u2_baseos_base           Oracle Linux 9.2 BaseOS (x86_64)           disabled
ol9_x86_64_userspace_ksplice Ksplice aware userspace packages for Oracl disabled
$

手順4: インターネット公開用設定

手順4-1: fail2ban導入

公開サーバは各種のアタックにさらされます。管理用sshポートにもやってきます。

多少なりとも軽減するためにEPELレポジトリ収録のfail2banを使用します。

$ sudo dnf install fail2ban -y
<略>
$

カスタム設定は/etc/fail2ban/jail.local に対して行います。

$ sudo vi /etc/fail2ban/jail.local
$ cat /etc/fail2ban/jail.local
[DEFAULT]
# 86400秒=24時間以内に5回不審なアクセスがあったら24時間BAN
bantime  = 86400
findtime  = 86400
maxretry = 5
# 259200秒=3日以内に5回不審なアクセスがあったら3日間BAN
#bantime  = 259200
#findtime  = 259200
#maxretry = 5
# 除外IP
ignoreip = 127.0.0.1 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
[sshd]
enabled = true
banaction = firewallcmd-ipset
$

上記設定では24時間BANにしていますが、まぁ、3日BANでもかまわないとは思います。(本当に間違えた場合に困るのでほどほどにしておくとよい)

fail2banをOS起動時に実行する設定と、今すぐfail2banを起動するコマンドを実行します。

$ sudo systemctl enable fail2ban
$ sudo systemctl start fail2ban
$

以降、アタックがあると /var/log/fail2ban.log にログが出ます。

手順4-2: Webサーバ用ポート公開設定

この段階では、dhcpv6-clientとsshのみが許可されています。

Webサーバ公開用にhttp(ポート80)とhttps(ポート443)を追加します。

$ sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens3
  sources:
  services: dhcpv6-client ssh
  ports:
  protocols:
  forward: yes
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
$
$ sudo firewall-cmd --permanent --add-service=http
success
$ sudo firewall-cmd --permanent --add-service=https
success
$ sudo firewall-cmd --reload
success
$ sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens3
  sources:
  services: dhcpv6-client http https ssh
  ports:
  protocols:
  forward: yes
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
$

手順5: php 7.4追加

Oracle Linux 9環境では、moduleという形で複数バージョンのソフトウェアが提供されている場合があります。

phpに関してどのようなものがあるのかを「dnf module list | grep php」を実行して確認します。

$ dnf module list | grep php
php        8.1    common [d], devel, minimal            PHP scripting language  
$

Oracle Linux 9.2では php 8.1だけが提供されているようなので、phpとだけ指定してインストールします。

$ sudo dnf install php -y
Last metadata expiration check: 0:18:54 ago on Tue 12 Sep 2023 11:13:37 AM JST.
Dependencies resolved.
================================================================================
 Package             Arch    Version                   Repository          Size
================================================================================
Installing:
 php                 x86_64  8.0.27-1.el9_1            ol9_appstream       10 k
Installing dependencies:
 apr                 x86_64  1.7.0-11.el9              ol9_appstream      132 k
 apr-util            x86_64  1.6.1-20.el9_2.1          ol9_appstream       98 k
 apr-util-bdb        x86_64  1.6.1-20.el9_2.1          ol9_appstream       12 k
 httpd-core          x86_64  2.4.53-11.0.1.el9_2.5     ol9_appstream      1.8 M
 httpd-filesystem    noarch  2.4.53-11.0.1.el9_2.5     ol9_appstream       14 k
 httpd-tools         x86_64  2.4.53-11.0.1.el9_2.5     ol9_appstream       96 k
 nginx-filesystem    noarch  1:1.20.1-14.0.1.el9       ol9_appstream       11 k
 oracle-logos-httpd  noarch  90.2-1.0.2.el9            ol9_baseos_latest   37 k
 php-common          x86_64  8.0.27-1.el9_1            ol9_appstream      716 k
Installing weak dependencies:
 apr-util-openssl    x86_64  1.6.1-20.el9_2.1          ol9_appstream       14 k
 httpd               x86_64  2.4.53-11.0.1.el9_2.5     ol9_appstream       67 k
 mod_http2           x86_64  1.15.19-4.el9_2.4         ol9_appstream      157 k
 mod_lua             x86_64  2.4.53-11.0.1.el9_2.5     ol9_appstream       61 k
 php-cli             x86_64  8.0.27-1.el9_1            ol9_appstream      3.1 M
 php-fpm             x86_64  8.0.27-1.el9_1            ol9_appstream      1.6 M
 php-mbstring        x86_64  8.0.27-1.el9_1            ol9_appstream      470 k
 php-opcache         x86_64  8.0.27-1.el9_1            ol9_appstream      512 k
 php-pdo             x86_64  8.0.27-1.el9_1            ol9_appstream       90 k
 php-xml             x86_64  8.0.27-1.el9_1            ol9_appstream      144 k
Transaction Summary
================================================================================
Install  20 Packages
<略>
  php-pdo-8.0.27-1.el9_1.x86_64
  php-xml-8.0.27-1.el9_1.x86_64
Complete!
$

手順6: MySQL設定編

Oralce Linux 9.2ではMySQL 8.0.32 か mariadb 10.5.16が提供されています。

とりあえず、Oracle直営なのでMySQLを使っておきます。

$ sudo dnf install mysql-server -y
Last metadata expiration check: 0:23:36 ago on Tue 12 Sep 2023 11:13:37 AM JST.
Dependencies resolved.
================================================================================
 Package                      Arch     Version            Repository       Size
================================================================================
Installing:
 mysql-server                 x86_64   8.0.32-1.el9_2     ol9_appstream    17 M
Installing dependencies:
 mariadb-connector-c-config   noarch   3.2.6-1.el9_0      ol9_appstream   9.7 k
 mecab                        x86_64   0.996-3.el9.3      ol9_appstream   384 k
 mysql                        x86_64   8.0.32-1.el9_2     ol9_appstream   2.8 M
 mysql-common                 x86_64   8.0.32-1.el9_2     ol9_appstream   103 k
 mysql-errmsg                 x86_64   8.0.32-1.el9_2     ol9_appstream   513 k
 mysql-selinux                noarch   1.0.5-1.el9_0      ol9_appstream    35 k
 protobuf-lite                x86_64   3.14.0-13.el9      ol9_appstream   233 k
Transaction Summary
================================================================================
Install  8 Packages
<略>
Installed:
  mariadb-connector-c-config-3.2.6-1.el9_0.noarch
  mecab-0.996-3.el9.3.x86_64
  mysql-8.0.32-1.el9_2.x86_64
  mysql-common-8.0.32-1.el9_2.x86_64
  mysql-errmsg-8.0.32-1.el9_2.x86_64
  mysql-selinux-1.0.5-1.el9_0.noarch
  mysql-server-8.0.32-1.el9_2.x86_64
  protobuf-lite-3.14.0-13.el9.x86_64
Complete!
$

mysqldを自動起動する設定とします。

$ sudo systemctl enable mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
$

mysqldを起動します。

$ sudo systemctl start mysqld
$

WordPress用データベースを作成します。

MySQL 8におけるデータベースユーザ作成と権限の割り当てが従来の「grant all on DB名.* to wordpress@localhost identified by ‘パスワード’;」という一文から、「create user ~」と「grant ~」の2つに分かれている点に注意が必要です。

$ sudo mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.32 Source distribution
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database DB名 character set utf8;
Query OK, 1 row affected, 1 warning (0.01 sec)
mysql> create user wordpress@localhost  identified by 'パスワード';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on DB名.* to wordpress@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
$

手順7: Webサーバ設定

手順7-1: httpdインストール

httpdをインストールします。

Oracle Linux 9.2ではWebサーバとして Apache(httpd) 2.4.53 、nginx 1.20.1、nginx 1.22.1が使えるが、apacheを使う。

$ sudo dnf install httpd -y
Last metadata expiration check: 0:05:50 ago on Tue 12 Sep 2023 11:38:07 AM JST.
Package httpd-2.4.53-11.0.1.el9_2.5.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
$

って・・・よくみたらphpインストール時にインストール済みでした。

次で設定変更をするので、この段階ではhttpdを起動しません。

OS起動時に自動起動する設定だけを行います。

$ sudo systemctl enable httpd
$

手順7-2: dehydratedによるLet’s Encrypt導入

Let’s EncryptによるSSL証明書導入はcertbotを使うのが一般的ではあるのだが、python環境とあわせてパッケージサイズが大きいので、コンパクトでEPELにも収録されているdehydratedを使用する。

$ sudo dnf install dehydrated -y
Last metadata expiration check: 0:07:19 ago on Tue 12 Sep 2023 11:38:07 AM JST.
Dependencies resolved.
================================================================================
 Package         Arch        Version              Repository               Size
================================================================================
Installing:
 dehydrated      noarch      0.7.1-1.el9          ol9_developer_EPEL      154 k
Installing dependencies:
 s-nail          x86_64      14.9.22-6.el9        ol9_appstream           626 k
Transaction Summary
================================================================================
Install  2 Packages
<略>
Installed:
  dehydrated-0.7.1-1.el9.noarch           s-nail-14.9.22-6.el9.x86_64
Complete!
$

dehydratedによるSSL証明書取得処理には /var/www/dehydrated が使用されるためディレクトリを作成します。

$ sudo mkdir  /var/www/dehydrated
$

http://~/.well-known/acme-challenge でアクセスした時に上記ディレクトリが開くようApacheの設定を /etc/httpd/conf.d/dehydrated.conf として作成します。(sudo vi /etc/httpd/conf.d/dehydrated.conf )

$ sudo vi /etc/httpd/conf.d/dehydrated.conf
$ cat /etc/httpd/conf.d/dehydrated.conf
Alias /.well-known/acme-challenge /var/www/dehydrated
<Directory /var/www/dehydrated/>
</Directory>
$

httpdを起動します

$ sudo systemctl start httpd
$

SSL証明書を発行するホスト名を /etc/dehydrated/domains.txt に記載する。(sudo vi /etc/dehydrated/domains.txt)

1行に複数のホスト名を記載するとaliasになります。

$ sudo vi /etc/dehydrated/domains.txt
$ sudo cat /etc/dehydrated/domains.txt
ホスト1名.ドメイン名 ホスト2名.ドメイン名
$

登録操作を開始します。

$ sudo dehydrated --register
# INFO: Using main config file /etc/dehydrated/config
# INFO: Using additional config file /etc/dehydrated/conf.d/local.sh
To use dehydrated with this certificate authority you have to agree to their terms of service which you can find here: https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf
To accept these terms of service run "/bin/dehydrated --register --accept-terms".
$ sudo /bin/dehydrated --register --accept-terms
# INFO: Using main config file /etc/dehydrated/config
# INFO: Using additional config file /etc/dehydrated/conf.d/local.sh
+ Generating account key...
+ Registering account key with ACME server...
+ Fetching account URL...
+ Done!
$

初回のSSL証明書発行処理を実行します。

$ sudo dehydrated --cron
# INFO: Using main config file /etc/dehydrated/config
# INFO: Using additional config file /etc/dehydrated/conf.d/local.sh
 + Creating chain cache directory /etc/dehydrated/chains
Processing ホスト1名.ドメイン名 with alternative names: ホスト2名.ドメイン名
 + Creating new directory /etc/dehydrated/certs/ホスト1名.ドメイン名 ...
 + Signing domains...
 + Generating private key...
 + Generating signing request...
 + Requesting new certificate order from CA...
 + Received 2 authorizations URLs from the CA
 + Handling authorization for ホスト1名.ドメイン名
 + Handling authorization for ホスト2名.ドメイン名
 + 2 pending challenge(s)
 + Deploying challenge tokens...
 + Responding to challenge for ホスト1名.ドメイン名 authorization...
 + Challenge is valid!
 + Responding to challenge for ホスト2名.ドメイン名 authorization...
 + Challenge is valid!
 + Cleaning challenge tokens...
 + Requesting certificate...
 + Checking certificate...
 + Done!
 + Creating fullchain.pem...
 + Done!
 + Running automatic cleanup
$

手順7-3: WebサーバへのSSL証明書設定

まず、httpdにmod_sslを追加します。

$ sudo dnf install mod_ssl -y
Last metadata expiration check: 0:13:55 ago on Tue 12 Sep 2023 11:38:07 AM JST.
Dependencies resolved.
================================================================================
 Package      Arch        Version                      Repository          Size
================================================================================
Installing:
 mod_ssl      x86_64      1:2.4.53-11.0.1.el9_2.5      ol9_appstream      119 k
Transaction Summary
================================================================================
Install  1 Package
<略>
$

標準の /etc/httpd/conf.d/ssl.conf は使わず、Mozilla SSL Configuration Generatorベースの設定を /etc/httpd/conf.d/ssl-mozilla.conf として作成します。(なお、ssl.conf には”Listen 443 https”設定もあるので、そのままにしています)

$ sudo vi /etc/httpd/conf.d/ssl-mozilla.conf
$ cat /etc/httpd/conf.d/ssl-mozilla.conf
# generated 2023-09-12, Mozilla Guideline v5.7, Apache 2.4.53, OpenSSL 3.0.7, intermediate configuration
# https://ssl-config.mozilla.org/#server=apache&version=2.4.53&config=intermediate&openssl=3.0.7&guideline=5.7
# this configuration requires mod_ssl, mod_socache_shmcb, mod_rewrite, and mod_headers
<VirtualHost *:80>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
    SSLEngine on
    # curl https://ssl-config.mozilla.org/ffdhe2048.txt >> /path/to/signed_cert_and_intermediate_certs_and_dhparams
    SSLCertificateFile      /etc/dehydrated/certs/<ホスト名>/cert.pem
    SSLCertificateKeyFile   /etc/dehydrated/certs/<ホスト名>/privkey.pem
    # enable HTTP/2, if available
    Protocols h2 http/1.1
    # HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
    Header always set Strict-Transport-Security "max-age=63072000"
</VirtualHost>
# intermediate configuration
SSLProtocol             all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305
SSLHonorCipherOrder     off
SSLSessionTickets       off
SSLUseStapling On
SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
$

httpdを再起動します。

$ sudo systemctl restart httpd
$

手順8: WordPress導入

手順8-1: WordPressの基本インストール

WordPressのWebから最新版をダウンロードして、/var/www/html以下に展開します。
(日本語環境向けのlatest-ja.tar.gzファイルを使っていないのはWordpressプラグインが正常にインストールできるかを確認するためにWP Multibyte Patchを手動インストールする手順を入れているためです)

$ cd /var/www/html
$ ls
$ sudo curl -O https://wordpress.org/latest.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 22.3M  100 22.3M    0     0  17.6M      0  0:00:01  0:00:01 --:--:-- 17.6M
$ ls
latest.tar.gz
$ sudo tar xfz latest.tar.gz
$ ls -l
total 22904
-rw-r--r--. 1 root   root   23447259 Sep 12 11:57 latest.tar.gz
drwxr-xr-x. 5 nobody nobody     4096 Aug 29 23:14 wordpress
$ sudo rm latest.tar.gz
$

WordPressディレクトリの所有者をWebサービスのユーザである「apache」に変更します。

$ ps -ef|grep http
root       44914       1  0 11:56 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     44915   44914  0 11:56 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     44916   44914  0 11:56 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     44917   44914  0 11:56 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache     44918   44914  0 11:56 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
opc        45353    7003  0 11:59 pts/0    00:00:00 grep --color=auto http
$ sudo chown -R apache:apache wordpress/
$ ls -l
total 4
drwxr-xr-x. 5 apache apache 4096 Aug 29 23:14 wordpress
$

/var/www/html/wordpress をDocumentRootとするように ssl-mozilla.conf に追加して、httpdを再起動します。

$ sudo vi /etc/httpd/conf.d/ssl-mozilla.conf
$ cat /etc/httpd/conf.d/ssl-mozilla.conf
# generated 2023-09-12, Mozilla Guideline v5.7, Apache 2.4.53, OpenSSL 3.0.7, intermediate configuration
# https://ssl-config.mozilla.org/#server=apache&version=2.4.53&config=intermediate&openssl=3.0.7&guideline=5.7
# this configuration requires mod_ssl, mod_socache_shmcb, mod_rewrite, and mod_headers
<VirtualHost *:80>
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
    DocumentRoot /var/www/html/wordpress
    SSLEngine on
    # curl https://ssl-config.mozilla.org/ffdhe2048.txt >> /path/to/signed_cert_and_intermediate_certs_and_dhparams
    SSLCertificateFile      /etc/dehydrated/certs/<ホスト名>/cert.pem
    SSLCertificateKeyFile   /etc/dehydrated/certs/<ホスト名>/privkey.pem
    # enable HTTP/2, if available
    Protocols h2 http/1.1
    # HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
    Header always set Strict-Transport-Security "max-age=63072000"
</VirtualHost>
# intermediate configuration
SSLProtocol             all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite          ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305
SSLHonorCipherOrder     off
SSLSessionTickets       off
SSLUseStapling On
SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
$
$ sudo systemctl restart httpd
$

手順8-2: 「missing the MySQL extension」がでる場合の手順

いまの状態でブラウザからアクセスすると、下記の表示になります。

これはphpからMySQLにアクセスするためのパッケージがインストールされていないためなので、php-mysqlndを追加して、httpdを再起動します。

$ sudo dnf install php-mysqlnd -y
Last metadata expiration check: 0:25:26 ago on Tue 12 Sep 2023 11:38:07 AM JST.
Dependencies resolved.
================================================================================
 Package           Architecture Version               Repository           Size
================================================================================
Installing:
 php-mysqlnd       x86_64       8.0.27-1.el9_1        ol9_appstream       157 k
Transaction Summary
================================================================================
Install  1 Package
<略>
$ sudo systemctl restart httpd
$

WordPressの設定手順を進めると wp-config.php に書き込めない、と出ますので、「sudo vi /var/www/html/wordpress/wp-config.php」を実行し、指定された内容を記載します。

手順9: SELinux設定

手順9-1: httpdのネットワーク接続問題

一見するとここまででうまく動いているように見えます。

しかし、プラグインをインストールしようとするとエラーになります。

/var/log/audit/audit.logを確認すると下記のようなログが出ています。

type=AVC msg=audit(1622095859.957:2064): avc:  denied  { name_connect } for  pid=8908 comm="php-fpm" dest=443 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:http_port_t:s0 tclass=tcp_socket permissive=0
type=AVC msg=audit(1622095868.397:2065): avc:  denied  { name_connect } for  pid=8313 comm="php-fpm" dest=443 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:http_port_t:s0 tclass=tcp_socket permissive=0
type=AVC msg=audit(1622095868.401:2066): avc:  denied  { name_connect } for  pid=8313 comm="php-fpm" dest=80 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:http_port_t:s0 tclass=tcp_socket permissive=0

これはhttpd_can_network_connect という値で制御されている

現在の設定値を「sudo getsebool -a |grep httpd_can_network」で確認し、「sudo setsebool -P httpd_can_network_connect on」で有効にする

$ sudo getsebool -a |grep httpd_can_network
httpd_can_network_connect --> off
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off
httpd_can_network_memcache --> off
httpd_can_network_relay --> off
$ sudo setsebool -P httpd_can_network_connect on
$ sudo getsebool -a |grep httpd_can_network
httpd_can_network_connect --> on
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off
httpd_can_network_memcache --> off
httpd_can_network_relay --> off
$

この変更ではhttpdの再起動は不要。

手順9-2: php-fpmの書き込み権限問題

プラグインやテーマのインストールについては問題なくても、WordPressのアップデートが出来ない。

このときの/var/log/audit/audit.logは下記

type=AVC msg=audit(1694506911.363:1538): avc:  denied  { write } for  pid=51364 comm="php-fpm" name="wordpress" dev="dm-0" ino=34891933 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:httpd_sys_content_t:s0 tclass=dir permissive=0

こちらは/var/www/html/wordpress に対して httpdから書き込みが行えるような SELinuxのコンテキストをつけることで解決する。

「sudo chcon -R -t httpd_sys_script_rw_t /var/www/html/wordpress」

$ ls -lZ /var/www/html/
total 4
drwxr-xr-x. 5 apache apache unconfined_u:object_r:httpd_sys_content_t:s0 4096 Sep 12 13:14 wordpress
$ sudo chcon -R -t httpd_sys_script_rw_t /var/www/html/wordpress
$ ls -lZ /var/www/html/
total 4
drwxr-xr-x. 5 apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 4096 Sep 12 13:14 wordpress
$

手順9-3:Wordpressプラグイン追加の動作確認

WordPressプラグインがインストールできる状態になっているかを確認するために「WP Multibyte Patch」をインストールします。

これをインストールするとWordpressの設定画面([Settings]-[General])に「Site language(サイトの言語)」が追加され、「日本語」表示に切り替えることができるようになります。

手順10: WordPressで取り扱えるファイルサイズの拡大

WordPressで取り扱えるファイルは標準状態だと2MBになっている。

WordPressのドキュメントのFile Upload Sizes を見ると、これはphpの設定ファイル /etc/php.ini による制限となっている。

Oracle Linux 9の標準設定では下記の値となっている。

<略>
post_max_size = 8M
<略>
upload_max_filesize = 2M
<略>

で・・・よくある手順だと軽率に /etc/php.ini を書き換えていますが、 /etc/php.d/ 以下にファイルを追加することで、そちらの設定項目を優先させることができる機能があるため、 /etc/php.d/90-wordpress.ini に変更したい2行だけを記載したファイルを作成します。

$ sudo vi /etc/php.d/90-wordpress.ini
$ cat /etc/php.d/90-wordpress.ini
post_max_size = 100M
upload_max_filesize = 100M
$

phpの設定変更を反映させるために「sudo systemctl restart php-fpm」を実行します。

$ sudo systemctl restart php-fpm
$

手順11: WordPressのSite Health Status対応

WordPressのサイトステータスを見てみると、いくつかパッケージを要求されている。

上から順に調査

Oracle Linux 8ではimagemagickのphpモジュールはなかったが、Oracle Linux 9だとあったので「sudo dnf install php-pecl-imagick」でインストール

$ sudo dnf install php-pecl-imagick
Last metadata expiration check: 1:22:23 ago on Tue 12 Sep 2023 11:38:07 AM JST.
Dependencies resolved.
================================================================================
 Package                        Arch   Version         Repository          Size
================================================================================
Installing:
 php-pecl-imagick               x86_64 3.7.0-1.el9     ol9_developer_EPEL 149 k
Installing dependencies:
 ImageMagick-libs               x86_64 6.9.12.93-1.el9 ol9_developer_EPEL 2.6 M
 LibRaw                         x86_64 0.20.2-5.el9    ol9_appstream      382 k
 ModemManager-glib              x86_64 1.20.2-1.el9    ol9_baseos_latest  334 k
 adobe-mappings-cmap            noarch 20171205-12.el9 ol9_appstream      2.0 M
 adobe-mappings-cmap-deprecated noarch 20171205-12.el9 ol9_appstream      129 k
 adobe-mappings-pdf             noarch 20180407-10.el9 ol9_appstream      686 k
 adwaita-cursor-theme           noarch 40.1.1-3.el9    ol9_appstream      686 k
 adwaita-icon-theme             noarch 40.1.1-3.el9    ol9_appstream       16 M
 alsa-lib                       x86_64 1.2.8-3.el9     ol9_appstream      586 k
 at-spi2-atk                    x86_64 2.38.0-4.el9    ol9_appstream       92 k
 at-spi2-core                   x86_64 2.40.3-1.el9    ol9_appstream      262 k
 atk                            x86_64 2.36.0-5.el9    ol9_appstream      378 k
 avahi-glib                     x86_64 0.8-12.el9_2.1  ol9_appstream       13 k
 bluez-libs                     x86_64 5.64-2.el9      ol9_baseos_latest   83 k
 bubblewrap                     x86_64 0.4.1-6.el9     ol9_baseos_latest   50 k
 colord-libs                    x86_64 1.4.5-4.el9     ol9_appstream      235 k
 cups-libs                      x86_64 1:2.3.3op2-16.el9_2.1
                                                       ol9_baseos_latest  264 k
 exempi                         x86_64 2.6.0-0.2.20211007gite23c213.el9
                                                       ol9_appstream      531 k
 exiv2-libs                     x86_64 0.27.5-2.el9    ol9_appstream      780 k
 fdk-aac-free                   x86_64 2.0.0-8.el9     ol9_appstream      325 k
 flac-libs                      x86_64 1.3.3-10.el9    ol9_appstream      226 k
 flatpak-selinux                noarch 1.12.7-2.el9    ol9_appstream       22 k
 flatpak-session-helper         x86_64 1.12.7-2.el9    ol9_appstream       80 k
 fuse                           x86_64 2.9.9-15.el9    ol9_baseos_latest   91 k
 gd                             x86_64 2.3.2-3.el9     ol9_appstream      132 k
 gdk-pixbuf2-modules            x86_64 2.42.6-3.el9    ol9_appstream       96 k
 geoclue2                       x86_64 2.6.0-7.el9     ol9_appstream      136 k
 giflib                         x86_64 5.2.1-9.el9     ol9_appstream       53 k
 google-droid-sans-fonts        noarch 20200215-11.el9.2
                                                       ol9_appstream      2.7 M
 graphene                       x86_64 1.10.6-2.el9    ol9_appstream       64 k
 graphviz                       x86_64 2.44.0-25.el9   ol9_appstream      3.4 M
 gsm                            x86_64 1.0.19-6.el9    ol9_appstream       39 k
 gstreamer1                     x86_64 1.18.4-4.el9    ol9_appstream      1.5 M
 gstreamer1-plugins-base        x86_64 1.18.4-5.el9    ol9_appstream      2.1 M
 gtk-update-icon-cache          x86_64 3.24.31-2.el9   ol9_appstream       34 k
 gtk2                           x86_64 2.24.33-8.el9   ol9_appstream      3.6 M
 gtk3                           x86_64 3.24.31-2.el9   ol9_appstream      5.0 M
 hicolor-icon-theme             noarch 0.17-13.el9     ol9_appstream       70 k
 imath                          x86_64 3.1.2-1.el9     ol9_appstream      102 k
 iso-codes                      noarch 4.6.0-3.el9     ol9_appstream      4.0 M
 jasper-libs                    x86_64 2.0.28-3.el9    ol9_appstream      151 k
 jbig2dec-libs                  x86_64 0.19-7.el9      ol9_appstream       77 k
 jbigkit-libs                   x86_64 2.1-23.el9      ol9_appstream       58 k
 lcms2                          x86_64 2.12-3.el9      ol9_appstream      167 k
 libICE                         x86_64 1.0.10-8.el9    ol9_appstream       71 k
 libSM                          x86_64 1.2.3-10.el9    ol9_appstream       42 k
 libX11-xcb                     x86_64 1.7.0-7.el9     ol9_appstream       12 k
 libXaw                         x86_64 1.0.13-19.el9   ol9_appstream      198 k
 libXcomposite                  x86_64 0.4.5-7.el9     ol9_appstream       29 k
 libXcursor                     x86_64 1.2.0-7.el9     ol9_appstream       35 k
 libXdamage                     x86_64 1.1.5-7.el9     ol9_appstream       27 k
 libXfixes                      x86_64 5.0.3-16.el9    ol9_appstream       20 k
 libXi                          x86_64 1.7.10-8.el9    ol9_appstream       40 k
 libXinerama                    x86_64 1.1.4-10.el9    ol9_appstream       15 k
 libXmu                         x86_64 1.1.3-8.el9     ol9_appstream       79 k
 libXpm                         x86_64 3.5.13-8.el9_1  ol9_appstream       62 k
 libXrandr                      x86_64 1.5.2-8.el9     ol9_appstream       28 k
 libXt                          x86_64 1.2.0-6.el9     ol9_appstream      180 k
 libXtst                        x86_64 1.2.3-16.el9    ol9_appstream       21 k
 libXv                          x86_64 1.0.11-16.el9   ol9_appstream       19 k
 libXxf86vm                     x86_64 1.1.4-18.el9    ol9_appstream       19 k
 libasyncns                     x86_64 0.8-22.el9      ol9_appstream       30 k
 libcanberra                    x86_64 0.30-26.el9     ol9_appstream      100 k
 libcanberra-gtk3               x86_64 0.30-26.el9     ol9_appstream       39 k
 libdrm                         x86_64 2.4.114-1.el9   ol9_appstream      165 k
 libepoxy                       x86_64 1.5.5-4.el9     ol9_appstream      246 k
 libexif                        x86_64 0.6.22-6.el9    ol9_appstream      462 k
 libfontenc                     x86_64 1.1.3-17.el9    ol9_appstream       31 k
 libgexiv2                      x86_64 0.12.3-1.el9    ol9_appstream       88 k
 libglvnd                       x86_64 1:1.3.4-1.el9   ol9_appstream      134 k
 libglvnd-egl                   x86_64 1:1.3.4-1.el9   ol9_appstream       35 k
 libglvnd-glx                   x86_64 1:1.3.4-1.el9   ol9_appstream      141 k
 libgs                          x86_64 9.54.0-9.el9    ol9_appstream      3.4 M
 libgsf                         x86_64 1.14.47-5.el9   ol9_appstream      302 k
 libgxps                        x86_64 0.3.2-3.el9     ol9_appstream       86 k
 libijs                         x86_64 0.35-15.el9     ol9_appstream       30 k
 libiptcdata                    x86_64 1.0.5-9.el9     ol9_appstream       73 k
 libldac                        x86_64 2.0.2.3-10.el9  ol9_appstream       41 k
 liblqr-1                       x86_64 0.4.2-19.el9    ol9_developer_EPEL  53 k
 libnotify                      x86_64 0.7.9-8.el9     ol9_appstream       50 k
 libogg                         x86_64 2:1.3.4-6.el9   ol9_appstream       38 k
 libosinfo                      x86_64 1.10.0-1.el9    ol9_appstream      345 k
 libpaper                       x86_64 1.1.28-4.el9    ol9_appstream       67 k
 libpciaccess                   x86_64 0.16-6.el9      ol9_baseos_latest   28 k
 libraqm                        x86_64 0.8.0-1.el9     ol9_developer_EPEL  19 k
 libsbc                         x86_64 1.4-9.el9       ol9_appstream       45 k
 libsndfile                     x86_64 1.0.31-7.el9    ol9_appstream      212 k
 libtheora                      x86_64 1:1.1.1-31.el9  ol9_appstream      168 k
 libtiff                        x86_64 4.4.0-8.el9_2   ol9_appstream      202 k
 libtool-ltdl                   x86_64 2.4.6-45.el9    ol9_appstream       36 k
 libtracker-sparql              x86_64 3.1.2-3.el9_1   ol9_appstream      354 k
 libvisual                      x86_64 1:0.4.0-34.el9  ol9_appstream      152 k
 libvorbis                      x86_64 1:1.3.7-5.el9   ol9_appstream      198 k
 libwayland-client              x86_64 1.21.0-1.el9    ol9_appstream       32 k
 libwayland-cursor              x86_64 1.21.0-1.el9    ol9_appstream       18 k
 libwayland-egl                 x86_64 1.21.0-1.el9    ol9_appstream       12 k
 libwayland-server              x86_64 1.21.0-1.el9    ol9_appstream       41 k
 libwebp                        x86_64 1.2.0-6.el9_1   ol9_appstream      284 k
 libwmf-lite                    x86_64 0.2.12-10.el9   ol9_appstream       77 k
 libxkbcommon                   x86_64 1.0.3-4.el9     ol9_appstream      133 k
 libxshmfence                   x86_64 1.3-10.el9      ol9_appstream       13 k
 low-memory-monitor             x86_64 2.1-4.el9       ol9_appstream       42 k
 mesa-libEGL                    x86_64 22.3.0-2.el9    ol9_appstream      123 k
 mesa-libGL                     x86_64 22.3.0-2.el9    ol9_appstream      168 k
 mesa-libgbm                    x86_64 22.3.0-2.el9    ol9_appstream       37 k
 mesa-libglapi                  x86_64 22.3.0-2.el9    ol9_appstream       49 k
 mesa-vulkan-drivers            x86_64 22.3.0-2.el9    ol9_appstream      7.4 M
 mkfontscale                    x86_64 1.2.1-3.el9     ol9_appstream       37 k
 openexr-libs                   x86_64 3.1.1-2.el9     ol9_appstream      1.1 M
 openjpeg2                      x86_64 2.4.0-7.el9     ol9_appstream      170 k
 opus                           x86_64 1.3.1-10.el9    ol9_appstream      200 k
 orc                            x86_64 0.4.31-6.el9    ol9_appstream      188 k
 osinfo-db                      noarch 20221130-1.0.2.el9
                                                       ol9_appstream      1.2 M
 osinfo-db-tools                x86_64 1.10.0-1.el9    ol9_appstream       96 k
 ostree-libs                    x86_64 2023.1-6.el9_2  ol9_appstream      441 k
 pipewire-libs                  x86_64 0.3.47-3.el9_2  ol9_appstream      1.7 M
 poppler                        x86_64 21.01.0-14.el9  ol9_appstream      1.1 M
 poppler-data                   noarch 0.4.9-9.el9     ol9_appstream      2.1 M
 poppler-glib                   x86_64 21.01.0-14.el9  ol9_appstream      152 k
 pulseaudio-libs                x86_64 15.0-2.el9      ol9_appstream      726 k
 pulseaudio-utils               x86_64 15.0-2.el9      ol9_appstream       82 k
 rtkit                          x86_64 0.11-28.el9     ol9_appstream       69 k
 sound-theme-freedesktop        noarch 0.8-17.el9      ol9_appstream      407 k
 totem-pl-parser                x86_64 3.26.6-2.el9    ol9_appstream      238 k
 tracker                        x86_64 3.1.2-3.el9_1   ol9_appstream      616 k
 upower                         x86_64 0.99.13-2.el9   ol9_appstream      188 k
 urw-base35-bookman-fonts       noarch 20200910-6.el9  ol9_appstream      861 k
 urw-base35-c059-fonts          noarch 20200910-6.el9  ol9_appstream      888 k
 urw-base35-d050000l-fonts      noarch 20200910-6.el9  ol9_appstream       81 k
 urw-base35-fonts               noarch 20200910-6.el9  ol9_appstream       11 k
 urw-base35-fonts-common        noarch 20200910-6.el9  ol9_appstream       22 k
 urw-base35-gothic-fonts        noarch 20200910-6.el9  ol9_appstream      657 k
 urw-base35-nimbus-mono-ps-fonts
                                noarch 20200910-6.el9  ol9_appstream      810 k
 urw-base35-nimbus-roman-fonts  noarch 20200910-6.el9  ol9_appstream      870 k
 urw-base35-nimbus-sans-fonts   noarch 20200910-6.el9  ol9_appstream      1.3 M
 urw-base35-p052-fonts          noarch 20200910-6.el9  ol9_appstream      987 k
 urw-base35-standard-symbols-ps-fonts
                                noarch 20200910-6.el9  ol9_appstream       42 k
 urw-base35-z003-fonts          noarch 20200910-6.el9  ol9_appstream      281 k
 vulkan-loader                  x86_64 1.3.239.0-1.el9 ol9_appstream      143 k
 webrtc-audio-processing        x86_64 0.3.1-8.el9     ol9_appstream      310 k
 wireplumber                    x86_64 0.4.8-1.0.1.el9 ol9_appstream      123 k
 wireplumber-libs               x86_64 0.4.8-1.0.1.el9 ol9_appstream      335 k
 xdg-dbus-proxy                 x86_64 0.1.3-1.el9     ol9_appstream       41 k
 xdg-desktop-portal             x86_64 1.12.4-1.el9    ol9_appstream      453 k
 xkeyboard-config               noarch 2.33-2.el9      ol9_appstream      1.1 M
 xorg-x11-fonts-ISO8859-1-100dpi
                                noarch 7.5-33.el9      ol9_appstream      1.2 M
Installing weak dependencies:
 dconf                          x86_64 0.40.0-6.el9    ol9_appstream      121 k
 exiv2                          x86_64 0.27.5-2.el9    ol9_appstream      1.0 M
 flatpak                        x86_64 1.12.7-2.el9    ol9_appstream      1.8 M
 libcanberra-gtk2               x86_64 0.30-26.el9     ol9_appstream       26 k
 p11-kit-server                 x86_64 0.24.1-2.el9    ol9_appstream      202 k
 pipewire                       x86_64 0.3.47-3.el9_2  ol9_appstream       49 k
 pipewire-alsa                  x86_64 0.3.47-3.el9_2  ol9_appstream       59 k
 pipewire-jack-audio-connection-kit
                                x86_64 0.3.47-3.el9_2  ol9_appstream      133 k
 pipewire-pulseaudio            x86_64 0.3.47-3.el9_2  ol9_appstream       24 k
 tracker-miners                 x86_64 3.1.2-3.el9     ol9_appstream      1.0 M
 xdg-desktop-portal-gtk         x86_64 1.12.0-3.el9    ol9_appstream      162 k
Transaction Summary
================================================================================
Install  158 Packages
<略>
$

インストール後にサイトヘルスステータスを確認するとgdも消えている

続いて「sudo dnf install php-pecl-zip php-intl」をインストール

$ sudo dnf install php-pecl-zip php-intl
Last metadata expiration check: 1:28:15 ago on Tue 12 Sep 2023 11:38:07 AM JST.
Dependencies resolved.
================================================================================
 Package            Architecture Version              Repository           Size
================================================================================
Installing:
 php-intl           x86_64       8.0.27-1.el9_1       ol9_appstream       150 k
 php-pecl-zip       x86_64       1.19.2-6.el9         ol9_appstream        78 k
Installing dependencies:
 libzip             x86_64       1.7.3-7.el9          ol9_appstream        63 k
Transaction Summary
================================================================================
Install  3 Packages
<略>
$

これで、サイトヘルスステータスのパッケージ関連のメッセージは消えた。

手順12: WordPressの.htaccess有効化

/var/www/html/wordpress/.htaccess が作成されているが、Oracle Linux 8のhttpd標準設定ではこれを読み込むようにはなっていない。

これが有効になっていないと、パーマリンク設定を「基本」から変えた場合に個別記事にアクセスできなくなる。

/etc/httpd/conf.d/wordpress.conf にファイルを作って設定する。

$ sudo vi /etc/httpd/conf.d/wordpress.conf
$ cat /etc/httpd/conf.d/wordpress.conf
<Directory /var/www/html/wordpress/>
 Allowoverride All
</Directory>
$ sudo systemctl restart httpd
$

手順13: OS自動更新の設定

メンテナンスがめんどくさくなって忘れる可能性があるので、Oracle Linux 8の自動更新設定を実施。

以前はyum-cronでしたが、現在は dnf-automatic に変わったので、パッケージをインストールします。

$ sudo dnf install dnf-automatic -y
Last metadata expiration check: 1:30:59 ago on Tue 12 Sep 2023 11:38:07 AM JST.
Dependencies resolved.
================================================================================
 Package          Arch      Version                  Repository            Size
================================================================================
Installing:
 dnf-automatic    noarch    4.14.0-5.0.1.el9_2       ol9_baseos_latest     53 k
Transaction Summary
================================================================================
Install  1 Package
<略>
$

/etc/dnf/automatic.conf 内の「apply_updates = no」を「apply_updates = yes」に変更

$ sudo vi /etc/dnf/automatic.conf
$ cat /etc/dnf/automatic.conf
[commands]
#  What kind of upgrade to perform:
# default                            = all available upgrades
# security                           = only the security upgrades
upgrade_type = default
random_sleep = 0
# Maximum time in seconds to wait until the system is on-line and able to
# connect to remote repositories.
network_online_timeout = 60
# To just receive updates use dnf-automatic-notifyonly.timer
# Whether updates should be downloaded when they are available, by
# dnf-automatic.timer. notifyonly.timer, download.timer and
# install.timer override this setting.
download_updates = yes
# Whether updates should be applied when they are available, by
# dnf-automatic.timer. notifyonly.timer, download.timer and
# install.timer override this setting.
apply_updates = yes
[emitters]
# Name to use for this system in messages that are emitted.  Default is the
# hostname.
# system_name = my-host
# How to send messages.  Valid options are stdio, email and motd.  If
# emit_via includes stdio, messages will be sent to stdout; this is useful
# to have cron send the messages.  If emit_via includes email, this
# program will send email itself according to the configured options.
# If emit_via includes motd, /etc/motd file will have the messages. if
# emit_via includes command_email, then messages will be send via a shell
# command compatible with sendmail.
# Default is email,stdio.
# If emit_via is None or left blank, no messages will be sent.
emit_via = stdio
[email]
# The address to send email messages from.
email_from = root@example.com
# List of addresses to send messages to.
email_to = root
# Name of the host to connect to to send email messages.
email_host = localhost
[command]
# The shell command to execute. This is a Python format string, as used in
# str.format(). The format function will pass a shell-quoted argument called
# `body`.
# command_format = "cat"
# The contents of stdin to pass to the command. It is a format string with the
# same arguments as `command_format`.
# stdin_format = "{body}"
[command_email]
# The shell command to use to send email. This is a Python format string,
# as used in str.format(). The format function will pass shell-quoted arguments
# called body, subject, email_from, email_to.
# command_format = "mail -Ssendwait -s {subject} -r {email_from} {email_to}"
# The contents of stdin to pass to the command. It is a format string with the
# same arguments as `command_format`.
# stdin_format = "{body}"
# The address to send email messages from.
email_from = root@example.com
# List of addresses to send messages to.
email_to = root
[base]
# This section overrides dnf.conf
# Use this to filter DNF core messages
debuglevel = 1
$

そしてdnf-automatic.timerを有効化し、開始します。

$ sudo systemctl enable dnf-automatic.timer
Created symlink /etc/systemd/system/timers.target.wants/dnf-automatic.timer → /usr/lib/systemd/system/dnf-automatic.timer.
$ sudo systemctl status dnf-automatic
○ dnf-automatic.service - dnf automatic
     Loaded: loaded (/usr/lib/systemd/system/dnf-automatic.service; static)
     Active: inactive (dead)
TriggeredBy: ○ dnf-automatic.timer
$ sudo systemctl start dnf-automatic.timer
$ sudo systemctl status dnf-automatic.timer
● dnf-automatic.timer - dnf-automatic timer
     Loaded: loaded (/usr/lib/systemd/system/dnf-automatic.timer; enabled; pres>
     Active: active (waiting) since Tue 2023-09-12 13:11:00 JST; 5s ago
      Until: Tue 2023-09-12 13:11:00 JST; 5s ago
    Trigger: Wed 2023-09-13 06:44:33 JST; 17h left
   Triggers: ● dnf-automatic.service
Sep 12 13:11:00 ホスト名 systemd[1]: Started dnf-automatic timer.
$