Bug 1156313 - patch to account for F21 crypto policies
Summary: patch to account for F21 crypto policies
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rpmlint
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: fedora-crypto-policies
TreeView+ depends on / blocked
 
Reported: 2014-10-24 07:28 UTC by Nikos Mavrogiannopoulos
Modified: 2015-10-26 13:19 UTC (History)
10 users (show)

Fixed In Version: rpmlint-1.8-1.fc23 rpmlint-1.8-2.fc22 rpmlint-1.8-2.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-10-05 21:53:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
a patch on upstream rpmlint (4.11 KB, application/mbox)
2014-10-24 07:28 UTC, Nikos Mavrogiannopoulos
no flags Details
A complete patch for fedora package (5.59 KB, application/mbox)
2014-10-29 12:48 UTC, Nikos Mavrogiannopoulos
no flags Details
generalized previous patch (5.04 KB, patch)
2014-11-24 09:17 UTC, Nikos Mavrogiannopoulos
no flags Details | Diff
generalised version of C call blacklisting (6.45 KB, patch)
2015-07-30 18:21 UTC, Hubert Kario
no flags Details | Diff
non-squashed version of attachment 1057800 (4.13 KB, application/x-gzip)
2015-07-30 18:24 UTC, Hubert Kario
no flags Details

Description Nikos Mavrogiannopoulos 2014-10-24 07:28:58 UTC
Created attachment 950245 [details]
a patch on upstream rpmlint

Description of problem:
In Fedora 21 crypto policies was introduced [0]. The attached patch allows to warn the maintainer of potential actions he needs to do. That is in accordance to recommendation from FPC: https://fedorahosted.org/fpc/ticket/452

The temporary descriptive URL is:
https://fedoraproject.org/wiki/User:Nmav/CryptoPolicies

[0]. http://fedoraproject.org/wiki/Changes/CryptoPolicy

Comment 1 Nikos Mavrogiannopoulos 2014-10-29 12:48:37 UTC
Created attachment 951768 [details]
A complete patch for fedora package

The new patch applies to the fedora git repository for rpmlint.

Comment 2 Tom "spot" Callaway 2014-11-05 16:43:04 UTC
Ville, what do you think about this change? I don't really want to be carrying a Fedora-only patch if I can avoid it.

Comment 3 Nikos Mavrogiannopoulos 2014-11-06 09:19:17 UTC
Suggestions how to make the patch non-Fedora-only are welcome. The policy it enforces is Fedora only.

Comment 4 Ville Skyttä 2014-11-06 10:57:34 UTC
Could you elaborate which part specifically of this is Fedora only? At least there is a reference Fedora docs in the description, that should probably be dropped. Does for example the crypto_param_regex need to be made configurable?

BTW I'm not a big fan of the additional "strings" call. Would it be possible to extract this information from output of some of the existing calls? Or turn it the other way around so that if crypto calls are found, *then* check for crypto params instead of doing it eagerly and doing nothing with it in the vast majority of cases.

