RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2106940 - FIPS breaks pdftopdf and bannertopdf
Summary: FIPS breaks pdftopdf and bannertopdf
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: qpdf
Version: 9.0
Hardware: x86_64
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Zdenek Dohnal
QA Contact: Petr Dancak
URL:
Whiteboard:
Depends On:
Blocks: 2107478
TreeView+ depends on / blocked
 
Reported: 2022-07-13 22:32 UTC by Bryan Mason
Modified: 2022-11-15 11:43 UTC (History)
4 users (show)

Fixed In Version: qpdf-10.3.1-6.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2107478 (view as bug list)
Environment:
Last Closed: 2022-11-15 10:36:02 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pdancak: needinfo+
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-127640 0 None None None 2022-07-13 22:35:52 UTC
Red Hat Knowledge Base (Solution) 6967614 0 None None None 2022-07-14 18:37:15 UTC
Red Hat Product Errata RHBA-2022:8200 0 None None None 2022-11-15 10:36:07 UTC

Description Bryan Mason 2022-07-13 22:32:56 UTC
Description of problem:

  After making RHEL 9 FIPS compliant, printing breaks.
  The pdftopdf and bannertopdf filters use QPDFWriter, which
  results in a call to 

    gnutls_hash_init(&this->hash_ctx, GNUTLS_DIG_MD5)

  which fails because FIPS doesn't allow MD5.

  Not sure if this is something that needs to be addressed
  in pdftopdf/bannertopdf (cups-filters) or libqpdf (qpdf).
  I thought I'd file the bug against cups-filters and it
  can be moved if needed.
  
Version-Release number of selected component (if applicable):

  cups-filters-1.28.7-10.el9.x86_64
  qpdf-libs-10.3.1-4.el9.x86_64

How reproducible:

  100%

Steps to Reproduce:

  1. fips-mode-setup --enable
  2. /usr/lib/cups/filter/pdftopdf 1 user title 1 "" /usr/share/cups/data/default-testpage.pdf > /dev/null
  3. /usr/lib/cups/filter/bannertopdf 1 user title 1 "" /usr/share/cups/data/testprint > /dev/null

Actual results:

  # /usr/lib/cups/filter/pdftopdf 1 user title 1 "" /usr/share/cups/data/default-testpage.pdf > /dev/null
  DEBUG: pdftopdf: No PPD file specified, could not determine whether to log pages or not, so turned off page logging. 
  DEBUG: PDF interactive form and annotation flattening done via QPDF
  ERROR: Exception: gnutls: MD5 error: An algorithm that is not enabled was negotiated.

  #  /usr/lib/cups/filter/bannertopdf 1 user title 1 "" /usr/share/cups/data/testprint > /dev/null
  DEBUG: Could not open PPD file '(null)'
  DEBUG: PDF template file doesn't have form. It's okay.
  terminate called after throwing an instance of 'std::runtime_error'
    what():  gnutls: MD5 error: An algorithm that is not enabled was negotiated.
  Aborted (core dumped)

Expected results:

  No errors.
  Printing with FIPS enabled should work

