mirror of
https://github.com/samuelhbne/server-xray.git
synced 2025-12-17 12:24:39 +03:00
Codacy compliant
This commit is contained in:
60
.github/workflows/codacy-outdated.yml
vendored
60
.github/workflows/codacy-outdated.yml
vendored
@@ -1,60 +0,0 @@
|
|||||||
# This workflow uses actions that are not certified by GitHub.
|
|
||||||
# They are provided by a third-party and are governed by
|
|
||||||
# separate terms of service, privacy policy, and support
|
|
||||||
# documentation.
|
|
||||||
|
|
||||||
# This workflow checks out code, performs a Codacy security scan
|
|
||||||
# and integrates the results with the
|
|
||||||
# GitHub Advanced Security code scanning feature. For more information on
|
|
||||||
# the Codacy security scan action usage and parameters, see
|
|
||||||
# https://github.com/codacy/codacy-analysis-cli-action.
|
|
||||||
# For more information on Codacy Analysis CLI in general, see
|
|
||||||
# https://github.com/codacy/codacy-analysis-cli.
|
|
||||||
|
|
||||||
name: Codacy Security Scan
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "master", "dev" ]
|
|
||||||
pull_request:
|
|
||||||
# The branches below must be a subset of the branches above
|
|
||||||
branches: [ "master" ]
|
|
||||||
schedule:
|
|
||||||
- cron: '45 16 * * 5'
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
codacy-security-scan:
|
|
||||||
permissions:
|
|
||||||
contents: read # for actions/checkout to fetch code
|
|
||||||
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
|
||||||
name: Codacy Security Scan
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# Checkout the repository to the GitHub Actions runner
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
|
||||||
- name: Run Codacy Analysis CLI
|
|
||||||
uses: codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b
|
|
||||||
with:
|
|
||||||
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
|
|
||||||
# You can also omit the token and run the tools that support default configurations
|
|
||||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
||||||
verbose: true
|
|
||||||
output: results.sarif
|
|
||||||
format: sarif
|
|
||||||
# Adjust severity of non-security issues
|
|
||||||
gh-code-scanning-compat: true
|
|
||||||
# Force 0 exit code to allow SARIF file generation
|
|
||||||
# This will handover control about PR rejection to the GitHub side
|
|
||||||
max-allowed-issues: 2147483647
|
|
||||||
|
|
||||||
# Upload the SARIF file generated in the previous step
|
|
||||||
- name: Upload SARIF results file
|
|
||||||
uses: github/codeql-action/upload-sarif@v2
|
|
||||||
with:
|
|
||||||
sarif_file: results.sarif
|
|
||||||
4
run.sh
4
run.sh
@@ -136,7 +136,7 @@ while true ; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Invoking all hook-URLs
|
# Invoking all hook-URLs
|
||||||
if [ -n "${HOOKURL}" ]; then
|
if [ "${#HOOKURL[@]}" -gt 0 ]; then
|
||||||
for URL in "${HOOKURL[@]}"
|
for URL in "${HOOKURL[@]}"
|
||||||
do
|
do
|
||||||
echo "curl -sSL $URL"
|
echo "curl -sSL $URL"
|
||||||
@@ -185,7 +185,7 @@ if [ -n "${STSVR}" ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${NGSVR}" ]; then
|
if [ "${#NGSVR[@]}" -gt 0 ]; then
|
||||||
for svropt in "${NGSVR[@]}"
|
for svropt in "${NGSVR[@]}"
|
||||||
do
|
do
|
||||||
NGOPT="${NGOPT} --ng-server ${svropt},$xopt"
|
NGOPT="${NGOPT} --ng-server ${svropt},$xopt"
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
d|domain)
|
d|domain)
|
||||||
domain="${kv[1]}"
|
domain="${kv[1]}"
|
||||||
@@ -65,7 +65,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -99,5 +99,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
d|dest)
|
d|dest)
|
||||||
dest="${kv[1]}"
|
dest="${kv[1]}"
|
||||||
@@ -64,7 +64,7 @@ fi
|
|||||||
|
|
||||||
if [ -z "${prvkey}" ]; then
|
if [ -z "${prvkey}" ]; then
|
||||||
>&2 echo -e "Warning: PrivateKey undefined, Generated new...\n"
|
>&2 echo -e "Warning: PrivateKey undefined, Generated new...\n"
|
||||||
kv=($(/usr/local/bin/xray x25519|cut -d ' ' -f3|tr ' '))
|
read -ra kv <<< "$(/usr/local/bin/xray x25519|cut -d ' ' -f3|tr '\r\n' ' ')"
|
||||||
prvkey="${kv[0]}"
|
prvkey="${kv[0]}"
|
||||||
pubkey="${kv[1]}"
|
pubkey="${kv[1]}"
|
||||||
>&2 echo -e "PublicKey: $pubkey\n"
|
>&2 echo -e "PublicKey: $pubkey\n"
|
||||||
@@ -88,7 +88,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -136,5 +136,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
c|certhome)
|
c|certhome)
|
||||||
certhome="${kv[1]}"
|
certhome="${kv[1]}"
|
||||||
@@ -81,7 +81,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -117,5 +117,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
d|domain)
|
d|domain)
|
||||||
domain="${kv[1]}"
|
domain="${kv[1]}"
|
||||||
@@ -65,7 +65,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
c|certhome)
|
c|certhome)
|
||||||
certhome="${kv[1]}"
|
certhome="${kv[1]}"
|
||||||
@@ -81,7 +81,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
d|dest)
|
d|dest)
|
||||||
dest="${kv[1]}"
|
dest="${kv[1]}"
|
||||||
@@ -61,7 +61,7 @@ fi
|
|||||||
|
|
||||||
if [ -z "${prvkey}" ]; then
|
if [ -z "${prvkey}" ]; then
|
||||||
>&2 echo -e "Warning: PrivateKey undefined, Generated new...\n"
|
>&2 echo -e "Warning: PrivateKey undefined, Generated new...\n"
|
||||||
kv=($(/usr/local/bin/xray x25519|cut -d ' ' -f3|tr ' '))
|
read -ra kv <<< "$(/usr/local/bin/xray x25519|cut -d ' ' -f3|tr '\r\n' ' ')"
|
||||||
prvkey="${kv[0]}"
|
prvkey="${kv[0]}"
|
||||||
pubkey="${kv[1]}"
|
pubkey="${kv[1]}"
|
||||||
>&2 echo -e "PublicKey: $pubkey\n"
|
>&2 echo -e "PublicKey: $pubkey\n"
|
||||||
@@ -80,7 +80,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -128,5 +128,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
c|certhome)
|
c|certhome)
|
||||||
certhome="${kv[1]}"
|
certhome="${kv[1]}"
|
||||||
@@ -73,7 +73,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -109,5 +109,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
d|domain)
|
d|domain)
|
||||||
domain="${kv[1]}"
|
domain="${kv[1]}"
|
||||||
@@ -65,7 +65,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -99,5 +99,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
c|certhome)
|
c|certhome)
|
||||||
certhome="${kv[1]}"
|
certhome="${kv[1]}"
|
||||||
@@ -81,7 +81,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vles
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -117,5 +117,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
c|certhome)
|
c|certhome)
|
||||||
certhome="${kv[1]}"
|
certhome="${kv[1]}"
|
||||||
@@ -73,7 +73,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vmes
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -109,5 +109,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
d|domain)
|
d|domain)
|
||||||
domain="${kv[1]}"
|
domain="${kv[1]}"
|
||||||
@@ -65,7 +65,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vmes
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -102,5 +102,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
c|certhome)
|
c|certhome)
|
||||||
certhome="${kv[1]}"
|
certhome="${kv[1]}"
|
||||||
@@ -81,7 +81,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"vmes
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -120,5 +120,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ sed -i '/\#STREAM_TAG/d' $NGCONF
|
|||||||
|
|
||||||
# Generate Nginx Stream server configuration.
|
# Generate Nginx Stream server configuration.
|
||||||
if [ -n "${STSVR}" ]; then
|
if [ -n "${STSVR}" ]; then
|
||||||
options=($(echo $STSVR |tr ',' ' '))
|
IFS=',' read -ra options <<< "$STSVR"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
kv=($(echo $option |tr '=' ' '))
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
p|port)
|
p|port)
|
||||||
STPORT="${kv[1]}"
|
STPORT="${kv[1]}"
|
||||||
@@ -82,6 +82,7 @@ options=($(echo $STSVR |tr ',' ' '))
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
unset IFS
|
||||||
|
|
||||||
if [ -z "${STPORT}" ]; then STPORT=443; fi
|
if [ -z "${STPORT}" ]; then STPORT=443; fi
|
||||||
if ! [ "${STPORT}" -eq "${STPORT}" ] 2>/dev/null; then >&2 echo "Stream port number must be numeric"; exit 1; fi
|
if ! [ "${STPORT}" -eq "${STPORT}" ] 2>/dev/null; then >&2 echo "Stream port number must be numeric"; exit 1; fi
|
||||||
@@ -90,10 +91,10 @@ options=($(echo $STSVR |tr ',' ' '))
|
|||||||
cat ${STREAM_TPL} >> $NGCONF
|
cat ${STREAM_TPL} >> $NGCONF
|
||||||
for stmap in "${STMAP[@]}"
|
for stmap in "${STMAP[@]}"
|
||||||
do
|
do
|
||||||
options=($(echo $stmap |tr ',' ' '))
|
IFS=',' read -ra options <<< "$stmap"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
kv=($(echo $option |tr '=' ' '))
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
sni)
|
sni)
|
||||||
sni="${kv[1]}"
|
sni="${kv[1]}"
|
||||||
@@ -103,6 +104,7 @@ options=($(echo $STSVR |tr ',' ' '))
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
unset IFS
|
||||||
# Naming the upstream as yahoo_com_jp for SNI yahoo.com.jp
|
# Naming the upstream as yahoo_com_jp for SNI yahoo.com.jp
|
||||||
upsname="${sni//\./_}"
|
upsname="${sni//\./_}"
|
||||||
echo " $sni $upsname;" >>/tmp/stmap.conf
|
echo " $sni $upsname;" >>/tmp/stmap.conf
|
||||||
@@ -132,10 +134,10 @@ do
|
|||||||
unset certhome NGPROTOCOL
|
unset certhome NGPROTOCOL
|
||||||
# removing site default config file if any.
|
# removing site default config file if any.
|
||||||
rm -rf /etc/nginx/conf.d/00_default_*.conf
|
rm -rf /etc/nginx/conf.d/00_default_*.conf
|
||||||
options=($(echo $ngsvr |tr ',' ' '))
|
IFS=',' read -ra options <<< "$ngsvr"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
kv=($(echo $option |tr '=' ' '))
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
c|certhome)
|
c|certhome)
|
||||||
certhome="${kv[1]}"
|
certhome="${kv[1]}"
|
||||||
@@ -153,6 +155,7 @@ do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
unset IFS
|
||||||
|
|
||||||
if [ -z "${certhome}" ]; then echo -e "Error: Nginx certhome undefined.\n"; usage; exit 1; fi
|
if [ -z "${certhome}" ]; then echo -e "Error: Nginx certhome undefined.\n"; usage; exit 1; fi
|
||||||
if [ "${#SITEDOMAINS[@]}" -eq 0 ]; then echo -e "Error: Nginx site domain undefined.\n"; usage; exit 1; fi
|
if [ "${#SITEDOMAINS[@]}" -eq 0 ]; then echo -e "Error: Nginx site domain undefined.\n"; usage; exit 1; fi
|
||||||
@@ -199,10 +202,10 @@ done
|
|||||||
for ngproxy in "${NGPROXY[@]}"
|
for ngproxy in "${NGPROXY[@]}"
|
||||||
do
|
do
|
||||||
unset XDOMAINS xhost xport xlocation xnetwork
|
unset XDOMAINS xhost xport xlocation xnetwork
|
||||||
options=($(echo $ngproxy |tr ',' ' '))
|
IFS=',' read -ra options <<< "$ngproxy"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
kv=($(echo $option |tr '=' ' '))
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
d|domain)
|
d|domain)
|
||||||
XDOMAINS+=("${kv[1]}")
|
XDOMAINS+=("${kv[1]}")
|
||||||
@@ -221,6 +224,7 @@ do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
unset IFS
|
||||||
|
|
||||||
if [ -z "${xhost}" ]; then xhost="127.0.0.1"; fi
|
if [ -z "${xhost}" ]; then xhost="127.0.0.1"; fi
|
||||||
if [ "${#XDOMAINS[@]}" -eq 0 ]; then XDOMAINS=("${ALLDOMAINS[@]}"); fi
|
if [ "${#XDOMAINS[@]}" -eq 0 ]; then XDOMAINS=("${ALLDOMAINS[@]}"); fi
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
c|certhome)
|
c|certhome)
|
||||||
certhome="${kv[1]}"
|
certhome="${kv[1]}"
|
||||||
@@ -73,7 +73,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"troj
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user=<uid>[:level:email]"
|
>&2 echo -e "User format: user=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
d|domain)
|
d|domain)
|
||||||
domain="${kv[1]}"
|
domain="${kv[1]}"
|
||||||
@@ -65,7 +65,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"troj
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -102,5 +102,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ usage() {
|
|||||||
>&2 echo -e "User format: user=<uid>[:level:email]"
|
>&2 echo -e "User format: user=<uid>[:level:email]"
|
||||||
}
|
}
|
||||||
|
|
||||||
IFS=',' read -a options <<< "$1"
|
IFS=',' read -ra options <<< "$1"
|
||||||
for option in "${options[@]}"
|
for option in "${options[@]}"
|
||||||
do
|
do
|
||||||
IFS='=' read -a kv <<< "$option"
|
IFS='=' read -ra kv <<< "$option"
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
c|certhome)
|
c|certhome)
|
||||||
certhome="${kv[1]}"
|
certhome="${kv[1]}"
|
||||||
@@ -81,7 +81,7 @@ inbound=$(jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"troj
|
|||||||
# User settings
|
# User settings
|
||||||
for user in "${xuser[@]}"
|
for user in "${xuser[@]}"
|
||||||
do
|
do
|
||||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
IFS=':'; uopt=("${user}"); uopt=("${uopt[@]}")
|
||||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||||
unset IFS
|
unset IFS
|
||||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||||
@@ -120,5 +120,5 @@ do
|
|||||||
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
inbound=$(echo $inbound| jq -c --argjson Jfb "${Jfb}" '.settings.fallbacks += [$Jfb]')
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $inbound
|
echo "$inbound"
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user