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 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すると、今度は成功しました

NetApp ONTAPから他サーバに気軽にsshできる穴がふさがれてしまった

NetApp ONTAP 9.xに長らく存在していた diagアカウントをロックしていても、lsなどのコマンドを実行できる、という技があった。

ontap98::> set diag

Warning: These diagnostic commands are for use by NetApp personnel only.
Do you want to continue? {y|n}: y

ontap98::*> systemshell -node localhost -command ls /
  (system node systemshell)
BUILD                           mroot_late
COMPAT.TXT                      mroot_late.tgz
COPYRIGHT                       netapp_nodar_build_check
INSTALL                         nfsroot
README.TXT                      ontap
VERSION                         ovl
bin                             partner
boot                            platform
cap.xml                         proc
cfcard                          root
clus                            sbin
dev                             sim
etc                             sldiag
fw                              tmp
kmip                            usr
lib                             var
libexec                         varfs.tgz
mnt                             vs_conf_files.tgz
mroot                           webjail
mroot.tgz

ontap98::*>

ONTAP 9.10.1でも使えていたのだが、Active Directory暗号化問題パッチを適用したONTAP 9.10.1P12で試したところ、実行できなくなっていた。

netapp9101::> set diag

Warning: These diagnostic commands are for use by NetApp personnel only.
Do you want to continue? {y|n}: y

netapp9101::*> systemshell -node localhost -command ls /
  (system node systemshell)

Error: command failed: Error: Account currently locked. Contact the storage
       administrator to unlock it.

netapp9101::*>

え!?と調べたら ONTAP 9.12.1リリースのころからのパッチバージョンから使えなくなっていた模様。

diagアカウントがロックされている場合は、systemshellを禁止します

以降のバージョンが対象
9.7P22
9.8P15
9.9.1P13
9.10.1P9
9.11.1P5.
9.12.1.
9.13.0
9.13.1.

ということで、いまのONTAPだとdiag モードのロックを解除しないと実行できなくなっていました。

公式の解除手順 SystemShell diagユーザアカウントのロックを解除する方法

上記手順だと、diagユーザアカウントにパスワードを設定していますが、「systemshell -node localhost -command コマンド」で実行する場合はパスワード設定は必須ではありません。

現在のdiagユーザのロック状況を確認「security login show -username diag」(バージョンによっては security login show -user-or-group-name diag)

netapp9101::> security login show -username diag

Vserver: netapp9101
                                                                 Second
User/Group                 Authentication                 Acct   Authentication
Name           Application Method        Role Name        Locked Method
-------------- ----------- ------------- ---------------- ------ --------------
diag           console     password      admin            yes    none

netapp9101::>

「Acct Locked: yes」だとロックされている

「security login unlock -username diag」を実行して、ロック解除する

netapp9101::> security login unlock -username diag

netapp9101::> security login show -username diag

Vserver: netapp9101
                                                                 Second
User/Group                 Authentication                 Acct   Authentication
Name           Application Method        Role Name        Locked Method
-------------- ----------- ------------- ---------------- ------ --------------
diag           console     password      admin            no     none

netapp9101::>

ロック解除したあとであれば従来通り実行できた

netapp9101::> set diag

Warning: These diagnostic commands are for use by NetApp personnel only.
Do you want to continue? {y|n}: y

netapp9101::*> systemshell -node localhost -command ls /
  (system node systemshell)
BUILD                           mroot_late
COMPAT.TXT                      mroot_late.tgz
COPYRIGHT                       netapp_nodar_build_check
INSTALL                         nfsroot
README.TXT                      ontap
VERSION                         ovl
bin                             partner
boot                            platform
cap.xml                         proc
cfcard                          root
clus                            sbin
dev                             sim
etc                             sldiag
fw                              tmp
kmip                            usr
lib                             var
libexec                         varfs.tgz
mnt                             vs_conf_files.tgz
mroot                           webjail
mroot.tgz

netapp9101::*>

なお、ONTAP OSの標準値が変わっていますので、利用が終わったら「security login lock -username diag」を実行してロック状態を戻しておきましょう

netapp9101::*> set admin

netapp9101::> security login lock -username diag

netapp9101::> security login show -username diag

Vserver: netapp9101
                                                                 Second
User/Group                 Authentication                 Acct   Authentication
Name           Application Method        Role Name        Locked Method
-------------- ----------- ------------- ---------------- ------ --------------
diag           console     password      admin            yes    none

netapp9101::>

