Rcloneで暗号化リモート設定を作成すると、ファイルを透過的に暗号化・復号して読み書きすることができます。
このリモートを使用すると、以下のような階層構造でファイルにアクセスすることになります。
- 元ファイルの読み書き
⇅ - 暗号化リモート設定(サンプル名: gdrive_crypt)による暗号化
⇅ - Google Driveリモート設定(サンプル名: gdrive)によるネットワークアクセス
⇅ - 暗号化されたファイルのGoogle Driveに対する保存・読み取り
暗号化リモート設定の作成
-
コンソール(コマンドプロンプトまたはPowerShell)を開きます。
-
rclone config
を入力します。
(もしくは、PATHが通っていなければc:\rclone\rclone.exe config
)
前章で作成したリモート設定(gdrive)が表示されます。Current remotes: Name Type ==== ==== gdrive drive
-
新規リモート設定を作成します。
n
(New Remote)を入力します。 -
設定名として
gdrive_crypt
(任意の名前)を入力します。 -
ストレージタイプとして
crypt
(Encrypt/Decrypt a remote)を入力します。Type of storage to configure. Enter a string value. Press Enter for the default (""). Choose a number from below, or type in your own value …《省略》… 10 / Encrypt/Decrypt a remote \ "crypt" …《省略》… Storage> crypt
-
暗号化してアクセスするリモートパスとして
gdrive:Crypt/
を入力します。
これはGoogle Drive用に前章で作成した名前gdrive
をプレフィックスとしてディレクトリCrypt
以下に対して暗号化アクセスを行う場合の設定となります。
Google Driveのルートフォルダからすべて暗号化アクセスする場合はgdrive:
を入力します。** See help for crypt backend at: https://rclone.org/crypt/ ** Remote to encrypt/decrypt. Normally should contain a ':' and a path, eg "myremote:path/to/dir", "myremote:bucket" or maybe "myremote:" (not recommended). Enter a string value. Press Enter for the default (""). remote> gdrive:Crypt/
-
ファイル名を暗号化するため
standard
を入力します。How to encrypt the filenames. Enter a string value. Press Enter for the default ("standard"). Choose a number from below, or type in your own value 1 / Encrypt the filenames see the docs for the details. \ "standard" 2 / Very simple filename obfuscation. \ "obfuscate" 3 / Don't encrypt the file names. Adds a ".bin" extension only. \ "off" filename_encryption> off
-
ディレクトリ名を暗号化するため
true
を入力します。Option to either encrypt directory names or leave them intact. NB If filename_encryption is "off" then this option will do nothing. Enter a boolean value (true or false). Press Enter for the default ("true"). Choose a number from below, or type in your own value 1 / Encrypt directory names. \ "true" 2 / Don't encrypt directory names, leave them intact. \ "false" directory_name_encryption> true
-
パスワードを自動生成させるため
g
を入力します。
続けて強度として128
を入力し、確認のy
を入力します。Password or pass phrase for encryption. y) Yes type in my own password g) Generate random password y/g> g Password strength in bits. 64 is just about memorable 128 is secure 1024 is the maximum Bits> 128 Your password is: XXXXXXXXXXXXXXXXXXXXXX Use this password? Please note that an obscured version of this password (and not the password itself) will be stored under your configuration file, so keep this generated password in a safe place. y) Yes (default) n) No y/n> y
-
同様にソルトを自動生成させるため
g
を入力します。
続けて強度として128
を入力し、確認のy
を入力します。Password or pass phrase for salt. Optional but recommended. Should be different to the previous password. y) Yes type in my own password g) Generate random password n) No leave this optional password blank (default) y/g/n> g Password strength in bits. 64 is just about memorable 128 is secure 1024 is the maximum Bits> 128 Your password is: XXXXXXXXXXXXXXXXXXXXXX Use this password? Please note that an obscured version of this password (and not the password itself) will be stored under your configuration file, so keep this generated password in a safe place. y) Yes (default) n) No y/n> y
-
advanced config はスキップするため
n
を入力します。Edit advanced config? (y/n) y) Yes n) No (default) y/n> n
-
設定を保存するため
y
を入力します。Remote config -------------------- [gdrive_crypt] type = crypt remote = gdrive:Crypt/ filename_encryption = standard directory_name_encryption = true password = *** ENCRYPTED *** password2 = *** ENCRYPTED *** -------------------- y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d> y
-
q
を入力して終了します。
暗号化の動作確認
プレフィックスとして gdrive_crypt:
を使用すると暗号化されたファイルがGoogle Driveに保存されます。
> echo foo> myfile.txt
> rclone copy myfile.txt gdrive_crypt:bar/
> rclone ls gdrive_crypt:
5 bar/myfile.txt
プレフィックスとして gdrive:
を使用するとファイル・ファイル名・ディレクトリ名が暗号化されていることを確認できます。
> rclone ls gdrive:Crypt/
53 vusi4lpv3m4nj5dasgt2l0v9bo/bj2bkn8p1gfq21ug4fq04no4j0
> rclone copy gdrive:Crypt/vusi4lpv3m4nj5dasgt2l0v9bo/bj2bkn8p1gfq21ug4fq04no4j0 .
> type bj2bkn8p1gfq21ug4fq04no4j0
Rkv・ク開cソ$"円Nbaソ紗H*・iu2・x