ラベル CVM の投稿を表示しています。 すべての投稿を表示
ラベル CVM の投稿を表示しています。 すべての投稿を表示

2026年9月30日水曜日

CVMのSSHアクセス制限方法

昨今のサイバー攻撃が増えている中、Nutanix環境を運用している場合、その中枢であるCVMも攻撃の対象になる可能性が高くなっています。

CVMに関しては、AOS 7.3よりCVMと同一のセグメント以外からの疎通を受け付けなくする機能が備えられております。

以下のコマンドを実行することで、CVMのローカルサブネットのみのアクセスにすることができます。

ncli cluster edit-cvm-security-params ip-restriction=restricted

しかし、このコマンドだけですとリモートからのメンテナンスの場合踏み台のコンソールを用意する必要などが出てくるケースもあるかと思います。そうなると結果攻撃対象の一つとなってしまう可能性もあります。特定のサブネット以外のIPアドレスをホワイトリストに入れ許可の対象とする場合、以下のコマンドを実行します。

ncli cluster edit-cvm-security-params add-to-ssh-whitelist=x.x.x.x

ホワイトリストから削除する場合は、以下のコマンドを実行します。

cluster edit-cvm-security-params remove-from-ssh-whitelist=x.x.x.x


外部から、ホワイトリストの追加許可等をAPIやncliが設定不可にすることもできます。

ncli cluster edit-cvm-security-params enable-lock-status=true

ただし、このコマンドを実行した場合、解除はNutanixサポートへのコールが必要となります。


(参考)
https://portal.nutanix.com/page/documents/details?targetId=Nutanix-Security-Guide-v7_6:sec-controller-virtual-machine-t.html


また、AOS 7.5よりネットワーク経由でのCVMへのSSH接続制限機能が追加されています。

こちらは、専用の実行モジュールが以下のKBで用意されています。
モジュールのダウンロードおよび実行方法は、以下のKBを参考にいただくのがよいと思います。

KB:19114 / Enabling/Disabling SSH Access to CVMs via API
https://portal.nutanix.com/kb/19114

※本コマンドを実行するとAOS 7.5以降は、CVMとAHVの両方のにSSHアクセス制限が施されます。


また、Prism Central 7.6を確認すると、GUIでSSHアクセスを制御できるようになっています。

Prism Centralのインフラストラクチャーメニューにすすみクラスタを選択後、「More」をクリックすると「NuService Mode」が表示されます。こちらはBashシェルに戻すというわkではなく、メニュー自体にアクセスできなくするかどうかの設定となります。


NutanixのSSHにも様々なセキュリティ設定が施されています。デフォルトのままで安心せず、必要農事手閉める対策を行ってください。






 

2026年9月26日土曜日

CVMにアクセスできないときに確認する事項

なんらかの不具合等でCVMにアクセスができない場合、様々障害調査を行う必要がありますが、SSHでCVMにアクセスができないとCVMで何が起きているのかが見えないため、状態を確認することが非常に困難を極めます。

今回は、CVMと疎通ができない場合の調査について記載いたします。

CVMに接続ができない場合、頼りのすべは、CVMをホストするAHVコンソールに入ることが必要です。SSHでAHVホストにアクセスができる場合は、SSHでアクセスしてください。SSHアクセスがAOS7.6以降ではdefault無効化されていますので、その場合は直接キーボードとディスプレイをつないで操作をするか、IPMIのバーチャルコンソールから操作します。

まずは、CVM自体が起動しているかを確認します。

[root@UX-AHV171 ~]# virsh list --all --title
 Id   Name                                   State      Title
--------------------------------------------------------------------
 4    48b04e15-f435-44ea-474b-56f81a30a2b8   running    WINVGSH012
 -    NTNX-UX-AHV171-CVM                     shut off

この状態では、CVMが「shut off」起動していないことがわかります。

起動していない場合は、以下のコマンドでCVMを起動します。

[root@UX-AHV171 ~]# virsh start NTNX-UX-AHV171-CVM


すでに起動している場合は、CVMへの接続を確認します。

AHVから、CVMの内部IPである「192.168.5.2」にPING応答を確認します。

[root@UX-AHV171 ~]# ping 192.168.5.2
PING 192.168.5.2 (192.168.5.2) 56(84) bytes of data.
64 bytes from 192.168.5.2: icmp_seq=1 ttl=64 time=0.417 ms
64 bytes from 192.168.5.2: icmp_seq=2 ttl=64 time=0.113 ms
64 bytes from 192.168.5.2: icmp_seq=3 ttl=64 time=0.093 ms
64 bytes from 192.168.5.2: icmp_seq=4 ttl=64 time=0.095 ms

このように返答がある場合は、CVMの表側のネットワークから接続ができていないのが要因の可能性があります。VLANの設定が間違っているなどの場合も想定されます。

この場合は、192.168.5.2へSSH接続を行い、CVMのネットワーク設定を変更します。

[root@UX-AHV171 ~]# ssh admin@192.168.5.2
The authenticity of host '192.168.5.2 (192.168.5.2)' can't be established.
ECDSA key fingerprint is SHA256:/b4fxxxxxxxxnU+CnsyJf3ZpR5I8SRJ9xxxnVSENmn40.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.5.2' (ECDSA) to the list of known hosts.
Nutanix Controller VM
admin@192.168.5.2's password:

Last login: Sat Sep 26 14:14:45 JST 2026 on pts/1
Last login: Sat Sep 26 17:09:55 2026 from 192.168.5.1

