ONTAP 9.x環境でActive DirectoryとNISとでユーザ名マッピングを行わせた場合の確認手法

Windows Active Direcotry環境とNISによるユーザ管理を行っているSolaris/Linux環境の両方からONTAP 9.9上の共有にアクセスする場合、ユーザ名マッピング設定を行う。

ただ、指定したマッピングが正しく動いているかを確認する方法がわかりにくいのでメモ書き。

(関連資料「ONTAP 9.xでntpやDNSの動作確認」)

今回はStorage VM:netapp103に対して、 Active Directory:VM2 (vm2.adosakana.local) と NISドメイン:nisdom を接続した。

NISに接続できているかを確認

「vserver services name-service nis-domain show」で設定を確認

netapp101::> vserver services name-service nis-domain show
                                  NIS
Vserver       Domain              Server
------------- ------------------- ------------------------------------
netapp103     nisdom              172.17.44.49

netapp101::>

接続できているかを確認するには「vserver services name-service nis-domain show-bound」を実行する。接続できている場合は「Bound NIS Server」に接続出来ているNISサーバのIPアドレスが表示される。

netapp101::> vserver services name-service nis-domain show-bound
                                  Bound
Vserver       Domain              NIS Server
------------- ------------------- -----------------
netapp103     nisdom              172.17.44.49

netapp101::>

接続できていない場合は、「-」という表示になる

netapp101::> vserver services name-service nis-domain show-bound
                                  Bound
Vserver       Domain              NIS Server
------------- ------------------- -----------------
netapp103     nisdom              -

netapp101::>

なぜ接続出来ていないかを確認するには権限をdiagに変更した上で「vserver services name-service nis-domain show-bound-debug」を実行して確認する。(advancedでは使えない)

netapp101::*> vserver services name-service nis-domain show-bound-debug
                                  Bound              Bound
Vserver       Domain              NIS Server         Status
------------- ------------------- -----------------  -------------------
netapp103     nisdom              172.17.44.49       Could not connect to server

netapp101::*>

今回は「Could not connect to server」ということで、NISサーバへの接続がうまくいかない、ということだった。確認したところ、途中のfirewall設定の問題でNISに関するポートが空いていないためだった。

設定変更後、手動でNISの再接続を行う場合は、ypbindの再起動を行う。このコマンドはノード名を指定することに注意

netapp101::*> vserver services name-service ypbind restart -node ノード名

netapp101::*>

再度「vserver services name-service nis-domain show-bound-debug」を実行して「Status: Success」となっていれば問題ない。

netapp101::*> vserver services name-service nis-domain show-bound-debug
                                  Bound              Bound
Vserver       Domain              NIS Server         Status
------------- ------------------- -----------------  -------------------
netapp103     nisdom              172.17.44.49       Success

netapp101::*>

ネームサービススイッチ設定

/etc/nsswitch.confに相当する設定をStorage VMに対して行い、ユーザ名とグループ名に関してNISから情報を持ってくるように設定する。

設定を確認するには「vserver services ns-switch show」を実行する

netapp101::> vserver services ns-switch show
                               Source
Vserver         Database       Order
--------------- ------------   ---------
netapp103       hosts          files,
                               dns
netapp103       group          files,
                               nis
netapp103       passwd         files,
                               nis
netapp103       netgroup       files
netapp103       namemap        files
netapp101     hosts          files,
                               dns
netapp101     group          files
netapp101     passwd         files
8 entries were displayed.
netapp101::>

UNIX側でLDAP情報を使っていない場合は、LDAPを登録する必要は無い。(Windows側だけでActive Directory/LDAPを使っている場合はnsswitchには登録しない)

なお、ONTAP 9.xでは、NISを使用できるのは passwd, group, netgroup となっており、hosts では使用できない。

情報取得の確認

まず、UNIX側のユーザ名とUIDに関する情報がひけるかを確認するため「vserver services name-service getxxbyyy getpwbyname」と「vserver services name-service getxxbyyy getpwbyuid」を実行する。

これらはadvanced権限が必要となっているので「set adv」で切り替えてから実行する。

netpp101::*> vserver services name-service getxxbyyy getpwbyname -vserver netapp103 -username osakanataro
pw_name: osakanataro
pw_passwd: !!
pw_uid: 1000
pw_gid: 1000
pw_gecos:
pw_dir: /home/osakanataro
pw_shell: /bin/bash


netpp101::*> vserver services name-service getxxbyyy getpwbyuid -vserver netapp103 -userID 1000
pw_name: osakanataro
pw_passwd: !!
pw_uid: 1000
pw_gid: 1000
pw_gecos:
pw_dir: /home/osakanataro
pw_shell: /bin/bash


netpp101::*>

このような形で情報が引けたら問題ない

うまく取得出来ていない場合は、下記の様な出力となる

netapp101::*> vserver services name-service getxxbyyy getpwbyname -vserver netapp103 -username osakanataro

Error: command failed: Failed to resolve osakanataro. Reason: Entry not found for
       "username: osakanataro".

netapp101::*>

マッピング設定

UNIX/Linuxのユーザ名/UIDとWindowsのユーザ名/SIDを変換するには ONTAPにネームマッピング設定を行う必要がある。

WindowsからUNIX/Linuxに対するマッピング(win-unix)と、UNIX/Linuxに対するマッピング(unix-win)の2種類を設定する必要がある。

netapp101::> vserver name-mapping show

Vserver:   netapp103
Direction: win-unix
Position Hostname         IP Address/Mask
-------- ---------------- ----------------
1       -                 -                   Pattern: VM2\\*
                                          Replacement: *

Vserver:   netapp103
Direction: unix-win
Position Hostname         IP Address/Mask
-------- ---------------- ----------------
1       -                 -                   Pattern: *
                                          Replacement: VM2\\*
2 entries were displayed.

netapp101::>

基本的に1対1となるようであれば、「ADドメイン\Windowsユーザ名」→「UNIXユーザ名」というルール(win-unixにある「VM2\\* → *」)と「UNIXユーザ名」→「ADドメイン\Windowsユーザ名」(unix-winにある「* → VM2\\*」)を設定することになる。

なお、”\”は2つ指定する必要がある。

マッピングの確認

実際にどのようなマッピングが行われているのかを確認するには「vserver services access-check name-mapping show」を使います。このコマンドもadvanced権限が必要です。

netapp101::*> vserver services access-check name-mapping show -vserver netapp103 -direction win-unix -name osakanataro

ATTENTION: Mapping of Data ONTAP "admin" users to UNIX user "root" is enabled, but the following information does not reflect this mapping.

'osakanataro' maps to 'osakanataro'


netapp101::*> 
Windowsの名前からUNIXを探すときはにユーザ名を「-name "vm2\\osakanataro"」というように"でくくると正常な動作とならないので注意。
また、ドメインとユーザの区切りは「\\」と2つ続ける必要がある。
netapp101::*> vserver services access-check name-mapping show -vserver netapp103 -direction win-unix -name vm2\\osakanataro

ATTENTION: Mapping of Data ONTAP "admin" users to UNIX user "root" is enabled, but the following information does not reflect this mapping.

'vm2\\osakanataro' maps to 'osakanataro'


netapp101::*> vserver services access-check name-mapping show -vserver netapp103 -direction unix-win -name osakanataro

'osakanataro' maps to 'VM2\osakanataro'


netapp101::*>

なお、NISサーバにアクセスできない場合にこのコマンドを実行すると、以下の様な結果になります。

netapp101::*> vserver services access-check name-mapping show -vserver netapp103 -direction unix-win -name osakanataro

