From 0c7bf11f9c16494ee7f74db3466d32f891cbc743 Mon Sep 17 00:00:00 2001 From: USER Date: Fri, 24 Mar 2023 20:13:44 +0000 Subject: [PATCH] update to public gitea --- sbin/GitClonePublic | 3 +- shared/get_public_bastion.sh | 10 +++--- shared/get_public_bastion.sh.O | 60 ++++++++++++++++++++++++++++++++++ shared/get_public_rsync.sh | 10 +++--- shared/get_public_rsync.sh.O | 44 +++++++++++++++++++++++++ 5 files changed, 118 insertions(+), 9 deletions(-) create mode 100755 shared/get_public_bastion.sh.O create mode 100755 shared/get_public_rsync.sh.O diff --git a/sbin/GitClonePublic b/sbin/GitClonePublic index 2e76ad5..c6be3d6 100755 --- a/sbin/GitClonePublic +++ b/sbin/GitClonePublic @@ -13,6 +13,7 @@ then mkdir ${ZPC} fi +REPO=https://mint.nopenso.com/mirror for i in ${REPO} do echo $i @@ -20,6 +21,6 @@ do then echo $i cd ${ZPC} - git clone https://github.com/spongle70/${i}.git + git clone ${REPO}/${i}.git fi done diff --git a/shared/get_public_bastion.sh b/shared/get_public_bastion.sh index 8007d22..3a12a95 100755 --- a/shared/get_public_bastion.sh +++ b/shared/get_public_bastion.sh @@ -18,12 +18,14 @@ get_public_bastion () { chmod 644 ${AUTHFILE} cd /tmp - rm -rf /tmp/zKeys* + rm -rf /tmp/z* - curl -LJO https://github.com/spongle70/zKeys/archive/refs/heads/main.zip + REPO=https://mint.nopenso.com/mirror + + curl -LJO ${REPO}/zKeys/archive/main.zip unzip zKeys*.zip - cd zKeys-main + cd zkeys echo "Save keys from github" if [ "${SERVER_TYPE}" == "master" ] then @@ -47,7 +49,7 @@ get_public_bastion () { echo "The approved keys are:" cat ${AUTHFILE} - rm -rf ./zKeys* + rm -rf ./z* echo "${SERVER_TYPE}: finished $0" } diff --git a/shared/get_public_bastion.sh.O b/shared/get_public_bastion.sh.O new file mode 100755 index 0000000..8007d22 --- /dev/null +++ b/shared/get_public_bastion.sh.O @@ -0,0 +1,60 @@ +#!/bin/sh +set -u + +######################################################## +get_public_bastion () { + # AUTHDIR=/root/.ssh + # AUTHFILE=${AUTHDIR}/authorized_keys + + # mkdir -p ${AUTHDIR} + + AUTHDIR=/var/lib/bastion/.ssh + AUTHFILE=${AUTHDIR}/authorized_keys + + mkdir -p ${AUTHDIR} + + echo "Save keys from environment" + echo "${PUBLIC_KEYS}" | base64 -d > ${AUTHFILE} + chmod 644 ${AUTHFILE} + + cd /tmp + rm -rf /tmp/zKeys* + + curl -LJO https://github.com/spongle70/zKeys/archive/refs/heads/main.zip + unzip zKeys*.zip + + cd zKeys-main + echo "Save keys from github" + if [ "${SERVER_TYPE}" == "master" ] + then + cat _b*.pub >> ${AUTHFILE} + cat _d*.pub >> ${AUTHFILE} + # remove above lines in near future + cat _[1-9]ba*.pub >> ${AUTHFILE} + else + cat _v*.pub >> ${AUTHFILE} + # remove above lines in near future + cat _[1-9]vi*.pub >> ${AUTHFILE} + fi + +# testing + # cat _d*.pub >> ${AUTHFILE} + # cat _v*.pub >> ${AUTHFILE} + # AUTHDIR=/root/.ssh + # AUTHFILE=${AUTHDIR}/authorized_keys + # cat _d*.pub >> ${AUTHFILE} + # cat _v*.pub >> ${AUTHFILE} + + echo "The approved keys are:" + cat ${AUTHFILE} + rm -rf ./zKeys* + echo "${SERVER_TYPE}: finished $0" +} + + +main() { + echo "--------------Starting $0 -------------------------" + get_public_bastion +} + +main diff --git a/shared/get_public_rsync.sh b/shared/get_public_rsync.sh index f2df0eb..86af335 100755 --- a/shared/get_public_rsync.sh +++ b/shared/get_public_rsync.sh @@ -18,12 +18,14 @@ get_public_rsync () { chmod 644 ${AUTHFILE} cd /tmp - rm -rf /tmp/zKeys* + rm -rf /tmp/z* - curl -LJO https://github.com/spongle70/zKeys/archive/refs/heads/main.zip + REPO=https://mint.nopenso.com/mirror + + curl -LJO ${REPO}/zKeys/archive/main.zip unzip zKeys*.zip - cd zKeys-main + cd zkeys echo "Save keys from github" cat _r*.pub >> ${AUTHFILE} # remove above lines in near future @@ -31,7 +33,7 @@ get_public_rsync () { echo "The approved keys are:" cat ${AUTHFILE} - rm -rf ./zKeys* + rm -rf ./z* echo "${SERVER_TYPE}: finished $0" } diff --git a/shared/get_public_rsync.sh.O b/shared/get_public_rsync.sh.O new file mode 100755 index 0000000..f2df0eb --- /dev/null +++ b/shared/get_public_rsync.sh.O @@ -0,0 +1,44 @@ +#!/bin/sh +set -u + +######################################################## +get_public_rsync () { + # AUTHDIR=/root/.ssh + # AUTHFILE=${AUTHDIR}/authorized_keys + + # mkdir -p ${AUTHDIR} + + AUTHDIR=/root/.ssh + AUTHFILE=${AUTHDIR}/authorized_keys + + mkdir -p ${AUTHDIR} + + echo "Save keys from environment" + echo "${PUBLIC_KEYS}" | base64 -d > ${AUTHFILE} + chmod 644 ${AUTHFILE} + + cd /tmp + rm -rf /tmp/zKeys* + + curl -LJO https://github.com/spongle70/zKeys/archive/refs/heads/main.zip + unzip zKeys*.zip + + cd zKeys-main + echo "Save keys from github" + cat _r*.pub >> ${AUTHFILE} + # remove above lines in near future + cat _[1-9]rs*.pub >> ${AUTHFILE} + + echo "The approved keys are:" + cat ${AUTHFILE} + rm -rf ./zKeys* + echo "${SERVER_TYPE}: finished $0" +} + + +main() { + echo "--------------Starting $0 -------------------------" + get_public_rsync +} + +main