============================
NuService  Menu:
============================
Option 1: Execute Commands
Option 2: Log Viewer
Option 3: Launch Admin Shell
Option 4: Configure Settings
Option 5: Help
Option X: Exit
============================
Choice:


一方で以下のようにCVMにアクセスができないことも考えられます。

[root@UX-AHV171 ~]# ping 192.168.5.2
PING 192.168.5.2 (192.168.5.2) 56(84) bytes of data.
From 192.168.5.1 icmp_seq=1 Destination Host Unreachable
From 192.168.5.1 icmp_seq=2 Destination Host Unreachable
From 192.168.5.1 icmp_seq=3 Destination Host Unreachable

 CVMが起動しているにもかかわらずCVMの内部IPに疎通が通らない場合、CVMが起動中にハングアップしている可能性が非常に高いと考えられます。

この場合、CVMのコンソールに表示されている情報を確認する必要があります。


AHVから、「 /var/log/NTNX.serial.out.0」ファイルをlessやcatで確認しどこで起動ができずストップしているかを確認します。

[root@UX-AHV171 ~]# cat /var/log/NTNX.serial.out.0
...

svmboot: error: no valid boot partition (i.e. no active partition marker)
[  162.175021] dracut-mount[637]: /lib/dracut/hooks/mount/10-nutanix-root-selector.sh: line 3: NEWROOT: readonly variable
[  OK  ] Started dracut mount hook.
[  162.103204] kauditd_printk_skb: 30 callbacks suppressed
[  162.103208] audit: type=1130 audit(1787375412.929:41): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=dracut-mount comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
         Starting dracut pre-pivot and cleanup hook...
[  162.190333] d[  162.217094] dracut: FATAL: FIPS integrity test failed
racut-pre-pivot[733]: Warning: /boot//.vmlinuz-5[  162.218091] dracut: Refusing to continue
.10.224-2.el8.nutanix.20241212.100213.x86_64.hmac does not exist
[  162.265123] printk: systemd-shutdow: 31 output lines suppressed due to ratelimiting
[  162.314812] systemd-shutdown[1]: Syncing filesystems and block devices.
[  162.315818] systemd-shutdown[1]: Sending SIGTERM to remaining processes...
[  162.322817] systemd-shutdown[1]: Sending SIGKILL to remaining processes...
[  162.325088] systemd-shutdown[1]: Unmounting file systems.
[  162.326311] [754]: Remounting '/' read-only in with options 'size=16283196k,nr_inodes=4070799'.
[  162.327814] systemd-shutdown[1]: All filesystems unmounted.
[  162.328685] systemd-shutdown[1]: Deactivating swaps.
[  162.329419] systemd-shutdown[1]: All swaps deactivated.
[  162.330259] systemd-shutdown[1]: Detaching loop devices.
[  162.331405] systemd-shutdown[1]: All loop devices detached.
[  162.332221] systemd-shutdown[1]: Stopping MD devices.
[  162.334372] reboot: System halted

この例では、CVMがパススルーしているHBAデバイスからSSDやHDDなどの記憶メディアがが読み取れないため、CVMとして起動できずにOSが落ちている状態のように見受けられます。

このような場合は、ハードウェアの障害を疑う必要もあります。

(参考)Serial Console Redirection to a Telnet Port
https://portal.nutanix.com/page/documents/details?targetId=AHV-Admin-Guide-v10_3-ja-JP:ahv-serial-console-redirection-telnet-port.html


何らかの障害が発生した場合に、調査をするすべを持っているかいないかは、トラブル解決までの時間に大きくかかわってきます。

CVMの状態を把握することは、Nutanixのトラブルを把握するはじめの一歩ですので、これらのオペレーションは把握しておくことがおすすめです。





restricted accessによるCVMへのBashシェルアクセス廃止について

前回までにBashシェルアクセスの廃止におけるロードマップと新しいNuService Menuについて紹介しました。

今回はおそらくAOS7.6 の次のバージョンでデフォルト(強制)されるであろうBashシェルの完全廃止について紹介したいと思います。

AOS 7.6においては、Bashシェルで「configure_restricted_access」コマンドを実行することで、Bashシェルを無効化し、Nutanixサポートからのトークンをもらわない限りBashシェルアクセスが許可されないモードにすることができます。

※configure_restricted_accessを実行し、Bashシェルを無効化すると、再度Bashシェルを有効化することはできませんので、ご注意ください。

ここでは、「configure_restricted_access」を有効化し、その後の動きを見てみたいと思います。

nutanix@NTNX-WKJ951XPCX-A-CVM:10.187.67.223:~$ configure_restricted_access
############################################################# Configuring restricted bash access will put your system in a STIG compliant state by enabling support-only-login-mode wherein, you will be required to open a support ticket with Nutanix in order to gain temporary access to the full bash shell. This action cannot be reversed. ############################################################# Type YES to confirm and proceed, or anything else to cancel: YES ############################################################# Configuring restricted access state in ZK... Waiting 10s for all nodes to apply changes... Verifying restricted access configuration... [1/2] Verifying restricted access configuration... [2/2] Verification done. Successfully configured restricted access.

実行自体は、1分もかからない程度で終わります。

その後、SSHで、nutanixユーザで接続してみましょう。