Vserver: netapp103 (internal ID: 3)

Error: RPC map name request procedure failed
  [  4 ms] Mapping Successful for Unix-user 'osakanataro' to Windows
           user 'VM2*' at position 1
  [    11] Successfully connected to ip 172.17.44.49, port 445 using
           TCP
  [    59] Unknown error: 12
  [    59] Failed to initiate Kerberos authentication. Trying NTLM.
  [    70] Encountered NT error (NT_STATUS_MORE_PROCESSING_REQUIRED)
           for SMB command SessionSetup
  [    95] Successfully authenticated with DC
           samba.adosakana.local
  [   109] Encountered NT error (NT_STATUS_PENDING) for SMB command
           Read
  [   117] Could not find Windows name 'VM2*'
**[   120] FAILURE: Name mapping for UNIX user 'osakanataro' failed.
**         Explicit Mapping failed and no default mapping found

Error: command failed: Failed to find mapping for the user. Reason: "SecD
       Error: The mapped user does not exist and no default user is defined".

netapp101::*>

ファイル権限確認

ONTAP上に置かれているファイルの権限をONTAP OS上から確認する「vserver security file-directory show-effective-permissions」がadvanced権限にあります。

確認したいファイル/ディレクトリをフルパスで指定します。

Windows側ユーザ名でアクセスした場合の確認。このコマンドではドメインとユーザの区切りは「\」が1つとなる。

netapp101::*> vserver security file-directory show-effective-permissions -vserver netapp103 -win-user-name VM2\osakanataro -path /sharevol/testfile.txt

                        Vserver: netapp103
              Windows User Name: VM2\osakanataro
                 Unix User Name: osakanataro
                      File Path: /sharevol/testfile.txt
                CIFS Share Path: -
          Effective Permissions:
                                 Effective File or Directory Permission: 0x1f01ff
                                        Read
                                        Write
                                        Append
                                        Read EA
                                        Write EA
                                        Execute
                                        Delete Child
                                        Read Attributes
                                        Write Attributes
                                        Delete
                                        Read Control
                                        Write DAC
                                        Write Owner
                                        Synchronize

netapp101::*>

UNIX/Linux側からアクセスした場合の確認

netapp101::*> vserver security file-directory show-effective-permissions -vserver netapp103 -unix-user-name osakanataro -path /sharevol/testfile.txt

                        Vserver: netapp103
              Windows User Name: VM2\osakanataro
                 Unix User Name: osakanataro
                      File Path: /sharevol/testfile.txt
                CIFS Share Path: -
          Effective Permissions:
                                 Effective File or Directory Permission: 0x1f01ff
                                        Read
                                        Write
                                        Append
                                        Read EA
                                        Write EA
                                        Execute
                                        Delete Child
                                        Read Attributes
                                        Write Attributes
                                        Delete
                                        Read Control
                                        Write DAC
                                        Write Owner
                                        Synchronize

netapp101::*>

細かい動作確認

ユーザ名/UID/SID変換の詳細を確認したい場合は、advanced権限にある「vserver services access-check authentication」を使います

UNIX用ユーザ名からUNIX UIDを検索

netapp101::*> vserver services access-check authentication translate -vserver netapp103 -unix-user-name osakanataro
1000


netapp101::*>

UNIX UIDからUNIX用ユーザ名を検索

netapp101::*> vserver services access-check authentication translate -vserver netapp103 -uid 1000
osakanataro


netapp101::*>

UNIX UIDからWindows用SIDを検索

netapp101::*> vserver services access-check authentication uid-to-sid -vserver netapp103 -uid 1000
SID: S-1-5-21-937304154-1581684492-536532533-1180


netapp101::*>

SIDからUNIX用ユーザ名 と Windows用ユーザ名を検索

netapp101::*> vserver services access-check authentication sid-to-unix-name -vserver netapp103 -sid S-1-5-21-937304154-1581684492-536532533-1180
    SID Type: User
   Unix Name: osakanataro
 Domain Name: VM2
Windows Name: osakanataro


netapp101::*>

Windows用ユーザ名からSIDを検索。このコマンドではドメインとユーザの区切りは「\」が1つとなる。

netapp101::*> vserver services access-check authentication translate -vserver  netapp103 -win-name osakanataro
S-1-5-21-937304154-1581684492-536532533-1180


netapp101::*> vserver services access-check authentication translate -vserver  netapp103 -win-name vm2\osakanataro
S-1-5-21-937304154-1581684492-536532533-1180


netapp101::*>

AlmaLinux 8にRStudio serverをインストールしてみる

AlmaLinux 8環境にRStudio serverをセットアップする必要がある、ということで検証してみた。

Rのインストール

まずはRをインストールする。

Install R」を参考に作業。

必要なレポジトリとして「CodeReady」と「EPEL」と書かれている。

AlmaLinux/RockyLinuxではCodeReadyは「powertools」であるため「dnf config-manager –enable powertools」を実行してPowerToolsレポジトリを有効化する

# dnf config-manager --enable powertools
#

続いてEPELを有効化するため「dnf install epel-release」を実行する。

# dnf install epel-release
メタデータの期限切れの最終確認: 0:00:21 時間前の 2022年08月05日 17時05分19秒 に実施しました。
依存関係が解決しました。
==============================================================================================================
 パッケージ                   アーキテクチャー       バージョン                  リポジトリー           サイズ
==============================================================================================================
インストール:
 epel-release                 noarch                 8-10.el8                    extras                  22 k

トランザクションの概要
==============================================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 22 k
インストール後のサイズ: 32 k
これでよろしいですか? [y/N]: y
<略>
インストール済み:
  epel-release-8-10.el8.noarch

完了しました!
#

現在有効になっているレポジトリを確認するため「dnf repolist」を実行

# dnf repolist
repo id                           repo の名前
appstream                         AlmaLinux 8 - AppStream
baseos                            AlmaLinux 8 - BaseOS
epel                              Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                      Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                            AlmaLinux 8 - Extras
powertools                        AlmaLinux 8 - PowerTools
# dnf repolist --all

続いてR本体をインストールする。

まず、インストールできるRバージョンを「https://cran.r-project.org/src/base/R-4/」にアクセスして確認する

バージョン「4.1.3」をインストールする場合は環境変数「R_VERSION」を「4.1.3」と指定して実行する

# export R_VERSION=4.1.3
# curl -O https://cdn.rstudio.com/r/centos-8/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 61.6M  100 61.6M    0     0  4741k      0  0:00:13  0:00:13 --:--:-- 3486k
# ls -l R-4.1.3-1-1.x86_64.rpm
-rw-r--r--. 1 root root 64609131  8月  5 17:08 R-4.1.3-1-1.x86_64.rpm
# dnf install R-4.1.3-1-1.x86_64.rpm
メタデータの期限切れの最終確認: 0:02:34 時間前の 2022年08月05日 17時06分28秒 に実施しました。
依存関係が解決しました。
==============================================================================================================
 パッケージ                       Arch            バージョン                      リポジトリー          サイズ
==============================================================================================================
インストール:
 R-4.1.3                          x86_64          1-1                             @commandline           62 M
