vpn 세팅 스크립트 수정
This commit is contained in:
+23
-2
@@ -23,7 +23,13 @@ inputs:
|
|||||||
description: VPN 정적 비밀번호 (OTP만 쓰는 설정이면 비워둠)
|
description: VPN 정적 비밀번호 (OTP만 쓰는 설정이면 비워둠)
|
||||||
otp-seed:
|
otp-seed:
|
||||||
required: true
|
required: true
|
||||||
description: TOTP Base32 시드 키 (이 값으로 매 실행 OTP 코드를 로컬 생성)
|
description: TOTP 시드 키 (이 값으로 매 실행 OTP 코드를 로컬 생성)
|
||||||
|
otp-seed-format:
|
||||||
|
required: false
|
||||||
|
default: "base32"
|
||||||
|
description: >
|
||||||
|
OTP 시드 포맷. base32=구글OTP류 문자열(대문자/공백은 자동 정규화),
|
||||||
|
hex=16진수 문자열. base32에서 'Base32 invalid' 나면 hex로 시도.
|
||||||
otp-mode:
|
otp-mode:
|
||||||
required: false
|
required: false
|
||||||
default: "append"
|
default: "append"
|
||||||
@@ -113,6 +119,7 @@ runs:
|
|||||||
VPN_USER: ${{ inputs.vpn-user }}
|
VPN_USER: ${{ inputs.vpn-user }}
|
||||||
VPN_PASS: ${{ inputs.vpn-password }}
|
VPN_PASS: ${{ inputs.vpn-password }}
|
||||||
OTP_SEED: ${{ inputs.otp-seed }}
|
OTP_SEED: ${{ inputs.otp-seed }}
|
||||||
|
OTP_SEED_FORMAT: ${{ inputs.otp-seed-format }}
|
||||||
OTP_MODE: ${{ inputs.otp-mode }}
|
OTP_MODE: ${{ inputs.otp-mode }}
|
||||||
TIMEOUT: ${{ inputs.timeout }}
|
TIMEOUT: ${{ inputs.timeout }}
|
||||||
CONNECTED_PATTERN: ${{ inputs.connected-pattern }}
|
CONNECTED_PATTERN: ${{ inputs.connected-pattern }}
|
||||||
@@ -123,7 +130,21 @@ runs:
|
|||||||
[ "$(id -u)" -ne 0 ] && SUDO="sudo"
|
[ "$(id -u)" -ne 0 ] && SUDO="sudo"
|
||||||
|
|
||||||
# TOTP 코드 로컬 생성 (API 불필요)
|
# TOTP 코드 로컬 생성 (API 불필요)
|
||||||
OTP=$(oathtool --totp -b "$OTP_SEED")
|
# 시드 정규화: 앞뒤/중간 공백 제거
|
||||||
|
SEED=$(printf '%s' "$OTP_SEED" | tr -d '[:space:]')
|
||||||
|
case "$OTP_SEED_FORMAT" in
|
||||||
|
base32)
|
||||||
|
# Base32는 대문자 필요 → 소문자 자동 변환
|
||||||
|
SEED=$(printf '%s' "$SEED" | tr 'a-z' 'A-Z')
|
||||||
|
OTP=$(oathtool --totp -b "$SEED")
|
||||||
|
;;
|
||||||
|
hex)
|
||||||
|
OTP=$(oathtool --totp "$SEED")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "잘못된 otp-seed-format: $OTP_SEED_FORMAT (base32|hex)"; exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# OTP 결합 방식에 따라 password 필드 구성
|
# OTP 결합 방식에 따라 password 필드 구성
|
||||||
case "$OTP_MODE" in
|
case "$OTP_MODE" in
|
||||||
|
|||||||
Reference in New Issue
Block a user