Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何在Jenkins中加密文件_Linux_Shell_Jenkins_Encryption - Fatal编程技术网

Linux 如何在Jenkins中加密文件

Linux 如何在Jenkins中加密文件,linux,shell,jenkins,encryption,Linux,Shell,Jenkins,Encryption,我正在尝试从jenkins运行Node.js应用程序,它备份了我们的API管理平台。 当我们在jenkins服务器上得到备份时,我们有以下目录- 备份 机密中有一些目录,如abc、pqr、xyz,其中存储了一些包含机密数据的.txt文件 在创建zip并将其放置在备份存储位置之前,我想对secrets目录中的所有文件进行加密。任何加密方法都适用于我。使用外部工具,如创建强加密的zip文件 使用以下命令安装它sudo apt get Install p7zip full-y 使用以下命令加密Jenk

我正在尝试从jenkins运行Node.js应用程序,它备份了我们的API管理平台。 当我们在jenkins服务器上得到备份时,我们有以下目录- 备份

机密中有一些目录,如
abc
pqr
xyz
,其中存储了一些包含机密数据的.txt文件


在创建zip并将其放置在备份存储位置之前,我想对
secrets
目录中的所有文件进行加密。任何加密方法都适用于我。

使用外部工具,如创建强加密的zip文件

使用以下命令安装它
sudo apt get Install p7zip full-y

使用以下命令加密Jenkins的secrets目录

7z a -mhe=on -t7z -mx=9 -pyour_custom_password output_encryped_backup_archive.7z secretes
有关上述选项的更多信息,请访问


您可以使用crontab自动化此脚本。

选项1。詹金斯凭证插件

将所有凭据/机密存储在一个位置

范例

node {
  ws {
    withCredentials([file(credentialsId: 'secret', variable: 'FILE')]) {
      sh 'use $FILE'
    }
  }
}
备选案文2。吉特隐窝

只需使用模块git crypt将原样存储到git中即可。在Jenkins凭证中,您已存储密钥

要获取数据,只需使用附加的加密密钥签出git即可

备选案文3。将加密存档存储在acrtifactory/S3中,并将密码存储在Jenkins凭据中

e、 g.来自

node {
  ws {
    withCredentials([file(credentialsId: 'secret', variable: 'FILE')]) {
      sh 'use $FILE'
    }
  }
}
node {
  withCredentials([usernameColonPassword(credentialsId: 'mylogin', variable: 'USERPASS')]) {
    sh '''
      set +x
      curl -u "$USERPASS" https://private.server/ > output
    '''
  }
}