依存関係のインストール:
 binutils                         x86_64          2.30-113.el8                    baseos                5.8 M
 bzip2-devel                      x86_64          1.0.6-26.el8                    baseos                224 k
 cairo                            x86_64          1.15.12-6.el8                   appstream             718 k
 cpp                              x86_64          8.5.0-10.1.el8_6.alma           appstream              10 M
 dejavu-fonts-common              noarch          2.35-7.el8                      baseos                 73 k
 dejavu-sans-fonts                noarch          2.35-7.el8                      baseos                1.5 M
 fontconfig                       x86_64          2.13.1-4.el8                    baseos                273 k
 fontpackages-filesystem          noarch          1.44-22.el8                     baseos                 16 k
 fribidi                          x86_64          1.0.4-8.el8                     appstream              89 k
 gcc                              x86_64          8.5.0-10.1.el8_6.alma           appstream              23 M
 gcc-c++                          x86_64          8.5.0-10.1.el8_6.alma           appstream              12 M
 gcc-gfortran                     x86_64          8.5.0-10.1.el8_6.alma           appstream              12 M
 glibc-devel                      x86_64          2.28-189.5.el8_6                baseos                 78 k
 glibc-headers                    x86_64          2.28-189.5.el8_6                baseos                482 k
 graphite2                        x86_64          1.3.10-10.el8                   appstream             121 k
 harfbuzz                         x86_64          1.7.5-3.el8                     appstream             295 k
 isl                              x86_64          0.16.1-6.el8                    appstream             841 k
 jbigkit-libs                     x86_64          2.1-14.el8                      appstream              54 k
 kernel-headers                   x86_64          4.18.0-372.16.1.el8_6           baseos                9.3 M
 libICE                           x86_64          1.0.9-15.el8                    appstream              73 k
 libSM                            x86_64          1.2.3-1.el8                     appstream              47 k
 libX11                           x86_64          1.6.8-5.el8                     appstream             610 k
 libX11-common                    noarch          1.6.8-5.el8                     appstream             157 k
 libXau                           x86_64          1.0.9-3.el8                     appstream              37 k
 libXext                          x86_64          1.3.4-1.el8                     appstream              45 k
 libXft                           x86_64          2.3.3-1.el8                     appstream              66 k
 libXmu                           x86_64          1.1.3-1.el8                     appstream              75 k
 libXrender                       x86_64          0.9.10-7.el8                    appstream              33 k
 libXt                            x86_64          1.1.5-12.el8                    appstream             185 k
 libcurl-devel                    x86_64          7.61.1-22.el8_6.3               baseos                833 k
 libdatrie                        x86_64          0.2.9-7.el8                     appstream              33 k
 libgfortran                      x86_64          8.5.0-10.1.el8_6.alma           baseos                643 k
 libicu                           x86_64          60.3-2.el8_1                    baseos                8.8 M
 libicu-devel                     x86_64          60.3-2.el8_1                    baseos                922 k
 libjpeg-turbo                    x86_64          1.5.3-12.el8                    appstream             156 k
 libmpc                           x86_64          1.1.0-9.1.el8                   appstream              60 k
 libpkgconf                       x86_64          1.4.2-1.el8                     baseos                 35 k
 libquadmath                      x86_64          8.5.0-10.1.el8_6.alma           baseos                170 k
 libquadmath-devel                x86_64          8.5.0-10.1.el8_6.alma           appstream              23 k
 libstdc++-devel                  x86_64          8.5.0-10.1.el8_6.alma           appstream             2.0 M
 libthai                          x86_64          0.1.27-2.el8                    appstream             203 k
 libtiff                          x86_64          4.0.9-21.el8                    appstream             187 k
 libxcb                           x86_64          1.13.1-1.el8                    appstream             231 k
 libxcrypt-devel                  x86_64          4.1.1-6.el8                     baseos                 24 k
 make                             x86_64          1:4.2.1-11.el8                  baseos                497 k
 openblas-threads                 x86_64          0.3.15-3.el8                    appstream             4.9 M
 pango                            x86_64          1.42.4-8.el8                    appstream             296 k
 pcre2-devel                      x86_64          10.32-2.el8                     baseos                604 k
 pcre2-utf16                      x86_64          10.32-2.el8                     baseos                228 k
 pcre2-utf32                      x86_64          10.32-2.el8                     baseos                220 k
 pixman                           x86_64          0.38.4-2.el8                    appstream             256 k
 pkgconf                          x86_64          1.4.2-1.el8                     baseos                 38 k
 pkgconf-m4                       noarch          1.4.2-1.el8                     baseos                 17 k
 pkgconf-pkg-config               x86_64          1.4.2-1.el8                     baseos                 15 k
 tcl                              x86_64          1:8.6.8-2.el8                   baseos                1.1 M
 tk                               x86_64          1:8.6.8-1.el8                   appstream             1.6 M
 unzip                            x86_64          6.0-46.el8                      baseos                195 k
 xz-devel                         x86_64          5.2.4-4.el8_6                   baseos                 62 k
 zip                              x86_64          3.0-23.el8                      baseos                270 k
 zlib-devel                       x86_64          1.2.11-18.el8_5                 baseos                 57 k

トランザクションの概要
==============================================================================================================
インストール  61 パッケージ

合計サイズ: 165 M
ダウンロードサイズの合計: 103 M
インストール後のサイズ: 416 M
これでよろしいですか? [y/N]: y
<略>
完了しました!
#

R本体が必要としているパッケージ群が追加でインストールされる。

Rは/opt以下にインストールされる

# ls -l /opt
合計 0
drwxr-xr-x. 3 root root 19  8月  5 17:10 R
# ls -l /opt/R/
合計 0
drwxr-xr-x. 5 root root 41  8月  5 17:10 4.1.3
# ls -l /opt/R/4.1.3/
合計 0
drwxr-xr-x. 2 root root 30  8月  5 17:10 bin
drwxr-xr-x. 4 root root 32  8月  5 17:10 lib
drwxr-xr-x. 3 root root 17  8月  5 17:10 share
# du -ks /opt/R/
157716  /opt/R/
#

/opt/R/bin/ は標準的なパスに入っていないので、標準的なパスである /usr/local/bin 以下にRを配置する。

# sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
# sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
# which R
/usr/local/bin/R
# R --version
R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

#

Rstudio serverのインストール

Download RStudio Server for Red Hat/CentOS の手順に従い、rpmファイルをダウンロードし、インストールする。

# curl -O https://download2.rstudio.org/server/rhel8/x86_64/rstudio-server-rhel-2022.07.1-554-x86_64.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 73.7M  100 73.7M    0     0  4257k      0  0:00:17  0:00:17 --:--:-- 7049k
# ls -l rstudio-server-rhel-2022.07.1-554-x86_64.rpm
-rw-r--r--. 1 root root 77282076  8月  5 17:16 rstudio-server-rhel-2022.07.1-554-x86_64.rpm
# dnf install rstudio-server-rhel-2022.07.1-554-x86_64.rpm
メタデータの期限切れの最終確認: 0:11:33 時間前の 2022年08月05日 17時06分28秒 に実施しました。
依存関係が解決しました。
==============================================================================================================
 パッケージ                  アーキテクチャー    バージョン                   リポジトリー              サイズ
==============================================================================================================
インストール:
 rstudio-server              x86_64              2022.07.1+554-1              @commandline               74 M
依存関係のインストール:
 libpq                       x86_64              13.5-1.el8                   appstream                 197 k
 sqlite                      x86_64              3.26.0-15.el8                baseos                    667 k

トランザクションの概要
==============================================================================================================
インストール  3 パッケージ

