[SP-pm] perlbrew e distribuições Linux antigas

Alceu Rodrigues de Freitas Junior glasswalk3r at yahoo.com.br
Tue Jul 1 07:34:45 PDT 2014


Finalmente consegui fazer as pazes com o SELinux!

Primeiro é necessário remover os headers do openSSL... no Linux aqui eu 
tive que fazer isso para não concorrer com a configuração do ldconfig.

Depois é compilar e instalar o openSSL como shared libraries:

./config shared --prefix=DIR
make
make test
make install

Eu usei como DIR um subdiretório dentro do diretório do Perlbrew 
(~/perl5/openssl) para conseguir gerar um tarball de tudo.

Depois é obter instalar o Net::SSLeay, dependência básica para usar 
openSSL no Perl:

perl -MCPAN -e shell
get Net::SSLeay
look Net::SSLeay

Depois no prompt do shell:

perl Makefile.PL

Verifique se o Makefile gerado contem a opção "-fPIC". Se você não usar 
isso, o SELinux não vai deixar as coisas funcionarem. Na minha máquina 
essa opção foi configurada automaticamente pelo Makefile.PL.

Exportar as seguintes variáveis de ambiente:

export C_INCLUDE_PATH=$HOME/perl5/openssl/include
export LIBRARY_PATH=$HOME/perl5/openssl/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBRARY_PATH

Provavelmente melhor deixar essas variáveis no .bashrc ou equivalente. 
Então executar:

make
make test
make install
exit

Depois, no prompt do CPAN novamente:

install IO::Socket::SSL

Os testes todos devem funcionar. Agora preciso testar empacotar o perl + 
openssl com um tarball e levar para executar em outra máquina.

Em 21-06-2014 12:37, Alceu Rodrigues de Freitas Junior escreveu:
> Em 18-06-2014 13:23, Daniel de Oliveira Mantovani escreveu:
>> Alceu,
>>
>> Eu olhei o código fonte do Crypt-SSLeay-0.64 e não tem nenhum lugar
>> mesmo para passar o header a lib (OPENSSL_LIB e OPENSSL_INCLUDE).
>>
>> :(
>>
>
> Acho que de uma forma geral o suporte a SSL do Perl anda meio precário.
>
> http://search.cpan.org/dist/Crypt-SSLeay/SSLeay.pm#DO_YOU_NEED_Crypt::SSLeay?
>
>
> "Starting with version 6.02 of LWP, https support was unbundled into
> LWP::Protocol::https. This module specifies as one of its prerequisites
> IO::Socket::SSL which is automatically used by LWP::UserAgent unless
> this preference is overridden separately. IO::Socket::SSL is a more
> complete implementation, and, crucially, it allows hostname
> verification. Crypt::SSLeay does not support this. At this point,
> Crypt::SSLeay is maintained to support existing software that already
> depends on it. However, it is possible that your software does not
> really depend on Crypt::SSLeay, only on the ability of LWP::UserAgent
> class to communicate with sites over SSL/TLS."
>
> Vamos ver agora o IO::Socket::SSL:
>
> https://github.com/noxxi/p5-io-socket-ssl/blob/master/Makefile.PL
>
> WriteMakefile(
>      'NAME' => 'IO::Socket::SSL',
>      'ABSTRACT' => 'Nearly transparent SSL encapsulation for
> IO::Socket::INET.',
>      'AUTHOR' => 'Steffen Ullrich <sullr at cpan.org>, Peter Behroozi,
> Marko Asplund',
>      'LICENSE' => 'perl',
>      'DISTNAME' => 'IO-Socket-SSL',
>      'VERSION_FROM' => 'lib/IO/Socket/SSL.pm',
>      'PREREQ_PM' => {
> 'Net::SSLeay' => 1.46,
>
> Vamos ver o Net::SSLeay:
>
> http://search.cpan.org/~sampo/Net_SSLeay.pm-1.25/SSLeay.pm#VERSION
>
> "There are currently two perl modules for using OpenSSL C library:
> Net::SSLeay (maintaned by me) and SSLeay (maintained by OpenSSL team).
> This module is the Net::SSLeay variant.
>
> At the time of making this release, Eric's module was still quite
> sketchy and could not be used for real work, thus I felt motivated to
> make this maintenance release. This module is not planned to evolve to
> contain any further functionality, i.e. I will concentrate on just
> making a simple SSL connection over TCP socket. Presumably Eric's own
> module will offer full SSLeay API one day.
>
> This module uses OpenSSL-0.9.6c. It does not work with any earlier
> version and there is no guarantee that it will work with later versions
> either, though as long as C API does not change, it should. This module
> requires perl5.005, or 5.6.0 (or better?) though I believe it would
> build with any perl5.002 or newer."
>
> E agora a cereja no topo do bolo:
>
> http://blog.nu42.com/2014/04/does-your-code-really-depend-on.html
>
> Esta aí uma sugestão para desenvolvimento financiado pela Perl
> Foundation, principalmente depois do "causo" do Heartbleed. :-)
>
> []'s
>
> Alceu
> =begin disclaimer
>    Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
> SaoPaulo-pm mailing list: SaoPaulo-pm at pm.org
> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
> =end disclaimer



More information about the SaoPaulo-pm mailing list