有哪些选项可以保护具有docker守护程序的Jenkins从属节点?有人可以启动docker容器并基本上访问root拥有的文件。
环境和问题详情:
问题:
示例:
pipeline {
agent {
docker {
image 'maven:3-alpine'
args '-v /:/hostroot'
(args '—user 500 ' --> since Jenkinsfile is managed by development team, ensuring everyone puts this parameter is tricky… someone could forget to put it)
}
}
stages {
stage('Build') {
steps {
sh 'rm -rf /hostroot/*' --> delete the entire filesystem!
sh 'cat /path/to/secret/file' --> see some files owned by root!
}
}
}
}
此处发布了一个类似的问题,但这是2岁,并没有一个好的答案: Building Docker images with Jenkins that runs inside a Docker container