Comment 5 Nikos Mavrogiannopoulos 2014-11-06 12:54:34 UTC
(In reply to Ville Skyttä from comment #4)
> Could you elaborate which part specifically of this is Fedora only? At least
> there is a reference Fedora docs in the description, that should probably be
> dropped. Does for example the crypto_param_regex need to be made
> configurable?

I'm not sure I understand the question. The policy this patch implements is fedora-specific, thus the whole patch is fedora specific.

> BTW I'm not a big fan of the additional "strings" call. Would it be possible
> to extract this information from output of some of the existing calls? Or
> turn it the other way around so that if crypto calls are found, *then* check
> for crypto params instead of doing it eagerly and doing nothing with it in
> the vast majority of cases.

I'm also not a fan of it, but as far as I understand it is mandated by the current design which splits the BinaryInfo from the BinaryCheck. If you have some proposal on how to achieve the functionality you propose I'd be very interested.

Comment 6 Ville Skyttä 2014-11-06 13:22:10 UTC
(In reply to Nikos Mavrogiannopoulos from comment #5)
> I'm not sure I understand the question. The policy this patch implements is
> fedora-specific, thus the whole patch is fedora specific.

What exactly about the policy is Fedora specific? For example are the PROFILE=SYSTEM and @SYSTEM names Fedora specific or available generally in openssl/gnutls setups on non-Fedora as well?

One thought off the cuff is: make the crypto param names configurable (default to empty list) and construct crypto_param_regex from them; if the list is empty then the whole check is disabled, otherwise it gets run.

(Will postpone looking into the strings invocation stuff more closely, will revisit if we can solve the above general hurdle first wrt upstreaming.)

Comment 7 Nikos Mavrogiannopoulos 2014-11-06 13:48:36 UTC
(In reply to Ville Skyttä from comment #6)
> (In reply to Nikos Mavrogiannopoulos from comment #5)
> > I'm not sure I understand the question. The policy this patch implements is
> > fedora-specific, thus the whole patch is fedora specific.
> 
> What exactly about the policy is Fedora specific? For example are the
> PROFILE=SYSTEM and @SYSTEM names Fedora specific or available generally in
> openssl/gnutls setups on non-Fedora as well?

They are fedora-specific.

Comment 8 Ville Skyttä 2014-11-07 06:53:35 UTC
In that case I'd say the "off the cuff" thought from comment 6 applies -- if you want to upstream this, create an upstream patch along those lines: config value for crypto params as list or a ready made regex (see "config" distributed with rpmlint for examples) and leave the default value as None/empty list (--> empty disables this check) and remove the Fedora reference from the message description, then configure PROFILE=SYSTEM and @SYSTEM crypto params in the Fedora rpmlint package's config.

Comment 9 Nikos Mavrogiannopoulos 2014-11-07 08:14:52 UTC
(In reply to Ville Skyttä from comment #8)
> In that case I'd say the "off the cuff" thought from comment 6 applies -- if
> you want to upstream this, create an upstream patch along those lines:
> config value for crypto params as list or a ready made regex (see "config"
> distributed with rpmlint for examples) and leave the default value as
> None/empty list (--> empty disables this check) and remove the Fedora
> reference from the message description, then configure PROFILE=SYSTEM and
> @SYSTEM crypto params in the Fedora rpmlint package's config.

I believe I'm misunderstood. I don't care if that is going upstream. I was asked by the FPC to make an rpmlint check for fedora, and that's what I attach here. If you want to send it upstream I'd be glad to help, but I have no time to spend discussing the issue with upstream and how they'd like it to be included.

Comment 10 Ville Skyttä 2014-11-07 08:18:16 UTC
I am upstream and my opinion was asked in comment 2. I hope I've made it clear now.

Comment 11 Nikos Mavrogiannopoulos 2014-11-07 08:20:56 UTC
(In reply to Ville Skyttä from comment #10)
> I am upstream and my opinion was asked in comment 2. I hope I've made it
> clear now.

Ok that makes that clear, sorry. I'll add the change to my todo list.

Comment 12 Nikos Mavrogiannopoulos 2014-11-24 09:17:11 UTC
Created attachment 960621 [details]
generalized previous patch

This patch generalizes the previous one. The previous behaviour can be restored by a configuration file containing the following:

setOption("WarnOnFunctions", ['SSL_CTX_set_cipher_list','gnutls_priority_set_direct','gnutls_priority_init'])
setOption("WarnOnFunctionsExceptIfStringIsPresent", '(^PROFILE=SYSTEM$|^@SYSTEM$)')
setOption("WarnOnFunctionsInfo", 'bin-may-not-adhere-to-system-wide-crypto-policy')

addDetails(
'bin-may-not-adhere-to-system-wide-crypto-policy',
'''This application package calls a function to explicitly set crypto ciphers or
SSL/TLS. That may not use the default crypto policy and should be modified in
accordance to: https://fedoraproject.org/wiki/Packaging:CryptoPolicies
''')

Comment 13 Nikos Mavrogiannopoulos 2014-12-12 07:33:47 UTC
Tom, can we move forward to having that change in F21 on way or another? It is now an official policy and would be best if rpmlint would help enforce the policies.

Comment 14 Ville Skyttä 2014-12-21 11:25:58 UTC
WarnOnFunctions and *ExceptIfStringIsPresent should be grouped so that an exception maps to a specific set of functions and not to everything. For example in addition to stuff in the patch's sample config one might want to flag calls for foo() no matter what strings are present and the crypto ones shouldn't affect it. Also, the message identifiers and their details should be specific for a set of functions, not to everything. For example WarnOnFunction could be a modifiable sequence of function-sequence, exception-filter, message-id, detail sequences (empty by default) that could be appended to in configs like this:

getOption("WarnOnFunctions").append(
    (('SSL_CTX_set_cipher_list',
      'gnutls_priority_set_direct',
      'gnutls_priority_init'),
     '(^PROFILE=SYSTEM$|^@SYSTEM$)',
     'bin-may-not-adhere-to-system-wide-crypto-policy',
     '...detail for the crypto policy message goes here...'))
getOption("WarnOnFunctions").append(
    (('foo'),
     None,
     'bin-calls-foo',
     'Calling foo is a no-no!'))

Comment 15 Tom "spot" Callaway 2015-01-05 21:30:56 UTC
Ville's suggestions seem on target. I want to get the framework for this change into upstream rpmlint, and not have to carry it as a patch in Fedora forever. Having a custom Fedora config to throw errors/warnings on this condition is fine, but a custom patch that upstream will not take is not.

Comment 16 Nikos Mavrogiannopoulos 2015-01-06 12:15:22 UTC
(In reply to Ville Skyttä from comment #14)
> WarnOnFunctions and *ExceptIfStringIsPresent should be grouped so that an
> exception maps to a specific set of functions and not to everything. For
> example in addition to stuff in the patch's sample config one might want to
> flag calls for foo() no matter what strings are present and the crypto ones
> shouldn't affect it. Also, the message identifiers and their details should
> be specific for a set of functions, not to everything. For example
> WarnOnFunction could be a modifiable sequence of function-sequence,
> exception-filter, message-id, detail sequences (empty by default) that could
> be appended to in configs like this:

Sorry but I have no idea how to do that. If you have some example code for that I could work on it.

Comment 17 Nikos Mavrogiannopoulos 2015-01-06 17:01:23 UTC
(In reply to Tom "spot" Callaway from comment #15)
> Ville's suggestions seem on target. I want to get the framework for this
> change into upstream rpmlint, and not have to carry it as a patch in Fedora
> forever. Having a custom Fedora config to throw errors/warnings on this
> condition is fine, but a custom patch that upstream will not take is not.

I don't disagree, but I don't have the python knowlege to achieve that. If you or any other maintainer is interested to complete that, please step up.

Comment 19 Michael Catanzaro 2015-03-23 10:53:15 UTC
(Aside: You probably also want to check for glib applications that set the environment variable G_TLS_GNUTLS_PRIORITY.)

Comment 20 Hubert Kario 2015-07-30 18:21:44 UTC
Created attachment 1057800 [details]
generalised version of C call blacklisting

Version of the patch that follows suggestions from Comment #4 and Comment #14 (although I've used a dictionary, not a tuple or list)

Comment 21 Hubert Kario 2015-07-30 18:24:36 UTC
Created attachment 1057802 [details]
non-squashed version of attachment 1057800 [details]

this is just to explain my reasoning between particular changes in the patch

Comment 22 Hubert Kario 2015-07-30 18:26:18 UTC
Ville, could you take a look at attachment 1057800 [details]?

Comment 23 Michael S. 2015-07-31 13:44:17 UTC
Now that rpmlint moved to github, and after Hubert asked me to review the patch, wouldn't it be easier to have it in a PR there ?

Also, line 158/159, it would be more pythonic to use iteritems

I am also not sure that the try/except need to be so large on line 186 ( since that's just for 1 call ), and I think it would be better to just verify if waiver_regex exist before search rather than a try/except.

Comment 24 Hubert Kario 2015-07-31 14:59:39 UTC
(In reply to Michael Scherer from comment #23)
> Now that rpmlint moved to github, and after Hubert asked me to review the
> patch, wouldn't it be easier to have it in a PR there ?
> 
> Also, line 158/159, it would be more pythonic to use iteritems

will do

> I am also not sure that the try/except need to be so large on line 186 (
> since that's just for 1 call ), and I think it would be better to just
> verify if waiver_regex exist before search rather than a try/except.

I've put try/except as "ask forgiveness not permission" is more pythonic, but I have no strong feelings either way. The try is so large because it makes it a bit more readable than putting the rest of lines into "else" clause of "try", IMHO

Comment 25 Hubert Kario 2015-07-31 15:49:06 UTC
PR with changes from comment #23 created here: https://github.com/rpm-software-management/rpmlint/pull/48

this makes the attachment 1057800 [details] and attachment 1057802 [details] obsolete

Comment 26 Nikos Mavrogiannopoulos 2015-09-02 09:12:37 UTC
Tom can we schedule this for F24 irrespective of upstream? It is taking too long, and our policies depend on that change. In any case that would be a good test for the upstream functionality.

Comment 27 Ville Skyttä 2015-09-05 05:54:31 UTC
Please continue the upstream patch review/discussion @github, I've just posted some comments there.

Comment 28 Ville Skyttä 2015-09-05 05:56:28 UTC
Damn Bugzilla. Resetting spot's needinfo for comment 26.

Comment 29 Tom "spot" Callaway 2015-09-11 16:35:47 UTC
Given that upstream is active in this process and interested in this change, I'd really rather wait for them to merge it. I don't mind carrying a patch _after_ they merge it instead of waiting for a new release.

Comment 30 Hubert Kario 2015-09-17 12:58:53 UTC
https://github.com/rpm-software-management/rpmlint/pull/48 was merged

Tom, can you backport it?

Comment 31 Ville Skyttä 2015-09-18 13:53:31 UTC
(In reply to Hubert Kario from comment #30)
> Tom, can you backport it?

No need, I just tagged release 1.8.

Comment 32 Fedora Update System 2015-09-25 18:05:40 UTC
rpmlint-1.8-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-6c7d8111f9

Comment 33 Fedora Update System 2015-09-25 18:05:51 UTC
rpmlint-1.8-1.fc21 has been submitted as an update to Fedora 21. https://bodhi.fedoraproject.org/updates/FEDORA-2015-8fa7f53497

Comment 34 Fedora Update System 2015-09-27 00:37:24 UTC
rpmlint-1.8-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update rpmlint'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-6c7d8111f9

Comment 35 Fedora Update System 2015-09-27 00:54:36 UTC
rpmlint-1.8-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update rpmlint'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-8c4e0f236f

Comment 36 Fedora Update System 2015-09-27 02:21:47 UTC
rpmlint-1.8-1.fc21 has been pushed to the Fedora 21 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update rpmlint'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-8fa7f53497

Comment 37 Fedora Update System 2015-09-28 15:01:22 UTC
rpmlint-1.8-2.fc21 has been submitted as an update to Fedora 21. https://bodhi.fedoraproject.org/updates/FEDORA-2015-8fa7f53497

Comment 38 Fedora Update System 2015-09-28 15:04:19 UTC
rpmlint-1.8-2.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-b00be42cfd

Comment 39 Fedora Update System 2015-09-29 04:50:30 UTC
rpmlint-1.8-2.fc21 has been pushed to the Fedora 21 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update rpmlint'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-8fa7f53497

Comment 40 Fedora Update System 2015-10-01 16:01:13 UTC
rpmlint-1.8-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 41 Fedora Update System 2015-10-02 03:48:40 UTC
rpmlint-1.8-2.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update rpmlint'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-b00be42cfd

Comment 42 Fedora Update System 2015-10-05 21:53:43 UTC
rpmlint-1.8-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 43 Fedora Update System 2015-10-26 13:19:42 UTC
rpmlint-1.8-2.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.