diff --git a/connect-vpn/action.yml b/connect-vpn/action.yml index aa7ccea..c49337d 100644 --- a/connect-vpn/action.yml +++ b/connect-vpn/action.yml @@ -38,6 +38,10 @@ inputs: required: false default: "false" description: "true면 seed 검증용으로 생성된 OTP를 로그에 출력합니다. 확인 후 즉시 false로 되돌리세요." + debug-otp-only: + required: false + default: "false" + description: "true면 생성된 OTP만 출력하고 VPN 로그인은 시도하지 않습니다." resource-name: required: false @@ -114,6 +118,7 @@ runs: OTP_SEED: ${{ inputs.otp-seed }} OTP_SEED_FORMAT: ${{ inputs.otp-seed-format }} DEBUG_OTP: ${{ inputs.debug-otp }} + DEBUG_OTP_ONLY: ${{ inputs.debug-otp-only }} RESOURCE_NAME: ${{ inputs.resource-name }} TIMEOUT: ${{ inputs.timeout }} run: | @@ -186,6 +191,13 @@ runs: curl -k -sS --http1.1 -A "$UA" "$@" } + debug_print_otps() { + echo "DEBUG OTP 확인용 코드 (unix-time=$(date +%s))" + for otp_offset in 0 -1 1; do + echo "DEBUG generated OTP offset=${otp_offset}: $(totp "$otp_offset")" + done + } + summarize_html() { page="$1" if [ ! -f "$page" ]; then @@ -220,6 +232,12 @@ runs: exit 1 fi + if [ "$DEBUG_OTP_ONLY" = "true" ]; then + debug_print_otps + echo "debug-otp-only=true 이므로 VPN 로그인 시도 없이 종료합니다." + exit 0 + fi + host_no_scheme="${VPN_HOST#https://}" host_no_scheme="${host_no_scheme#http://}" host_no_scheme="${host_no_scheme%%/*}"