<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>102587</bug_id>
          
          <creation_ts>2005-08-15 03:30 0000</creation_ts>
          <short_desc>dev-libs/apr depends on /dev/random instead of /dev/urandom</short_desc>
          <delta_ts>2007-08-10 01:21:20 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Ebuilds</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>pylon@gentoo.org</reporter>
          <assigned_to>vericgar@gentoo.org</assigned_to>
          <cc>akihana@gmail.com</cc>
    
    <cc>akopa@charter.net</cc>
    
    <cc>alchemyx@uznam.net.pl</cc>
    
    <cc>apache-bugs@gentoo.org</cc>
    
    <cc>elfarto@gmail.com</cc>
    
    <cc>federico@serversidestudio.it</cc>
    
    <cc>jakub@gentoo.org</cc>
    
    <cc>simishag@gmail.com</cc>

      

      
          <long_desc isprivate="0">
            <who>pylon@gentoo.org</who>
            <bug_when>2005-08-15 03:30:37 0000</bug_when>
            <thetext>I had a problem with creating new subversion repositories on lark.  It turned
out that /dev/random didn&apos;t produced new random any more.  Somehow there was too
few entropy.

The problem is that dev-libs/apr are built with /dev/random-support.  But in
most cases it should be okay to build with /dev/urandom-support.  Therefore the
ebuild needed to be changed.  Probably /dev/urandom should become default or
make it a use-flag.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>trapni@gentoo.org</who>
            <bug_when>2005-08-15 07:14:17 0000</bug_when>
            <thetext>I vote for /dev/urandom; 
 
any objections? chipig/hollow/stuart/kloeri/...? </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vericgar@gentoo.org</who>
            <bug_when>2005-08-15 16:59:23 0000</bug_when>
            <thetext>I&apos;m for /dev/urandom. I&apos;ve run into this issue myself and had to find ways to
get more entropy for /dev/random.

Though the downside is that /dev/urandom is more predictable. Maybe this could
be controlled by a use-flag?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>trapni@gentoo.org</who>
            <bug_when>2005-08-15 19:14:37 0000</bug_when>
            <thetext>would be an alternative, and, at least _better_ than leaving as-is 
 
cyrus-sasl already has a local useflag &quot;urandom&quot; we might us there as well, in 
case we decide for the `useq erandom` solution </thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>simishag@gmail.com</who>
            <bug_when>2005-08-24 12:28:03 0000</bug_when>
            <thetext>Created an attachment (id=66784)
patch to use urandom instead of random

Please merge this ASAP.  The use of /dev/random causes serious headaches with
Apache.  The Apache ebuilds use /dev/urandom anyway.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>simishag@gmail.com</who>
            <bug_when>2005-08-25 09:55:32 0000</bug_when>
            <thetext>Created an attachment (id=66877)
patch to allow selection of random device

Adds a USE flag &quot;no-urandom&quot;.  Default is to use /dev/urandom to avoid blocking
Apache on startup.  USE=&quot;no-urandom&quot; will change that to /dev/random, which is
cryptographically better but can cause problems.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vericgar@gentoo.org</who>
            <bug_when>2005-09-14 18:13:53 0000</bug_when>
            <thetext>I&apos;ll look into a fix for this Friday night.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vericgar@gentoo.org</who>
            <bug_when>2005-09-17 17:13:00 0000</bug_when>
            <thetext>I&apos;ve added a USE-flag, urandom (because we don&apos;t like no-* USE-flags, and
because another package already uses the same flag) that when enabled will use
/dev/urandom instead of /dev/random. The new ebuild is apr-0.9.6-r4. Please test
and see if it works for you.

Thanks!</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2005-09-21 15:18:17 0000</bug_when>
            <thetext>*** Bug 106834 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2005-09-27 14:34:40 0000</bug_when>
            <thetext>*** Bug 107449 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>seemant@gentoo.org</who>
            <bug_when>2005-10-03 12:01:20 0000</bug_when>
            <thetext>I just experienced apache hanging for 12 minutes while restarting for generating