>ssh nutanix@10.187.67.223
The authenticity of host '10.187.67.223 (10.187.67.223)' can't be established.
ECDSA key fingerprint is SHA256:zsJ+7xxxxxxxxxxCL6wlqrxNzHsSY7cEXP61401kqho.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.187.67.223' (ECDSA) to the list of known hosts.
Nutanix Controller VM
nutanix@10.187.67.223's password:
** SSH to CVM via 'nutanix' user is restricted. Please use the 'admin' user. **
Connection to 10.187.67.223 closed.
adminユーザ以外の接続は拒否されたことがわかります。

なお、Prism Elementのコンソールから、nutanixユーザーでログインをしても、Permission deniedとメッセージが表示されログインコンソールに戻されてしまいます。


それでは、adminユーザでログインし、Bashシェルアクセスを実行してみます。

============================
NuService  Menu:
============================
Option 1: Execute Commands
Option 2: Log Viewer
Option 3: Launch Admin Shell
Option 4: Configure Settings
Option 5: Help
Option X: Exit
============================
Choice: 3

========================================= New Full Access Session ==========================================
Enter Salesforce Case Number: XXXXXXXXXXX
[2026-09-26 12:43:14] Please share the following request token with the Nutanix Support (valid for 30 mins).
============================================================================================================
bread industry market duty bag reform ivory major brain world trash open
============================================================================================================
[2026-09-26 12:43:14] Attempt 1/3: Enter the response token received from the Nutanix Support: XXXX

シェルアクセスを実行しようとすると、Case番号を要求されます。Case番号を入れると、サポートからもらったトークンを入力するとBashシェルがアクセスできるようになります。

サポートからのトークンがなければ、Bashシェルへのアクセスはできなくなります。


サイバー攻撃において、Bashシェルはその自由度から攻撃の温床になりやすいため、Bashシェルの制限は、昨今において必要な機能実装であると考えられます。

一方でオペレーションの自由度は下がる点や今までのシェルに依存した運用は変更を行う必要があります。


(参考)Activating Support-only Login on a Cluster
https://portal.nutanix.com/page/documents/details?targetId=Nutanix-Security-Guide-v7_6:sec-secure-access-support-only-login-activation-t.html






NuService MenuとBashシェルアクセスの廃止について

Nutanixの機能中枢であるCVMは、クラスターのコントロールセンターであることから、サイバー攻撃者が狙う標的にもなりやすい特徴があります。パスワードの変更や、クラスターロックダウンで侵入を防ぐアプローチを行う必要は、セキュリティ対策の一丁目・一番地であることに変わりがありませんが、ゼロトラストの思想からいけば、万が一侵入されてた場合における対策も考えておく必要があります。

Nutanixは、段階的にBashシェルアクセスを廃止する方向になっています。

AOS 7.5 ・・・ CVMへのシェルアクセス制限機能を追加
AOS 7.6 ・・・ CVMへNuService Menu追加(AHVは、デフォルトでSSH接続禁止)
次のバージョン ・・・ デフォルトでCVMへのBashシェル廃止

この実装により米国国防情報局(DISA)のSTIG組織と連携して、RHELベースのSTIGからネットワークアプライアンスベースのSTIGへの準拠になります。

今まで、独自のスクリプトをCVMに入れて運用していたなど様々CVMをカスタマイズした運用をされている場合は、早期にCVM外でオペレーションを行うように改善が必要となります。(そもそもCVM内部で独自のスクリプトなどを動作させることはサポート対象外です)

本日は、AOS7.6で追加されたNuService Menuを紹介します。

CVMにSSHで、「admin」ユーザでログインすると以下のメニューが表示されます。

============================
NuService  Menu:
============================
Option 1: Execute Commands
Option 2: Log Viewer
Option 3: Launch Admin Shell
Option 4: Configure Settings
Option 5: Help
Option X: Exit
============================
Choice:

ここで、必要な操作メニューを開きます。まずは、1番のコマンド実行を確認してみます。

============================
Execute Commands:
============================
Option 1: CVM
Option 2: AHV
Option B: Go Back to Main Menu
============================
Choice:

CVMは、CVMでの制限されたシェルアクセス、AHVは、AHVにおける限定されたコマンドを提供するようです。まずは、CVM側のシェルに入ってみます。

--- Allowed Commands Mode ---
Type 'help' for available commands, or 'exit' to return to main menu

acli
afs
arping
cerebro_cli
change_ahv_hostname
change_cvm_display_name
change_cvm_hostname
change_cvm_vlan
check_temporary_full_bash_access_expiration
chronyc tracking
cluster restart_genesis
cluster start
cluster status
cluster stop
collect_perf
configure_restricted_access
convert_cluster_status
cvm_shutdown
date
df
disable_full_bash_access
dmesg
ecli
exit
foundation_service
genesis
help
history
install_host_package
intersight_info
iptables --check
iptables --list
iptables --list-rules
iptables -C
iptables -L
iptables -S
last
lcm_cancel_updates
lcm_leader
lcm_node_recovery
lcm_upgrade_status
list_disks
logbay
manage_bad_passwords.py
manage_bootloader_fix
manage_ipv6
manage_ovs
md5sum
modify_firewall
ncc
ncli
network_segment_status --last_task
nfs_ls
nodetool -h 0 ring
nslookup
nsx_t_manager -l
nutanix_pulse_packet_helper.py
panacea_cli
progress_monitor_cli
rolling_restart
rsync
sar
scp
set_remote_diagnostics_status
smartctl
snapshot_tree_printer
storcli64 /call/eall show
stretch_params_printer
upgrade_status

Tabキーで実行できるコマンドを確認してみました。従来のシェルのようにcpとかsshとかは使えなくなっています。CVMオペレーションでよく利用していたallsshも使えなくなっています。

