From 2ce6720deb9534b3d709ffcfbcde75d6b844be18 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 9 Dec 2022 15:04:51 +0100 Subject: [PATCH 01/28] add archlinux version with teleport installed --- Dockerfile | 22 ++++--- Testing/crontab.txt | 2 +- bash-config/.bashrc | 79 +------------------------ bash-config/.bashrc_root | 100 ++++++++++++++++++++++++++++++++ build.sh | 1 + entrypoint-script/entrypoint.sh | 36 +++++++----- motd.txt | 5 -- 7 files changed, 140 insertions(+), 105 deletions(-) create mode 100644 bash-config/.bashrc_root delete mode 100644 motd.txt diff --git a/Dockerfile b/Dockerfile index 7c5941a..01aa2fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:edge +FROM archlinux:latest ENV USER=borg ENV UID=1000 @@ -15,22 +15,29 @@ VOLUME ["/backups"] VOLUME ["/logs"] VOLUME ["/sshkeys/host"] -COPY motd.txt /etc/motd COPY entrypoint-script/entrypoint.sh / COPY entrypoint-script/variables.sh / COPY scripts/borgbackup.sh /usr/local/bin/ COPY bash-config/.bash_profile /root/ -COPY bash-config/.bashrc /root/ +COPY bash-config/.bashrc_root /root/ + +COPY bash-config/.bash_profile / +COPY bash-config/.bashrc / COPY prometheus-borg-exporter/borg_exporter.sh /usr/local/bin/ COPY prometheus-borg-exporter/borg_exporter.rc /etc/ # Install packages -RUN apk update ; apk upgrade -RUN apk add --no-cache sudo bash bash-completion tzdata openssh openrc neofetch \ - borgbackup dateutils prometheus-node-exporter curl wget -RUN rm -rf /var/cache/apk/* +RUN pacman -Syu --noconfirm sudo bash-completion openssh neofetch \ + borgbackup dateutils prometheus-node-exporter wget git base-devel cron net-tools inetutils + +# Make Build User +RUN useradd builduser -m +RUN passwd -d builduser +RUN printf 'builduser ALL=(ALL) ALL\n' | tee -a /etc/sudoers +RUN sudo -u builduser bash -c 'cd ~ && git clone https://aur.archlinux.org/teleport-bin.git teleport && cd teleport && makepkg -si --noconfirm && cd ~ && rm -rf teleport' +RUN userdel -r builduser # Setup SSH-Server RUN sed -ie 's/#Port 22/Port 22/g' /etc/ssh/sshd_config @@ -40,7 +47,6 @@ RUN sed -ie 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh RUN sed -ie 's|#HostKey /etc/ssh/ssh_host_rsa_key|HostKey /sshkeys/host/ssh_host_rsa_key|g' /etc/ssh/sshd_config RUN sed -ie 's|#HostKey /etc/ssh/ssh_host_ecdsa_key|HostKey /sshkeys/host/ssh_host_ecdsa_key|g' /etc/ssh/sshd_config RUN sed -ie 's|#HostKey /etc/ssh/ssh_host_ed25519_key|HostKey /sshkeys/host/ssh_host_ed25519_key|g' /etc/ssh/sshd_config -RUN sed -ie 's|root:x:0:0:root:/root:/bin/ash|root:x:0:0:root:/root:/bin/bash|g' /etc/passwd EXPOSE 22 ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/Testing/crontab.txt b/Testing/crontab.txt index 5b4d1ab..f3320f8 100644 --- a/Testing/crontab.txt +++ b/Testing/crontab.txt @@ -1 +1 @@ -* * * * * /test_script.sh \ No newline at end of file +* * * * * /test_script.sh diff --git a/bash-config/.bashrc b/bash-config/.bashrc index c67a2df..919a21b 100644 --- a/bash-config/.bashrc +++ b/bash-config/.bashrc @@ -1,4 +1,4 @@ -alias update='apk update && apk upgrade' +alias update='sudo pacman -Syu --noconfirm' export HISTTIMEFORMAT="%d/%m/%y %T " export PS1='\u@\h:\W \$ ' @@ -8,79 +8,13 @@ alias la='ls -A' alias ll='ls -alF' alias ls='ls --color=auto' -source /etc/profile.d/bash_completion.sh - export PS1="\[\e[31m\][\[\e[m\]\[\e[38;5;172m\]\u\[\e[m\]@\[\e[38;5;153m\]\h\[\e[m\] \[\e[38;5;214m\]\W\[\e[m\]\[\e[31m\]]\[\e[m\]\\$ " ############################################################################################################################## -# Borg Repo finder +# Functions ############################################################################################################################## source "/variables.sh" COLUMNS=$(/usr/bin/tput cols) -function find_borg_repo { - repo_list=( $(find "$1" -name "index.*" -type f | rev | cut -d '/' -f "2-" | rev) ) - - if [ -z "$repo_list" ]; then - sepurator - echo "* Can not find borg repository" - else - sepurator - echo "* Select borg repository" - sepurator - select_borg_repo - fi -} - -function select_borg_repo { - if [ "${#repo_list[@]}" -eq 1 ]; then - echo "* Only one item" - sepurator - selected_repo="0" - else - for key in "${!repo_list[@]}" ; do - echo "$key: ${repo_list[key]}" - done - - echo "" - - selected_repo=asfd - while ! [[ $selected_repo -lt ${#repo_list[@]} && $selected_repo =~ ^[+]?[0-9]+$ ]]; do - read -p "Please select a Repo: " selected_repo - - if [[ $selected_repo -gt $((${#repo_list[@]} -1)) ]]; then - sepurator - echo "* Oops! User input was out of range!" - sepurator - fi - - if ! [[ $selected_repo =~ ^[+]?[0-9]+$ ]]; then - sepurator - echo "* Oops! User input was not a positive integer!" - sepurator - fi - done - fi - sepurator -} - -function ask_for_repo_password { - if [ -z "$BORG_PASSPHRASE" ]; then - if grep -q 'key' "$BORG_REPO/config"; then - echo "* BORG REPO has a password" - sepurator - echo "(you can leave it empty if you not like to export BORG_PASSPHRASE)" - read -s -p "Please enter password: " BORG_REPO_PASSWORD - echo "" - if [ "$BORG_REPO_PASSWORD" != "" ]; then - export BORG_PASSPHRASE="$BORG_REPO_PASSWORD" - fi - else - echo "* BORG REPO has no password" - fi - sepurator - fi -} - function print_container_info { sepurator echo "BorgServer powered by $BORG_VERSION - Image Hostname: $HOSTNAME | Image Version: $DOCKER_IMAGE_VERSION" @@ -89,14 +23,5 @@ function print_container_info { ############################################################################################################################## # Run Code ############################################################################################################################## -if [ "$INTERACTIVE_MODE" != "false" ]; then - find_borg_repo /backups/ - export BORG_REPO="${repo_list[selected_repo]}" - if [ ! -z "$BORG_REPO" ]; then - ask_for_repo_password - clear - fi -fi - print_container_info neofetch diff --git a/bash-config/.bashrc_root b/bash-config/.bashrc_root new file mode 100644 index 0000000..b354153 --- /dev/null +++ b/bash-config/.bashrc_root @@ -0,0 +1,100 @@ +alias update='pacman -Syu --noconfirm' + +export HISTTIMEFORMAT="%d/%m/%y %T " +export PS1='\u@\h:\W \$ ' + +alias l='ls -CF' +alias la='ls -A' +alias ll='ls -alF' +alias ls='ls --color=auto' + +export PS1="\[\e[31m\][\[\e[m\]\[\e[38;5;172m\]\u\[\e[m\]@\[\e[38;5;153m\]\h\[\e[m\] \[\e[38;5;214m\]\W\[\e[m\]\[\e[31m\]]\[\e[m\]\\$ " +############################################################################################################################## +# Borg Repo finder +############################################################################################################################## +source "/variables.sh" +COLUMNS=$(/usr/bin/tput cols) + +function find_borg_repo { + repo_list=( $(find "$1" -name "index.*" -type f | rev | cut -d '/' -f "2-" | rev) ) + + if [ -z "$repo_list" ]; then + sepurator + echo "* Can not find borg repository" + else + sepurator + echo "* Select borg repository" + sepurator + select_borg_repo + fi +} + +function select_borg_repo { + if [ "${#repo_list[@]}" -eq 1 ]; then + echo "* Only one item" + sepurator + selected_repo="0" + else + for key in "${!repo_list[@]}" ; do + echo "$key: ${repo_list[key]}" + done + + echo "" + + selected_repo=asfd + while ! [[ $selected_repo -lt ${#repo_list[@]} && $selected_repo =~ ^[+]?[0-9]+$ ]]; do + read -p "Please select a Repo: " selected_repo + + if [[ $selected_repo -gt $((${#repo_list[@]} -1)) ]]; then + sepurator + echo "* Oops! User input was out of range!" + sepurator + fi + + if ! [[ $selected_repo =~ ^[+]?[0-9]+$ ]]; then + sepurator + echo "* Oops! User input was not a positive integer!" + sepurator + fi + done + fi + sepurator +} + +function ask_for_repo_password { + if [ -z "$BORG_PASSPHRASE" ]; then + if grep -q 'key' "$BORG_REPO/config"; then + echo "* BORG REPO has a password" + sepurator + echo "(you can leave it empty if you not like to export BORG_PASSPHRASE)" + read -s -p "Please enter password: " BORG_REPO_PASSWORD + echo "" + if [ "$BORG_REPO_PASSWORD" != "" ]; then + export BORG_PASSPHRASE="$BORG_REPO_PASSWORD" + fi + else + echo "* BORG REPO has no password" + fi + sepurator + fi +} + +function print_container_info { + sepurator + echo "BorgServer powered by $BORG_VERSION - Image Hostname: $HOSTNAME | Image Version: $DOCKER_IMAGE_VERSION" + sepurator +} +############################################################################################################################## +# Run Code +############################################################################################################################## +if [ "$INTERACTIVE_MODE" != "false" ]; then + find_borg_repo /backups/ + export BORG_REPO="${repo_list[selected_repo]}" + if [ ! -z "$BORG_REPO" ]; then + ask_for_repo_password + clear + fi +fi + +print_container_info +neofetch diff --git a/build.sh b/build.sh index b174c0d..8c6082c 100755 --- a/build.sh +++ b/build.sh @@ -8,6 +8,7 @@ run_docker_container() { echo "Running..." docker run -dp 3000:22 \ -p 9100:9100 \ + -p 2222:22 \ -e UID=$(id -u) \ -e GID=$(id -g) \ -e MAINTENANCE_ENABLE="true" \ diff --git a/entrypoint-script/entrypoint.sh b/entrypoint-script/entrypoint.sh index 5ff35c5..8ccf515 100755 --- a/entrypoint-script/entrypoint.sh +++ b/entrypoint-script/entrypoint.sh @@ -18,16 +18,15 @@ function print_user_info { function add_borg_user { if ! id "$USER" &>/dev/null; then - sh -c "echo '$USER ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" - adduser \ - -s /bin/bash \ - --disabled-password \ - --gecos "" \ - --home "/" \ - --uid "$UID" \ - "$USER" - echo "$USER:*" | chpasswd 2>> /dev/null - addgroup -g "$GID" "$USER" 2>> /dev/null + groupadd -g "$GID" "$USER" >> /dev/null + useradd -r -u "$UID" -g "$GID" -s "/bin/bash" "$USER" >> /dev/null + passwd -d "$USER" >> /dev/null + printf "$USER ALL=(ALL) NOPASSWD: ALL\n" | tee -a /etc/sudoers >> /dev/null + usermod -d / borg >> /dev/null + + create_folder_and_change_permissions "/.config" + create_folder_and_change_permissions "/.cache" + chmod 700 "/.cache" fi } @@ -112,8 +111,8 @@ function maintenance_enable { echo "* MAINTENANCE MODE - ENABLED" echo "" if [ -f "/crontab.txt" ]; then - /usr/bin/crontab "/crontab.txt" - /usr/sbin/crond -b 2> /dev/null + crontab "/crontab.txt" + crond -i 2> /dev/null echo "- Crontab loaded successfully" else echo "- Can not find /crontab.txt" @@ -152,12 +151,20 @@ function create_folder_and_change_permissions { chown -R "$USER":"$USER" "$1" } +function run_teleport_server() { + if [ -f "/etc/teleport.yaml" ]; then + echo "* STARTING Teleport Server" + teleport start -c /etc/teleport.yaml > /var/log/teleport.log 2>&1 & + sepurator + fi +} + function run_prometheus_exporter() { if [ "$RUN_PROMETHEUS_EXPORTER" != "false" ]; then - create_folder_and_change_permissions "/.config" create_folder_and_change_permissions "/var/log/" echo "* STARTING Prometheus Exporter for Borg Backup" + echo "" crontab -l > /tmp/cron_bkp echo "" >> /tmp/cron_bkp @@ -173,7 +180,7 @@ function run_prometheus_exporter() { fi echo "- STARTING Node Exporter" - sudo -H -u "$USER" bash -c "node_exporter --collector.textfile.directory=$NODE_EXPORTER_DIR &" + sudo -H -u "$USER" bash -c "prometheus-node-exporter --collector.textfile.directory=$NODE_EXPORTER_DIR > /dev/null 2>&1 &" sepurator fi } @@ -192,6 +199,7 @@ sepurator maintenance_enable set_timezone +run_teleport_server run_prometheus_exporter run_install_script diff --git a/motd.txt b/motd.txt deleted file mode 100644 index b32afc5..0000000 --- a/motd.txt +++ /dev/null @@ -1,5 +0,0 @@ -Welcome to BorgBackup! - -You can run all borg command here: borg -to Check you Version run: borg -V - From 0c9ecf810d5ac17022dec9da34ffe6b035946130 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 16 Dec 2022 14:43:12 +0100 Subject: [PATCH 02/28] init pacman key --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 01aa2fe..ab21269 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,7 @@ COPY prometheus-borg-exporter/borg_exporter.sh /usr/local/bin/ COPY prometheus-borg-exporter/borg_exporter.rc /etc/ # Install packages +RUN pacman-key --init RUN pacman -Syu --noconfirm sudo bash-completion openssh neofetch \ borgbackup dateutils prometheus-node-exporter wget git base-devel cron net-tools inetutils From 6fa17329818dbe611ae51cc17f0cd529dd492170 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Mon, 19 Dec 2022 16:35:27 +0100 Subject: [PATCH 03/28] remove not neaded echos --- entrypoint-script/entrypoint.sh | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/entrypoint-script/entrypoint.sh b/entrypoint-script/entrypoint.sh index 8ccf515..dd51dbe 100755 --- a/entrypoint-script/entrypoint.sh +++ b/entrypoint-script/entrypoint.sh @@ -1,8 +1,8 @@ #!/bin/bash source "/variables.sh" -############################################################################################################################## +##################################################################################################### # Funktionen -############################################################################################################################## +##################################################################################################### function print_container_info { sepurator echo "* BorgServer powered by $BORG_VERSION" @@ -55,7 +55,6 @@ function make_and_import_ssh_keys { fi echo "* IMPORT SSH KEYS" - echo "" FILES=$(ls -1 /sshkeys/clients) for key in $FILES; do @@ -76,31 +75,24 @@ function print_message { } function generate_host_sshkey { - local generated_keys="0" - echo "* GENERATE HOST SSH-KEYs" # Generate SSH-Keys if [ ! -f "/sshkeys/host/ssh_host_rsa_key" ]; then + sepurator print_message "HOST SSH-KEY RSA not found, generating..." ssh-keygen -t rsa -b 4096 -f "/sshkeys/host/ssh_host_rsa_key" -N "" print_message "HOST SSH-KEY RSA Generated" - generated_keys="1" fi if [ ! -f "/sshkeys/host/ssh_host_ecdsa_key" ]; then + sepurator print_message "HOST SSH-KEY ECDSA not found, generating..." ssh-keygen -t ecdsa -b 521 -f "/sshkeys/host/ssh_host_ecdsa_key" -N "" print_message "HOST SSH-KEY ECDSA Generated" - generated_keys="1" fi if [ ! -f "/sshkeys/host/ssh_host_ed25519_key" ]; then + sepurator print_message "HOST SSH-KEY ED25519 not found, generating..." ssh-keygen -t ed25519 -b 521 -f "/sshkeys/host/ssh_host_ed25519_key" -N "" print_message "HOST SSH-KEY ED25519 Generated" - generated_keys="1" - fi - - if [ "$generated_keys" == "0" ]; then - echo "" - echo "- HOST SSH-KEYs already exist" fi chown -R "$USER":"$USER" "/sshkeys/host" @@ -109,7 +101,6 @@ function generate_host_sshkey { function maintenance_enable { if [ "$MAINTENANCE_ENABLE" != "false" ]; then echo "* MAINTENANCE MODE - ENABLED" - echo "" if [ -f "/crontab.txt" ]; then crontab "/crontab.txt" crond -i 2> /dev/null @@ -137,7 +128,7 @@ function run_install_script { echo "* RUNNING INSTALL SCRIPT" sepurator sh "$RUN_INSTALL_SCRIPT" - echo "" + sepurator touch "/.runnedInstall" fi @@ -164,7 +155,6 @@ function run_prometheus_exporter() { create_folder_and_change_permissions "/var/log/" echo "* STARTING Prometheus Exporter for Borg Backup" - echo "" crontab -l > /tmp/cron_bkp echo "" >> /tmp/cron_bkp @@ -184,16 +174,16 @@ function run_prometheus_exporter() { sepurator fi } -############################################################################################################################## +##################################################################################################### # Main Code -############################################################################################################################## +##################################################################################################### add_borg_user print_container_info print_user_info sepurator make_and_import_ssh_keys -sepurator + generate_host_sshkey sepurator @@ -205,5 +195,5 @@ run_install_script echo "* Init done! - Starting SSH-Daemon..." sepurator -echo "" -exec /usr/sbin/sshd -D -e "$@" 2> /var/log/sshd.log + +exec /usr/sbin/sshd -D -e "$@" #2> /var/log/sshd.log From 0486f908d980ba9025c9dd96f8d65809c490970d Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 21 Apr 2023 19:46:45 +0200 Subject: [PATCH 04/28] change docker builder to buildx --- build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 8c6082c..8cc081c 100755 --- a/build.sh +++ b/build.sh @@ -26,7 +26,9 @@ build_docker_image() { TAG="$1" echo "Building..." - docker build -t "$DOCKER_IMAGE_NAME:$TAG" . + docker buildx build --push \ + --platform linux/amd64 \ + --tag "$DOCKER_IMAGE_NAME:$TAG" . } if [ "$GIT_BRANCH" == "main" ]; then From 10d564dd301c2ac2e97101f1f401b471887685f6 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Sun, 30 Apr 2023 15:40:22 +0200 Subject: [PATCH 05/28] update build script --- build.sh | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/build.sh b/build.sh index 8cc081c..d08a257 100755 --- a/build.sh +++ b/build.sh @@ -1,10 +1,11 @@ #!/bin/bash +source "../build-functions.sh" +source "../build-config.sh" DOCKER_IMAGE_NAME="daniel156161/borgbackup-ssh" DOCKER_CONTAINER_NAME="borgbackup" -GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) -run_docker_container() { +function run_docker_container { echo "Running..." docker run -dp 3000:22 \ -p 9100:9100 \ @@ -19,39 +20,18 @@ run_docker_container() { -v "$PWD"/Testing/test_script.sh:/test_script.sh \ -v "$PWD"/sshkeys/clients:/sshkeys/clients \ -v "$PWD"/backups:/backups \ - "$DOCKER_IMAGE_NAME":"$GIT_BRANCH" + "$DOCKER_IMAGE_NAME:$GIT_BRANCH" } -build_docker_image() { - TAG="$1" - - echo "Building..." - docker buildx build --push \ - --platform linux/amd64 \ - --tag "$DOCKER_IMAGE_NAME:$TAG" . -} - -if [ "$GIT_BRANCH" == "main" ]; then - GIT_BRANCH="latest" -fi - case "$1" in run) run_docker_container ;; build) - build_docker_image "$GIT_BRANCH" - ;; - upload) - build_docker_image "$GIT_BRANCH" - docker push "$DOCKER_IMAGE_NAME:$GIT_BRANCH" - ;; - test) - build_docker_image "$GIT_BRANCH" - run_docker_container + build_docker_image "$DOCKER_IMAGE_NAME:$GIT_BRANCH" ;; *) - echo "Usage: $0 {run|build|test|upload}" + echo "Usage: $0 {run|build}" exit 1 ;; esac From f1f90d0555535ef2d131ddb1748c7358016225c8 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Wed, 21 Jun 2023 14:52:33 +0200 Subject: [PATCH 06/28] make a syslink to get correct timezone --- entrypoint-script/entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint-script/entrypoint.sh b/entrypoint-script/entrypoint.sh index dd51dbe..2d4b693 100755 --- a/entrypoint-script/entrypoint.sh +++ b/entrypoint-script/entrypoint.sh @@ -116,6 +116,7 @@ function set_timezone { if [ "$TZ" != "" ]; then echo "* Setting Timezone to $TZ" echo "TZ=$TZ" > /etc/environment + ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime else echo "* Timezone not set - Use UTC Time" fi From eb8aaaa43544da9a4e27baf02dda08f6ccb3892e Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Thu, 6 Jul 2023 20:17:56 +0200 Subject: [PATCH 07/28] add github action to update docker container automaticly --- .github/workflows/docker-image.yml | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..a4dfacb --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,31 @@ +name: Build and Push Docker Container +on: + schedule: + - cron: "30 18 * * 4" + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + driver-opts: networks=host + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: daniel156161/borgbackup-ssh:archlinux + platforms: linux/amd64 # Ersetze dies durch die gewünschten Plattformen From ca4bbd04917c1b4d9b99ca449e5cf4d9991b2644 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Thu, 6 Jul 2023 20:22:26 +0200 Subject: [PATCH 08/28] rename workflow name --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index a4dfacb..9c11c10 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,4 +1,4 @@ -name: Build and Push Docker Container +name: Build and Push Docker Container - Arch Linux on: schedule: - cron: "30 18 * * 4" From eb4ef610709ec598f9cc60613cbc9505b1dd5c25 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Thu, 6 Jul 2023 20:45:44 +0200 Subject: [PATCH 09/28] remove not working workflow file --- .github/workflows/docker-image.yml | 31 ------------------------------ 1 file changed, 31 deletions(-) delete mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 9c11c10..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Build and Push Docker Container - Arch Linux -on: - schedule: - - cron: "30 18 * * 4" - -jobs: - build-and-push: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - with: - driver-opts: networks=host - - - name: Login to Docker Hub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Build and push Docker image - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: daniel156161/borgbackup-ssh:archlinux - platforms: linux/amd64 # Ersetze dies durch die gewünschten Plattformen From 59d1929692a713409a0ff7f9f759c689f4a8d555 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Sun, 1 Dec 2024 21:12:17 +0100 Subject: [PATCH 10/28] create cache folder for root account --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index ab21269..0eb96e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,9 @@ COPY bash-config/.bashrc / COPY prometheus-borg-exporter/borg_exporter.sh /usr/local/bin/ COPY prometheus-borg-exporter/borg_exporter.rc /etc/ +# Create .cache folder +RUN mkdir -p "/root/.cache/crontab" + # Install packages RUN pacman-key --init RUN pacman -Syu --noconfirm sudo bash-completion openssh neofetch \ From 12d0a362b4a0a744aa7899ff1bc243f8c3543247 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Sun, 1 Dec 2024 21:44:40 +0100 Subject: [PATCH 11/28] add tmux shell terminal multiplexer --- Dockerfile | 2 +- bash-config/.bashrc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0eb96e4..984596e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,7 +34,7 @@ RUN mkdir -p "/root/.cache/crontab" # Install packages RUN pacman-key --init RUN pacman -Syu --noconfirm sudo bash-completion openssh neofetch \ - borgbackup dateutils prometheus-node-exporter wget git base-devel cron net-tools inetutils + borgbackup dateutils prometheus-node-exporter wget git base-devel cron net-tools inetutils tmux # Make Build User RUN useradd builduser -m diff --git a/bash-config/.bashrc b/bash-config/.bashrc index 919a21b..1e43b08 100644 --- a/bash-config/.bashrc +++ b/bash-config/.bashrc @@ -1,3 +1,5 @@ +[ ! -z "$USE_TMUX_SHELL" ] && [[ -t 0 ]] && [ -z "$TMUX" ] && (exec tmux attach || exec tmux new-session && exit) + alias update='sudo pacman -Syu --noconfirm' export HISTTIMEFORMAT="%d/%m/%y %T " From 8ec5a38ccc5372562c87b79f1ccf70c77f37b33a Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Tue, 3 Dec 2024 19:39:53 +0100 Subject: [PATCH 12/28] create missing locale files --- Dockerfile | 4 + bash-config/locale.gen | 516 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 520 insertions(+) create mode 100644 bash-config/locale.gen diff --git a/Dockerfile b/Dockerfile index 984596e..63f7d3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,7 @@ COPY bash-config/.bashrc_root /root/ COPY bash-config/.bash_profile / COPY bash-config/.bashrc / +COPY bash-config/locale.gen /etc/locale.gen COPY prometheus-borg-exporter/borg_exporter.sh /usr/local/bin/ COPY prometheus-borg-exporter/borg_exporter.rc /etc/ @@ -31,6 +32,9 @@ COPY prometheus-borg-exporter/borg_exporter.rc /etc/ # Create .cache folder RUN mkdir -p "/root/.cache/crontab" +# Create locale files +RUN locale-gen + # Install packages RUN pacman-key --init RUN pacman -Syu --noconfirm sudo bash-completion openssh neofetch \ diff --git a/bash-config/locale.gen b/bash-config/locale.gen new file mode 100644 index 0000000..84356b0 --- /dev/null +++ b/bash-config/locale.gen @@ -0,0 +1,516 @@ +# Configuration file for locale-gen +# +# lists of locales that are to be generated by the locale-gen command. +# +# Each line is of the form: +# +# +# +# where is one of the locales given in /usr/share/i18n/locales +# and is one of the character sets listed in /usr/share/i18n/charmaps +# +# The locale-gen command will generate all the locales, +# placing them in /usr/lib/locale. +# +# A list of supported locales is given in /usr/share/i18n/SUPPORTED +# and is included in this file. Uncomment the needed locales below. +# +#aa_DJ.UTF-8 UTF-8 +#aa_DJ ISO-8859-1 +#aa_ER UTF-8 +#aa_ET UTF-8 +#af_ZA.UTF-8 UTF-8 +#af_ZA ISO-8859-1 +#agr_PE UTF-8 +#ak_GH UTF-8 +#am_ET UTF-8 +#an_ES.UTF-8 UTF-8 +#an_ES ISO-8859-15 +#anp_IN UTF-8 +#ar_AE.UTF-8 UTF-8 +#ar_AE ISO-8859-6 +#ar_BH.UTF-8 UTF-8 +#ar_BH ISO-8859-6 +#ar_DZ.UTF-8 UTF-8 +#ar_DZ ISO-8859-6 +#ar_EG.UTF-8 UTF-8 +#ar_EG ISO-8859-6 +#ar_IN UTF-8 +#ar_IQ.UTF-8 UTF-8 +#ar_IQ ISO-8859-6 +#ar_JO.UTF-8 UTF-8 +#ar_JO ISO-8859-6 +#ar_KW.UTF-8 UTF-8 +#ar_KW ISO-8859-6 +#ar_LB.UTF-8 UTF-8 +#ar_LB ISO-8859-6 +#ar_LY.UTF-8 UTF-8 +#ar_LY ISO-8859-6 +#ar_MA.UTF-8 UTF-8 +#ar_MA ISO-8859-6 +#ar_OM.UTF-8 UTF-8 +#ar_OM ISO-8859-6 +#ar_QA.UTF-8 UTF-8 +#ar_QA ISO-8859-6 +#ar_SA.UTF-8 UTF-8 +#ar_SA ISO-8859-6 +#ar_SD.UTF-8 UTF-8 +#ar_SD ISO-8859-6 +#ar_SS UTF-8 +#ar_SY.UTF-8 UTF-8 +#ar_SY ISO-8859-6 +#ar_TN.UTF-8 UTF-8 +#ar_TN ISO-8859-6 +#ar_YE.UTF-8 UTF-8 +#ar_YE ISO-8859-6 +#ayc_PE UTF-8 +#az_AZ UTF-8 +#az_IR UTF-8 +#as_IN UTF-8 +#ast_ES.UTF-8 UTF-8 +#ast_ES ISO-8859-15 +#be_BY.UTF-8 UTF-8 +#be_BY CP1251 +#be_BY@latin UTF-8 +#bem_ZM UTF-8 +#ber_DZ UTF-8 +#ber_MA UTF-8 +#bg_BG.UTF-8 UTF-8 +#bg_BG CP1251 +#bhb_IN.UTF-8 UTF-8 +#bho_IN UTF-8 +#bho_NP UTF-8 +#bi_VU UTF-8 +#bn_BD UTF-8 +#bn_IN UTF-8 +#bo_CN UTF-8 +#bo_IN UTF-8 +#br_FR.UTF-8 UTF-8 +#br_FR ISO-8859-1 +#br_FR@euro ISO-8859-15 +#brx_IN UTF-8 +#bs_BA.UTF-8 UTF-8 +#bs_BA ISO-8859-2 +#byn_ER UTF-8 +#ca_AD.UTF-8 UTF-8 +#ca_AD ISO-8859-15 +#ca_ES.UTF-8 UTF-8 +#ca_ES ISO-8859-1 +#ca_ES@euro ISO-8859-15 +#ca_ES@valencia UTF-8 +#ca_FR.UTF-8 UTF-8 +#ca_FR ISO-8859-15 +#ca_IT.UTF-8 UTF-8 +#ca_IT ISO-8859-15 +#ce_RU UTF-8 +#chr_US UTF-8 +#ckb_IQ UTF-8 +#cmn_TW UTF-8 +#crh_RU UTF-8 +#crh_UA UTF-8 +#cs_CZ.UTF-8 UTF-8 +#cs_CZ ISO-8859-2 +#csb_PL UTF-8 +#cv_RU UTF-8 +#cy_GB.UTF-8 UTF-8 +#cy_GB ISO-8859-14 +#da_DK.UTF-8 UTF-8 +#da_DK ISO-8859-1 +#de_AT.UTF-8 UTF-8 +#de_AT ISO-8859-1 +#de_AT@euro ISO-8859-15 +#de_BE.UTF-8 UTF-8 +#de_BE ISO-8859-1 +#de_BE@euro ISO-8859-15 +#de_CH.UTF-8 UTF-8 +#de_CH ISO-8859-1 +#de_DE.UTF-8 UTF-8 +#de_DE ISO-8859-1 +#de_DE@euro ISO-8859-15 +#de_IT.UTF-8 UTF-8 +#de_IT ISO-8859-1 +#de_LI.UTF-8 UTF-8 +#de_LU.UTF-8 UTF-8 +#de_LU ISO-8859-1 +#de_LU@euro ISO-8859-15 +#doi_IN UTF-8 +#dsb_DE UTF-8 +#dv_MV UTF-8 +#dz_BT UTF-8 +#el_GR.UTF-8 UTF-8 +#el_GR ISO-8859-7 +#el_GR@euro ISO-8859-7 +#el_CY.UTF-8 UTF-8 +#el_CY ISO-8859-7 +#en_AG UTF-8 +#en_AU.UTF-8 UTF-8 +#en_AU ISO-8859-1 +#en_BW.UTF-8 UTF-8 +#en_BW ISO-8859-1 +#en_CA.UTF-8 UTF-8 +#en_CA ISO-8859-1 +#en_DK.UTF-8 UTF-8 +#en_DK ISO-8859-1 +#en_GB.UTF-8 UTF-8 +#en_GB ISO-8859-1 +#en_HK.UTF-8 UTF-8 +#en_HK ISO-8859-1 +#en_IE.UTF-8 UTF-8 +#en_IE ISO-8859-1 +#en_IE@euro ISO-8859-15 +#en_IL UTF-8 +#en_IN UTF-8 +#en_NG UTF-8 +#en_NZ.UTF-8 UTF-8 +#en_NZ ISO-8859-1 +#en_PH.UTF-8 UTF-8 +#en_PH ISO-8859-1 +#en_SC.UTF-8 UTF-8 +#en_SG.UTF-8 UTF-8 +#en_SG ISO-8859-1 +en_US.UTF-8 UTF-8 +#en_US ISO-8859-1 +#en_ZA.UTF-8 UTF-8 +#en_ZA ISO-8859-1 +#en_ZM UTF-8 +#en_ZW.UTF-8 UTF-8 +#en_ZW ISO-8859-1 +#eo UTF-8 +#es_AR.UTF-8 UTF-8 +#es_AR ISO-8859-1 +#es_BO.UTF-8 UTF-8 +#es_BO ISO-8859-1 +#es_CL.UTF-8 UTF-8 +#es_CL ISO-8859-1 +#es_CO.UTF-8 UTF-8 +#es_CO ISO-8859-1 +#es_CR.UTF-8 UTF-8 +#es_CR ISO-8859-1 +#es_CU UTF-8 +#es_DO.UTF-8 UTF-8 +#es_DO ISO-8859-1 +#es_EC.UTF-8 UTF-8 +#es_EC ISO-8859-1 +#es_ES.UTF-8 UTF-8 +#es_ES ISO-8859-1 +#es_ES@euro ISO-8859-15 +#es_GT.UTF-8 UTF-8 +#es_GT ISO-8859-1 +#es_HN.UTF-8 UTF-8 +#es_HN ISO-8859-1 +#es_MX.UTF-8 UTF-8 +#es_MX ISO-8859-1 +#es_NI.UTF-8 UTF-8 +#es_NI ISO-8859-1 +#es_PA.UTF-8 UTF-8 +#es_PA ISO-8859-1 +#es_PE.UTF-8 UTF-8 +#es_PE ISO-8859-1 +#es_PR.UTF-8 UTF-8 +#es_PR ISO-8859-1 +#es_PY.UTF-8 UTF-8 +#es_PY ISO-8859-1 +#es_SV.UTF-8 UTF-8 +#es_SV ISO-8859-1 +#es_US.UTF-8 UTF-8 +#es_US ISO-8859-1 +#es_UY.UTF-8 UTF-8 +#es_UY ISO-8859-1 +#es_VE.UTF-8 UTF-8 +#es_VE ISO-8859-1 +#et_EE.UTF-8 UTF-8 +#et_EE ISO-8859-1 +#et_EE.ISO-8859-15 ISO-8859-15 +#eu_ES.UTF-8 UTF-8 +#eu_ES ISO-8859-1 +#eu_ES@euro ISO-8859-15 +#fa_IR UTF-8 +#ff_SN UTF-8 +#fi_FI.UTF-8 UTF-8 +#fi_FI ISO-8859-1 +#fi_FI@euro ISO-8859-15 +#fil_PH UTF-8 +#fo_FO.UTF-8 UTF-8 +#fo_FO ISO-8859-1 +#fr_BE.UTF-8 UTF-8 +#fr_BE ISO-8859-1 +#fr_BE@euro ISO-8859-15 +#fr_CA.UTF-8 UTF-8 +#fr_CA ISO-8859-1 +#fr_CH.UTF-8 UTF-8 +#fr_CH ISO-8859-1 +#fr_FR.UTF-8 UTF-8 +#fr_FR ISO-8859-1 +#fr_FR@euro ISO-8859-15 +#fr_LU.UTF-8 UTF-8 +#fr_LU ISO-8859-1 +#fr_LU@euro ISO-8859-15 +#fur_IT UTF-8 +#fy_NL UTF-8 +#fy_DE UTF-8 +#ga_IE.UTF-8 UTF-8 +#ga_IE ISO-8859-1 +#ga_IE@euro ISO-8859-15 +#gbm_IN UTF-8 +#gd_GB.UTF-8 UTF-8 +#gd_GB ISO-8859-15 +#gez_ER UTF-8 +#gez_ER@abegede UTF-8 +#gez_ET UTF-8 +#gez_ET@abegede UTF-8 +#gl_ES.UTF-8 UTF-8 +#gl_ES ISO-8859-1 +#gl_ES@euro ISO-8859-15 +#gu_IN UTF-8 +#gv_GB.UTF-8 UTF-8 +#gv_GB ISO-8859-1 +#ha_NG UTF-8 +#hak_TW UTF-8 +#he_IL.UTF-8 UTF-8 +#he_IL ISO-8859-8 +#hi_IN UTF-8 +#hif_FJ UTF-8 +#hne_IN UTF-8 +#hr_HR.UTF-8 UTF-8 +#hr_HR ISO-8859-2 +#hsb_DE ISO-8859-2 +#hsb_DE.UTF-8 UTF-8 +#ht_HT UTF-8 +#hu_HU.UTF-8 UTF-8 +#hu_HU ISO-8859-2 +#hy_AM UTF-8 +#hy_AM.ARMSCII-8 ARMSCII-8 +#ia_FR UTF-8 +#id_ID.UTF-8 UTF-8 +#id_ID ISO-8859-1 +#ig_NG UTF-8 +#ik_CA UTF-8 +#is_IS.UTF-8 UTF-8 +#is_IS ISO-8859-1 +#it_CH.UTF-8 UTF-8 +#it_CH ISO-8859-1 +#it_IT.UTF-8 UTF-8 +#it_IT ISO-8859-1 +#it_IT@euro ISO-8859-15 +#iu_CA UTF-8 +#ja_JP.EUC-JP EUC-JP +#ja_JP.UTF-8 UTF-8 +#ka_GE.UTF-8 UTF-8 +#ka_GE GEORGIAN-PS +#kab_DZ UTF-8 +#kk_KZ.UTF-8 UTF-8 +#kk_KZ PT154 +#kl_GL.UTF-8 UTF-8 +#kl_GL ISO-8859-1 +#km_KH UTF-8 +#kn_IN UTF-8 +#ko_KR.EUC-KR EUC-KR +#ko_KR.UTF-8 UTF-8 +#kok_IN UTF-8 +#ks_IN UTF-8 +#ks_IN@devanagari UTF-8 +#ku_TR.UTF-8 UTF-8 +#ku_TR ISO-8859-9 +#kv_RU UTF-8 +#kw_GB.UTF-8 UTF-8 +#kw_GB ISO-8859-1 +#ky_KG UTF-8 +#lb_LU UTF-8 +#lg_UG.UTF-8 UTF-8 +#lg_UG ISO-8859-10 +#li_BE UTF-8 +#li_NL UTF-8 +#lij_IT UTF-8 +#ln_CD UTF-8 +#lo_LA UTF-8 +#lt_LT.UTF-8 UTF-8 +#lt_LT ISO-8859-13 +#ltg_LV.UTF-8 UTF-8 +#lv_LV.UTF-8 UTF-8 +#lv_LV ISO-8859-13 +#lzh_TW UTF-8 +#mag_IN UTF-8 +#mai_IN UTF-8 +#mai_NP UTF-8 +#mdf_RU UTF-8 +#mfe_MU UTF-8 +#mg_MG.UTF-8 UTF-8 +#mg_MG ISO-8859-15 +#mhr_RU UTF-8 +#mi_NZ.UTF-8 UTF-8 +#mi_NZ ISO-8859-13 +#miq_NI UTF-8 +#mjw_IN UTF-8 +#mk_MK.UTF-8 UTF-8 +#mk_MK ISO-8859-5 +#ml_IN UTF-8 +#mn_MN UTF-8 +#mni_IN UTF-8 +#mnw_MM UTF-8 +#mr_IN UTF-8 +#ms_MY.UTF-8 UTF-8 +#ms_MY ISO-8859-1 +#mt_MT.UTF-8 UTF-8 +#mt_MT ISO-8859-3 +#my_MM UTF-8 +#nan_TW UTF-8 +#nan_TW@latin UTF-8 +#nb_NO.UTF-8 UTF-8 +#nb_NO ISO-8859-1 +#nds_DE UTF-8 +#nds_NL UTF-8 +#ne_NP UTF-8 +#nhn_MX UTF-8 +#niu_NU UTF-8 +#niu_NZ UTF-8 +#nl_AW UTF-8 +#nl_BE.UTF-8 UTF-8 +#nl_BE ISO-8859-1 +#nl_BE@euro ISO-8859-15 +#nl_NL.UTF-8 UTF-8 +#nl_NL ISO-8859-1 +#nl_NL@euro ISO-8859-15 +#nn_NO.UTF-8 UTF-8 +#nn_NO ISO-8859-1 +#nr_ZA UTF-8 +#nso_ZA UTF-8 +#oc_FR.UTF-8 UTF-8 +#oc_FR ISO-8859-1 +#om_ET UTF-8 +#om_KE.UTF-8 UTF-8 +#om_KE ISO-8859-1 +#or_IN UTF-8 +#os_RU UTF-8 +#pa_IN UTF-8 +#pa_PK UTF-8 +#pap_AW UTF-8 +#pap_CW UTF-8 +#pl_PL.UTF-8 UTF-8 +#pl_PL ISO-8859-2 +#ps_AF UTF-8 +#pt_BR.UTF-8 UTF-8 +#pt_BR ISO-8859-1 +#pt_PT.UTF-8 UTF-8 +#pt_PT ISO-8859-1 +#pt_PT@euro ISO-8859-15 +#quz_PE UTF-8 +#raj_IN UTF-8 +#rif_MA UTF-8 +#ro_RO.UTF-8 UTF-8 +#ro_RO ISO-8859-2 +#ru_RU.KOI8-R KOI8-R +#ru_RU.UTF-8 UTF-8 +#ru_RU ISO-8859-5 +#ru_UA.UTF-8 UTF-8 +#ru_UA KOI8-U +#rw_RW UTF-8 +#sa_IN UTF-8 +#sah_RU UTF-8 +#sat_IN UTF-8 +#sc_IT UTF-8 +#scn_IT UTF-8 +#sd_IN UTF-8 +#sd_IN@devanagari UTF-8 +#se_NO UTF-8 +#sgs_LT UTF-8 +#shn_MM UTF-8 +#shs_CA UTF-8 +#si_LK UTF-8 +#sid_ET UTF-8 +#sk_SK.UTF-8 UTF-8 +#sk_SK ISO-8859-2 +#sl_SI.UTF-8 UTF-8 +#sl_SI ISO-8859-2 +#sm_WS UTF-8 +#so_DJ.UTF-8 UTF-8 +#so_DJ ISO-8859-1 +#so_ET UTF-8 +#so_KE.UTF-8 UTF-8 +#so_KE ISO-8859-1 +#so_SO.UTF-8 UTF-8 +#so_SO ISO-8859-1 +#sq_AL.UTF-8 UTF-8 +#sq_AL ISO-8859-1 +#sq_MK UTF-8 +#sr_ME UTF-8 +#sr_RS UTF-8 +#sr_RS@latin UTF-8 +#ss_ZA UTF-8 +#ssy_ER UTF-8 +#st_ZA.UTF-8 UTF-8 +#st_ZA ISO-8859-1 +#su_ID UTF-8 +#sv_FI.UTF-8 UTF-8 +#sv_FI ISO-8859-1 +#sv_FI@euro ISO-8859-15 +#sv_SE.UTF-8 UTF-8 +#sv_SE ISO-8859-1 +#sw_KE UTF-8 +#sw_TZ UTF-8 +#syr UTF-8 +#szl_PL UTF-8 +#ta_IN UTF-8 +#ta_LK UTF-8 +#tcy_IN.UTF-8 UTF-8 +#te_IN UTF-8 +#tg_TJ.UTF-8 UTF-8 +#tg_TJ KOI8-T +#th_TH.UTF-8 UTF-8 +#th_TH TIS-620 +#the_NP UTF-8 +#ti_ER UTF-8 +#ti_ET UTF-8 +#tig_ER UTF-8 +#tk_TM UTF-8 +#tl_PH.UTF-8 UTF-8 +#tl_PH ISO-8859-1 +#tn_ZA UTF-8 +#to_TO UTF-8 +#tok UTF-8 +#tpi_PG UTF-8 +#tr_CY.UTF-8 UTF-8 +#tr_CY ISO-8859-9 +#tr_TR.UTF-8 UTF-8 +#tr_TR ISO-8859-9 +#ts_ZA UTF-8 +#tt_RU UTF-8 +#tt_RU@iqtelif UTF-8 +#ug_CN UTF-8 +#uk_UA.UTF-8 UTF-8 +#uk_UA KOI8-U +#unm_US UTF-8 +#ur_IN UTF-8 +#ur_PK UTF-8 +#uz_UZ.UTF-8 UTF-8 +#uz_UZ ISO-8859-1 +#uz_UZ@cyrillic UTF-8 +#ve_ZA UTF-8 +#vi_VN UTF-8 +#wa_BE ISO-8859-1 +#wa_BE@euro ISO-8859-15 +#wa_BE.UTF-8 UTF-8 +#wae_CH UTF-8 +#wal_ET UTF-8 +#wo_SN UTF-8 +#xh_ZA.UTF-8 UTF-8 +#xh_ZA ISO-8859-1 +#yi_US.UTF-8 UTF-8 +#yi_US CP1255 +#yo_NG UTF-8 +#yue_HK UTF-8 +#yuw_PG UTF-8 +#zgh_MA UTF-8 +#zh_CN.GB18030 GB18030 +#zh_CN.GBK GBK +#zh_CN.UTF-8 UTF-8 +#zh_CN GB2312 +#zh_HK.UTF-8 UTF-8 +#zh_HK BIG5-HKSCS +#zh_SG.UTF-8 UTF-8 +#zh_SG.GBK GBK +#zh_SG GB2312 +#zh_TW.EUC-TW EUC-TW +#zh_TW.UTF-8 UTF-8 +#zh_TW BIG5 +#zu_ZA.UTF-8 UTF-8 +#zu_ZA ISO-8859-1 \ No newline at end of file From 07680cd3ce5cc097cc91a704cae876871c3752fd Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Tue, 3 Dec 2024 20:20:40 +0100 Subject: [PATCH 13/28] store teleport-bin repo temporary on my git server because Community LICENSE file has been moved (referenced in PKGBUILD) and is not yet updatet by https://aur.archlinux.org/packages/teleport-bin fix to build container --- .gitmodules | 3 +++ Dockerfile | 3 ++- package/teleport-bin | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .gitmodules create mode 160000 package/teleport-bin diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..cd43278 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "package/teleport-bin"] + path = package/teleport-bin + url = git@git.yiprawr.dev:daniel156161/teleport-bin.git diff --git a/Dockerfile b/Dockerfile index 63f7d3a..69cacfa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,8 @@ RUN pacman -Syu --noconfirm sudo bash-completion openssh neofetch \ RUN useradd builduser -m RUN passwd -d builduser RUN printf 'builduser ALL=(ALL) ALL\n' | tee -a /etc/sudoers -RUN sudo -u builduser bash -c 'cd ~ && git clone https://aur.archlinux.org/teleport-bin.git teleport && cd teleport && makepkg -si --noconfirm && cd ~ && rm -rf teleport' +#RUN sudo -u builduser bash -c 'cd ~ && git clone https://aur.archlinux.org/teleport-bin.git teleport && cd teleport && makepkg -si --noconfirm && cd ~ && rm -rf teleport' +RUN sudo -u builduser bash -c 'cd ~ && git clone https://git.yiprawr.dev/daniel156161/teleport-bin.git teleport && cd teleport && makepkg -si --noconfirm && cd ~ && rm -rf teleport' RUN userdel -r builduser # Setup SSH-Server diff --git a/package/teleport-bin b/package/teleport-bin new file mode 160000 index 0000000..be365bd --- /dev/null +++ b/package/teleport-bin @@ -0,0 +1 @@ +Subproject commit be365bd6ac563a0870538e4af4d2d318bcc72100 From e96bcbfbaf60328c0bed67ae43f64a1c52f4e561 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 6 Dec 2024 10:45:50 +0100 Subject: [PATCH 14/28] update teleport-bin submodule --- package/teleport-bin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/teleport-bin b/package/teleport-bin index be365bd..a840ba5 160000 --- a/package/teleport-bin +++ b/package/teleport-bin @@ -1 +1 @@ -Subproject commit be365bd6ac563a0870538e4af4d2d318bcc72100 +Subproject commit a840ba5f13b25ae03c2c912c9db2c8a5617b630f From 79a074aef9830ba170e91d8d9d357cccb1f19de3 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 6 Dec 2024 10:51:47 +0100 Subject: [PATCH 15/28] remove test script and not neaded files --- .gitignore | 1 + Testing/crontab.txt | 1 - Testing/test_script.sh | 3 --- build.sh | 2 -- 4 files changed, 1 insertion(+), 6 deletions(-) delete mode 100644 Testing/crontab.txt delete mode 100755 Testing/test_script.sh diff --git a/.gitignore b/.gitignore index b0549b5..e5ee08c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ sshkeys/ backups/ .dccache +Testing/ diff --git a/Testing/crontab.txt b/Testing/crontab.txt deleted file mode 100644 index f3320f8..0000000 --- a/Testing/crontab.txt +++ /dev/null @@ -1 +0,0 @@ -* * * * * /test_script.sh diff --git a/Testing/test_script.sh b/Testing/test_script.sh deleted file mode 100755 index cc37238..0000000 --- a/Testing/test_script.sh +++ /dev/null @@ -1,3 +0,0 @@ -# !/bin/bash - -echo "$(date +%Y-%m-%d_%H:%M:%S) Test" >> /logs/test.log diff --git a/build.sh b/build.sh index d08a257..8ed6f98 100755 --- a/build.sh +++ b/build.sh @@ -16,8 +16,6 @@ function run_docker_container { -e INTERACTIVE_MODE="true" \ -e TZ="Europe/Vienna" \ -e RUN_PROMETHEUS_EXPORTER="0 * * * *" \ - -v "$PWD"/Testing/crontab.txt:/crontab.txt \ - -v "$PWD"/Testing/test_script.sh:/test_script.sh \ -v "$PWD"/sshkeys/clients:/sshkeys/clients \ -v "$PWD"/backups:/backups \ "$DOCKER_IMAGE_NAME:$GIT_BRANCH" From 5f39aa09facd932e5d70b6c974f85da317dec3f9 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 6 Dec 2024 10:52:21 +0100 Subject: [PATCH 16/28] remove not neaded new line --- bash-config/.bash_profile | 1 - 1 file changed, 1 deletion(-) diff --git a/bash-config/.bash_profile b/bash-config/.bash_profile index 0551e69..05f7894 100644 --- a/bash-config/.bash_profile +++ b/bash-config/.bash_profile @@ -6,7 +6,6 @@ if [ -f ~/.bashrc ]; then fi # User specific environment and startup programs - PATH=$PATH:$HOME/bin export PATH From 1523b333e64effdf26279e75035062115947cf0f Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 6 Dec 2024 12:14:02 +0100 Subject: [PATCH 17/28] fix bachrc to load tmux correctly --- bash-config/.bashrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bash-config/.bashrc b/bash-config/.bashrc index 1e43b08..355ab3f 100644 --- a/bash-config/.bashrc +++ b/bash-config/.bashrc @@ -1,4 +1,7 @@ -[ ! -z "$USE_TMUX_SHELL" ] && [[ -t 0 ]] && [ -z "$TMUX" ] && (exec tmux attach || exec tmux new-session && exit) +if [ ! -z "$USE_TMUX_SHELL" ] && [[ -t 0 ]] && [ -z "$TMUX" ]; then + tmux attach || tmux new-session + exit +fi alias update='sudo pacman -Syu --noconfirm' From 92483d0a4b4d3fa072bb2c885b9ad6237fe6afda Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 6 Dec 2024 12:19:36 +0100 Subject: [PATCH 18/28] use function to set all environment variables at once --- entrypoint-script/entrypoint.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/entrypoint-script/entrypoint.sh b/entrypoint-script/entrypoint.sh index 2d4b693..8f0b1dd 100755 --- a/entrypoint-script/entrypoint.sh +++ b/entrypoint-script/entrypoint.sh @@ -3,6 +3,19 @@ source "/variables.sh" ##################################################################################################### # Funktionen ##################################################################################################### +function set_environment_variables_if_not_empty { + # Set Tmux Shell for .bashrc to load tmux and attach session if exists else create new session + if [ "$USE_TMUX_SHELL" != "" ]; then + echo "USE_TMUX_SHELL=$USE_TMUX_SHELL" >> /etc/environment + fi + + # Set Server Timezone + if [ "$TZ" != "" ]; then + echo "TZ=$TZ" >> /etc/environment + ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime + fi +} + function print_container_info { sepurator echo "* BorgServer powered by $BORG_VERSION" @@ -112,11 +125,9 @@ function maintenance_enable { fi } -function set_timezone { +function show_timezone_output { if [ "$TZ" != "" ]; then echo "* Setting Timezone to $TZ" - echo "TZ=$TZ" > /etc/environment - ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime else echo "* Timezone not set - Use UTC Time" fi @@ -178,6 +189,7 @@ function run_prometheus_exporter() { ##################################################################################################### # Main Code ##################################################################################################### +set_environment_variables_if_not_empty add_borg_user print_container_info @@ -189,7 +201,7 @@ generate_host_sshkey sepurator maintenance_enable -set_timezone +show_timezone_output run_teleport_server run_prometheus_exporter run_install_script From 8955d4b2da61e97a290ef1d93022a0e96279a80e Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 6 Dec 2024 12:20:03 +0100 Subject: [PATCH 19/28] update build run code --- build.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 8ed6f98..0d033cd 100755 --- a/build.sh +++ b/build.sh @@ -7,16 +7,17 @@ DOCKER_CONTAINER_NAME="borgbackup" function run_docker_container { echo "Running..." - docker run -dp 3000:22 \ - -p 9100:9100 \ + docker run -d \ -p 2222:22 \ + -p 9100:9100 \ -e UID=$(id -u) \ -e GID=$(id -g) \ -e MAINTENANCE_ENABLE="true" \ -e INTERACTIVE_MODE="true" \ -e TZ="Europe/Vienna" \ - -e RUN_PROMETHEUS_EXPORTER="0 * * * *" \ + -e RUN_PROMETHEUS_EXPORTER="15 * * * *" \ -v "$PWD"/sshkeys/clients:/sshkeys/clients \ + -v "$PWD"/sshkeys/host:/sshkeys/host \ -v "$PWD"/backups:/backups \ "$DOCKER_IMAGE_NAME:$GIT_BRANCH" } From e550beafd5d8a111903dc20f32f5ee86839ff3a9 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 6 Dec 2024 13:38:17 +0100 Subject: [PATCH 20/28] fix loading of sshd or teleport and get teleport output into console --- entrypoint-script/entrypoint.sh | 20 ++++++++++---------- entrypoint-script/variables.sh | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/entrypoint-script/entrypoint.sh b/entrypoint-script/entrypoint.sh index 8f0b1dd..de13436 100755 --- a/entrypoint-script/entrypoint.sh +++ b/entrypoint-script/entrypoint.sh @@ -154,14 +154,6 @@ function create_folder_and_change_permissions { chown -R "$USER":"$USER" "$1" } -function run_teleport_server() { - if [ -f "/etc/teleport.yaml" ]; then - echo "* STARTING Teleport Server" - teleport start -c /etc/teleport.yaml > /var/log/teleport.log 2>&1 & - sepurator - fi -} - function run_prometheus_exporter() { if [ "$RUN_PROMETHEUS_EXPORTER" != "false" ]; then create_folder_and_change_permissions "/var/log/" @@ -186,6 +178,15 @@ function run_prometheus_exporter() { sepurator fi } + +function run_correct_ssh_service() { + if [ -f "/etc/teleport.yaml" ]; then + echo "* STARTING Teleport Server" + exec teleport start -c /etc/teleport.yaml 2>&1 + else + exec /usr/sbin/sshd -D -e "$@" 2>&1 + fi; +} ##################################################################################################### # Main Code ##################################################################################################### @@ -202,11 +203,10 @@ sepurator maintenance_enable show_timezone_output -run_teleport_server run_prometheus_exporter run_install_script echo "* Init done! - Starting SSH-Daemon..." sepurator -exec /usr/sbin/sshd -D -e "$@" #2> /var/log/sshd.log +run_correct_ssh_service diff --git a/entrypoint-script/variables.sh b/entrypoint-script/variables.sh index a7e1466..8d064cf 100644 --- a/entrypoint-script/variables.sh +++ b/entrypoint-script/variables.sh @@ -1,4 +1,4 @@ -DOCKER_IMAGE_VERSION="2.0.0" +DOCKER_IMAGE_VERSION="3.0.0" BORG_VERSION=$(borg -V) SSH_FOLDERS=( "/sshkeys/clients" "/sshkeys/host" ) NODE_EXPORTER_DIR="/var/log" From 27291ad2ac6de1acdfeb26c21ef879388be485dd Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 6 Dec 2024 13:39:05 +0100 Subject: [PATCH 21/28] remove test container when stoping and cleanup "$PWD" paths --- build.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index 0d033cd..4242ce0 100755 --- a/build.sh +++ b/build.sh @@ -7,18 +7,17 @@ DOCKER_CONTAINER_NAME="borgbackup" function run_docker_container { echo "Running..." - docker run -d \ + docker run --rm -d \ -p 2222:22 \ -p 9100:9100 \ -e UID=$(id -u) \ -e GID=$(id -g) \ - -e MAINTENANCE_ENABLE="true" \ -e INTERACTIVE_MODE="true" \ -e TZ="Europe/Vienna" \ -e RUN_PROMETHEUS_EXPORTER="15 * * * *" \ - -v "$PWD"/sshkeys/clients:/sshkeys/clients \ - -v "$PWD"/sshkeys/host:/sshkeys/host \ - -v "$PWD"/backups:/backups \ + -v "$PWD/sshkeys/clients:/sshkeys/clients:ro" \ + -v "$PWD/sshkeys/host:/sshkeys/host" \ + -v "$PWD/backups:/backups" \ "$DOCKER_IMAGE_NAME:$GIT_BRANCH" } From 1cf418a1a78a0f301cab6e3b17873f7e9e37efb3 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 6 Dec 2024 14:25:16 +0100 Subject: [PATCH 22/28] allow to auto open tmux in Teleport Shell --- bash-config/.bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash-config/.bashrc b/bash-config/.bashrc index 355ab3f..5fd1244 100644 --- a/bash-config/.bashrc +++ b/bash-config/.bashrc @@ -1,4 +1,4 @@ -if [ ! -z "$USE_TMUX_SHELL" ] && [[ -t 0 ]] && [ -z "$TMUX" ]; then +if [ ! -z $(cat /etc/environment | grep "USE_TMUX_SHELL") ] && [[ -t 0 ]] && [ -z "$TMUX" ]; then tmux attach || tmux new-session exit fi From c6e4767c378b5adb4223d91449f00a6fe78cb30d Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Sun, 22 Dec 2024 13:34:18 +0100 Subject: [PATCH 23/28] change teleport package back to aur --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 69cacfa..bdd171b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,8 +44,8 @@ RUN pacman -Syu --noconfirm sudo bash-completion openssh neofetch \ RUN useradd builduser -m RUN passwd -d builduser RUN printf 'builduser ALL=(ALL) ALL\n' | tee -a /etc/sudoers -#RUN sudo -u builduser bash -c 'cd ~ && git clone https://aur.archlinux.org/teleport-bin.git teleport && cd teleport && makepkg -si --noconfirm && cd ~ && rm -rf teleport' -RUN sudo -u builduser bash -c 'cd ~ && git clone https://git.yiprawr.dev/daniel156161/teleport-bin.git teleport && cd teleport && makepkg -si --noconfirm && cd ~ && rm -rf teleport' +RUN sudo -u builduser bash -c 'cd ~ && git clone https://aur.archlinux.org/teleport-bin.git teleport && cd teleport && makepkg -si --noconfirm && cd ~ && rm -rf teleport' +#RUN sudo -u builduser bash -c 'cd ~ && git clone https://git.yiprawr.dev/daniel156161/teleport-bin.git teleport && cd teleport && makepkg -si --noconfirm && cd ~ && rm -rf teleport' RUN userdel -r builduser # Setup SSH-Server From 147338f56f9b759956f10654a741b3d57f74576e Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Sun, 22 Dec 2024 13:35:58 +0100 Subject: [PATCH 24/28] try to not show crontab backup output --- entrypoint-script/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint-script/entrypoint.sh b/entrypoint-script/entrypoint.sh index de13436..118ae4e 100755 --- a/entrypoint-script/entrypoint.sh +++ b/entrypoint-script/entrypoint.sh @@ -165,7 +165,7 @@ function run_prometheus_exporter() { echo "- Add Cronjob to Crontab" echo "$RUN_PROMETHEUS_EXPORTER su -c '/usr/local/bin/borg_exporter.sh 2>&1' -s /bin/bash borg" >> /tmp/cron_bkp - crontab /tmp/cron_bkp + crontab /tmp/cron_bkp > /dev/null 2>&1 rm /tmp/cron_bkp if [ ! -f "/var/log/borg_exporter.prom" ]; then From 8d16cbefc5dde1681a3aca3fa80d37c35bfb1b6a Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Mon, 2 Jun 2025 13:29:26 +0200 Subject: [PATCH 25/28] change package neofetch to fastfetch --- Dockerfile | 2 +- bash-config/.bashrc | 2 +- bash-config/.bashrc_root | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index bdd171b..cca72c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN locale-gen # Install packages RUN pacman-key --init -RUN pacman -Syu --noconfirm sudo bash-completion openssh neofetch \ +RUN pacman -Syu --noconfirm sudo bash-completion openssh fastfetch \ borgbackup dateutils prometheus-node-exporter wget git base-devel cron net-tools inetutils tmux # Make Build User diff --git a/bash-config/.bashrc b/bash-config/.bashrc index 5fd1244..e3a56e5 100644 --- a/bash-config/.bashrc +++ b/bash-config/.bashrc @@ -29,4 +29,4 @@ function print_container_info { # Run Code ############################################################################################################################## print_container_info -neofetch +fastfetch --config neofetch diff --git a/bash-config/.bashrc_root b/bash-config/.bashrc_root index b354153..1a05e94 100644 --- a/bash-config/.bashrc_root +++ b/bash-config/.bashrc_root @@ -97,4 +97,4 @@ if [ "$INTERACTIVE_MODE" != "false" ]; then fi print_container_info -neofetch +fastfetch --config neofetch From 116fe064d907ff56e47b20e17087b79d9c89ced9 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 10 Oct 2025 13:23:06 +0200 Subject: [PATCH 26/28] generate a maschine-id when building the container to remove bash warning --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index cca72c5..b4fee00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,8 @@ ENV RUN_INSTALL_SCRIPT="false" ENV RUN_PROMETHEUS_EXPORTER="false" ENV TZ="" +RUN sudo dbus-uuidgen --ensure=/etc/machine-id + # Add Folders and Shell Scripts RUN mkdir "/.ssh" VOLUME ["/backups"] From 6b3de4d5cf4d7c32c6c65b08f1e82816182ab29b Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 10 Oct 2025 13:25:25 +0200 Subject: [PATCH 27/28] remove sudo before creating new machine id --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b4fee00..603bfae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ENV RUN_INSTALL_SCRIPT="false" ENV RUN_PROMETHEUS_EXPORTER="false" ENV TZ="" -RUN sudo dbus-uuidgen --ensure=/etc/machine-id +RUN dbus-uuidgen --ensure=/etc/machine-id # Add Folders and Shell Scripts RUN mkdir "/.ssh" From e435f97beb6ca6513ebb0b869f1e5c4264e6a643 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Fri, 10 Oct 2025 13:31:22 +0200 Subject: [PATCH 28/28] move dbus-uuidgen --ensure=/etc/machine-id into entrypoint.sh --- Dockerfile | 2 -- entrypoint-script/entrypoint.sh | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 603bfae..cca72c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,8 +9,6 @@ ENV RUN_INSTALL_SCRIPT="false" ENV RUN_PROMETHEUS_EXPORTER="false" ENV TZ="" -RUN dbus-uuidgen --ensure=/etc/machine-id - # Add Folders and Shell Scripts RUN mkdir "/.ssh" VOLUME ["/backups"] diff --git a/entrypoint-script/entrypoint.sh b/entrypoint-script/entrypoint.sh index 118ae4e..7512756 100755 --- a/entrypoint-script/entrypoint.sh +++ b/entrypoint-script/entrypoint.sh @@ -191,6 +191,7 @@ function run_correct_ssh_service() { # Main Code ##################################################################################################### set_environment_variables_if_not_empty +dbus-uuidgen --ensure=/etc/machine-id add_borg_user print_container_info