NetApp上から他のサーバに対してSSH接続する

シリアル接続したNetApp上から他のサーバに対してSSH接続する方法

まず、diagモードになる

netapp1::> set diag

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

netapp1::*>

次に「system node systemshell -node localhost -command ssh ユーザ名@接続先」で接続する

netapp1::*> system node systemshell -node localhost -command ssh root@ホスト名
The authenticity of host 'xxxxxxx (xxxxxxx)' can't be established.
ECDSA key fingerprint is SHA256:IX4Bar+J8/eOeFoSu+QPIUWxxxxxxxxxxxxxI.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'xxxxxxx' (ECDSA) to the list of known hosts.
root@xxxxxxx's password:
Last login: Wed Apr 20 16:03:51 2022 from xxxxxxx
[root@xxxxxxx ~]#

PowerShellにパスワード文字列を直接書かない手法

PowerShellで用意されているGet-Credential 関連を駆使して、PowerShellスクリプト内に直接パスワードを書かないで済む手法でスクリプトを作成した。

スクリプトを配置したディレクトリにscript.cred というファイルを作り、そこに暗号化されたパスワード文字列を配置する、という仕組み。

$authfile=$PSScriptRoot+".\script.cred"
$username="admin" #ユーザ名
$passwdstr="" # この変数にパスワード文字列が入る。
if((Test-Path $authfile) -eq $false){
    $creds = Get-Credential -UserName $username -Message $($username+"ユーザのパスワードを入力してください")
    $creds.Password | ConvertFrom-SecureString | Set-Content -Path $authfile | Out-Null
    $passwdstr=[Runtime.InteropServices.Marshal]::PtrToStringBSTR([Runtime.InteropServices.Marshal]::SecureStringToBSTR($creds.Password))
}else{
    $passwdstr=[Runtime.InteropServices.Marshal]::PtrToStringBSTR([Runtime.InteropServices.Marshal]::SecureStringToBSTR($(Get-Content $authfile | ConvertTo-SecureString)))
}

# この段階の $passwdstr には暗号化されていないパスワード文字列が入っている

なお、メモリ上の$passwdstr には暗号化されていない文字列が保存されているため、そこは注意が必要。

CommvaultのREST APIをPowerShellで使って見る

Commvaultバックアップの操作にREST APIを使うことができる。

・Commvault V11SP24の「REST API Overview
Commvault Rest APIの出力サンプル群

ログインして、指定したクライアントのサブクライアント情報を取得するPowerShellで作成してみた。

# CommCellユーザ情報
$restapiuser="admin"
$restapipasswd="パスワード"

# REST APIで使用するURL
# どちらを使うかについて https://documentation.commvault.com/11.24/expert/45592_available_web_services_for_rest_api.html
#$restapiurlbase="http://~:81/SearchSvc/CVWebService.svc/"
$restapiurlbase="http://~/webconsole/api/"

# 検索用文字列
$clientname="クライアント名"

# CommCell環境にログイン
$restapipasswdbase64=[Convert]::ToBase64String(([System.Text.Encoding]::Default).GetBytes($restapipasswd))
$headers=@{
    "Accept"="application/json"
    "Content-Type"="application/json"
}
$loginReq = @{
    username=$restapiuser
    password=$restapipasswdbase64
}
$loginresponse=Invoke-RestMethod -Method post -Uri $($restapiurlbase+"Login") -Body $($loginReq|ConvertTo-Json) -ContentType 'application/json' -Headers $headers

# 指定クライアントのサブクライアント情報取得
$headers=@{
    "Accept"="application/json"
    "Authtoken"=$loginresponse.token
}
$response=Invoke-RestMethod -Method Get -Uri $($restapiurlbase+"Subclient?clientName="+$clientname) -Headers $headers

# $response.subClientProperties.subClientEntity にサブクライアントの情報が入っているが
# 複数のサブクライアントがあると $response.subClientProperties.subClientEntity.subclientName が複数行になるので注意

# 表示
$response.subClientProperties.subClientEntity | ForEach-Object {
    $subcliententory=$_
    Write-host $subcliententory
 }

# CommCellログアウト
$headers=@{
    "Accept"="application/json"
    "Authtoken"=$loginresponse.token
}
$logoutresponse=Invoke-RestMethod -Method post -Uri $($restapiurlbase+"Logout") -Headers $headers

ただ、このスクリプトを使うとCommvault Event viewerに表示されるログイン情報が「Machine:unknown Locale:unknown」となる。

これを設定できるか調べて見たが、無いように思える。

sambaのDNSでは委任(delegate)ができないようだ

PowerScaleシミュレータのSmartConnect動作を見てみようと、samba 4.15.5で作ったActive DirectoryのDNSサーバ機能で名前解決動作を試みて見た。

結果、samba 4.15.5ではWindowsのDNS管理ツールから行う「委任ウィザード」の「ネームサーバーレコード」の登録で「検証エラー」が発生するためうまく動作しなかった。

sa

samba-tool コマンドでNSレコードの登録を行ってみたところ登録ができるが、指定したDNSサーバに聞きに行くわけではない、という動作だった。

同じ操作をWindows Server 2019で作ったActive Directory環境で試すと何も問題が無く設定完了した

IPMIを有効にしたPowerScaleでipmitoolによる電源ON/OFF

PowerScale/IsilonではIPMIを有効にする必要性はない。

しかし、UPS連動をちゃんと行おうとすると、IPMI経由で電源ON/OFF制御が行えるようにしておいた方が良い。

IPMIを有効にするあたりのことはDELLコミュニティにある「PowerScale IPMI編」を参考のこと。

使用するipmitoolのコマンドは下記のような感じとなる。

$ ipmitool -I lanplus -H IPアドレス -U admin -L OPERATOR -P パスワード power status
$ ipmitool -I lanplus -H IPアドレス -U admin -L OPERATOR -P パスワード power off
$ ipmitool -I lanplus -H IPアドレス -U admin -L OPERATOR -P パスワード power on

ためしに電源ステータスを確認すると下記の様になった。

$ ipmitool -I lanplus -H IPアドレス -U admin -L OPERATOR -P パスワード power status
Chassis Power is on
$

なお、ipmitool側から接続先のIPアドレスがどのノードであるかを確認する手法はないようなので、事前にPowerScale上で「isi ipmi nodes list」コマンドを実行し、IPMIのIPアドレス一覧を取得しておく必要がある。

isilon-1# isi ipmi nodes list
Lnn  IP Addr      Remote Ipmi Capable
--------------------------------------
1    192.168.1.11 Yes
2    192.168.1.14 Yes
3    192.168.1.12 Yes
4    192.168.1.13 Yes
5    192.168.1.15 Yes
6    192.168.1.17 Yes
7    192.168.1.18 Yes
8    192.168.1.16 Yes
--------------------------------------
Total: 8
isilon-1#

この時注意が必要なのは、IPアドレスがLnnの番号とは関係無く割り当てられているということ。

一度割り当たると、ノード物理交換でも無い限りは割当が変更されないようなので、一度確認しておけばよい感じではある。