では、AHV側のコマンド実行画面も見てみましょう。

--- AHV Commands Mode ---
Type 'help' for available commands, or 'exit' to return to main menu

exit                  ovs-appctl fdb/flush  shutdown -h now
help                  ovs-appctl fdb/show   update-cvm-config
history               ovs-vsctl get
nvidia-smi            ovs-vsctl set

AHV側は、かなり実行できるコマンドが制限されています。許可されているのは、GPU周りのコマンドと仮想スイッチ周りの操作程度でしょうか..。

続いて、2番目のLog Viewerを見てみましょう。

  Select an option:

    A. File Explorer (with filename filtering)
    B. Content Search (string in filtered files)こ

こちらは、AかBをメニューで選択します。まずは、AのFile Explorerを見てみます。

ここでは、「/home/nutanix/data/logs」配下に配置されるログが一覧で表示されます。

File Filter:
 Modified date        Size      File name
 2026-09-26 11:07:20 7.8MB    sysstats/top.INFO
 2026-09-26 11:07:20 7.8MB    sysstats/top.INFO.20260926-013152
 2026-09-26 11:07:20 9.6MB    insights_server.ntnx-sgh950xpcv-a-cvm.nutanix.log.
 2026-09-26 11:07:20 12.9MB   health_server.log.20260926-013412Z
 2026-09-26 11:07:20 65.2KB   acropolis-publisher.out
 2026-09-26 11:07:20 853.0KB  zookeeper.out
 2026-09-26 11:07:20 9.6MB    insights_server.INFO
 2026-09-26 11:07:20 12.9MB   health_server.log
 2026-09-26 11:07:20 17.7MB   cassandra/cassandra_gc.1790386341.log
 2026-09-26 11:07:20 65.2KB   acropolis-publisher.out.20260926-104946Z
 2026-09-26 11:07:20 853.0KB  zookeeper.out.20260926-012946Z
 2026-09-26 11:07:19 20.3MB   stargate.ntnx-sgh950xpcv-a-cvm.nutanix.log.INFO.20
 2026-09-26 11:07:19 374.4KB  mantle.INFO
 2026-09-26 11:07:19 228.2KB  cluster_health.out
 2026-09-26 11:07:19 20.3MB   stargate.INFO
 2026-09-26 11:07:19 228.2KB  cluster_health.out.20260926-013412Z
 2026-09-26 11:07:19 374.4KB  mantle.ntnx-sgh950xpcv-a-cvm.nutanix.log.INFO.2026
 2026-09-26 11:07:18 33.4KB   sysstats/ping_gateway.INFO.20260926-013144
 2026-09-26 11:07:18 33.4KB   sysstats/ping_gateway.INFO
 2026-09-26 11:07:18 5.6MB    sysstats/iotop.INFO.20260926-013147
 2026-09-26 11:07:18 1.1MB    genesis.out.20260926-011857Z
 2026-09-26 11:07:18 1.1MB    genesis.out  
 ...こ

ここで、開きたいログを選択しEnterキーを押します。File Filerは、ファイル名を入れると部分一致でファイルを検索しリストをフィルターしてくれます。(フィルター部分はBackspaceキーが使えないので注意が必要です)

ログを開くとログビューワーが起動します。

2026-09-26 01:18:57,439Z rolled over log file
2026-09-26 01:18:57,433Z INFO 9813 /src/bigtop/infra/infra_server/cluster/service_monitor/service_monitor.c:256 main: /home/nutanix/bin/service_monitor: appending fatal messages to /home/nutanix/data/logs/genesis.FATAL
2026-09-26 01:18:57,433Z INFO 9813 /src/bigtop/infra/infra_server/cluster/service_monitor/service_monitor.c:87 StartServiceMonitor: Launched child with pid: 9815
2026-09-26 01:18:57,433Z INFO 9815 /src/bigtop/infra/infra_server/cluster/service_monitor/service_monitor.c:158 StartService: Starting service with cmd: /home/nutanix/cluster/bin/genesis
2026-09-26 01:18:57,433Z ERROR 9815 /src/bigtop/infra/infra_server/cluster/service_monitor/nxenv.c:81 GetHostPortListFromFile: Failed to get host port list call errno() to get error
2026-09-26 01:18:57,434Z ERROR 9815 /src/bigtop/infra/infra_server/cluster/service_monitor/nxenv.c:107 RefreshZkHostPortList: Failed to get host port list error: No such file or directory
2026-09-26 01:18:57,434Z ERROR 9815 /src/bigtop/infra/infra_server/cluster/service_monitor/service_monitor.c:161 StartService: Could not refresh the value of zk host port list
2026-09-26 01:19:02,305Z INFO 95996224 server.py:313 GENESIS START
q to go Back | / to Search  | h for Help | 'genesis.out'

「/」で検索ができるあたりは、viチックな動作になっています。

