|
| 1 | +# qip-pass-export |
| 2 | + |
| 3 | +Script to export passwords from pass / password-store / the standard unix password manager. |
| 4 | +The exported passwords can be imported into Passbolt. |
| 5 | + |
| 6 | +Is is very likely they can also be imported into other password managers like Bitwarden, Vaultwarden and more, but I have not tested this myself. |
| 7 | + |
| 8 | +## Background |
| 9 | + |
| 10 | +I love [pass](https://www.passwordstore.org/) but it doesn't get much approval from the low-tech members of my family because of the complex software setup, hokey browser integration and needing to manually maintain GPG keys. |
| 11 | + |
| 12 | +I decided to move all our passwords to a self-hosted [Passbolt Pro](https://www.passbolt.com/pricing/pro) instance. |
| 13 | + |
| 14 | +To help with the migration, I made this simple `pass2csv` script in Python to export all my "pass" passwords to a CSV file that can be imported directly into Passbolt. |
| 15 | + |
| 16 | +In particular the output format is supposedly Bitwarden's own format. See "Csv (BitWarden)" from [How to import passwords in passbolt](https://help.passbolt.com/faq/start/import-passwords) |
| 17 | + |
| 18 | +> [!NOTE] |
| 19 | +> This script can only decrypt password files for which you are the intended recipient, e.g., you posess the corresponding GPG private keys. |
| 20 | +> This is NOT a brute-force decrypter, you must *own* the data. |
| 21 | +
|
| 22 | +## Installation |
| 23 | + |
| 24 | +Minimum requirements: |
| 25 | + |
| 26 | +- Python 3.x (tested with 3.11) |
| 27 | + |
| 28 | +Clone the repository: |
| 29 | + |
| 30 | +```sh |
| 31 | +git clone https://github.com/qualIP/qip-pass-export.git |
| 32 | +cd qip-pass-export |
| 33 | +``` |
| 34 | + |
| 35 | +Required Python modules are in [requirements.txt](requirements.txt) -- Really just `python-gnupg`. |
| 36 | + |
| 37 | +You can install `python-gnupg` in your Linux distribution's standard packages or with `pip`. |
| 38 | + |
| 39 | +On Debian and derivative distributions based on `apt`, this should work: |
| 40 | + |
| 41 | +```sh |
| 42 | +sudo apt install python3-gnupg |
| 43 | +``` |
| 44 | + |
| 45 | +Otherwise, it is recommended to create a simple Python virtual environment, preferably under the qip-pass-export directory itself: |
| 46 | + |
| 47 | +```sh |
| 48 | +python3 -m venv venv |
| 49 | +source venv/bin/activate |
| 50 | +pip install -r requirements.txt |
| 51 | +``` |
| 52 | + |
| 53 | +You may need to install your distributions Python venv module, e.g, the `python3-venv` package. |
| 54 | + |
| 55 | +## Usage |
| 56 | + |
| 57 | +### Exporting pass passwords |
| 58 | + |
| 59 | +Usage is simple, just provide paths to pass `.gpg` files and it will output a CSV file on its standard output which you can pipe to a file of your choice. |
| 60 | +Typically, pass stores your password files under the `~/.password-store` directory. |
| 61 | + |
| 62 | +Example: Export top-level passwords |
| 63 | + |
| 64 | +```sh |
| 65 | +./pass2csv ~/.password-store/*.gpg > pass.csv |
| 66 | +``` |
| 67 | + |
| 68 | +Example: Export passwords from a sub-directory |
| 69 | + |
| 70 | +```sh |
| 71 | +./pass2csv ~/.password-store/sub-directory/*.gpg > pass.csv |
| 72 | +``` |
| 73 | + |
| 74 | +Example: Export all passwords at once |
| 75 | + |
| 76 | +```sh |
| 77 | +find ~/.password-store -name '*.gpg' -print0 | xargs -r0 ./pass2csv > pass.csv |
| 78 | +``` |
| 79 | + |
| 80 | +Please be patient, it takes a while to decrypt each individual file. |
| 81 | + |
| 82 | +> [!CAUTION] |
| 83 | +> The exported CSV file contains **plain text**, **unencrypted passwords**. |
| 84 | +> Once you no longer needed the CSV file, delete it and empty your trash before someone else gets a hold of it. |
| 85 | +> Better yet, use a tool like [wipe](https://github.com/berke/wipe) to perform a secure erase. |
| 86 | +
|
| 87 | +### Import passwords into Passbolt |
| 88 | + |
| 89 | +Next, go to your Passbolt Web interface, and click on the Import button: |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | +In the Import dialog, select your CSV file. |
| 94 | +If you wish to preserve the original directory structure, make sure to check the "Import folders" checkbox. |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | +Hit "Import", you're done. |
| 99 | + |
| 100 | +> [!CAUTION] |
| 101 | +> Remember to securely erase the CSV file! |
| 102 | +
|
| 103 | +## Future work |
| 104 | + |
| 105 | +Now that I'm done migrating my passwords to Passbolt, I don't foresee making any change of consequence to this software. |
| 106 | + |
| 107 | +With proper incentives :moneybag::coffee:, I may be inclined to export various other formats -- Let me know. |
| 108 | + |
| 109 | +If you're having issues using this software, please let me know by [opening an issue](https://github.com/qualIP/qip-pass-export/issues) in GitHub. |
0 commit comments