이번에 우분투 서버 셋팅하면서 거래처 해당 담당자가 헤메는 부분이 있어
혹 도움이 될까 하여 간단한 팁을 소개 합니다.
우분투에선 패키지를 재빌드 하거나 ppa를 만들때 GPG 시크릿 키나 공개키가 필요한 경우가 있습니다.
여러 경로로 GPG 키를 만드는 방법은 많이 있으나 키 생성시 요구하는 엔트리가 부족하다는 메세지에서
어리둥절 하시는 분들이 많이 계시는 데 위에서 말씀드린 담당자도 그렇더군요!
이런 경우 아래를 참고 하시면 도움이 될 것 같습니다. (루트 권한은 필요 없습니다.)
터미널에서 아래를 실행 하시기 바랍니다.
# gpg --gen-key
1단계: Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
1번을 선택 하시고 엔타키를 칩니다.
2단계: DSA keypair will have 1024 bits.
ELG-E keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
사이즈는 기본으로 하셔도 되고 4096로 하시기를 권해 드립니다.
3단계: Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
0번을 입력 후 엔터키를 치거나 년식을 입력합니다. (예: 3y (3년))
4단계: You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
"Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"
Real name:
Email address:
실제 이름과 이메일 주소를 입력하십시오. 그러나 이메일 주소는 반드시 진짜 사용하는 주소를 입력하시기 바랍니다.
나중에 후회하지 마시구요!
5단계: Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?
O키를 칩니다. 다음에 나오는 메세지에서 save를 칩니다.
6단계: You need a Passphrase to protect your secret key.
gpg: gpg-agent is not available in this session
Enter passphrase:
패스워드를 입력하시고 재입력에서 같은 패스워드를 입력합니다.
7단계: We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
위의 메세지는 커널의 엔트로피가 모자라다는 내용으로 굳이 설명 드리지 않겠지만
이 부분에서 다들 어리 둥절 하시거나 키 생성에 실패 하십니다.
이제 트릭이 필요한 데 현재 실행하고 있는 터미널 말고 한개의 터미널 창을 더 열어서
아래 명령을 실행 하십시오.
# sudo rngd -f -r /dev/urandom
위의 명령어를 실행하고 키생성에 성공할 때 까지 창을 닫지 마십시오. rngd 명령어가 먹혀들지 않으면
얌으로 rng-utils을 설치 하시면 됩니다.
이제 키를 생성하는 터미널에서 보시면 -__++ 와 같은 첨자가 나오고
잠시만 기다리시면 키 생성이 완료 되었다는 메세지가 나올 것 입니다.
8단계: gpg: key D8FC66D2 marked as ultimately trusted
public and secret key created and signed.
pub 1024D/D8FC66D2 2005-09-08
Key fingerprint = 95BD 8377 2644 DD4F 28B5 2C37 0F6E 4CA6 D8FC 66D2
uid 이름 (Tutorial key) <이메일>
sub 2048g/389AA63E 2005-09-08
이제 키 생성에 성공했습니다. 추후 키를 이용하는 방법은 직접 확인해 보십시오.