• Publicidad

Problema con Crypt::OpenSSL::CA en Linux

Aquí encontrarás todo lo que sea específicamente acerca de módulos de Perl. Ya sea que estás compartiendo tu módulo, un manual o simplemente tienes una duda acerca de alguno.

Re: Problema con Crypt::OpenSSL::CA en Linux

Notapor danycky » 2013-10-24 09:33 @439

Pues nada, explorer... mi gozo en un pozo :(

Con el código de CA.pl me sigue pidiendo en la línea de comandos los datos a introducir (Provincia, nombre del host, email, etc)... Así es que la verdad no sé muy bien para qué sirve CA.pl ni openssl.cnf, la verdad.

Por otro lado, el módulo OpenCA::OpenSSL tiene buena pinta, pero resulta que me da problemas para instalarlo al igual que el Crypt::OpenSSL::CA con el que intentaba yo trabajar inicialmente.

Por último, el módulo Crypt::OpenSSL::X509 no permite crear una CA :(

Seguiré intentándolo... ¡Mi proyecto de final de carrera depende de este maldito módulo de Perl!
danycky
Perlero nuevo
Perlero nuevo
 
Mensajes: 11
Registrado: 2013-10-21 10:43 @488

Publicidad

Re: Problema con Crypt::OpenSSL::CA en Linux

Notapor explorer » 2013-10-24 12:37 @567

Si quien pide los datos es CA.pl, pues te vale con buscar, en su código, las líneas que lo hacen, y sustituirlas por otras que lean la información desde otras fuentes (archivos, entrada estándar, IPC, tcp, etc.). Muchos de los datos que no pide están en el archivo conf. Otra cosa es que sea el propio openssl el que los pida (contraseña, longitud de clave y demás). Pero leyendo la página de manual, dice que también se puede pasar a través de sus argumentos.

Dinos los problemas que te salen al instalar el módulo.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: Problema con Crypt::OpenSSL::CA en Linux

Notapor danycky » 2013-10-25 05:24 @266

explorer escribiste:Si quien pide los datos es CA.pl, pues te vale con buscar, en su código, las líneas que lo hacen, y sustituirlas por otras que lean la información desde otras fuentes (archivos, entrada estándar, IPC, tcp, etc.). Muchos de los datos que no pide están en el archivo conf. Otra cosa es que sea el propio openssl el que los pida (contraseña, longitud de clave y demás). Pero leyendo la página de manual, dice que también se puede pasar a través de sus argumentos.

Dinos los problemas que te salen al instalar el módulo.


explorer... el problema es que openssl es el que siempre pide una contraseña para generar la clave privada y además pide los datos (Nombre, provincia, email, etc.). Lo que comentas de leer la información de otras fuentes creo que se escapa a mis conocimientos de programación.

Por otro lado no he encontrado nada sobre openssl que diga que se le pueden pasar esos datos que te solicita como argumentos (y mira que le he dado vueltas...) pero tampoco me fio mucho de mi mismo.

Ya para finalizar te dejo lo que recibo al intentar instalar el módulo que me recomendaste:

Sintáxis: [ Descargar ] [ Ocultar ]
Using text Syntax Highlighting
cpan[1]> install OpenCA::OpenSSL
Fetching with LWP:
http://ftp.belnet.be/ftp.cpan.org/autho ... lrc.txt.gz
Going to read '/root/.local/share/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with LWP:
http://ftp.belnet.be/ftp.cpan.org/modul ... ils.txt.gz
Going to read '/root/.local/share/.cpan/sources/modules/02packages.details.txt.gz'
  Database was generated on Thu, 24 Oct 2013 21:29:03 GMT
..............
  New CPAN.pm version (v2.00) available.
  [Currently running version is v1.960001]
  You might want to try
    install CPAN
    reload cpan
  to both upgrade CPAN.pm and run the new version without leaving
  the current session.


..............................................................DONE
Fetching with LWP:
http://ftp.belnet.be/ftp.cpan.org/modul ... st.data.gz
Going to read '/root/.local/share/.cpan/sources/modules/03modlist.data.gz'
............................................................................DONE
Going to write /root/.local/share/.cpan/Metadata
Running install for module 'OpenCA::OpenSSL'
Running make for M/MA/MADWOLF/OpenCA-OpenSSL-2.0.29.tar.gz
Fetching with LWP:
http://ftp.belnet.be/ftp.cpan.org/autho ... .29.tar.gz
Fetching with LWP:
http://ftp.belnet.be/ftp.cpan.org/autho ... /CHECKSUMS
Checksum for /root/.local/share/.cpan/sources/authors/id/M/MA/MADWOLF/OpenCA-OpenSSL-2.0.29.tar.gz ok
Scanning cache /root/.local/share/.cpan/build for sizes
DONE

  CPAN.pm: Going to build M/MA/MADWOLF/OpenCA-OpenSSL-2.0.29.tar.gz

Checking if your kit is complete...
Looks good
Warning: prerequisite X500::DN 0.27 not found.
Writing Makefile for OpenCA::OpenSSL
Writing MYMETA.yml
---- Unsatisfied dependencies detected during ----
----   MADWOLF/OpenCA-OpenSSL-2.0.29.tar.gz   ----
    X500::DN [requires]
Running make test
  Delayed until after prerequisites
Running make install
  Delayed until after prerequisites
Running install for module 'X500::DN'
Running make for R/RJ/RJOOP/X500-DN-0.29.tar.gz
Fetching with LWP:
http://ftp.belnet.be/ftp.cpan.org/autho ... .29.tar.gz
Fetching with LWP:
http://ftp.belnet.be/ftp.cpan.org/autho ... /CHECKSUMS
Checksum for /root/.local/share/.cpan/sources/authors/id/R/RJ/RJOOP/X500-DN-0.29.tar.gz ok

  CPAN.pm: Going to build R/RJ/RJOOP/X500-DN-0.29.tar.gz

Checking if your kit is complete...
Looks good
Warning: prerequisite Parse::RecDescent 1.80 not found.
Writing Makefile for X500::DN
Writing MYMETA.yml
---- Unsatisfied dependencies detected during ----
----         RJOOP/X500-DN-0.29.tar.gz        ----
    Parse::RecDescent [requires]
Running make test
  Delayed until after prerequisites
Running make install
  Delayed until after prerequisites
Running install for module 'Parse::RecDescent'
Running make for J/JT/JTBRAUN/Parse-RecDescent-1.967009.tar.gz
Fetching with LWP:
http://ftp.belnet.be/ftp.cpan.org/autho ... 009.tar.gz
Fetching with LWP:
http://ftp.belnet.be/ftp.cpan.org/autho ... /CHECKSUMS
Checksum for /root/.local/share/.cpan/sources/authors/id/J/JT/JTBRAUN/Parse-RecDescent-1.967009.tar.gz ok

  CPAN.pm: Going to build J/JT/JTBRAUN/Parse-RecDescent-1.967009.tar.gz

Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Parse-RecDescent' version '1.967009'
Building Parse-RecDescent
  JTBRAUN/Parse-RecDescent-1.967009.tar.gz
  ./Build -- OK
'YAML' not installed, will not store persistent state
Running Build test
t/00.load.t ............... 1/1 # Testing Parse::RecDescent 1.967009
t/00.load.t ............... ok  
t/01.basics.t ............. ok    
t/autotree.t .............. ok  
t/leftop_cap.t ............ ok  
t/pod.t ................... skipped: Test::Pod 1.14 required for testing POD
t/precompile.t ............ ok    
t/re_capture_return.t ..... ok  
t/reentry.t ............... skipped: Test::Warn required for testing reentry
t/separated_repetition.t .. ok  
t/skip.t .................. ok  
t/skip_dynamic.t .......... ok  
t/text.t .................. ok  
All tests successful.
Files=12, Tests=77,  1 wallclock secs ( 0.05 usr  0.02 sys +  0.55 cusr  0.08 csys =  0.70 CPU)
Result: PASS
  JTBRAUN/Parse-RecDescent-1.967009.tar.gz
  ./Build test -- OK
Running Build install
Building Parse-RecDescent
Installing /usr/local/share/perl/5.14.2/Parse/RecDescent.pm
Installing /usr/local/man/man3/Parse::RecDescent.3pm
  JTBRAUN/Parse-RecDescent-1.967009.tar.gz
  ./Build install  -- OK
Running make for R/RJ/RJOOP/X500-DN-0.29.tar.gz
  Has already been unwrapped into directory /root/.local/share/.cpan/build/X500-DN-0.29-DH2yrx

  CPAN.pm: Going to build R/RJ/RJOOP/X500-DN-0.29.tar.gz

cpan[1]> install OpenCA::OpenSSLcp RDN.pod blib/lib/X500/RDN.pod
cp DN.pod blib/lib/X500/DN.pod
cp RDN.pm blib/lib/X500/RDN.pm
cp DN.pm blib/lib/X500/DN.pm
Manifying blib/man3/X500::RDN.3pm
Manifying blib/man3/X500::DN.3pm
  RJOOP/X500-DN-0.29.tar.gz
  /usr/bin/make -- OK
Running make test
cpan[1]> install OpenCA::OpenSSLPERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/dn.t ... Use of uninitialized value $initial_skip in concatenation (.) or string at /usr/local/share/perl/5.14.2/Parse/RecDescent.pm line 3054.
t/dn.t ... 1/43 # Test 38 got: "1 " (t/dn.t at line 108 *TODO*)
#    Expected: "1"
#  t/dn.t line 108 is: ok ($rdn && $rdn->getAttributeValue ('foo'), '1');
t/dn.t ... ok    
t/rdn.t .. ok    
All tests successful.
Files=2, Tests=54,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.08 cusr  0.00 csys =  0.09 CPU)
Result: PASS
  RJOOP/X500-DN-0.29.tar.gz
  /usr/bin/make test -- OK
Running make install
cpan[1]> install OpenCA::OpenSSLInstalling /usr/local/share/perl/5.14.2/X500/DN.pod
Installing /usr/local/share/perl/5.14.2/X500/RDN.pm
Installing /usr/local/share/perl/5.14.2/X500/RDN.pod
Installing /usr/local/share/perl/5.14.2/X500/DN.pm
Installing /usr/local/man/man3/X500::DN.3pm
Installing /usr/local/man/man3/X500::RDN.3pm
Appending installation info to /usr/local/lib/perl/5.14.2/perllocal.pod
  RJOOP/X500-DN-0.29.tar.gz
  /usr/bin/make install  -- OK
Running make for M/MA/MADWOLF/OpenCA-OpenSSL-2.0.29.tar.gz
  Has already been unwrapped into directory /root/.local/share/.cpan/build/OpenCA-OpenSSL-2.0.29-MwwEO7

  CPAN.pm: Going to build M/MA/MADWOLF/OpenCA-OpenSSL-2.0.29.tar.gz

cp OpenSSL/SMIME.pm blib/lib/OpenCA/OpenSSL/SMIME.pm
cp OpenSSL.pm blib/lib/OpenCA/OpenSSL.pm
AutoSplitting blib/lib/OpenCA/OpenSSL.pm (blib/lib/auto/OpenCA/OpenSSL)
cp OpenSSL.pod blib/lib/OpenCA/OpenSSL.pod
/usr/bin/perl /usr/share/perl/5.14/ExtUtils/xsubpp  -typemap /usr/share/perl/5.14/ExtUtils/typemap -typemap typemap  OpenSSL.xs > OpenSSL.xsc && mv OpenSSL.xsc OpenSSL.c
Please specify prototyping behavior for OpenSSL.xs (see perlxs manual)
cc -c  -I. -I/include -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g   -DVERSION=\"2.0.29\" -DXS_VERSION=\"2.0.29\" -fPIC "-I/usr/lib/perl/5.14/CORE"   OpenSSL.c
In file included from OpenSSL.xs:5:0:
ppport.h:227:0: warning: "PERL_UNUSED_DECL" redefined [enabled by default]
In file included from OpenSSL.xs:2:0:
/usr/lib/perl/5.14/CORE/perl.h:328:0: note: this is the location of the previous definition
OpenSSL.xs:7:30: fatal error: openssl/opensslv.h: No such file or directory
compilation terminated.
make: *** [OpenSSL.o] Error 1
  MADWOLF/OpenCA-OpenSSL-2.0.29.tar.gz
  /usr/bin/make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
Failed during this command:
 MADWOLF/OpenCA-OpenSSL-2.0.29.tar.gz         : make NO
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4
danycky
Perlero nuevo
Perlero nuevo
 
Mensajes: 11
Registrado: 2013-10-21 10:43 @488

Re: Problema con Crypt::OpenSSL::CA en Linux

Notapor explorer » 2013-10-25 13:15 @593

En el manual de openssl, dice:
PASS PHRASE ARGUMENTS
Several commands accept password arguments, typically using -passin and -passout for input and output passwords respectively. These allow the password to be obtained from a variety of sources. Both of these options take a single argument whose format is described below. If no password argument is given and a password is required then the user is prompted to enter one: this will typically be read from the current terminal with echoing turned off.
A eso me refería con lo de otras fuentes: si no le indicas la contraseña, te la pedirá por la propia terminal. Pero si quieres, se la puedes de varias formas distintas (las indicadas en el manual). En esa sección te explica cómo.

El resto de datos es posible que se lo puedas indicar en el openssl.cnf. Mira lo que pone al principio de ese documento:
Sintáxis: [ Descargar ] [ Ocultar ]
Using text Syntax Highlighting
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
Coloreado en 0.000 segundos, usando GeSHi 1.0.8.4


El mensaje es el mismo de antes, por lo que se resuelve de la misma manera: debes instalar el paquete con las fuentes de openssl (apt-get install libssl-dev, que es donde se encuentre el archivo que le hace falta: openssl/opensslv.h).
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: Problema con Crypt::OpenSSL::CA en Linux

Notapor danycky » 2013-10-27 05:23 @266

Sigo investigando sobre el uso de Openssl y demás (poco tiene que ver con el título del foro, pero bueno... por si a alguien le puede servir en el futuro). He conseguido inicializar la contraseña en el openssl.cnf pero el problema es que el hecho de modificar el archivo openssl.cnf solo sirve para no tener que poner los datos que te solicita al generar el certificado, sino que si los has puesto anteriormente en el propio archivo openssl.cnf tienes que pulsar ENTRAAR en cada una de las opciones que te pide el programa (no sé si me explico bien...).

dany-XPS-M1330 ssl # openssl req -config openssl.cnf -new -x509 -extensions v3_ca -keyout private/ca.key -out certs
Generating a 2048 bit RSA private key
..........................................+++
........+++
writing new private key to 'private/ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:


Como se puede observar, el programa se queda esperando a que el usuario presione ENTRAR y cogerá el valor que se haya puesto en el archivo openssl.cnf.... Mi objetivo es que el proceso sea totalmente automático.... ¡¡¡Lo conseguiré!!!
danycky
Perlero nuevo
Perlero nuevo
 
Mensajes: 11
Registrado: 2013-10-21 10:43 @488

Re: Problema con Crypt::OpenSSL::CA en Linux

Notapor explorer » 2013-10-27 06:23 @308

Tienes dos opciones:
  • poner el sujeto en la lista de argumentos (-subj). Ejemplo
  • Usar un archivo de configuración aparte (por ejemplo, el openssl.cnf) y añadir la opción -batch a los argumentos que pasas a openssl (sacado de man req, man ca, etc.) Ejemplo

P.D.: para responder a un mensaje, pulsa el botón Responder, que está a continuación del último mensaje del hilo. El botón Citar es para cuando quieres comentar algo de lo que se ha dicho en el mensaje anterior.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Anterior

Volver a Módulos

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 0 invitados

cron