From 6347c150d882ee3c454a1b77ae8083fdbf997812 Mon Sep 17 00:00:00 2001 From: Brieuc Dubois Date: Fri, 26 Jan 2024 21:38:51 +0100 Subject: [PATCH] Initial commit --- .gitignore | 2 ++ LICENSE | 7 +++++++ configs/git/.gitignore_global | 1 + root/etc/wireguard/bxl-shp.conf.enc | 7 +++++++ root/etc/wireguard/bxl40.conf.enc | 8 ++++++++ root/etc/wireguard/llnux.conf.enc | 7 +++++++ root/home/bhasher/.gitconfig | 8 ++++++++ scripts/decrypt.sh | 18 ++++++++++++++++++ scripts/encrypt.sh | 20 ++++++++++++++++++++ scripts/sync.sh | 20 ++++++++++++++++++++ 10 files changed, 98 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 configs/git/.gitignore_global create mode 100644 root/etc/wireguard/bxl-shp.conf.enc create mode 100644 root/etc/wireguard/bxl40.conf.enc create mode 100644 root/etc/wireguard/llnux.conf.enc create mode 100644 root/home/bhasher/.gitconfig create mode 100755 scripts/decrypt.sh create mode 100755 scripts/encrypt.sh create mode 100755 scripts/sync.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1fe6156 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +key +root/etc/wireguard/*.conf \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fa01e4a --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright © 2024 Brieuc Dubois + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/configs/git/.gitignore_global b/configs/git/.gitignore_global new file mode 100644 index 0000000..1d74e21 --- /dev/null +++ b/configs/git/.gitignore_global @@ -0,0 +1 @@ +.vscode/ diff --git a/root/etc/wireguard/bxl-shp.conf.enc b/root/etc/wireguard/bxl-shp.conf.enc new file mode 100644 index 0000000..7f5beac --- /dev/null +++ b/root/etc/wireguard/bxl-shp.conf.enc @@ -0,0 +1,7 @@ +U2FsdGVkX1+ncivGbkl9xEPNrLpEKtnb0Pxry6/T3oWckvIIz8gsj/vWPBO8spcs +UpMsDbsXCcixkoXtlrbKl95F1X4u1EWJyI5qA7UKBezppnTr918kMlNm7KEF41ML +cxEEoLx8vA4CdIgsXAEKfOkGu+wroyYWwFCpqaqd5muYrr7DEy92dFmHbxd79rKW +yyGWACK9Uwju4oR3meZVu6FfXeygcSLNmX4sLBeVazpIU2CUuKui7jntwCtS79gW +cBawTcplAcjQGAYSH3o4YJHIoOaaPC+TVrRLebjpTIPR8D6WJ6I3XqSP8/45iG4/ +7ohog51EFovotnKBHvIx2mSx+MzdGd/6vS5ew+UjckG/efp9CTCNuhwhNWDcVnqm +RXWKhjSyxlITFTnLKJZxu7qFvg+0CO4seN723XeqKCU= diff --git a/root/etc/wireguard/bxl40.conf.enc b/root/etc/wireguard/bxl40.conf.enc new file mode 100644 index 0000000..42c002f --- /dev/null +++ b/root/etc/wireguard/bxl40.conf.enc @@ -0,0 +1,8 @@ +U2FsdGVkX19aSzzg8Hk5XyxPZstPe2hwugKjc0NoRd0iAC7+UJahb6MCs0i2ZWeH +fafQ9bAu7+rY1My2F7GSiyjtcTXxtlm66pqaSsJW7MMi7eDgPo5Nr0udZYly259s +YQjsifE7LA3+f87U/v8PAbKVy2atRPh/uXVjC8qxjihNEQt9OSboUpyl5qakbM7X +2lVf7Ekr6E8e+tJzvDxI36ALsxhTCmO8cx+WF0qYIInAv84E+R83xl9PC19IftW6 +1dy3w++kYGuldqKnDWV969Hl0BAHYPxyQDHRPvew73RO0dBKcyNYmXiuR469D9yM +OsBwfmRvygWKs9zpn7AAR0uCwh6y9PuH4BJAiyYhn0PTSZU7gmtgvNGpgV1g6CPH +glFHPElh1GaRAeUmDN4N4jmbORtC129MwwiJsY+9CCKRX71uVmhj6P5q5y8R8akQ +kUjZ/4pvmy2l/Z5LjN5LfhdDzs+CrmSb0efYpkj7WNM= diff --git a/root/etc/wireguard/llnux.conf.enc b/root/etc/wireguard/llnux.conf.enc new file mode 100644 index 0000000..b3e8995 --- /dev/null +++ b/root/etc/wireguard/llnux.conf.enc @@ -0,0 +1,7 @@ +U2FsdGVkX1+91RK7IifU04BNXpMHyP3P2D7noVb68IPY4UfRXEsUbl9OZsVGqnAj +qfvZUwL8JvRTPeIppk+nKlaiBZC1+pb37eYHJ38/5D/3WMuM386T3TX5bQ+RGIN0 +tITHuFoCtDe30olAEPCOG6Cr726rDket1AA2aRTrsgVn8LCvH3svJlRT0qpPSi1Z +u34k7Hy5Mo3r9Cpq5/PzDYX+ebfWbY5bVo9vzOKck3eWO15YKOjmC2EwOYkfYw3/ +AHXECBlSkMKUVPIqwpRrDNPBio39JSPbk0l9L/r74eIYxSApyV858R5TPooql6hL +GDA/mSgYNR40VGskVSqPyAFOgPIWXUst2Io0GoUf2PGTULlx/xcF2GCaM/ugwJ3R +t/jwo0KqRHhVxeiOM8cXuY0tx6n6bWZ6aBdQ+Z6qgJw= diff --git a/root/home/bhasher/.gitconfig b/root/home/bhasher/.gitconfig new file mode 100644 index 0000000..4e094f9 --- /dev/null +++ b/root/home/bhasher/.gitconfig @@ -0,0 +1,8 @@ +[include] + path = ~/Documents/sync/.config/git/.gitconfig +[safe] + directory = /opt/flutter +[core] + excludesfile = /home/bhasher/.gitignore_global +[init] + defaultBranch = master diff --git a/scripts/decrypt.sh b/scripts/decrypt.sh new file mode 100755 index 0000000..acf235b --- /dev/null +++ b/scripts/decrypt.sh @@ -0,0 +1,18 @@ +#!/bin/bash + + +public_key_file="${1:-key}" + +find "../root" -type f -name "*.enc" | while read -r file; do + dir=$(dirname "$file") + base=$(basename "$file" .enc) + + openssl aes-256-cbc -d -a -md md5 -pbkdf2 -kfile $public_key_file -out "$dir/$base" -in "$file" + + echo "$file -> $dir/$base" +done + +amount=$(find "../root" -type f -name "*.enc" | wc -l) + +echo "" +echo "$amount files decrypted." \ No newline at end of file diff --git a/scripts/encrypt.sh b/scripts/encrypt.sh new file mode 100755 index 0000000..f195673 --- /dev/null +++ b/scripts/encrypt.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Usage: $(basename "$0") " + exit 1 +fi + +if [ ! -f "$1" ]; then + echo "Error: File not found or not a regular file: $1" + exit 1 +fi + +dir=$(dirname "$1") +base=$(basename "$1") + +public_key_file="${2:-$PWD/key}" + +openssl aes-256-cbc -e -a -salt -md md5 -pbkdf2 -kfile $public_key_file -out "$dir/${base}.enc" -in "$1" + +echo "$1 -> $dir/${base}.enc" diff --git a/scripts/sync.sh b/scripts/sync.sh new file mode 100755 index 0000000..c7e576a --- /dev/null +++ b/scripts/sync.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +src_dir="../root" +dst_dir="/" + +function create_hard_links() { + local src_path="$1" + local dst_path="$2" + + for item in "$src_path"/*; do + if [ -d "$item" ]; then + mkdir -p "${dst_path}${item#$src_path}/" + create_hard_links "$item" "${dst_path}${item#$src_path}/" + elif [ -f "$item" ] && [[ ! "$item" =~ \.enc$ ]]; then + ln "$item" "${dst_path}${item#$src_path}" + fi + done +} + +create_hard_links "$src_dir" "$dst_dir" \ No newline at end of file