WIP: Adding a script for xray users
This commit is contained in:
parent
a7b8e9c159
commit
d6796ca2b7
@ -7,6 +7,9 @@ CONFIG=$(sops -d ./values/badhouseplants/secrets.server-xray-public.yaml | yq '.
|
|||||||
read -p "Enter fullname (Ivan Ivanov): " FULLNAME
|
read -p "Enter fullname (Ivan Ivanov): " FULLNAME
|
||||||
read -p "Enter email (ivan@fakemail.net): " EMAIL
|
read -p "Enter email (ivan@fakemail.net): " EMAIL
|
||||||
PASS=$(openssl rand -base64 10)
|
PASS=$(openssl rand -base64 10)
|
||||||
|
export DOCKER="${CONTAINER_TOOL:-docker}"
|
||||||
|
echo "Generating UUID, please wait"
|
||||||
|
UUID=$(${DOCKER} run ghcr.io/xtls/xray-core:main uuid -i "${FULLNAME}")
|
||||||
|
|
||||||
CONFIG_ENTRY=$(cat <<-EndOfMessage
|
CONFIG_ENTRY=$(cat <<-EndOfMessage
|
||||||
[
|
[
|
||||||
@ -27,15 +30,22 @@ read -p "Type 'YES' to continue " AGREE
|
|||||||
if [ "${AGREE}" != "YES" ]; then echo "Alright, goodbye" && exit 1; fi
|
if [ "${AGREE}" != "YES" ]; then echo "Alright, goodbye" && exit 1; fi
|
||||||
|
|
||||||
NEW_CONFIG=$(jq '.inbounds[].settings.clients += '"${CONFIG_ENTRY}"'' <<< "${CONFIG}" | jq)
|
NEW_CONFIG=$(jq '.inbounds[].settings.clients += '"${CONFIG_ENTRY}"'' <<< "${CONFIG}" | jq)
|
||||||
echo $NEW_CONFIG
|
|
||||||
|
export NEW_CONFIG
|
||||||
|
sops -d ./values/badhouseplants/secrets.server-xray-public.yaml | yq '.files.config.entries."config.json".data = strenv(NEW_CONFIG)' > ./values/badhouseplants/secrets.server-xray-public.yaml
|
||||||
|
sops encrypt -i ./values/badhouseplants/secrets.server-xray-public.yaml
|
||||||
|
|
||||||
echo "Does the diff looks correct?"
|
echo "Does the diff looks correct?"
|
||||||
diff <(echo $CONFIG) <(echo $NEW_CONFIG) || true
|
helmfile -e badhouseplants -f ./installations/applications -l name=server-xray-public diff
|
||||||
read -p "Type 'YES' to continue " AGREE
|
read -p "Type 'YES' to continue " AGREE
|
||||||
if [ "${AGREE}" != "YES" ]; then echo "Alright, goodbye" && exit 1; fi
|
if [ "${AGREE}" != "YES" ]; then echo "Alright, goodbye" && exit 1; fi
|
||||||
|
|
||||||
WORKDIR=$(mktemp -d)
|
export FULLNAME
|
||||||
export NEW_CONFIG
|
export BRANCH="add-$(echo $FULLNAME | sed -e 's/ /_/g')-to-xray"
|
||||||
sops -d ./values/badhouseplants/secrets.server-xray-public.yaml | yq '.files.config.entries."config.json".data = strenv(NEW_CONFIG)' > ./values/badhouseplants/secrets.server-xray-public.yaml && sops -e ./values/badhouseplants/secrets.server-xray-public.yaml
|
|
||||||
|
|
||||||
helmfile -e badhouseplants -f ./installations/applications -l name=server-xray-public diff
|
git checkout -b $BRANCH
|
||||||
|
git add ./values/badhouseplants/secrets.server-xray-public.yaml
|
||||||
|
git commit -m "xray maintenance: adding ${FULLNAME}"
|
||||||
|
git push
|
||||||
|
|
||||||
|
echo $UUID
|
||||||
|
Loading…
Reference in New Issue
Block a user