hキーでヘルプを見てみます。

                   SUMMARY OF LESS COMMANDS

      Commands marked with * may be preceded by a number, N.
      Notes in parentheses indicate the behavior if N is given.
      A key preceded by a caret indicates the Ctrl key; thus ^K is ctrl-K.

  h  H                 Display this help.
  q  :q  Q  :Q  ZZ     Exit.
 ---------------------------------------------------------------------------

                           MOVING

  e  ^E  j  ^N  CR  *  Forward  one line   (or N lines).
  y  ^Y  k  ^K  ^P  *  Backward one line   (or N lines).
  f  ^F  ^V  SPACE  *  Forward  one window (or N lines).
  b  ^B  ESC-v      *  Backward one window (or N lines).
  z                 *  Forward  one window (and set window to N).
  w                 *  Backward one window (and set window to N).
  ESC-SPACE         *  Forward  one window, but don't stop at end-of-file.
  d  ^D             *  Forward  one half-window (and set half-window to N).
  u  ^U             *  Backward one half-window (and set half-window to N).
  ESC-)  RightArrow *  Right one half screen width (or N positions).
  ESC-(  LeftArrow  *  Left  one half screen width (or N positions).
  ESC-}  ^RightArrow   Right to last column displayed.
  ESC-{  ^LeftArrow    Left  to first column.
  F                    Forward forever; like "tail -f".
  ESC-F                Like F but stop when search pattern is found.
  r  ^R  ^L            Repaint screen.
  R                    Repaint screen, discarding buffered input.
        ---------------------------------------------------
        Default "window" is the screen height.
        Default "half-window" is half of the screen height.
 ---------------------------------------------------------------------------

                          SEARCHING

  /pattern          *  Search forward for (N-th) matching line.
  ?pattern          *  Search backward for (N-th) matching line.
  n                 *  Repeat previous search (for N-th occurrence).
  N                 *  Repeat previous search in reverse direction.
  ESC-n             *  Repeat previous search, spanning files.
  ESC-N             *  Repeat previous search, reverse dir. & spanning files.
  ESC-u                Undo (toggle) search highlighting.
  ESC-U                Clear search highlighting.
  &pattern          *  Display only matching lines.
        ---------------------------------------------------
        A search pattern may begin with one or more of:
        ^N or !  Search for NON-matching lines.
        ^E or *  Search multiple files (pass thru END OF FILE).
        ^F or @  Start search at FIRST file (for /) or last file (for ?).
        ^K       Highlight matches, but don't move (KEEP position).
        ^R       Don't use REGULAR EXPRESSIONS.
        ^W       WRAP search if no match found.
 ---------------------------------------------------------------------------

                           JUMPING

  g  <  ESC-<       *  Go to first line in file (or line N).
  G  >  ESC->       *  Go to last line in file (or line N).
  p  %              *  Go to beginning of file (or N percent into file).
  t                 *  Go to the (N-th) next tag.
  T                 *  Go to the (N-th) previous tag.
  {  (  [           *  Find close bracket } ) ].
  }  )  ]           *  Find open bracket { ( [.
  ESC-^F    *  Find close bracket .
  ESC-^B    *  Find open bracket .
        ---------------------------------------------------
        Each "find close bracket" command goes forward to the close bracket
          matching the (N-th) open bracket in the top line.
        Each "find open bracket" command goes backward to the open bracket
          matching the (N-th) close bracket in the bottom line.

  m            Mark the current top line with .
  M            Mark the current bottom line with .
  '            Go to a previously marked position.
  ''                   Go to the previous position.
  ^X^X                 Same as '.
  ESC-M        Clear a mark.
        ---------------------------------------------------
        A mark is any upper-case or lower-case letter.
        Certain marks are predefined:
             ^  means  beginning of the file
             $  means  end of the file
 ---------------------------------------------------------------------------

                        CHANGING FILES

  :e [file]            Examine a new file.
  ^X^V                 Same as :e.
  :n                *  Examine the (N-th) next file from the command line.
  :p                *  Examine the (N-th) previous file from the command line.
  :x                *  Examine the first (or N-th) file from the command line.
  :d                   Delete the current file from the command line list.
  =  ^G  :f            Print current file name.
 ---------------------------------------------------------------------------

                    MISCELLANEOUS COMMANDS

  -              Toggle a command line option [see OPTIONS below].
  --             Toggle a command line option, by name.
  _              Display the setting of a command line option.
  __             Display the setting of an option, by name.
  +cmd                 Execute the less cmd each time a new file is examined.

  !command             Execute the shell command with $SHELL.
  |Xcommand            Pipe file between current pos & mark X to shell command.
  s file               Save input to a file.
  v                    Edit the current file with $VISUAL or $EDITOR.
  V                    Print version number of "less".
 ---------------------------------------------------------------------------

                           OPTIONS

        Most options may be changed either on the command line,
        or from within less by using the - or -- command.
        Options may be given in one of two forms: either a single
        character preceded by a -, or a name preceded by --.

  -?  ........  --help
                  Display help (from command line).
  -a  ........  --search-skip-screen
                  Search skips current screen.
  -A  ........  --SEARCH-SKIP-SCREEN
                  Search starts just after target line.
  -b [N]  ....  --buffers=[N]
                  Number of buffers.
  -B  ........  --auto-buffers
                  Don't automatically allocate buffers for pipes.
  -c  -C  ....  --clear-screen --CLEAR-SCREEN
                  Repaint by clearing rather than scrolling.
  -d  ........  --dumb
                  Dumb terminal.
  -D xcolor  .  --color=xcolor
                  Set screen colors.
  -e  -E  ....  --quit-at-eof  --QUIT-AT-EOF
                  Quit at end of file.
  -f  ........  --force
                  Force open non-regular files.
  -F  ........  --quit-if-one-screen
                  Quit if entire file fits on first screen.
  -g  ........  --hilite-search
                  Highlight only last match for searches.
  -G  ........  --HILITE-SEARCH
                  Don't highlight any matches for searches.
  --old-bot
                  Revert to the old bottom of screen behavior.
  -h [N]  ....  --max-back-scroll=[N]
                  Backward scroll limit.
  -i  ........  --ignore-case
                  Ignore case in searches that do not contain uppercase.
  -I  ........  --IGNORE-CASE
                  Ignore case in all searches.
  -j [N]  ....  --jump-target=[N]
                  Screen position of target lines.
  -J  ........  --status-column
                  Display a status column at left edge of screen.
  -k [file]  .  --lesskey-file=[file]
                  Use a lesskey file.
  -K  ........  --quit-on-intr
                  Exit less in response to ctrl-C.
  -L  ........  --no-lessopen
                  Ignore the LESSOPEN environment variable.
  -m  -M  ....  --long-prompt  --LONG-PROMPT
                  Set prompt style.
  -n  ........  --line-numbers
                  Don't use line numbers.
  -N  ........  --LINE-NUMBERS
                  Use line numbers.
  -o [file]  .  --log-file=[file]
                  Copy to log file (standard input only).
  -O [file]  .  --LOG-FILE=[file]
                  Copy to log file (unconditionally overwrite).
  -p [pattern]  --pattern=[pattern]
                  Start at pattern (from command line).
  -P [prompt]   --prompt=[prompt]
                  Define new prompt.
  -q  -Q  ....  --quiet  --QUIET  --silent --SILENT
                  Quiet the terminal bell.
  -r  -R  ....  --raw-control-chars  --RAW-CONTROL-CHARS
                  Output "raw" control characters.
  -s  ........  --squeeze-blank-lines
                  Squeeze multiple blank lines.
  -S  ........  --chop-long-lines
                  Chop (truncate) long lines rather than wrapping.
  -t [tag]  ..  --tag=[tag]
                  Find a tag.
  -T [tagsfile] --tag-file=[tagsfile]
                  Use an alternate tags file.
  -u  -U  ....  --underline-special  --UNDERLINE-SPECIAL
                  Change handling of backspaces.
  -V  ........  --version
                  Display the version number of "less".
  -w  ........  --hilite-unread
                  Highlight first new line after forward-screen.
  -W  ........  --HILITE-UNREAD
                  Highlight first new line after any forward movement.
  -x [N[,...]]  --tabs=[N[,...]]
                  Set tab stops.
  -X  ........  --no-init
                  Don't use termcap init/deinit strings.
  -y [N]  ....  --max-forw-scroll=[N]
                  Forward scroll limit.
  -z [N]  ....  --window=[N]
                  Set size of window.
  -" [c[c]]  .  --quotes=[c[c]]
                  Set shell quote characters.
  -~  ........  --tilde
                  Don't display tildes after end of file.
  -# [N]  ....  --shift=[N]
                  Set horizontal scroll amount (0 = one half screen width).
                --file-size
                  Automatically determine the size of the input file.
                --follow-name
                  The F command changes files if the input file is renamed.
                --incsearch
                  Search file as each pattern character is typed in.
                --line-num-width=N
                  Set the width of the -N line number field to N characters.
                --mouse
                  Enable mouse input.
                --no-keypad
                  Don't send termcap keypad init/deinit strings.
                --no-histdups
                  Remove duplicates from command history.
                --rscroll=C
                  Set the character used to mark truncated lines.
                --save-marks
                  Retain marks across invocations of less.
                --status-col-width=N
                  Set the width of the -J status column to N characters.
                --use-backslash
                  Subsequent options use backslash as escape char.
                --use-color
                  Enables colored text.
                --wheel-lines=N
                  Each click of the mouse wheel moves N lines.


 ---------------------------------------------------------------------------

                          LINE EDITING

        These keys can be used to edit text being entered
        on the "command line" at the bottom of the screen.

 RightArrow ..................... ESC-l ... Move cursor right one character.
 LeftArrow ...................... ESC-h ... Move cursor left one character.
 ctrl-RightArrow  ESC-RightArrow  ESC-w ... Move cursor right one word.
 ctrl-LeftArrow   ESC-LeftArrow   ESC-b ... Move cursor left one word.
 HOME ........................... ESC-0 ... Move cursor to start of line.
 END ............................ ESC-$ ... Move cursor to end of line.
 BACKSPACE ................................ Delete char to left of cursor.
 DELETE ......................... ESC-x ... Delete char under cursor.
 ctrl-BACKSPACE   ESC-BACKSPACE ........... Delete word to left of cursor.
 ctrl-DELETE .... ESC-DELETE .... ESC-X ... Delete word under cursor.
 ctrl-U ......... ESC (MS-DOS only) ....... Delete entire line.
 UpArrow ........................ ESC-k ... Retrieve previous command line.
 DownArrow ...................... ESC-j ... Retrieve next command line.
 TAB ...................................... Complete filename & cycle.
 SHIFT-TAB ...................... ESC-TAB   Complete filename & reverse cycle.
 ctrl-L ................................... Complete filename, list all.
HELP -- END -- Press g to see it again, or q when done

オペレーション的には、「less」コマンドと同じような感じに見受けられます。

ヘルプは、「q」キーで終了できます。

では、もう一つのメニューである「B. Content Search (string in filtered files)」も見てみたいと思います。

  Search String: <keywoedを入力>                                                         
  File Filter:



   TAB/UP/DOWN to switch fields | ENTER to search | ESC to Menu

Search Stringに文字を入力すると、その文字が該当するログを探して一覧にしてくれます。

ここでは「nutanix」で、検索をしてみました。

  Found 50 matches (Page 1/10):

  File: using-gflags.log

    -> 2026-09-25 15:41:02,670Z ERROR using-gflags:452 Could Not Acquire Lo...      2026-09-25 15:41:02,671Z ERROR using-gflags:463 Cluster is not started

  File: using-gflags.log
       2026-09-26 01:33:02,458Z INFO zookeeper_session.py:1028 ZK session e...   -> 2026-09-26 01:33:02,460Z INFO using-gflags:409 Running Cmd using exe...      2026-09-26 01:33:02,485Z INFO zookeeper_session.py:308 using-gflags ...
  File: using-gflags.log
       2026-09-26 01:33:02,489Z INFO zookeeper_session.py:1028 ZK session e...   -> 2026-09-26 01:35:02,118Z INFO using-gflags:409 Running Cmd using exe...      2026-09-26 01:35:02,188Z INFO zookeeper_session.py:308 using-gflags ...
  File: using-gflags.log
       2026-09-26 01:35:02,194Z INFO zookeeper_session.py:1028 ZK session e...   -> 2026-09-26 01:38:02,711Z INFO using-gflags:409 Running Cmd using exe...      2026-09-26 01:38:13,563Z INFO zookeeper_session.py:308 using-gflags ...
  File: using-gflags.log
       2026-09-26 01:38:13,568Z INFO zookeeper_session.py:1028 ZK session e...   -> 2026-09-26 02:15:02,437Z INFO using-gflags:409 Running Cmd using exe...      2026-09-26 02:15:02,622Z INFO zookeeper_session.py:308 using-gflags ...



  UP/DOWN: navigate | ENTER: open | LEFT/RIGHT: page | ESC: returnこ

ここで、選択したログを開くとログが表示されます。キーボードの右キーを押すと次ページの検索結果が表示されます。

これらのメニューは、「ESC」キーで前画面に戻ります。

では次に、メニュー3の「 Launch Admin Shell」を見てみましょう。

これを選択すると普通のBashシェルが表示されます。

    Launching bash...
admin@NTNX-XAI911XPCV-A-CVM:10.185.153.213:~$

adminユーザとしてシェルに入ることができます。おそらくこの機能がAOS7.6の次のバージョンからロックされる流れになると思われます。


この辺りは、「configure_restricted_access」コマンドで挙動が変わるので、次回ご紹介したいと思います。


(参考)KB20212 / End of Support Life (EOSL) for SSH Bash Shell Access
https://portal.nutanix.com/kb/20212






2026年8月31日月曜日

アカウントがロックされた場合の対応方法

PrismやSSHで、CVMにログインする際、数回ログインを間違えるとアカウントがロックされる仕様となっております。

構築作業中でパスワードを変更したばかりで、前のパスワードを間違えて入れたとか、コンソール画面のキーボードが101キーボードマッピングのため記号をうまく入力できずに、アカウントがロックされたなど、正常なオペレーションでアカウントがロックされることもあります。

今回は、アカウントロックされた場合の会場方法についてご紹介します。


SSHで、「 nutanix 」ユーザがロックされた場合

CVMのnutanixユーザーのロックは、各CVM単体で行われます。そのため、仮に1台目のCVMにて、nutanixユーザーのアカウントロックがなされた場合も、2台目のCVMには、nutanixユーザーでログインができる仕様となります。

この場合、ログインができるCVMにnutanixユーザーでログインするか、Prismの「admin」ユーザでログインをしてください。

その後、以下のコマンドを実行します。

sudo su - nutanix

allssh "sudo faillock --user nutanix --reset"

これで、アカウントがロック解除されたはずです。


Prismのadminユーザーがロックされた場合

Prismのログイン画面で「Account locked due to too many failed attempts.」と表示されログインができなくなった場合は、アカウントがロックされている状態となります。

CVMへnutanixユーザーでログインし、以下のコマンドを実行します。

allssh 'sudo faillock --user admin --reset'

これで、アカウントロックは、解除されたと思います。


パスワードの有効期限切れとアカウントのロック状態は異なります。

パスワードの取り扱いに注意していただきつつ、オペレーションによりアカウントがロックされた場合は、こちらの方法で対応してください。


KB18411 / SSH login fails for the nutanix user due to Account Locked on CVMs

KB8130 / Prism admin account locked with "Account locked due to too many failed attempts."









2025年9月22日月曜日

CVMのコンソール出力情報を確認する方法

通常操作することはありませんが、たとえばハードウェアのHBAを交換したり、ストレージのエンクロージャー部分のバックプレインを交換などハードウェアのメンテナンス後、CVMが世情に起動しない場合などがあります。

原因は様々ですが(ディスクが見えてないとか、HBAの搭載場所が変わったことでPCIバスの位置が変わっているなど)、CVMがどのような状態でエラーになっているかを確認する必要があります。

しかし、CVMは仮想マシンであることとPrismのコンソール画面は、クラスターメンバーに正常に属しているホスト上で動作する仮想マシンのコンソールを確認することは出来ますが、CVMが起動していない状態では、CVMのコンソールをPrismのGUIから確認することは出来ません。

このような場合、CVMの標準出力(コンソールへの直接出力)に関しては、AHV側に保存されるように設定されています。

CVMの標準出力先:/var/log/NTNX.serial.out.0


CVMが起動途中でハングアップするなど、未知の障害に出くわした場合は、AHVのコンソールから

tail -f /var/log/NTNX.serial.out.0

コマンドでモニタリングをするほか、単純に「/var/log/NTNX.serial.out.0」ファイルをエディタ等で開きログを追いかけることで、トラブルが起きている場所を特定することが出来ます。


あまり使わない(使いたくない)機能ですが、いざというときに覚えておくと便利ですので、押えておきましょう。



 

2025年9月20日土曜日

nutanixやadminユーザーがロックされた場合の対応

CVMやAHVにSSHでログインして作業することは、メンテナンス時にまれに行うことがあるかともいます。普段行わない作業のため、nutanixユーザーのパスワードやAHVのrootパスワードを忘れてしまい、アカウントロックされてしまう問題に遭遇する可能性があります。そのような際の対処法をご紹介します。

まずは、CVMにログインを行います。

CVMにログインするnutanixユーザーのパスワードを忘れたんだよ!という方は、慌てずPrismでログインするadminユーザーのパスワードでCVMにSSH等でログインします。

CVMになにかしログインができればOKです。
状況によって、以下のコマンドを実行します。


AHVのrootユーザーのアカウントロックを解除する場合

hostssh "faillock --user root --reset"


CVM上のnutanixユーザーのアカウントロックを解除する場合

allssh "faillock --user nutanix --reset"


CVM上のadminユーザーのアカウントロックを解除する場合

allssh "faillock --user admin --reset"


AOS 6.7以降でAOS6.10.1.9、AOS7.0.1未満の場合、ロックされたユーザーは自動でロック解除されません。AOS6.10.1.91/AOS 7.0.1以降、AHVは、20230302.102001以降は、ロックされたユーザーは、900秒後にロック解除されます。


(参考)
KB17355:Users nutanix/admin and root are not getting unlocked automatically after 900 seconds





 

2018年12月1日土曜日

AOSアップグレード前に/home/nutanixをチェックする

この記事はNutanix Advent Calendar(1枚目) 2018/12/1の記事です
AOS5.10がLTSバージョンとして、11月末にリリースされました。
年末が近いこともあり、年末年始でインフラ周りのメンテナンスの際に、AOSアップグレード行う方も多くいるかと思います。
まあ、そもそもAOSはシステム稼働中であったとしても安全にシステムを止めることなくアップグレードすることができます(業務がフル稼働中にあまりやる作業ではありませんが)ので、そんなにかしこまってやる作業ではないのですが、従来のシステムメンテナンス形態を取られているデーターセンター等では、今までのルールに則り、業務外の時間にメンテナンス時間を作成し作業をされる方が多いと思います。

さて、AOSのアップグレード時に注意する事項が一つあります。
それは、「/home/nutanix」の容量枯渇です

Nutanixを長く利用していますと、いろいろな物がたまってくることと、AOSバイナリは今は4GBを超える大きな容量であるため、AOSアップグレード前チェックで/home/nutanixの容量不足でアップデートが失敗することがあります。

(参考)/home/nutanixの容量が枯渇すると、OneClickUpgradeに失敗します

この際にお掃除するべきは、/home/nutanixです。

まずは、消費しているディレクトリを確認します。
SSHでCVMにログインします。

まずは、使用容量を確認します。
nutanix@NTNX-1-B-CVM:X.X.X.X:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/md0        9.8G  6.0G  3.3G  65% /
devtmpfs         16G     0   16G   0% /dev
tmpfs           512M  4.0K  512M   1% /dev/shm
tmpfs            16G  640K   16G   1% /run
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/loop0      240M  3.1M  221M   2% /tmp
/dev/md2         40G   24G   15G  62% /home
/dev/sdb4       600G   82G  513G  14% /home/nutanix/data/stargate-storage/disks/BTHC6490032S800NGN
/dev/sda4       600G   82G  513G  14% /home/nutanix/data/stargate-storage/disks/BTHC648105XJ800NGN
/dev/sdc1       660G   85G  568G  13% /home/nutanix/data/stargate-storage/disks/BTHC64810ABU800NGN
tmpfs           3.2G     0  3.2G   0% /run/user/1000

この環境では、/home/nutanixが、62%の使用率ということでまだ余裕ですが、実際の環境では長く使っていると90%を超えていることもよくあります。

この際のお掃除をすべきディレクトリは以下のディレクトリ配下です
/home/nutanix/data/cores/
/home/nutanix/data/binary_logs/
/home/nutanix/data/installer/
/home/nutanix/data/ncc/installer/
/home/nutanix/data/log_collector/
/home/nutanix/foundation/isos/
/home/nutanix/foundation/tmp/


ここで、注意が必要です。
まず、これらはこのディレクトリ配下のファイルやディレクトリを消す必要があります。
このディレクトリを直接消してはいけません。

「/home/nutanix/data/installer」は、現在インストール使用としているAOS5.6バージョンのバイナリ以外を消す必要があります。

「/home/nutanix/foundation/isos/」は、使っていないハイパーバイザーのバイナリだけを消してください。

なお、「df -h」で見ていると「/home/nutanix/software_downloads/」も容量
を多く使ってくる一覧で上がってきますが、こちらは、OneClickUpgradeの画面で管理されている関係から、直接ファイルを消すことは禁止されています。


またこのディレクトリ配下のファイルもお掃除対象です
/home/nutanix/data/binary_logs/*
/home/nutanix/data/cores/*

こちらは、このディレクトリ配下のディレクトリは削除せず(当然このディレクトリも削除してはいけません)にファイルだけを消す形になります。

なお、CVMはノードの数だけありますが「allssh」でrmコマンドを実行すると、がっさりきえてしまいますので、面倒かもしれませんが、1台ずつ確認しながらファイルを消すことをおすすめします。

詳細は以下のKBを参考にしてください。
http://portal.nutanix.com/kb/1540