I am trying to run Node.js app from jenkins which takes a backup of our API management platform. When we get a backup on jenkins server, we have below directories – Backup
├── apps ├── secretes │ ├── abc │ ├── pqr │ └── xyz └─ devs
There are directories in secrets like abc
, pqr
, xyz
which store some .txt files in it which has confidential data.
I want to encrypt all files present in the secretes
directory before creating a zip and placing it in backup storage location. Any encryption method will work for me.
Advertisement
Answer
Use an external tool such as 7zip to create a strongly encrypted zip file.
Install it by using this command sudo apt-get install p7zip-full -y
Encrypt your Jenkins’s secretes directory by using the following command;
7z a -mhe=on -t7z -mx=9 -pyour_custom_password output_encryped_backup_archive.7z secretes
You can read more about the above options at https://linux.die.net/man/1/7z
You can automate this script by using crontab.