NetAppのボリュームの言語設定についてのメモ

NetAppのボリュームには言語設定があり、設定内容に応じて使える日本語文字列が異なる。

2023年8月時点での最も対応できる範囲が広い設定は4バイトのUTF-8エンコード形式をサポートしている「utf8mb4」となる。

ドキュメント: マルチバイトを含むファイル名、ディレクトリ名、 qtree 名の ONTAP での処理

utf8mb4はONTAP 9.5以降で使える設定で、Windows側でファイル名に「サロゲート文字と補助文字」を含む文字をNetApp内に保存しようとする場合は、ボリュームがutf8mb4でなければ保存できない

なお、ONTP9.7P1以降では、UTF-8系言語をutf8mb4に変更できるようになっているとのこと(Can the volume language be changed after creation in ONTAP?)

問題は旧来から存在している言語設定である。

ONTAP 8.3.2(7-mode)にある日本語系設定
 ja (Japanese euc-j+)
 ja_v1 (Japanese euc-j)
 ja_JP.PCK (Japanese PCK(sjis)*)
 ja_JP.932 (Japanese cp932*)
 ja_JP.PCK_v2 (Japanese PCK(sjis))

ONTAP 9.10.1にある日本語系設定
 ja
 ja_JP.PCK
 ja.UTF-8
 ja_v1
 ja_v1.UTF-8
 ja_JP.PCK.UTF-8
 ja_JP.932
 ja_JP.932.UTF-8
 ja_JP.PCK_v2
 ja_JP.PCK_v2.UTF-8

問題はドキュメントにここらへんの説明が見当たらないこと

volume create」にある-languageオプションの解説は「Language code」としかなく、標準ではvserverのlanguageと同じとあるので「vserver create」を参照してもたいしたことは書いていない

[-language <Language code>] – Default Volume Language Code
This optionally specifies the default language encoding setting for the Vserver and its volumes. The recommended format is to append .UTF-8 for the language encoding values. For example, for the en_US language, the recommended format is en_US.UTF-8 . The default setting is C.UTF-8 .

NetApp KBに What is the difference between ja_JP.PCK.UTF-8 and ja_JP.PCK_v2.UTF-8? があるのだが

ja_JP.PCK uses cp932_v1.ntt and eucj_v1.ntt.
ja_JP.PCK_v2 uses cp932_v1.ntt and sjis_v2.ntt.

・・・いや説明になってないのでは?という記述のみ

ONTAP 8.3時代のドキュメントの「言語オプション一覧」もたいした記述は無い

ja_v1日本語(euc-j)
ja_v1.UTF-8日本語(euc-j)(UTF-8)
ja_jp.pck_v2日本語PCK(sjis)
ja_JP.PCK_v2.UTF-8日本語PCK(sjis)(UTF-8)

おそらくPCKはSolarisにおける「PC漢字コード」が由来と想定される。

Solaris 2.6 では、従来の日本語 EUC に加えて PCK (シフト JIS あるいは MS 漢字コード) で日本語を扱う環境を新たに提供します。PCK は、Microsoft が Windows3.1 で規定したマイクロソフト標準キャラクタセットと同等の文字集合およびエンコーディングを提供するものです。また、PCK は、従来の Solaris リリースで MS 漢字コード (または シフト JIS) と呼ばれていたものに、ユーザー定義文字やベンダー定義文字を加えたもので、JIS X 0201、JIS X 0208 の 1-84 区 (13 区除く) までに関しては従来のものと互換性があります。

これがベースであるとすれば、PCKはWindows 3.1ベースのもので、PCK_v2はWindows それ以降対応。ONTAP 7.2などで既にPCK_v2は存在していたので、Windows2000ぐらいをベースにしていると想定される。

詳細を探すとSolaris 8のマニュアル PCK(5) に記載があった。

(内容については省略)

同じくONTAP 7.2ぐらいでja_v1, ja_JP.UTF-8 が登場していた。

cp932/932はMicrosoftコードページ932 と呼ばれるWindows 3.1J用にマイクロソフトとNECが定義したShift JISの独自拡張となる。

定義的に考えると、cp932とpckは同一ということになるのだが、先に出てきたWhat is the difference between ja_JP.PCK.UTF-8 and ja_JP.PCK_v2.UTF-8? によると、NetAppのPCKには、cp932範囲の他にも含まれているものがある、ということになる。

で・・・

これ以上の情報が見つからないのである

困ったもんだ

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