This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
сервис_git [2026/02/25 21:55] val [Удаление чувствительных данных (паролей, ключей) из репозитория] |
сервис_git [2026/09/21 06:49] (current) val [etckeeper] |
||
|---|---|---|---|
| Line 17: | Line 17: | ||
| * Вместо каталога conf/ можно использовать /etc/ или /srv/tftp/ | * Вместо каталога conf/ можно использовать /etc/ или /srv/tftp/ | ||
| + | * [[#etckeeper]] | ||
| <code> | <code> | ||
| Line 32: | Line 33: | ||
| server:~/conf$ git init | server:~/conf$ git init | ||
| + | |||
| + | server:~/conf$ cat .gitignore | ||
| + | __pycache__/ | ||
| + | #shadow | ||
| + | #*key | ||
| + | |||
| server:~/conf$ git add . | server:~/conf$ git add . | ||
| Line 37: | Line 44: | ||
| server:~/conf$ git status | server:~/conf$ git status | ||
| - | server:~/conf$ git config --global user.email "student@corpX.un" | + | server:~/conf$ |
| - | server:~/conf$ git config --global user.name "FIO" | + | git config --global user.name "FIO" |
| + | git config --global user.email "student@corpX.un" | ||
| server:~/conf$ git commit -a -m 'ver: 1.1' | server:~/conf$ git commit -a -m 'ver: 1.1' | ||
| Line 45: | Line 53: | ||
| server:~/conf$ git status | server:~/conf$ git status | ||
| + | |||
| + | server:~/conf$ ###git restore file1 | ||
| server:~/conf$ git add -v . | server:~/conf$ git add -v . | ||
| Line 72: | Line 82: | ||
| ===== Пример с использованием cron ===== | ===== Пример с использованием cron ===== | ||
| + | |||
| + | * [[#etckeeper]] | ||
| <code> | <code> | ||
| Line 300: | Line 312: | ||
| (venv1) server:~/kubespray# git checkout tags/v2.26.0 | (venv1) server:~/kubespray# git checkout tags/v2.26.0 | ||
| + | </code> | ||
| + | |||
| + | ===== Поиск чувствительных данных (паролей, ключей) в репозитории ===== | ||
| + | |||
| + | * [[https://www.reddit.com/r/git/comments/o7jaau/how_to_scan_for_secrets_on_git_repositories/]] | ||
| + | <code> | ||
| + | ~/openvpn1# git rev-list --all | while read commit_hash; do | ||
| + | git grep pass $commit_hash | cat | ||
| + | done | ||
| + | </code> | ||
| + | * https://github.com/trufflesecurity/trufflehog | ||
| + | <code> | ||
| + | ~# wget https://github.com/trufflesecurity/trufflehog/releases/download/v3.93.6/trufflehog_3.93.6_linux_amd64.tar.gz | ||
| + | |||
| + | ~# tar -xvf trufflehog_3.93.6_linux_amd64.tar.gz trufflehog | ||
| + | |||
| + | ~# mv trufflehog /usr/local/bin/ | ||
| + | |||
| + | ~# trufflehog git https://server.corp13.un:4443/student/openvpn1.git | ||
| + | |||
| + | ~# ###trufflehog git file://openvpn1 | ||
| + | </code> | ||
| + | |||
| + | ===== etckeeper ===== | ||
| + | <code> | ||
| + | # apt install etckeeper git -y | ||
| + | |||
| + | # git -C /etc/ status | ||
| + | |||
| + | # git -C /etc/ log | ||
| + | |||
| + | # less /etc/.gitignore | ||
| </code> | </code> | ||
| Line 319: | Line 363: | ||
| server:/tmp/openvpn1# cp ~/openvpn1/inventory.yaml . -v | server:/tmp/openvpn1# cp ~/openvpn1/inventory.yaml . -v | ||
| server:/tmp/openvpn1# cp ~/openvpn1/openvpn1/files/server.key openvpn1/files/ -v | server:/tmp/openvpn1# cp ~/openvpn1/openvpn1/files/server.key openvpn1/files/ -v | ||
| + | |||
| + | server:/tmp/openvpn1# rm -rf ~/openvpn1 | ||
| server:/tmp/openvpn1# sops edit inventory.yaml | server:/tmp/openvpn1# sops edit inventory.yaml | ||
| Line 328: | Line 374: | ||
| server:/tmp/openvpn1# git remote -v | server:/tmp/openvpn1# git remote -v | ||
| - | server:/tmp/openvpn1# git remote add origin https://gitlab.corpX.un/student/openvpn1.git | + | server:/tmp/openvpn1# git remote add origin https://server.corpX.un/student/openvpn1.git |
| + | </code> | ||
| + | Settings -> Repository -> Protected Branches -> Allowed to force push: ON | ||
| + | <code> | ||
| server:/tmp/openvpn1# git push --force --all | server:/tmp/openvpn1# git push --force --all | ||
| server:/tmp/openvpn1# git push --force --tags | server:/tmp/openvpn1# git push --force --tags | ||
| </code> | </code> | ||