Bug 135291 - kernel SRPM %build uses hardcoded /tmp
Summary: kernel SRPM %build uses hardcoded /tmp
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Rik van Riel
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks: FC3Target FC4Target
TreeView+ depends on / blocked
 
Reported: 2004-10-11 19:32 UTC by D. Hugh Redelmeier
Modified: 2007-11-30 22:10 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-03-15 15:36:09 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description D. Hugh Redelmeier 2004-10-11 19:32:11 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20040914
Firefox/0.10

Description of problem:
In kernel-2.6.8-1.603.src.rpm (and probably others),
in kernel-2.6.spec,
in %build:
  gpg --homedir /tmp --batch --gen-key %{SOURCE11} 
  gpg --homedir /tmp --export --keyring ./kernel.pub Red > extract.pub

The hardcoded /tmp seems like a bad idea:

- It causes separate users on the system to interfere with each other.
 For example, I built as root, then could not build as myself because
these files existed and were owned by root.

- It introduces a security issue: the paths are predictable and so an
adversary could plant symlinks or whatever.  Doubly so considering
that we are dealing with keying material.

- These files don't seem to be deleted.  It is hard to know what files
should be deleted since they are mixed in with everything else in /tmp.

I don't know enough to suggest the best alternative.  A workable one
might be:

  KT=%{_builddir}/keytmp
  rm -rf $KT
  mkdir $KT
  chmod go-rwx $KT
  gpg --homedir $KT --batch --gen-key %{SOURCE11} 
  gpg --homedir $KT --export --keyring ./kernel.pub Red > extract.pub
  rm -rf $KT

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. as root: build kernel from SRPM
2. as an ordinary user: build kernel from SRPM
3.
    

Actual Results:  gpg: can't open `/tmp/random_seed': Permission denied


Expected Results:  build works

Additional info:

Technically, this is a security issue.

Comment 1 Rik van Riel 2004-12-07 16:14:45 UTC
I'll look into it, since I'm the one messing up the rawhide kernel
spec file the most often anyway (and davej is busy with production
kernels).

Comment 2 Rik van Riel 2005-03-15 15:36:09 UTC
This seems to have been fixed in rawhide, while I was looking the other way:

#
# Create gpg keys for signing the modules
#

gpg --homedir . --batch --gen-key %{SOURCE11}
gpg --homedir . --export --keyring ./kernel.pub Red > extract.pub



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