digest stuff.  sys-apps/rng-tools I installed at Marquel (#gentoo-apache)
suggestion and that caused apache2 to start up immediately.  I&apos;ve seen this
behaviour for quite a while, but today was the longest period that it did not
fully start.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vericgar@gentoo.org</who>
            <bug_when>2005-10-03 18:33:42 0000</bug_when>
            <thetext>seemant: if you can reproduce the waiting, can you look at /proc/&lt;processID&gt;/fd/
and see which random device it&apos;s blocking on? Adding urandom to USE for
dev-libs/apr (and using apr-0.9.6-r4, which isn&apos;t in arch yet, just ~arch) and
recompiling apr, apr-util, apache, and any modules you have should make it use
/dev/urandom instead of /dev/random. (On a side note, I do not know if you need
to recompile all of that, or just apr, best to be safe and do it all)

Also, as a workaround, you can remove the line for auth_digest_module from
httpd.conf - most people don&apos;t use that digest method.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2005-10-07 15:22:42 0000</bug_when>
            <thetext>This simply does not work w/ apache. I had to emerge emerge sys-apps/clrngd to
work around this bug because I need digest authentication.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vericgar@gentoo.org</who>
            <bug_when>2005-10-07 19:12:00 0000</bug_when>
            <thetext>It does work for me, and I did an strace to verify it (it&apos;s reading /dev/urandom) 

For those of you that it isn&apos;t working, please run an strace and see what random
device it&apos;s using. If it&apos;s still using the wrong device, please rebuild the
entire stack, after verifying that you have the urandom USE-flag set. The stack
includes dev-libs/apr-0.9.6-r4 (currently ~arch) dev-libs/apr-util, and
net-www/apache.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vericgar@gentoo.org</who>
            <bug_when>2005-10-22 20:22:25 0000</bug_when>
            <thetext>I haven&apos;t heard any other feedback on this, I can&apos;t reproduce it not working. If
anyone else can reproduce it after rebuilding thier apache stack, please reopen
this bug.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2005-11-22 13:07:31 0000</bug_when>
            <thetext>*** Bug 113284 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>federico@serversidestudio.it</who>
            <bug_when>2006-02-07 08:14:03 0000</bug_when>
            <thetext>While the urandom flag is useful, it does not solve the problem at all, because
it&apos;s not on by default and most users are not aware of the whole issue, first.
We just got caught by this same problem because you leave /dev/random on by
default nor you ewarn advice about risks.
The point of no-urandom use flag, as requested before, is that it makes /dev/urandom default. Even if it&apos;s not elegant, the other way is leaving us
with a &quot;broken&quot; installation, which may stop working without users doing something
wrong and using absolutely common sense default configuration.
Even net-www/apache itself defaults to urandom, period. How many have to waste time down the same painful way leading to strace before it&apos;s worth an indoubtely unelegant but working solution?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>vericgar@gentoo.org</who>
            <bug_when>2006-02-07 15:47:49 0000</bug_when>
            <thetext>This is a *corner* case, specific to gentoo, probably specific to one or two certain kernel lines. Gentoo is not in the practice of making things less secure because a minority amount of users have a problem with thier kernel - a problem that can be worked around in much better ways then using /dev/urandom. There are entropy deamons out there that help /dev/random fill - that is the solutions most users should use.

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>federico@serversidestudio.it</who>
            <bug_when>2006-02-08 01:48:05 0000</bug_when>
            <thetext>(In reply to comment #17)
&gt; This is a *corner* case, specific to gentoo, probably specific to one or two

This is a common case, well documented, which is going to happen to almost everyone running a server without taking extra steps. Did you care to search the gentoo forums, there are at least 5 posts about this issue with apache. 


&gt; certain kernel lines. Gentoo is not in the practice of making things less
&gt; secure because a minority amount of users have a problem with thier kernel - a

Gentoo, as any other distro out there, is in the practice of giving working
things and &quot;then&quot; make sure they&apos;re secure, and that&apos;s what the vast majority
of developers do. urandom may not be the safest solution but it&apos;s usually enough and it does always work. evidence can be found just grepping around:

GLSA from /usr/portage/metadata/glsa/glsa-200311-01.xml:
Secondly, KDM uses a weak cookie generation algorithm.  Users are advised to upgrade to KDE 3.1.4, which uses /dev/urandom as a non-predictable source of entropy to improve security.

-Qmail from /usr/portage/mail-mta/qmail/files/mkservercert:
dd if=/dev/urandom of=${randfile} bs=64 count=1 2&gt;/dev/null

-Bind from /usr/portage/net-dns/bind/bind-9.3.2.ebuild:
einfo &quot;Using /dev/urandom for generating rndc.key&quot;
/usr/sbin/rndc-confgen -r /dev/urandom -a -u named

-Pdns from /usr/portage/net-dns/pdnsd/pdnsd-1.2.3.ebuild:
[ -c /dev/urandom ] &amp;&amp; myconf=&quot;${myconf} --with-random-device=/dev/urandom&quot;

-Openldap from /usr/net-nds/openldap/files/gencert.sh-2.2.27:
dd if=/dev/urandom of=$randfile count=1 2&gt;/dev/null

-Mod_ssl from /usr/portage/net-www/apache/files/2.0.49/40_mod_ssl.conf:
This means you then cannot use the /dev/random device because it would lead to very long connection times (as long as it requires to make more entropy available). But usually those platforms additionally provide a /dev/urandom device which doesn&apos;t block. So, if available, use this one instead. Read the mod_ssl User Manual for more details.

-Apache ebuild from /usr/portage/net-www/apache/apache-2.0.54-r31.ebuild:
 --with-devrandom=/dev/urandom \

-Courier IMAP from /usr/portage/net-mail/courier-imap/files/mkpop3dcert:
dd if=/dev/urandom of=$randfile count=1 2&gt;/dev/null

-Various VNC from /usr/portage/net-misc/vnc/files/vnc-4.0/vnc-cookie.patch:
PID and part of the encrypted form of the password.  Ideally we&apos;d use /dev/urandom, but that&apos;s only available on Linux.
from /usr/portage/net-misc/tightvnc/files/tightvnc-1.3_alpha7-gentoo.security.patch:
PID and part of the encrypted form of the password.  Ideally we&apos;d use /dev/urandom, but that&apos;s only available on Linux.

-Gentoo BaseLayout from /usr/portage/sys-fs/cryptsetup/files/cryptfs.confd:
If no options are given, they will default to: -c aes -h sha1 -d /dev/urandom

-Ssp security patch in the hardened profile silently falls back to urandom if erandom is not there, it doesn&apos;t die refusing to use an unsafe randomness:
     * Attempt to open kernel pseudo random device if one exists before
     * opening urandom to avoid system entropy depletion.

And there are more. Even &quot;safe&quot; rng-tools which you suggest as the best
solution fall back to urandom if no hardware random generator is there
(and they are NOT there unless you know how to and do customize your kernel),
because the mantainer listened users and understood the issue:
BUG http://bugs.gentoo.org/show_bug.cgi?id=47107
and from /usr/portage/sys-apps/rng-tools/files/rngd:
start-stop-daemon --start --quiet --exec /usr/sbin/rngd -- -b -r /dev/urandom

Then there&apos;s &quot;the majority&quot; who prefer the approach you took...
grep urandom /usr/portage/profiles/use.*
/usr/portage/profiles/use.local.desc:dev-libs/apr:urandom - Use /dev/urandom instead of /dev/random
/usr/portage/profiles/use.local.desc:dev-libs/cyrus-sasl:urandom - Use /dev/urandom instead of /dev/random
... that is you and cyrus-sasl

so, tell me that you like this way, ignore my rant, whatever but don&apos;t even try to make it look the way every gentoo dev would or should take.

&gt; problem that can be worked around in much better ways then using /dev/urandom.
&gt; There are entropy deamons out there that help /dev/random fill - that is the
&gt; solutions most users should use.
&gt; 
and yet ewarning about this fine solution is way too much work, i know.

Federico</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2006-07-30 04:09:14 0000</bug_when>
            <thetext>*** Bug 142089 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>akopa@charter.net</who>
            <bug_when>2006-07-30 08:00:44 0000</bug_when>
            <thetext>In reply to comment #18
After becomming the latest victim to this silent breakage, I concur with Federico Galassi sentiment that it is asinine to make /dev/random the default w/o at least a warning from the apr ebuild</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>patrick.allaert@gmail.com</who>
            <bug_when>2007-01-15 21:58:46 0000</bug_when>
            <thetext>Still really annoying and takes time to found first what&apos;s going wrong and then hitting this bug :(</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>jakub@gentoo.org</who>
            <bug_when>2007-08-09 06:37:53 0000</bug_when>
            <thetext>*** Bug 188195 has been marked as a duplicate of this bug. ***</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>66784</attachid>
            <date>2005-08-24 12:28 0000</date>
            <desc>patch to use urandom instead of random</desc>
            <filename>apr-patch.txt</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIGFwci0wLjkuNi1yMy5lYnVpbGQgMjAwNS0wNy0xMiAyMTozNTozMC4wMDAwMDAwMDAgLTA3
MDAKKysrIGFwci0wLjkuNi1yNC5lYnVpbGQgMjAwNS0wOC0yNCAxMjowNDozMC4wMDAwMDAwMDAg
LTA3MDAKQEAgLTI0LDcgKzI0LDcgQEAKICAgICAgICBteWNvbmY9IiR7bXljb25mfSAkKHVzZV9l
bmFibGUgaXB2NikiCiAgICAgICAgbXljb25mPSIke215Y29uZn0gLS1lbmFibGUtdGhyZWFkcyIK
ICAgICAgICBteWNvbmY9IiR7bXljb25mfSAtLWVuYWJsZS1ub25wb3J0YWJsZS1hdG9taWNzIgot
ICAgICAgIG15Y29uZj0iJHtteWNvbmZ9IC0td2l0aC1kZXZyYW5kb209L2Rldi9yYW5kb20iCisg
ICAgICAgbXljb25mPSIke215Y29uZn0gLS13aXRoLWRldnJhbmRvbT0vZGV2L3VyYW5kb20iCgog
ICAgICAgIGVjb25mICR7bXljb25mfSB8fCBkaWUKICAgICAgICBlbWFrZSB8fCBkaWUK
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>66877</attachid>
            <date>2005-08-25 09:55 0000</date>
            <desc>patch to allow selection of random device</desc>
            <filename>apr-patch2.txt</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIGFwci0wLjkuNi1yMy5lYnVpbGQJMjAwNS0wOC0yNSAwOTo0NToxMC4wMDAwMDAwMDAgLTA3
MDAKKysrIGFwci0wLjkuNi1yNC5lYnVpbGQJMjAwNS0wOC0yNSAwOTo0ODoyNy4wMDAwMDAwMDAg
LTA3MDAKQEAgLTExLDcgKzExLDcgQEAKIExJQ0VOU0U9IkFwYWNoZS0yLjAiCiBTTE9UPSIwIgog
S0VZV09SRFM9In5hbHBoYSB+YW1kNjQgfmFybSB+aHBwYSB+aWE2NCB+bWlwcyB+cHBjIH5wcGM2
NCB+czM5MCB+c3BhcmMgfng4NiIKLUlVU0U9ImlwdjYiCitJVVNFPSJpcHY2IG5vLXVyYW5kb20i
CiBSRVNUUklDVD0idGVzdCIKIAogREVQRU5EPSIiCkBAIC0yNCw3ICsyNCwxMyBAQAogCW15Y29u
Zj0iJHtteWNvbmZ9ICQodXNlX2VuYWJsZSBpcHY2KSIKIAlteWNvbmY9IiR7bXljb25mfSAtLWVu
YWJsZS10aHJlYWRzIgogCW15Y29uZj0iJHtteWNvbmZ9IC0tZW5hYmxlLW5vbnBvcnRhYmxlLWF0
b21pY3MiCi0JbXljb25mPSIke215Y29uZn0gLS13aXRoLWRldnJhbmRvbT0vZGV2L3JhbmRvbSIK
KwlpZiB1c2Ugbm8tdXJhbmRvbSA7IHRoZW4KKwkJZWluZm8gIlVzaW5nIC9kZXYvcmFuZG9tIGFz
IHJhbmRvbSBkZXZpY2UuIgorCQlteWNvbmY9IiR7bXljb25mfSAtLXdpdGgtZGV2cmFuZG9tPS9k
ZXYvcmFuZG9tIgorCWVsc2UKKwkJZWluZm8gIlVzaW5nIC9kZXYvdXJhbmRvbSBhcyByYW5kb20g
ZGV2aWNlLiIKKwkJbXljb25mPSIke215Y29uZn0gLS13aXRoLWRldnJhbmRvbT0vZGV2L3VyYW5k
b20iCisJZmkKIAogCWVjb25mICR7bXljb25mfSB8fCBkaWUKIAllbWFrZSB8fCBkaWUK
</data>        

          </attachment>
    </bug>

</bugzilla>