Provide credentials to Synchrony standalone using environment variables (Linux)

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

This guide applies to Confluence Data Center 6.5 and later.

This guide does NOT apply if Synchrony is managed by Confluence (available in Confluence 6.12 and later).

目的

If you're running Synchrony standalone in a cluster, and you prefer to store sensitive information in your environment, rather than directly in the Synchrony startup scripts you can create a synchronyenv file, and use it to provide your database credentials. 

These instructions are for Linux users. We'll assume your dedicated Synchrony user is named synchrony.

手順

synchronyenv ファイルを作成する

  1. Synchrony ユーザーに変更します。例:

    sudo su - synchrony
  2. In your <synchrony-home> directory, create a new file called synchronyenv.
  3. Add the following lines to the synchronyenv file, and include your database credentials.

    export SYNCHRONY_DATABASE_USERNAME="database-username"
    export SYNCHRONY_DATABASE_PASSWORD="database-password"
  4. Make sure to make this file executable, so it can be sourced by start-synchrony.sh
    chmod +x synchronyenv

Synchrony 起動スクリプトを変更する

  1. Edit your start-synchrony.sh  script. 

  2. 次の行をコメント アウトします。

    DATABASE_USER="<DB_USERNAME>"
    DATABASE_PASSWORD="<DB_PASSWORD>"

    既にコメントアウトされているか、異なる情報を持つ可能性があります。 

  3. Uncomment the following line, and include the path to the synchronyenv file you've just created.

    SYNCHRONY_ENV_FILE="<PATH_TO_ENV_FILE>"
  4. 変更を保存します。 

シェル プロファイルを変更する

bash のログイン シェルは、次のプロファイルを順に読み込みます。お使いの環境によって異なる場合がありますが、これは Ubuntu の例です。

  • /etc/profile
  • ~/.bash_profile
  • ~/.bash_login
  • ~/.profile

注: bash の非ログイン インタラクティブ シェルは load ~/.bashrc を読み込みます。

  1. 上記のように、適切なプロファイルを編集し、次のコードを追加します。

    # Defines the absolute path to the synchronyenv file. 
    # For example, if your synchronyenv file was located in
    /opt/synchrony-home/synchrony, you would use the example:
    source /opt/synchrony-home/synchrony/synchronyenv
  2. Synchrony ユーザーの bash セッションを終了してから再開し、次のコマンドを実行することで、変数が保存されていることを確認します。

    env
  3. 定義したデータベース資格情報が env 出力に表示されます。次のようになります (一部の情報を非表示にしています)。

    XDG_SESSION_ID=15
    SYNCHRONY_DATABASE_PASSWORD=<sanitized>
    ...
    SYNCHRONY_DATABASE_USERNAME=<sanitized>
    ...
    _=/usr/bin/env

If the info you defined in your synchronyenv file appears correctly in the output above, you should be good to start Synchrony once again. If they don't appear, you may need to define them in a different profile config, based on your operating system and shell.

最終更新日: 2018 年 12 月 21 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.