Additional info:

  Some backtraces:

  [root@sf03264105 ~]# gdb /usr/lib/cups/filter/bannertopdf 
  (gdb) set args 1 user title 1 '' /usr/share/cups/data/testprint
  (gdb) run
  Starting program: /usr/lib/cups/filter/bannertopdf 1 user title 1 '' /usr/share/cups/data/testprint

  Program received signal SIGABRT, Aborted.
  0x00007ffff79fb42c in __pthread_kill_implementation () from /lib64/libc.so.6
  (gdb) bt
  #0  0x00007ffff79fb42c in __pthread_kill_implementation () from /lib64/libc.so.6
  #1  0x00007ffff79aed06 in raise () from /lib64/libc.so.6
  #2  0x00007ffff79817d3 in abort () from /lib64/libc.so.6
  #3  0x00007ffff7c1ba01 in __gnu_cxx::__verbose_terminate_handler() [clone .cold] () from /lib64/libstdc++.so.6
  #4  0x00007ffff7c2735c in __cxxabiv1::__terminate(void (*)()) () from /lib64/libstdc++.so.6
  #5  0x00007ffff7c273c7 in std::terminate() () from /lib64/libstdc++.so.6
  #6  0x00007ffff7c27669 in __cxa_throw () from /lib64/libstdc++.so.6
  #7  0x00007ffff7debcf4 in QPDFCrypto_gnutls::MD5_init() [clone .cold] () from /lib64/libqpdf.so.28
  #8  0x00007ffff7df42f1 in MD5::MD5() () from /lib64/libqpdf.so.28
  #9  0x00007ffff7e80529 in QPDF::compute_data_key(std::__cxx11::basic_string<char, std::char_traits<char>,
      std::allocator<char> > const&, int, int, bool, int, int) () from /lib64/libqpdf.so.28
  #10 0x00007ffff7e6649d in QPDFWriter::setDataKey(int) () from /lib64/libqpdf.so.28
  #11 0x00007ffff7e6c446 in QPDFWriter::writeObject(QPDFObjectHandle, int) () from /lib64/libqpdf.so.28
  #12 0x00007ffff7e77dba in QPDFWriter::write() () from /lib64/libqpdf.so.28
  #13 0x000055555555cc83 in pdf_write (file=<optimized out>, pdf=0x55555556c640) at filter/pdf.cxx:352
  #14 generate_banner_pdf (banner=<optimized out>, ppd=<optimized out>, jobid=0x7fffffffe1c0 "\001", 
      user=<optimized out>, jobtitle=0x7fffffffe160 "\001SVUUU", noptions=<optimized out>, options=0x7fffffffe3d0)
      at filter/bannertopdf.c:516
  #15 0x000055555555858b in main (argc=<optimized out>, argv=0x7fffffffe538) at filter/bannertopdf.c:563

  [root@sf03264105 ~]# gdb /usr/lib/cups/filter/pdftopdf
  (gdb) set args 1 user title 1 "" /usr/share/cups/data/default-testpage.pdf
  (gdb) break QPDFCrypto_gnutls::MD5_init
  Breakpoint 1 at 0x7ffff7e8ac6a (2 locations)

  (gdb) run
  
  Breakpoint 1, 0x00007ffff7f588c0 in QPDFCrypto_gnutls::MD5_init() () from /lib64/libqpdf.so.28
  (gdb) bt
  #0  0x00007ffff7f588c0 in QPDFCrypto_gnutls::MD5_init() () from /lib64/libqpdf.so.28
  #1  0x00007ffff7e932f1 in MD5::MD5() () from /lib64/libqpdf.so.28
  #2  0x00007ffff7f1f529 in QPDF::compute_data_key(std::__cxx11::basic_string<char, std::char_traits<char>,
      std::allocator<char> > const&, int, int, bool, int, int) () from /lib64/libqpdf.so.28
  #3  0x00007ffff7f0549d in QPDFWriter::setDataKey(int) () from /lib64/libqpdf.so.28
  #4  0x00007ffff7f0b446 in QPDFWriter::writeObject(QPDFObjectHandle, int) () from /lib64/libqpdf.so.28
  #5  0x00007ffff7f16dba in QPDFWriter::write() () from /lib64/libqpdf.so.28
  #6  0x00005555555691e1 in QPDF_PDFTOPDF_Processor::emitFilename (this=<optimized out>, name=<optimized out>)
      at filter/pdftopdf/qpdf_pdftopdf_processor.cc:743
  #7  0x000055555555e23e in main (argc=<optimized out>, argv=<optimized out>) at filter/pdftopdf/pdftopdf.cc:1310

  I think the code that generates the actual error is here in libqpdf/QPDFCrypto_gnutls.cc:

  44 void
  45 QPDFCrypto_gnutls::MD5_init()
  46 {
  47     MD5_finalize();
  48     int code = gnutls_hash_init(&this->hash_ctx, GNUTLS_DIG_MD5);
  49     if (code < 0)
  50     {
  51         this->hash_ctx = nullptr;
  52         throw std::runtime_error(
  53             std::string("gnutls: MD5 error: ") +
  54             std::string(gnutls_strerror(code)));
  55     }
  56 }

Comment 1 Zdenek Dohnal 2022-07-14 07:47:05 UTC
Hi Bryan,

thank you for reporting the issue!

I can reproduce the problem in 1minutetip machine, so I can deep into debugging immediately.

Both files passed into filters are unencrypted and pdftopdf turns off the file's encryption if needed (which is not our case), so any MD5 encryption defined by PDF standard should not be used, and other MD5 usages have been covered in qpdf by relaxing gnutls... so I'm not sure why it is blocked now (unless gnutls changed the policy...).

Comment 20 errata-xmlrpc 2022-11-15 10:36:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (qpdf bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8200


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