> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/sso-connect-on-prem/jp/integration-with-gemalto-hsm.md).

# Gemalto HSMとの統合

## Gemalto HSMとの統合

![](/files/MoqfnULnV352kICUyLu3)

## Keeper SSOコネクトHSMの概要

SSOコネクトの `data` フォルダ内には、ファイルがいくつかあります。このうちの2つのファイルには、サーバーで生成された、保護する必要のある秘密鍵が含まれ、エンドユーザーの自動生成されたマスターパスワードの暗号化と復号化に利用されます。また、暗号化されたデータのローカルキャッシュを含む `.sql` ファイルもあります。重要なのは、このデータフォルダへのアクセスを制限することです。

Windows以外のマシンの場合、 `data` フォルダはSSOコネクトのインストールフォルダ (通常は、 `$HOME/sso_connect/data`) の下にあります。

Windowsマシンの場合、バージョン14.1以降、 `data` フォルダは、 `C:\ProgramData\Keeper SSO Connect\data\` にあります。バージョン14.1より前は、 `C:\Program Files\Keeper Security\SSO Connect\data\` にありました。

以下に説明するように、HSM (ハードウェアセキュリティモジュール) を利用することで、セキュリティをもう1層追加できます。HSMが使用可能な場合、SSOコネクトのインスタンスごとに暗号鍵が生成され、HSMに安全に保存されます。暗号鍵は、 `data/` フォルダ内の重要なプロパティファイルの暗号化に使用されます。

## Gemalto Luna HSMの手順

### HSMの要件

1. Gemalto HSMは、Lunaファームウェア6.2以降を実行している必要があります。

### ネットワーク要件

* TCP/443ポートの開放、Keeper SSOコネクトからwww\.keepersecurity.comへのステートフルな発信
* TCP/22ポートの開放、HSM管理端末からHSMシステムへのステートフルな発信
* TCP/22ポートの開放、CLI 設定用のKeeper SSOコネクトサーバーへの着信
* TCP/1792ポートの開放、HSMシステムとの双方向通信
* TCP/8080ポートの開放、管理者GUIにアクセスするためのKeeper管理者ワークステーションからKeeper SSOコネクトへの着信 (オプション)

### ネットワークアクセスをテスト

```
$ telnet www.keepersecurity.com 443
Trying 52.204.60.27
Connected to www.keepersecurity.com.
Escape character is '^]'.

$ telnet push.services.keepersecurity.com 443
Trying 52.44.0.141...
Connected to push.services.keepersecurity.com.
Escape character is '^]'.

$ ssh <ip address of the HSM>
password: <admin-password>
```

### Linux固有の要件

CentOS 6または7を推奨しますが、以下の操作を追加すれば、Ubuntuでも実行できます。

```
UBUNTU only:
$ sudo apt-get install zip unzip # used by the Luna installer
$ sudo apt-get install alien # used by the Luna installer to convert .rpm files
$ sudo apt-get install gcc-multilib # Because some Luna programs are 32-bit
```

`/lib/ld-linux.so.2` が存在する場合は、以下のセクションに進みます。

```
If /lib/ld-linux.so.2 doesn't exist:
 if /usr/lib/ld-linux.so.2 exists:
 $ sudo ln -s /usr/lib/ld-linux.so.2 /lib/ld-linux.so.2
 if /lib32/ld-linux.so.2 exists:
 $ sudo ln -s /lib32/ld-linux.so.2 /lib/ld-linux.so.2
 otherwise (Ubuntu):
 $ sudo yum install gcc-multilib # use yum or apt-get

If you are on Red Hat (CentOS), do this:
 $ sudo yum install glibc-devel.i686
```

### Lunaクライアントをインストール

Keeper SSOコネクトでLuna HSMを使用するには、Lunaクライアントをインストールして、正しく設定する必要があります。

* LunaクライアントソフトウェアをSSOコネクトサーバーにコピーします。 通常、ファイルの名前は、 `LunaClient_7.3.0-165_Linux.tar.gz` のようになっています。
* SSOコネクトサーバーにログインします。
* Lunaクライアントのインストーラーを実行します。

```
$ tar xzf LunaClient_7.3.0-165.Linux.tar.gz
$ cd LunaClient_7.3.0-165_Linux/64
$ sudo sh install.sh
- Select Luna Network HSM
- Select (N)ext
- Select Luna JSP (Java)
- Select (I)nstall

