[edit vars with your site-specific info]and then you get
source ./vars
./clean-all
./build-dh
./pkitool --initca
./pkitool --server myserver
./pkitool client1
failed to update database TXT_DB error number 2
at the last step. I did and a web search mostly turned up suggestions to run ./clean-all again. But this article was the key. It's about openssl, but openvpn's easy-rsa is just a front-end to openssl. The important observation is that every certificate must have a unique CN in the database. In the file vars, this is controlled by KEY_CN. You left the settings read in from vars unchanged between generating the server cert and the client cert. You could edit vars before generating the client certificate and re-source vars, or you could do this before generating each client key.
I'm a bit surprised that the documentation for openvpn hasn't been updated to make this clear.
NB: It is also affected by the setting unique_subject = yes in the file keys/index.txt.attr, but I prefer not to go against the default setting.
KEY_CN=someuniqueclientcn ./pkitool client1and you will stop getting that TXT_DB error.
I'm a bit surprised that the documentation for openvpn hasn't been updated to make this clear.
NB: It is also affected by the setting unique_subject = yes in the file keys/index.txt.attr, but I prefer not to go against the default setting.
I find that I can use ./pkitool --interact to choose the different name during generating the ceritficate.
ReplyDeleteThank you for the usefull tip!
ReplyDeletehello, i want to ask you a question.
ReplyDeletewhen i generate "./pkitool client", the client ca successfully created. then i generate "./pkitool --pcks12 client", and it produce error " failed to update database TXT_DB error number 2".
Does pcks12 and client have to be in different Common Name?
Thanks Before
The KEY_CN has to be unique so if you just want two different formats for the same certificate, then generate one format and convert to the other format.
DeleteWow. Great tip.
ReplyDeleteKEY_CN=someuniqueclientcn did the trick.
Thanks! This solved my problem too.
ReplyDeleteThanks! That's it
ReplyDeleteThis was most helpful!! You stated the problem clearly and you provided the solution just as clearly.
ReplyDeleteHi,
ReplyDeleteI have the same problem, but I don't understand it, What files Do I have to modify? I am new in linux..
Please, could somebody tell me ?
Thanks a lot.
You don't have to modify anything. Just prepend KEY_CN=someuniquestring in front of the command ./pkitool client1.
DeleteNaturally substitute meaningful names for someuniquestring and client1.