vpn 세팅 스크립트 수정 2
This commit is contained in:
+12
-4
@@ -26,10 +26,10 @@ inputs:
|
|||||||
description: TOTP 시드 키 (이 값으로 매 실행 OTP 코드를 로컬 생성)
|
description: TOTP 시드 키 (이 값으로 매 실행 OTP 코드를 로컬 생성)
|
||||||
otp-seed-format:
|
otp-seed-format:
|
||||||
required: false
|
required: false
|
||||||
default: "base32"
|
default: "base64"
|
||||||
description: >
|
description: >
|
||||||
OTP 시드 포맷. base32=구글OTP류 문자열(대문자/공백은 자동 정규화),
|
OTP 시드 포맷. base32=구글OTP류 문자열(대문자/공백 자동 정규화),
|
||||||
hex=16진수 문자열. base32에서 'Base32 invalid' 나면 hex로 시도.
|
hex=16진수 문자열, base64=base64로 인코딩된 키(예 R1F5...== → 디코딩 후 사용).
|
||||||
otp-mode:
|
otp-mode:
|
||||||
required: false
|
required: false
|
||||||
default: "append"
|
default: "append"
|
||||||
@@ -141,8 +141,16 @@ runs:
|
|||||||
hex)
|
hex)
|
||||||
OTP=$(oathtool --totp "$SEED")
|
OTP=$(oathtool --totp "$SEED")
|
||||||
;;
|
;;
|
||||||
|
base64)
|
||||||
|
# base64 키를 디코딩 → raw 바이트를 hex로 변환 → oathtool에 hex로 전달
|
||||||
|
SEED_HEX=$(printf '%s' "$SEED" | base64 -d 2>/dev/null | od -An -v -tx1 | tr -d ' \n')
|
||||||
|
if [ -z "$SEED_HEX" ]; then
|
||||||
|
echo "base64 디코딩 실패: 시드가 올바른 base64인지 확인"; exit 1
|
||||||
|
fi
|
||||||
|
OTP=$(oathtool --totp "$SEED_HEX")
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "잘못된 otp-seed-format: $OTP_SEED_FORMAT (base32|hex)"; exit 1
|
echo "잘못된 otp-seed-format: $OTP_SEED_FORMAT (base32|hex|base64)"; exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user