$ sudo gpasswd --add <username> hsmusers
- type 'groups' to verify group membership
- You might need to create a new shell to recognize the new group

You might want to add this useful alias to your "~/.bash_profile" file.
alias luna='sudo /usr/safenet/lunaclient/bin/lunacm'
```

* `$JAVA_HOME/jre/lib/security/java.security` を編集します。

a. セキュリティプロバイダの一覧を見つけます。

b. `security.provider.10=com.safenetinc.luna.provider.LunaProvider` を追加します。

c.ファイルを保存します。

### Lunaへのアクセスを設定

#### 要件

1. HSMマシンのIPアドレスまたはホスト名。
2. 管理者パスワード (別名、セキュリティ責任者のパスワード)。
3. 現在使用中のマシンのIPアドレスやユーザーの名前などの一意の文字列。
4. パーティションのクリプトオフィサーのパスワード。
5. 鍵を保管するパーティション名 (これは設定済みのはずです)。

{% hint style="info" icon="pencil-line" %}
パーティションをまだ設定していない場合は、 `lunash` プログラムを使用し、管理者としてログインしてパーティションを作成してください。Gemalto Lunaのドキュメントをご参照ください。
{% endhint %}

#### HSMの設定を確認

1. Lunaクライアントを起動します。

```
$ luna
lunacm (64-bit) v7.3.0-165. Copyright (c) 2018 SafeNet. All rights reserved.

lunacm:> clientconfig deploy -n <hsm-ip-address> -c <unique-string> -par <partition-name> -ur admin -pw <hsm-admin-password> -v

... make sure it finishes successfully


Available HSMs:

Slot Id -> 0 
Label -> [your-partition-name]
Serial Number -> 12345678987654321
Model -> LunaSA 7.3.0 
Firmware Version -> 7.3.0 
Configuration -> Luna User Partition With SO (PW) Key Export With Cloning Mode
Slot Description -> Net Token Slot


Current Slot Id: 0


lunacm:>role login -n co
enter password: crypto-officer-password

Command Result : No Error

lunacm:>par con # display contents of partition
lunacm:>exit
```

### HSMにアクセスするためにKeeper SSOコネクトを設定

通常のSSOコネクト設定の質問に加えて、以下に示すようなHSM固有の質問がいくつかあります。

```
$ java -jar SSOConnect.jar -config

... normal SSO Connect configuration questions...

Configure Secure Key Storage (y/N): y
IMPORTANT: Make sure that this server is already connected to a networked HSM or other secure key storage device.
Type of Secure Key Storage (Gemalto SafeNet Luna HSM): <return>
Secure storage device access parameters (slot,password): <return>
 slot: 0
 password: crypto-officer-password
A certificate chain is required in order to store an encryption key.
You may use the SSL certificate file entered previously, or use a different one.
Certificate chain file (/home/ubuntu/keeperSSO/data/sso_keystore.jks): <return>
Certificate chain file password (none): <return>
1 certificates found
Enable Secure Key Storage (Y/n): y
```

### トラブルシューティング

#### 設定のトラブルシューティング

1. サーバーが適正であることを確認します。CentOS 6または7を推奨します。現時点ではWindowsには対応していません。

```
$ rpm -q centos-release
centos-release-7-6.1810.2.el7.centos.x86_64

$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
```

2. Lunaクライアントがサーバーに正しくインストールされていることを確認します。Lunaクライアントを実行して、クリプトオフィサーとしてログインし、正常にログインしてパーティションの内容を表示できることを確認します。

```
$ sudo /usr/safenet/lunaclient/bin/lunacm

