From Fedora Project Wiki
mNo edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Enforce system crypto policies ==
== Enforce system crypto policies ==
Since Fedora 21 (http://fedoraproject.org/wiki/Changes/CryptoPolicy) there are policies for the usage of SSL and TLS cryptographic protocols that are enforced system-wide. Each application being added in Fedora must be checked to comply with the policies. Currently the policies are restricted to applications using GnuTLS and OpenSSL. Note however that there are applications which intentionally set weaker, or custom settings on a purpose (e.g., postfix). When in doubt, discuss with the [https://lists.fedoraproject.org/mailman/listinfo/security Fedora security team].
Since Fedora 21 (http://fedoraproject.org/wiki/Changes/CryptoPolicy) there are policies for the usage of SSL and TLS cryptographic protocols that are enforced system-wide. Each application being added in Fedora must be checked to comply with the policies. Currently the policies are restricted to applications using GnuTLS and OpenSSL,
and rpmlint will warn when it detects that some action has to be taken; that detection is based on heuristics and limited to C programs, so manual inspection is recommended. Note however, that there are applications which intentionally set weaker, or custom settings on a purpose (e.g., postfix); those need not adhere to the policy. When in doubt, discuss with the [https://lists.fedoraproject.org/mailman/listinfo/security Fedora security team].
 
=== C/C++ applications ===


* '''OpenSSL applications''':  
* '''OpenSSL applications''':  
** ''If the application provides a configuration file'' that allows to modify the cipher list string, ensure that the shipped file contains "PROFILE=SYSTEM" as default. In that case no further action is required.  
** ''If the application provides a configuration file'' that allows to modify the cipher list string, ensure that the shipped file contains "PROFILE=SYSTEM" as default. In that case no further action is required.  
** ''If the application doesn't have a configuration file'', ensure that there is no default cipher list specified, or that the default list is set as "PROFILE=SYSTEM". That is, check the source code for SSL_CTX_set_cipher_list(). If it is not present then nothing needs to be done (the default is used). Otherwise, if that call is present and and provided a fixed string which does not contain PSK or SRP, replace the string with "PROFILE=SYSTEM", or remove the call.
** ''If the application doesn't have a configuration file'', ensure that there is no default cipher list specified, or that the default list is set as "PROFILE=SYSTEM". That is, check the source code for '''SSL_CTX_set_cipher_list'''(). If it is not present then nothing needs to be done (the default is used). Otherwise, if that call is present and provided a fixed string which does not contain PSK or SRP, replace the string with "PROFILE=SYSTEM", or remove the call.


{{admon/tip|Example|
{{admon/tip|Example|
Line 20: Line 23:
* '''GnuTLS applications''':  
* '''GnuTLS applications''':  
** ''If the application provides a configuration file'' that allows to modify the cipher priority string, the shipped file contains "@SYSTEM" as default. In that case no further action is required.  
** ''If the application provides a configuration file'' that allows to modify the cipher priority string, the shipped file contains "@SYSTEM" as default. In that case no further action is required.  
** ''If the application doesn't have a configuration file'', ensure that it uses gnutls_set_default_priority(), or that the default priority string is "@SYSTEM". That is, check the sourcec code for gnutls_priority_set_direct(), gnutls_priority_init(); if they are not present and gnutls_set_default_priority() is used, nothing needs to be done. Otherwise check the strings provided by the application. If it contains PSK or SRP do nothing (these applications are not currently covered by the default policy). If not, then replace gnutls_priority_set_direct() with gnutls_set_default_priority(). If gnutls_priority_init() is used instead with a fixed string, replace the string with "@SYSTEM".
** ''If the application doesn't have a configuration file'', ensure that it uses gnutls_set_default_priority(), or that the default priority string is "@SYSTEM". That is, check the source code for '''gnutls_priority_set_direct'''(), '''gnutls_priority_init'''(); if they are not present and gnutls_set_default_priority() is used, nothing needs to be done. Otherwise check the strings provided by the application. If it contains PSK or SRP do nothing (these applications are not currently covered by the default policy). If not, then replace gnutls_priority_set_direct() with gnutls_set_default_priority(). If gnutls_priority_init() is used instead with a fixed string, replace the string with "@SYSTEM".


{{admon/tip|Example|
{{admon/tip|Example|
Line 38: Line 41:
}}
}}


Note, that rpmlint will warn you when it detects that one of the above actions has to be taken.
Applications utilizing other cryptographic libraries do not adhere to the system wide crypto policies (note that adherence to the system-wide policies is work in progress for NSS libraries). Applications in Fedora should use one of these libraries when there is choice, and preferrably the version recommended by upstream.
 
=== Perl applications ===
 
* '''IO::Socket::SSL Perl applications''':
** Check the source code for passing '''SSL_cipher_list''' argument to '''IO::Socket::SSL''''s methods like '''new()''', '''start_SSL()''', '''new_from_fd()''', '''set_defaults()''',  '''set_client_defaults()''', and '''set_server_defaults()'''. If it is not present then nothing needs to be done (the default is used). Otherwise, if that argument is present, remove the argument or change its value as described in OpenSSL section.
 
{{admon/tip|Example|
<pre>
$socket = IO::Socket::SSL->new(PeerHost => $host, PeerPort => $port, SSL_cipher_list => 'HIGH:!aNULL:!eNULL:-RSA');
</pre>
 
should be replaced with
 
<pre>
$socket = IO::Socket::SSL->new(PeerHost => $host, PeerPort => $port, SSL_cipher_list => 'PROFILE=SYSTEM');
</pre>
}}
 
* '''Net::SSLeay Perl applications''':
** Check the source code for '''CTX_set_cipher_list()''', '''set_cipher_list()''', and '''set_pref_cipher()''' subroutine calls from '''Net::SSLeay''' name space. If such a call presents, follow instructions described in the OpenSSL section.
 
{{admon/tip|Example|
<pre>
Net::SSLeay::CTX_set_cipher_list($context, 'HIGH:!aNULL:!eNULL:-RSA');
</pre>
 
should be replaced with
 
<pre>
Net::SSLeay::CTX_set_cipher_list($context, 'PROFILE=SYSTEM');
</pre>
}}
 
* '''LWP::UserAgent Perl applications''':
** Check the source code for passing '''SSL_cipher_list''' argument to '''ssl_opts()''' method call on a '''LWP::UserAgent''' object. If such a call presents, follow instructions described in the OpenSSL section.
 
{{admon/tip|Example|
<pre>
my $ua = LWP::UserAgent->new;
$ua->ssl_opts(SSL_cipher_list => 'HIGH:!aNULL:!eNULL:-RSA');
</pre>


Applications utilizing other cryptographic libraries do not adhere to the system wide crypto policies (note that adherence to the system-wide policies is work in progress for NSS libraries). Applications in Fedora should use one of these libraries when there is choice, and preferrably the version recommended by upstream.
should be replaced with
 
<pre>
my $ua = LWP::UserAgent->new;
$ua->ssl_opts(SSL_cipher_list => 'PROFILE=SYSTEM');
</pre>
}}


[[Category:Packaging guidelines drafts]]
[[Category:Packaging guidelines drafts]]

Latest revision as of 19:26, 14 October 2016

Enforce system crypto policies

Since Fedora 21 (http://fedoraproject.org/wiki/Changes/CryptoPolicy) there are policies for the usage of SSL and TLS cryptographic protocols that are enforced system-wide. Each application being added in Fedora must be checked to comply with the policies. Currently the policies are restricted to applications using GnuTLS and OpenSSL, and rpmlint will warn when it detects that some action has to be taken; that detection is based on heuristics and limited to C programs, so manual inspection is recommended. Note however, that there are applications which intentionally set weaker, or custom settings on a purpose (e.g., postfix); those need not adhere to the policy. When in doubt, discuss with the Fedora security team.

C/C++ applications

  • OpenSSL applications:
    • If the application provides a configuration file that allows to modify the cipher list string, ensure that the shipped file contains "PROFILE=SYSTEM" as default. In that case no further action is required.
    • If the application doesn't have a configuration file, ensure that there is no default cipher list specified, or that the default list is set as "PROFILE=SYSTEM". That is, check the source code for SSL_CTX_set_cipher_list(). If it is not present then nothing needs to be done (the default is used). Otherwise, if that call is present and provided a fixed string which does not contain PSK or SRP, replace the string with "PROFILE=SYSTEM", or remove the call.
Idea.png
Example
SSL_CTX_set_cipher_list(vpninfo->https_ctx, "HIGH:!aNULL:!eNULL:-RSA");

should be replaced with

SSL_CTX_set_cipher_list(vpninfo->https_ctx, "PROFILE=SYSTEM");
  • GnuTLS applications:
    • If the application provides a configuration file that allows to modify the cipher priority string, the shipped file contains "@SYSTEM" as default. In that case no further action is required.
    • If the application doesn't have a configuration file, ensure that it uses gnutls_set_default_priority(), or that the default priority string is "@SYSTEM". That is, check the source code for gnutls_priority_set_direct(), gnutls_priority_init(); if they are not present and gnutls_set_default_priority() is used, nothing needs to be done. Otherwise check the strings provided by the application. If it contains PSK or SRP do nothing (these applications are not currently covered by the default policy). If not, then replace gnutls_priority_set_direct() with gnutls_set_default_priority(). If gnutls_priority_init() is used instead with a fixed string, replace the string with "@SYSTEM".
Idea.png
Example
err = gnutls_priority_set_direct (session, "NORMAL:-VERS-SSL3.0", NULL);

should be replaced with (preferred)

err = gnutls_set_default_priority (session);

or

err = gnutls_priority_set_direct (session, "@SYSTEM", NULL);

Applications utilizing other cryptographic libraries do not adhere to the system wide crypto policies (note that adherence to the system-wide policies is work in progress for NSS libraries). Applications in Fedora should use one of these libraries when there is choice, and preferrably the version recommended by upstream.

Perl applications

  • IO::Socket::SSL Perl applications:
    • Check the source code for passing SSL_cipher_list argument to IO::Socket::SSL's methods like new(), start_SSL(), new_from_fd(), set_defaults(), set_client_defaults(), and set_server_defaults(). If it is not present then nothing needs to be done (the default is used). Otherwise, if that argument is present, remove the argument or change its value as described in OpenSSL section.
Idea.png
Example
$socket = IO::Socket::SSL->new(PeerHost => $host, PeerPort => $port, SSL_cipher_list => 'HIGH:!aNULL:!eNULL:-RSA');

should be replaced with

$socket = IO::Socket::SSL->new(PeerHost => $host, PeerPort => $port, SSL_cipher_list => 'PROFILE=SYSTEM');
  • Net::SSLeay Perl applications:
    • Check the source code for CTX_set_cipher_list(), set_cipher_list(), and set_pref_cipher() subroutine calls from Net::SSLeay name space. If such a call presents, follow instructions described in the OpenSSL section.
Idea.png
Example
Net::SSLeay::CTX_set_cipher_list($context, 'HIGH:!aNULL:!eNULL:-RSA');

should be replaced with

Net::SSLeay::CTX_set_cipher_list($context, 'PROFILE=SYSTEM');
  • LWP::UserAgent Perl applications:
    • Check the source code for passing SSL_cipher_list argument to ssl_opts() method call on a LWP::UserAgent object. If such a call presents, follow instructions described in the OpenSSL section.
Idea.png
Example
my $ua = LWP::UserAgent->new;
$ua->ssl_opts(SSL_cipher_list => 'HIGH:!aNULL:!eNULL:-RSA');

should be replaced with

my $ua = LWP::UserAgent->new;
$ua->ssl_opts(SSL_cipher_list => 'PROFILE=SYSTEM');