合計サイズ: 75 M
ダウンロードサイズの合計: 864 k
インストール後のサイズ: 346 M
これでよろしいですか? [y/N]: y
<略>
Created symlink /etc/systemd/system/multi-user.target.wants/rstudio-server.service → /usr/lib/systemd/system/rstudio-server.service.
● rstudio-server.service - RStudio Server
   Loaded: loaded (/usr/lib/systemd/system/rstudio-server.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2022-08-05 17:19:06 JST; 1s ago
  Process: 29307 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
 Main PID: 29308 (rserver)
    Tasks: 4 (limit: 49426)
   Memory: 2.4M
   CGroup: /system.slice/rstudio-server.service
           mq29308 /usr/lib/rstudio-server/bin/rserver

 8月 05 17:19:06 rserver.adosakana.local systemd[1]: Starting RStudio Server...
 8月 05 17:19:06 rserver.adosakana.local systemd[1]: Started RStudio Server.

  検証             : sqlite-3.26.0-15.el8.x86_64                                                          1/3
  検証             : libpq-13.5-1.el8.x86_64                                                              2/3
  検証             : rstudio-server-2022.07.1+554-1.x86_64                                                3/3

インストール済み:
  libpq-13.5-1.el8.x86_64       rstudio-server-2022.07.1+554-1.x86_64       sqlite-3.26.0-15.el8.x86_64

完了しました!
#

インストールするとrstudio-serverがsystemdに登録され、起動している。

firewalldへの設定

rstudio-server の標準設定では port 8787 となっている。

これをfirewalldに登録して外部からアクセスできるようにする。

# firewall-cmd --permanent --add-port=8787/tcp
success
# firewall-cmd --reload
success
# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens192
  sources:
  services: cockpit dhcpv6-client ssh
  ports: 8787/tcp
  protocols:
  forward: no
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
#

設定後にブラウザからアクセスすると下記の様な表示が確認出来る

Rstudio Serverを使う為のSELinux設定

Rstudio Serverは一般ユーザのアカウントでログインして使用するため、SELinux側の設定を調整しないとログインもできない。

SELinuxのポリシーをそれなりに設定しようとするのであればaudit2allowコマンドとSELinuxのteファイルをppファイルにコンパイルできる環境が必要になる。

そのためには「policycoreutils-python-utils」と「selinux-policy-devel」パッケージを追加する

# dnf install policycoreutils-python-utils selinux-policy-devel

で・・・具体的にはログインを繰り返して、/var/log/audit/audit.log の出力を確認しつつ、許可する要素を増やしていく形となる

まずは「ausearch -m AVC |grep “denied”」を実行して、SELinuxで拒否されているものを確認する。

# ausearch -m AVC |grep "denied"
type=AVC msg=audit(1659948002.217:181): avc:  denied  { setpgid } for  pid=48278 comm="rserver" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=process permissive=0
type=AVC msg=audit(1659948020.309:182): avc:  denied  { setpgid } for  pid=48279 comm="rserver" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=process permissive=0
type=AVC msg=audit(1659948380.864:88): avc:  denied  { setpgid } for  pid=5723 comm="rserver" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=process permissive=1
type=AVC msg=audit(1659948381.339:89): avc:  denied  { setpgid } for  pid=5723 comm="rsession" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=process permissive=1
type=AVC msg=audit(1659950719.013:139): avc:  denied  { setpgid } for  pid=6574 comm="rsession" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=process permissive=1
type=AVC msg=audit(1659950719.419:140): avc:  denied  { name_connect } for  pid=6574 comm="R" dest=443 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:http_port_t:s0 tclass=tcp_socket permissive=1
type=AVC msg=audit(1659950783.684:141): avc:  denied  { write open } for  pid=5723 comm="rsession" path="/home/osakanataro/sample.R" dev="dm-2" ino=148 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=1
type=AVC msg=audit(1659950783.684:141): avc:  denied  { create } for  pid=5723 comm="rsession" name="sample.R" scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=1
type=AVC msg=audit(1659950783.684:142): avc:  denied  { read } for  pid=5723 comm="rsession" name="sample.R" dev="dm-2" ino=148 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=1
type=AVC msg=audit(1660013043.066:93): avc:  denied  { setpgid } for  pid=1774 comm="rserver" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=process permissive=0
type=AVC msg=audit(1660014586.546:175): avc:  denied  { rename } for  pid=2783 comm="rsession" name="sample.R" dev="dm-2" ino=148 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0
type=AVC msg=audit(1660014641.065:176): avc:  denied  { rmdir } for  pid=2783 comm="rsession" name="test" dev="dm-2" ino=134217876 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=dir permissive=0
type=AVC msg=audit(1660017628.367:179): avc:  denied  { rename } for  pid=2783 comm="rsession" name="Untitled" dev="dm-2" ino=159 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0
type=AVC msg=audit(1660018249.703:187): avc:  denied  { rename } for  pid=2783 comm="rsession" name="test" dev="dm-2" ino=134217876 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=dir permissive=0
type=AVC msg=audit(1660019006.786:116): avc:  denied  { reparent } for  pid=1809 comm="rsession" name="test2" dev="dm-2" ino=159 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=dir permissive=0
type=AVC msg=audit(1660028279.975:127): avc:  denied  { map } for  pid=1978 comm="rsession" path="/home/osakanataro/R/x86_64-pc-linux-gnu-library/4.1/digest/libs/digest.so" dev="dm-2" ino=177 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0
type=AVC msg=audit(1660028329.771:128): avc:  denied  { map } for  pid=1978 comm="rsession" path="/home/osakanataro/R/x86_64-pc-linux-gnu-library/4.1/digest/libs/digest.so" dev="dm-2" ino=177 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0
type=AVC msg=audit(1660028356.760:129): avc:  denied  { map } for  pid=1978 comm="rsession" path="/home/osakanataro/R/x86_64-pc-linux-gnu-library/4.1/digest/libs/digest.so" dev="dm-2" ino=177 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0
type=AVC msg=audit(1660028659.078:132): avc:  denied  { execute } for  pid=1978 comm="rsession" path="/home/osakanataro/R/x86_64-pc-linux-gnu-library/4.1/digest/libs/digest.so" dev="dm-2" ino=177 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0
type=AVC msg=audit(1660028775.153:135): avc:  denied  { append } for  pid=21355 comm="R" name="sample.spin.R" dev="dm-2" ino=10541 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0
type=AVC msg=audit(1660028911.809:138): avc:  denied  { setattr } for  pid=21400 comm="R" name="sample.spin.R" dev="dm-2" ino=10541 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0
type=AVC msg=audit(1660029171.607:143): avc:  denied  { name_connect } for  pid=1365 comm="rserver" dest=6687 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket permissive=0
type=AVC msg=audit(1660029171.607:144): avc:  denied  { name_connect } for  pid=1365 comm="rserver" dest=6687 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket permissive=0
type=AVC msg=audit(1660029171.630:145): avc:  denied  { read write } for  pid=1978 comm="rsession" name="ptmx" dev="devtmpfs" ino=1120 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:ptmx_t:s0 tclass=chr_file permissive=0
type=AVC msg=audit(1660029288.326:148): avc:  denied  { open } for  pid=1978 comm="rsession" path="/dev/ptmx" dev="devtmpfs" ino=1120 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:ptmx_t:s0 tclass=chr_file permissive=0
type=AVC msg=audit(1660029372.850:151): avc:  denied  { ioctl } for  pid=1978 comm="rsession" path="/dev/ptmx" dev="devtmpfs" ino=1120 ioctlcmd=0x5401 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:ptmx_t:s0 tclass=chr_file permissive=0
type=AVC msg=audit(1660029433.944:154): avc:  denied  { open } for  pid=1978 comm="rsession" path="/dev/pts/2" dev="devpts" ino=5 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:devpts_t:s0 tclass=chr_file permissive=0
type=AVC msg=audit(1660029433.944:155): avc:  denied  { open } for  pid=1978 comm="rsession" path="/dev/pts/2" dev="devpts" ino=5 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:devpts_t:s0 tclass=chr_file permissive=0
type=AVC msg=audit(1660029551.674:158): avc:  denied  { execmem } for  pid=21641 comm="deno" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=process permissive=0
type=AVC msg=audit(1660029594.331:162): avc:  denied  { execmem } for  pid=21664 comm="deno" scontext=system_u:system_r:init_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=process permissive=0
type=AVC msg=audit(1660029676.859:168): avc:  denied  { link } for  pid=21714 comm="rsession" name=".rstudio-lock-41c29-rserver.adosakana.local-21714-7f2b6802e980" dev="dm-2" ino=17682 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file permissive=0
#

特に問題ないようであれば、これをSELinux用のモジュールとする。

# ausearch -m AVC |grep "denied" | audit2allow -M rstudio
******************** 重要 ***********************
このポリシーパッケージを有効にするには、以下を実行して下さい:

semodule -i rstudio.pp

#

このコマンド実行によりrstudio.te というテキストファイルと、rstudio.pp というバイナリファイルが出力される。rstudio.te は下記のような内容となっている。

# cat rstudio.te

module rstudio 1.0;

require {
        type devpts_t;
        type init_t;
        type http_port_t;
        type ptmx_t;
        type user_home_t;
        type unreserved_port_t;
        class process { execmem setpgid };
        class tcp_socket name_connect;
        class file { append create execute link map open read rename setattr write };
        class dir { rename reparent rmdir };
        class chr_file { ioctl open read write };
}

#============= init_t ==============

#!!!! This avc is allowed in the current policy
allow init_t devpts_t:chr_file open;

#!!!! This avc is allowed in the current policy
allow init_t http_port_t:tcp_socket name_connect;

#!!!! This avc is allowed in the current policy
#!!!! This av rule may have been overridden by an extended permission av rule
allow init_t ptmx_t:chr_file { ioctl open read write };

#!!!! This avc is allowed in the current policy
allow init_t self:process { execmem setpgid };

#!!!! This avc is allowed in the current policy
allow init_t unreserved_port_t:tcp_socket name_connect;

#!!!! This avc is allowed in the current policy
allow init_t user_home_t:dir { rename reparent rmdir };
allow init_t user_home_t:file link;

#!!!! This avc is allowed in the current policy
allow init_t user_home_t:file { append create execute map open read rename setattr write };
#

作成されたモジュールを読み込み、モジュール一覧に表示されることを確認する。

# semodule -l | grep rstu
# semodule -i rstudio.pp
# semodule -l | grep rstu
rstudio
#

これで一通りは動作すると思われる

確認した内容
・ファイルの新規作成、削除、リネーム、移動
・ディレクトリの新規作成、削除、リネーム、移動
・Comnpile Reportでのレポート出力
cranパッケージを各ユーザディレクトリにインストールすること
・rstudio上でのshellコマンド実行
・rstudio上でのgitによるバージョン管理(別途 dnf install git でインストールしておくこと)

SELinuxのteファイルをppファイルにする

以下のteファイルをppにします。

# ls
rstudio.te
# cat rstudio.te

module rstudio 1.1;

require {
        type devpts_t;
        type init_t;
        type http_port_t;
        type ptmx_t;
        type user_home_t;
        type unreserved_port_t;
        class process { execmem setpgid };
        class tcp_socket name_connect;
        class file { append create execute link map open read rename setattr write };
        class dir { rename reparent rmdir };
        class chr_file { ioctl open read write };
}

#============= init_t ==============

#!!!! This avc is allowed in the current policy
allow init_t devpts_t:chr_file open;

#!!!! This avc is allowed in the current policy
allow init_t http_port_t:tcp_socket name_connect;

#!!!! This avc is allowed in the current policy
#!!!! This av rule may have been overridden by an extended permission av rule
allow init_t ptmx_t:chr_file { ioctl open read write };

#!!!! This avc is allowed in the current policy
allow init_t self:process { execmem setpgid };

#!!!! This avc is allowed in the current policy
allow init_t unreserved_port_t:tcp_socket name_connect;

#!!!! This avc is allowed in the current policy
allow init_t user_home_t:dir { rename reparent rmdir };
allow init_t user_home_t:file link;

#!!!! This avc is allowed in the current policy
allow init_t user_home_t:file { append create execute map open read rename setattr write };
#

teファイルがある場所で「make -f /usr/share/selinux/devel/Makefile」を実行すると、ppファイルが出力されます。

# make -f /usr/share/selinux/devel/
Makefile    example.if  html/       policy.dtd
example.fc  example.te  include/    policy.xml
# make -f /usr/share/selinux/devel/Makefile
Compiling targeted rstudio module
Creating targeted rstudio.pp policy package
rm tmp/rstudio.mod tmp/rstudio.mod.fc
# ls -l
合計 20
-rw-r--r--. 1 root root    0  8月  9 17:55 rstudio.fc
-rw-r--r--. 1 root root   23  8月  9 17:55 rstudio.if
-rw-r--r--. 1 root root 8589  8月  9 17:55 rstudio.pp
-rw-r--r--. 1 root root 1258  8月  9 17:54 rstudio.te
drwxr-xr-x. 2 root root   70  8月  9 17:55 tmp
#

こうしてできたppファイルを「semodule -i rstudio.pp」で読み込みます。


アレな実験

検証用ということで借りたサーバ実機がRHEL8でインストールされていたが、登録とくにされておらず、CodeReadyレポジトリなどが使えない状態となっていた。

なんかごまかせるかなーというのをチャレンジ

その1: BaseOSとAppStreamはISOファイルから取得する

BaseOSとAppStreamはrhel-8.6-x86_64-dvd.iso に含まれているため適当なディレクトリに置いてそれをレポジトリとする

参考URL:Oracle® Linux 8 Oracle Linuxでのソフトウェアの管理 1.8 ISOイメージを使用したローカルYumリポジトリの作成

ISOファイルを /var/isos/rhel-8.6-x86_64-dvd.iso に置いて、マウントポイントを /isos/rhel86 とし、/etc/fstabに下記を追加する

/var/isos/rhel-8.6-x86_64-dvd.iso       /isos/rhel86    iso9660 loop,ro 0 0

これでマウントすると下記の様になる。

# mount -a
# df -h
ファイルシス          サイズ  使用  残り 使用% マウント位置
devtmpfs                3.8G     0  3.8G    0% /dev
tmpfs                   3.8G     0  3.8G    0% /dev/shm
tmpfs                   3.8G  8.7M  3.8G    1% /run
tmpfs                   3.8G     0  3.8G    0% /sys/fs/cgroup
/dev/mapper/rhel-root    70G   14G   57G   20% /
/dev/sda2              1014M  206M  809M   21% /boot
/dev/sda1               599M  5.9M  594M    1% /boot/efi
/dev/mapper/rhel-home    41G  322M   41G    1% /home
tmpfs                   777M     0  777M    0% /run/user/0
/dev/loop0               11G   11G     0  100% /isos/rhel86
#

これをレポジトリとして登録するために /etc/yum.repos.d/media.repo として下記を作成する。

[media-baseos]
name=media-baseos
baseurl=file:///isos/rhel86/BaseOS/
gpgcheck=1
enabled=1

[media-appstream]
name=media-appstream
baseurl=file:///isos/rhel86/AppStream/
gpgcheck=0
enabled=1

(手動で入力することを想定しているため、入力が面倒くさい gpgkeyに関する記述を省略している)

その2: EPELとCodeReadyはAlmaLinuxから持ってくる

RHEL8からは持って来れないので、AlmaLinuxかRockyLinuxから持ってくる

今回は社内テストをAlmaLinuxで行っていたため、そこで登録されているレポジトリ設定を流用した。

また、RHEL側は8.6で固定したいので、 /etc/yum/vars/releasever を作成し、8.6 で固定する設定とした。

# cat /etc/yum/vars/releasever
8.6
#

EPELの内容 /etc/yum.repos.d/epel.repo

# cat /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 8 - $basearch
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/8/Everything/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=$basearch&infra=$infra&content=$contentdir
enabled=1
gpgcheck=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
#

powertoolsの設定 /etc/yum.repos.d/powertools.repo

# cat /etc/yum.repos.d/powertools.repo
[powertools]
name=AlmaLinux $releasever - PowerTools
#mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/powertools
baseurl=https://repo.almalinux.org/almalinux/$releasever/PowerTools/$basearch/os/
enabled=1
gpgcheck=0
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
#

なお、今後8.7が出た場合でも8.6固定を維持したい場合は https://repo.almalinux.org/almalinux/を https://repo.almalinux.org/vault/ に書き換える。

とりあえず、これで、目的はひとまず達成できた。

RHEL/AlmaLinux/OracleLinux 9.0でIntel VROCを使うとreboot/shutdown時にハングアップする

Intelのサーバ向けチップセットC600/C220に搭載されているオンボードsSATA RAID機能のIntel® Virtual RAID on CPU(VROC)が使える。

資料は「Support for Intel® Virtual RAID on CPU (Intel® VROC)」からだいたいたどりつけるが重要なものは下記となる。

インテル® Virtual RAID on CPU・ユーザーガイド
 Windows, Linux, ESXiでの利用についてのpdfがある

Linuxの場合、kernelにドライバが組み込まれ、RAID管理はmdadmコマンドを利用して行うようになっている。

RHEL/CentOS 7.3ぐらい以降であれば問題は無い。

当然RHEL/AlmaLinux 9.0でも問題ないのであろうと思ってインストールしてみたところ、再起動/停止(reboot/shutdown)にて問題が発生した。

シャットダウン/再起動実行後、umountの途中で止まる。

上記で少しとまった後、1分ぐらいすると下記の追加出力がある。

そのあと、タイムアウトが終わると下記のdumpを出力して完全に止まる。

RHEL9, AlmaLinux 9, Oracle Linux 9 で試したところ、全て同じエラーで止まっている。

エラーメッセージの中で特徴的な「Unmounting /oldroot timed out」で検索したところ、「Bug 1956133 – System hangs in shutdown stage – mdmon killed by dracut shutdown script」から「Bug 1970610 – On shutdown, “mdadm -vv –wait-clean –scan” hangs, preventing a reboot or poweroff」に到達。

いわく、systemdとmdadmのバグで適切にunmountできないために発生、とのこと。

このBugはFedora 34についてのもので、Fedora 34はRHEL 9.0の元となるバージョンとなる。

RHEL9.0は systemd-250-6、mdadm-4.2-2 で、直っていてもよさそうなんですけど…

出力されているエラーメッセージはxfsに関わるものが多いので、使用するファイルシステムを標準のxfsではなく、ext4に変更すればうまくいくのではないか?と変更してみたところ

ext4でインストールしたRHEL9.0/OracleLinux 9.0は問題無く再起動/停止を行うことができました。

インテルサーバのオンボードRAID(VROC)を使う場合、systemd/mdadmが修正されるまではRHEL9系の導入を見合わせた方がよさそうですね。


2022/11/07追記 なお、この現象が発生したサーバを使わないことになったので、その後の状況については不明です


2023/03/06追記

Lenovoサイトに「RHEL 9.0 fails to reboot or shut down on systems with XFS file system and Intel software SATA/NVME RAID – Lenovo ThinkSystem」という記載を発見

Workaround

There are two workarounds for this issue:

  1. Use the ext4 file system instead of the default xfs.
  2. If the xfs file system must be used, use the following command to shut down or reboot:
    #reboot -f #For restart the machine
    #poweroff -f #For shutdown the machine

「xfsじゃなくてext4を使え」というのはこちらで調査した通りのもの

もう1つは「reboot -f」もしくは「poweroff -f」コマンドを使うと強制的に実行できる、というもの。

なるほど

「This behavior will be corrected in a future release scheduled for First Quarter 2023.」とあるので、そろそろ対処されたものがでるのか?

HPEからも「アドバイザリ: (改訂版) Red Hat Enterprise Linux - Red Hat Enterprise Linux 8.6またはRed Hat Enterprise Linux 9.0で、シャットダウンまたは再起動中にインテルVirtual RAID on CPU (インテルVROC) mdraidアレイがアンマウントされると、システムが応答を停止することがある」(英語版)というのが出てるのだが、「Red Hat Enterprise Linux 9.0については、systemdパッケージを250-6.el9_0.1 (またはそれ以降) にアップグレードします。」という内容。

それじゃ対処されてないはずなんだけどなぁ・・・


2023/05/11追記

どうなったかな?とLenovoとHPEの記述を確認してみたが、変更は無かった。

RedHat「Installing RHEL 9.0 GA on Intel VROC RAID (NVMe) get failed」にも記載がある模様

Samba 4.16.x をOracle Linux 8環境でコンパイルする

Oracle Linux 8.6環境でSamba 4.16.3をコンパイルしようとしたら面倒だったのでメモ書き。

まず、「Package Dependencies Required to Build Samba」にあるVerified Package DependenciesのSamba master / CentOS 8 のリンクが使えない。

これは、CentOS8ではなく、CentOS8Streamにリンクが変わったためである。

ただ、Oracle Linux 8ではレポジトリ名が異なっているため、実行が失敗する。

Oracle Linux 8でのレポジトリ対応は下記となる。

RHEL 8CentOS 8Oracle Linux 8
BaseBaseol8_baseos_latest
AppStreamAppStreamol8_appstream
CodeReady Linux Builder*PowerToolsol8_codeready_builder
EPEL**EPEL**ol8_developer_EPEL

なので、Oracle Linux 8では下記を実行してレポジトリを有効化する

# yum config-manager --set-enabled ol8_codeready_builder
# yum config-manager --set-enabled ol8_developer_EPEL

次に、「Red Hat Enterprise Linux 8 / CentOS 8」に記載があるパッケージ群をインストール

# yum install docbook-style-xsl gcc gdb gnutls-devel gpgme-devel jansson-devel \
      keyutils-libs-devel krb5-workstation libacl-devel libaio-devel \
      libarchive-devel libattr-devel libblkid-devel libtasn1 libtasn1-tools \
      libxml2-devel libxslt lmdb-devel openldap-devel pam-devel perl \
      perl-ExtUtils-MakeMaker perl-Parse-Yapp popt-devel python3-cryptography \
      python3-dns python3-gpg python36-devel readline-devel rpcgen systemd-devel \
      tar zlib-devel

エラー対処1: dbus-devel

configure中にエラー発生

Checking for library nscd                                                                       : no
Checking for nscd_flush_cache                                                                   : not found
VFS_STATIC: vfs_default,vfs_not_implemented,vfs_posixacl,vfs_dfs_samba4
VFS_SHARED: vfs_recycle,vfs_audit,vfs_extd_audit,vfs_full_audit,vfs_fake_perms,vfs_default_quota,vfs_readonly,vfs_cap,vfs_expand_msdfs,vfs_shadow_copy,vfs_shadow_copy2,vfs_readahead,vfs_xattr_tdb,vfs_streams_xattr,vfs_streams_depot,vfs_acl_xattr,vfs_acl_tdb,vfs_preopen,vfs_catia,vfs_media_harmony,vfs_unityed_media,vfs_fruit,vfs_shell_snap,vfs_commit,vfs_worm,vfs_crossrename,vfs_linux_xfs_sgid,vfs_time_audit,vfs_offline,vfs_virusfilter,vfs_widelinks,vfs_snapper,vfs_posix_eadb,vfs_syncops,vfs_dirsort,vfs_fileid,vfs_aio_fork,vfs_aio_pthread,vfs_gpfs,vfs_btrfs,vfs_glusterfs_fuse
PDB_STATIC: pdb_smbpasswd,pdb_tdbsam,pdb_samba_dsdb,pdb_ldapsam
PDB_SHARED:
AUTH_STATIC: auth_builtin,auth_sam,auth_winbind,auth_unix,auth_samba4
AUTH_SHARED:
NSS_INFO_STATIC: nss_info_template
NSS_INFO_SHARED:
CHARSET_STATIC:
CHARSET_SHARED:
IDMAP_STATIC: idmap_tdb,idmap_passdb,idmap_nss,idmap_ldap
IDMAP_SHARED: idmap_ad,idmap_rfc2307,idmap_autorid,idmap_rid,idmap_hash,idmap_tdb2,idmap_script
GPEXT_STATIC:
GPEXT_SHARED:
PERFCOUNT_STATIC:
PERFCOUNT_SHARED:
Checking for dbus                                                                               : not found
vfs_snapper is enabled but prerequisite dbus-1 package not found. Use --with-shared-modules='!vfs_snapper' to disable vfs_snapper support.
(complete log in /root/samba-4.16.3/bin/config.log)
# 

これは「dnf install dbus-devel」のインストールで対応

# dnf install dbus-devel
メタデータの期限切れの最終確認: 0:08:21 時間前の 2022年07月19日 09時59分33秒 に 実施しました。
依存関係が解決しました。
================================================================================
 パッケージ      Arch        バージョン                リポジトリー       サイズ
================================================================================
インストール:
 dbus-devel      x86_64      1:1.12.8-18.0.1.el8       ol8_appstream       68 k

トランザクションの概要
================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 68 k
インストール後のサイズ: 127 k
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
dbus-devel-1.12.8-18.0.1.el8.x86_64.rpm          54 kB/s |  68 kB     00:01
--------------------------------------------------------------------------------
合計                                             54 kB/s |  68 kB     00:01
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                        1/1
  インストール中   : dbus-devel-1:1.12.8-18.0.1.el8.x86_64                  1/1
  scriptletの実行中: dbus-devel-1:1.12.8-18.0.1.el8.x86_64                  1/1
  検証             : dbus-devel-1:1.12.8-18.0.1.el8.x86_64                  1/1

インストール済み:
  dbus-devel-1:1.12.8-18.0.1.el8.x86_64

完了しました!
#

エラー対処2: python3-markdown

configure中にエラー発生

Checking for openpty                                                                            : not found
Checking for library util                                                                       : yes
Checking for openpty in util                                                                    : ok
Checking for system installation of Python module markdown                                      : not found
        Unable to find Python module 'markdown'. Please install the system package: python3-markdown'.
#

これは書かれている通りにpython3-markdownをインストール

# dnf install python3-markdown
メタデータの期限切れの最終確認: 0:09:33 時間前の 2022年07月19日 09時59分33秒 に 実施しました。
依存関係が解決しました。
================================================================================
 パッケージ          Arch      バージョン        リポジトリー             サイズ
================================================================================
インストール:
 python3-markdown    noarch    2.6.11-2.el8      ol8_codeready_builder    133 k

トランザクションの概要
================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 133 k
インストール後のサイズ: 418 k
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
python3-markdown-2.6.11-2.el8.noarch.rpm        108 kB/s | 133 kB     00:01
--------------------------------------------------------------------------------
合計                                            108 kB/s | 133 kB     00:01
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                        1/1
  インストール中   : python3-markdown-2.6.11-2.el8.noarch                   1/1
  scriptletの実行中: python3-markdown-2.6.11-2.el8.noarch                   1/1
  検証             : python3-markdown-2.6.11-2.el8.noarch                   1/1

インストール済み:
  python3-markdown-2.6.11-2.el8.noarch

完了しました!
#

エラー対処3: perl-JSON

make中にエラー発生

third_party/heimdal/lib/asn1/der_free.c third_party/heimdal/lib/asn1/der_format.c third_party/heimdal/lib/asn1/der_length.c third_party/heimdal/lib/asn1/der_copy.c third_party/heimdal/lib/asn1/der_cmp.c third_party/heimdal/lib/asn1/der_print.c third_party/heimdal/lib/asn1/extra.c third_party/heimdal/lib/asn1/timegm.c third_party/heimdal/lib/asn1/template.c third_party/heimdal/lib/asn1/oid_resolution.c -> bin/default/third_party/heimdal/lib/asn1/der-protos.h
Can't locate JSON.pm in @INC (you may need to install the JSON module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /root/samba-4.16.3/third_party/heimdal/cf/make-proto.pl line 7.
BEGIN failed--compilation aborted at /root/samba-4.16.3/third_party/heimdal/cf/make-proto.pl line 7.

Waf: Leaving directory `/root/samba-4.16.3/bin/default'
Build failed
 -> task in '../heimdal/lib/asn1/der-protos.h' failed with exit status 2 (run with -v to display more information)
make: *** [Makefile:7: all] エラー 1
PYTHONHASHSEED=1 WAF_MAKE=1  ./buildtools/bin/waf install
Waf: Entering directory `/root/samba-4.16.3/bin/default'
        Selected embedded Heimdal build
Checking project rules ...
Project rules pass
[1/1] Compiling VERSION
+ install /usr/local/samba/lib/pkgconfig/samba-hostconfig.pc (from bin/default/lib/param/samba-hostconfig.pc)
+ install /usr/local/samba/lib/pkgconfig/dcerpc_samr.pc (from bin/default/source4/librpc/dcerpc_samr.pc)
+ install /usr/local/samba/lib/pkgconfig/dcerpc.pc (from bin/default/source4/librpc/dcerpc.pc)
+ install /usr/local/samba/lib/pkgconfig/samdb.pc (from bin/default/source4/dsdb/samdb.pc)
+ install /usr/local/samba/lib/pkgconfig/samba-credentials.pc (from bin/default/auth/credentials/samba-credentials.pc)
+ install /usr/local/samba/lib/pkgconfig/wbclient.pc (from bin/default/nsswitch/libwbclient/wbclient.pc)
+ install /usr/local/samba/lib/pkgconfig/samba-util.pc (from bin/default/lib/util/samba-util.pc)
+ install /usr/local/samba/lib/pkgconfig/dcerpc_server.pc (from bin/default/source4/rpc_server/dcerpc_server.pc)
+ install /usr/local/samba/lib/pkgconfig/ndr_krb5pac.pc (from bin/default/librpc/ndr_krb5pac.pc)
+ install /usr/local/samba/lib/pkgconfig/ndr_standard.pc (from bin/default/librpc/ndr_standard.pc)
+ install /usr/local/samba/lib/pkgconfig/ndr_nbt.pc (from bin/default/librpc/ndr_nbt.pc)
+ install /usr/local/samba/lib/pkgconfig/ndr.pc (from bin/default/librpc/ndr.pc)
+ install /usr/local/samba/lib/pkgconfig/samba-policy.cpython-36m-x86_64-linux-gnu.pc (from bin/default/source4/lib/policy/samba-policy.cpython-36m-x86_64-linux-gnu.pc)
+ install /usr/local/samba/sbin/samba_downgrade_db (from bin/default/source4/scripting/bin/samba_downgrade_db.inst)
+ install /usr/local/samba/sbin/samba_dnsupdate (from bin/default/source4/scripting/bin/samba_dnsupdate.inst)
+ install /usr/local/samba/sbin/samba_spnupdate (from bin/default/source4/scripting/bin/samba_spnupdate.inst)
+ install /usr/local/samba/sbin/samba_upgradedns (from bin/default/source4/scripting/bin/samba_upgradedns.inst)
+ install /usr/local/samba/sbin/samba_kcc (from bin/default/source4/scripting/bin/samba_kcc.inst)
+ install /usr/local/samba/sbin/samba-gpupdate (from bin/default/source4/scripting/bin/samba-gpupdate.inst)
+ install /usr/local/samba/bin/samba-tool (from bin/default/source4/scripting/bin/samba-tool.inst)
+ install /usr/local/samba/lib/pkgconfig/netapi.pc (from bin/default/source3/libnet/netapi.pc)
+ install /usr/local/samba/lib/pkgconfig/smbclient.pc (from bin/default/source3/libsmb/smbclient.pc)
[306/306] Linking bin/default/third_party/heimdal_build/compile_et.inst
[317/322] Processing ../heimdal/lib/asn1/der-protos.h: third_party/heimdal/lib/asn1/der_get.c third_party/heimdal/lib/asn1/der_put.c third_party/heimdal/lib/asn1/der_free.c third_party/heimdal/lib/asn1/der_format.c third_party/heimdal/lib/asn1/der_length.c third_party/heimdal/lib/asn1/der_copy.c third_party/heimdal/lib/asn1/der_cmp.c third_party/heimdal/lib/asn1/der_print.c third_party/heimdal/lib/asn1/extra.c third_party/heimdal/lib/asn1/timegm.c third_party/heimdal/lib/asn1/template.c third_party/heimdal/lib/asn1/oid_resolution.c -> bin/default/third_party/heimdal/lib/asn1/der-protos.h
Can't locate JSON.pm in @INC (you may need to install the JSON module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /root/samba-4.16.3/third_party/heimdal/cf/make-proto.pl line 7.
BEGIN failed--compilation aborted at /root/samba-4.16.3/third_party/heimdal/cf/make-proto.pl line 7.

Waf: Leaving directory `/root/samba-4.16.3/bin/default'
Build failed
 -> task in '../heimdal/lib/asn1/der-protos.h' failed with exit status 2 (run with -v to display more information)
make: *** [Makefile:10: install] エラー 1
#

「dnf install perl-JSON」で対処

# dnf install perl-JSON
メタデータの期限切れの最終確認: 0:24:56 時間前の 2022年07月19日 09時59分33秒 に 実施しました。
依存関係が解決しました。
================================================================================
 パッケージ      Arch         バージョン              リポジトリー        サイズ
================================================================================
インストール:
 perl-JSON       noarch       2.97.001-2.el8          ol8_appstream        96 k

トランザクションの概要
================================================================================
インストール  1 パッケージ

ダウンロードサイズの合計: 96 k
インストール後のサイズ: 245 k
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
perl-JSON-2.97.001-2.el8.noarch.rpm              70 kB/s |  96 kB     00:01
--------------------------------------------------------------------------------
合計                                             70 kB/s |  96 kB     00:01
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                        1/1
  インストール中   : perl-JSON-2.97.001-2.el8.noarch                        1/1
  scriptletの実行中: perl-JSON-2.97.001-2.el8.noarch                        1/1
  検証             : perl-JSON-2.97.001-2.el8.noarch                        1/1

インストール済み:
  perl-JSON-2.97.001-2.el8.noarch

完了しました!
#

以上でsamba-4.16.3のコンパイルが正常に終了した。

AlmaLinux / Rocky Linuxのリリースバージョン固定方法

RedHat Enterprise Linux (RHEL)の基本として、dnfオプションで「–releasever=8.4」というような形でバージョン指定すると固定できる、という手法がある。

そして、設定ファイルとして設定する場合は /etc/yum/vars/releasever というファイルに「8.4」と書くことで反映され、dnfを実行する際にでオプション指定する必要がなくなる。

しかし、AlmaLinux, RockyLinuxともこの設定を行ってもうまくいかないように見える。

これは /etc/yum.repos.d/ の各レポジトリ設定にある情報取得元が「mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/~」というような指定になっていますが、このURLには最新バージョンのものしか残っていないため発生している。

この「mirrorlist=~」のほうを「#mirror=~」と行頭に#を入れてコメントとする。

そして標準ではコメントとなっている「# baseurl=https://repo.almalinux.org/almalinux/$releasever/~」となっている記述のほうの# を削除し、その後ろにあるURLを修正することで対処する。

どう書き換えるかについてはAlmaLinuxとRockyLinuxでそれぞれ異なる。

AlmaLinux の場合

AlmaLinux のレポジトリ https://repo.almalinux.org/almalinux/ を見に行くと 2022/07/14時点では「8.6」「8」「9.0」「9」のディレクトリしかなく古いバージョンのディレクトリはない。
(2023/09/15時点だと古いバージョンのディレクトリはあるものの中身は入っていない)

じゃあ古いバージョンはどこにあるかといえば https://repo.almalinux.org/vault/ にある

なので、 /etc/yum.repos.d/ の各設定にあるURLを「https://repo.almalinux.org/almalinux/~」から「https://repo.almalinux.org/vault/~」に書き換えればよい、ということになる。

RockyLinuxの場合

RockyLinux のレポジトリ https://download.rockylinux.org/pub/rocky/ を見に行くと 2022/07/14時点では「8.4」「8.5」「8.6」「8」「9.0」「9」とディレクトリがあるが、8.4,8.5のディレクトリ内にはreadme.txt があり https://dl.rockylinux.org/vault/rocky/ に案内される。

というわけで、/etc/yum.repos.d/ に書き換えは「https://download.rockylinux.org/pub/rocky/~」から「https://dl.rockylinux.org/vault/rocky/~」に書き換えることになる。

Oracle Linuxの場合

非サポート契約者で固定する方法はなさそう。

ISOファイルを読み込む、という手法で固定する場合は「Oracle Linux 8でリリースバージョン固定する方法」参照のこと。

Cent OSの場合

CentOSの古いレポジトリは https://vault.centos.org/centos/ となる

CentOS 7.xの場合は、各バージョンで提供されているアップデートも適用できる。

CentOS 8.xでは各バージョンの提供開始時のパッケージで固定される。kernelだけは各バージョンに相当する最新パッチも適用できる?


2023/03/06 追記

EPELレポジトリ使用時の注意点

EPELレポジトリの$releasever は基本的に「9」「8」「7」とメジャーバージョン部分だけの構成なようです。

このため、/etc/yum/vars/releaseverで「9.0」という感じでバージョン固定してしまうと、EPELレポジトリ検索の際も「9.0」として実施しますが、EPELレポジトリには小数点以下のディレクトリがないためエラーとなってしまいます。

このため、たとえばepelレポジトリの構成ファイルにある「$releasever」を直接数字の「9」に置き換えてしまう、といった対処が必要となります。

モバイルバージョンを終了