luna> role login -n co
(enter password)
luna> par con
If this HSM has been used with Keeper before, there will be an existing key with a name like Keeper SSO Properties 514320201573
```

3. Java 1.8またはJava 11が利用可能であることを確認します。

```
$ java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
```

4. Lunaライブラリが利用可能であることを確認します。

```
$ ls sso_connect/*Luna*
libLunaAPI.so LunaProvider.jar
```

5. 正しいポートが解放されていることを確認します。ファイアウォールは、ポート22および1792で発着信両方の接続を許可する必要があります。

```
If the firewall is local, use:
$ iptables -xvn -L
```

6. ユーザーがhsmusersグループのメンバーであることを確認します。

```
$ whoami
centos

$ groups
centos adm wheel systemd-journal hsmusers

** The Luna software requires that the user accessing the Luna libraries be a member of the hsmusers group.
$ sudo gpasswd --add centos hsmusers
You will need to open a new shell to see that this command worked correctly.
```

7. SSOconnectがマシンにインストールされていることを確認します。

* 通常、 `sso_connect`、 `KeeperSSO`、またはそれに類似した名前のフォルダがあります。フォルダには多数のjarファイルが含まれます。

8. `data` フォルダに不完全な設定がないことを確認します。

* 以前KeeperSSOを設定しようとして失敗した場合は、

`KeeperSSO/data` フォルダを削除してもう一度やり直すのが安全です。 9. アプリが `data/` フォルダに対する読み取り/書き込み権限を持っていることを確認します。

```
$ ls -ld data
drwxrwxr-x 2 centos centos 181 Feb 4 19:42 data
```

#### 動作のトラブルシューティング

1. ログファイルにエラーがないか確認します。SSOconnectのセキュアキーストレージサブシステムは、問題が発生すると、ログにERROR行を出力します。

```
$ more logs/ssoconnect.log
```

2. エラーは、**\[セキュアキーストレージが使用できません]** といったパターンになります。これは、以下のいずれかの問題を示しています。

```
a. Network problem accessing the HSM
- Perform Step 2 of "Troubleshooting the Configuration" to verify access to the HSM.

b. data/sks.properties is missing
- if data/sks.properties is missing you will need to re-configure SSOConnect.

c. The encrypted property files are missing
- Check for data/instance.encp and data/shared.encp.

d. The encryption key is missing from the HSM
- Did somebody clear the HSM partition? You will need to re-configure SSOConnect.

e. The server may be out of disk space
- clear some disk space.

f. The encryption algorithm used is not supported on the HSM
- The algorithm is AES/GCM/NoPadding. Check with the device provider.

g. The file data/sso-keystore.jks is missing
- The program cannot store a key in the HSM without the certificate chain from the sso_keystore.jks file.
Find the file and ensure that it is in the data folder.
```

## バックアップ

`data` フォルダにはSSOコネクト設定ファイルが含まれています。少なくとも、最初の設定の後、および設定を変更するたびにバックアップする必要があります。設定ファイル以外にも、 `data` にはデータファイルがありますが、こちらは、Keeperサーバーとの同期が外れると自動的に更新されます。そのため、通常の定期バックアップを利用してもよいですが、必須ではありません。すべてのコンフィグレーション設定がインスタンス間で共有されているわけではないため、各SSOコネクトインスタンスの `data` フォルダを個別にバックアップする必要があります。

Windows以外のマシンの場合、 `data` フォルダはSSOコネクトのインストールフォルダ (通常は、 `$HOME/sso_connect/data`) の下にあります。

Windowsマシンの場合、バージョン14.1以降、 `data` フォルダは、 `C:\ProgramData\Keeper SSO Connect\data\` にあります。バージョン14.1より前は、 `C:\Program Files\Keeper Security\SSO Connect\data\` にありました。

## 回復

### サーバーの障害

SSOコネクトサーバーが停止した場合は、上記の標準的なインストール手順に従って、代替マシンにLunaとSSOコネクトを再インストールする必要があります。

上記のとおり、 `data` フォルダをバックアップした場合は、データフォルダを復元してから、SSOコネクトを起動してください。(SSOコネクトを起動したため) `data` フォルダがすでに存在する場合は、SSOコネクトを停止し、データフォルダ内のファイルをすべて削除し、バックアップしたデータフォルダからファイルをコピーして、SSOコネクトを再起動します。SSOコネクトが正常に起動するはずです。

`data` フォルダをバックアップしていなかった場合、またはバックアップが古い場合は、代替インスタンスを新規でインストールするように設定する必要があります。SSOコネクトのインストールガイドに従ってください。

### HSMの障害

HSMを使用する場合、HSMは設定ファイルの復号化に使用した暗号鍵を `data` フォルダに保存します。HSMへのアクセスは、SSOコネクトの起動時に1度、設定が変更されるときにも随時行われます。設定ファイルが暗号化されており、HSMに保存した暗号鍵が失われたか、またはアクセスできない場合は、暗号化されていない設定ファイルを新規作成するために、SSOコネクトインスタンスを再度設定する必要があります。 `data` フォルダの内容を削除し、SSOコネクトをもう一度最初から設定します。

HSM/SKSの使用を無効にするには、**\[SKSを有効にしますか?]** という設定の質問に「No」を入力するか、 `-disableSKS` コマンドラインオプションを使用します。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/sso-connect-on-prem/jp/integration-with-gemalto-hsm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
