기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
AWS CloudHSM 관리 유틸리티 사용자에 대해 2FA가 활성화된 사용자 생성
AWS CloudHSM 관리 유틸리티 CMU(CMU) 및 키 페어를 사용하여 2단계 인증(2FA)이 활성화된 새 CO(Crypto Office) 사용자를 생성합니다.
2FA가 활성화된 CO 사용자를 생성하려면
-
한 터미널에서 다음 단계를 수행합니다.
HSM에 액세스하고 CloudHSM 관리 유틸리티에 로그인합니다.
/opt/cloudhsm/bin/cloudhsm_mgmt_util /opt/cloudhsm/etc/cloudhsm_mgmt_util.cfg
CO로 로그인하고 다음 명령을 사용하여 2FA가 있는 새 사용자 MFA를 생성합니다.
aws-cloudhsm>createUser CO MFA
*************************CAUTION********************************This is a CRITICAL operation, should be done on all nodes in the cluster. AWS does NOT synchronize these changes automatically with the nodes on which this operation is not executed or failed, please ensure this operation is executed on all nodes in the cluster. **************************************************************** Do you want to continue(y/n)? yCreating User exampleuser3(CO) on 1 nodesAuthentication data written to: "/home/ec2-user/authdata"Generate Base64-encoded signatures for SHA256 digests in the authentication datafile. To generate the signatures, use the RSA private key, which is the second factor ofauthentication for this user. Paste the signatures and the corresponding public keyinto the authentication data file and provide the file path below.Leave this field blank to use the path initially provided.Enter filename:<CO USER NAME>
-2fa /home/ec2-user/authdata위 터미널을 이 상태로 둡니다. Enter 키를 누르거나 파일 이름을 입력하면 안 됩니다.
다른 터미널에서 다음 단계를 수행합니다.
-
HSM에 액세스하고 CloudHSM 관리 유틸리티에 로그인합니다.
/opt/cloudhsm/bin/cloudhsm_mgmt_util /opt/cloudhsm/etc/cloudhsm_mgmt_util.cfg
다음 명령을 사용하여 퍼블릭-프라이빗 키 페어를 생성합니다.
openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -pubout -in private_key.pem -out public_key.pem
다음 명령을 실행하여 authdata 파일에서 다이제스트를 추출하기 위한 json 쿼리 기능을 설치합니다.
sudo yum install jq
다이제스트 값을 추출하려면 먼저 authdata 파일에서 다음 데이터를 찾습니다.
{ "Version":"1.0", "PublicKey":"", "Data":[ { "HsmId":
<"HSM ID">
, "Digest":<"DIGEST">
, "Signature":"" } ] }참고
획득한 다이제스트는 base64로 인코딩되지만 다이제스트에 서명하려면 먼저 파일을 디코딩한 다음 서명해야 합니다. 다음 명령은 다이제스트를 디코딩하고 디코딩된 콘텐츠를 'digest1.bin'에 저장합니다.
cat authdata | jq '.Data[0].Digest' | cut -c2- | rev | cut -c2- | rev | base64 -d > digest1.bin
-
다음과 같이 퍼블릭 키 콘텐츠를 변환하고 "\n"을 추가하며 공백을 제거합니다.
-----BEGIN PUBLIC KEY-----\n
<PUBLIC KEY>
\n-----END PUBLIC KEY-----중요
위 명령은 BEGIN PUBLIC KEY----- 바로 뒤에 "\n"이 추가되고, "\n"과 퍼블릭 키의 첫 번째 문자 사이의 공백이 제거되며, "\n"이 -----END PUBLIC KEY 앞에 추가되고, "\n"과 퍼블릭 키의 끝 사이의 공백이 제거되는 방식을 보여줍니다.
이는 authdata 파일에 허용되는 퍼블릭 키의 PEM 형식입니다.
authdata 파일의 퍼블릭 키 섹션에 퍼블릭 키 pem 형식 콘텐츠를 붙여 넣습니다.
vi authdata
{ "Version":"1.0", "PublicKey":"-----BEGIN PUBLIC KEY-----\n
<"PUBLIC KEY">
\n-----END PUBLIC KEY-----", "Data":[ { "HsmId":<"HSM ID">
, "Digest":<"DIGEST">
, "Signature":”” } ] }다음 명령을 사용하여 토큰 파일에 서명합니다.
openssl pkeyutl -sign -in digest1.bin -inkey private_key.pem -pkeyopt digest:sha256 | base64
Output Expected:<"THE SIGNATURE">
참고
위 명령에서 볼 수 있듯이, openssl dgst 서명 대신 openssl pkeyutl을 사용합니다.
Authdata 파일의 “서명” 필드에 서명된 다이제스트를 추가합니다.
vi authdata
{ "Version": "1.0", "PublicKey": "-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----", "Data": [ { "HsmId":
<"HSM ID">
, "Digest":<"DIGEST">
, "Signature":"Kkdl ... rkrvJ6Q=="
}, { "HsmId":<"HSM ID">
, "Digest":<"DIGEST">
, "Signature":"K1hxy ... Q261Q=="
} ] }
-
-
첫 번째 터미널로 돌아가서
Enter
을 누릅니다.Generate Base64-encoded signatures for SHA256 digests in the authentication datafile. To generate the signatures, use the RSA private key, which is the second factor ofauthentication for this user. Paste the signatures and the corresponding public keyinto the authentication data file and provide the file path below. Leave this field blank to use the path initially provided. Enter filename: >>>>> Press Enter here createUser success on server 0(10.0.1.11)