ntp profile denies write access to serial devices

Bug #596859 reported by Paul Crawford
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ntp (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: ntp

While reporting and testing for bug #596010 using the 10.04 release candidate I found that the intended user-tunable apparmor options in /etc/apparmor.d/tunables/ntpd do not work correctly due to the settings in /etc/apparmor.d/usr.sbin.ntpd including them with read-only permission.

While it might initially seem reasonable that you just 'read' the time from a serial port GPS or similar, in practice most of the drivers for serial clocks also need write-access to configure and/or poll them for the time.

I found that changing line 35 in /etc/apparmor.d/usr.sbin.ntpd from:

  @{NTPD_DEVICE} r,

to this:

  @{NTPD_DEVICE} rw,

seems to fix things so allowing /dev/ttyS* in the tunables works OK.

Tags: apparmor

Related branches

tags: added: apparmor
Changed in ntp (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ntp - 1:4.2.4p8+dfsg-1ubuntu4

---------------
ntp (1:4.2.4p8+dfsg-1ubuntu4) maverick; urgency=low

  * debian/dhcp.ntp: Dont remove *all* ntp server from ntp.conf.
    (LP: #575458)
  * debian/apparmor-profile: Allow access to /dev/ttyS*
    (LP: #596859)
 -- Chuck Short <email address hidden> Tue, 22 Jun 2010 09:24:02 -0400

Changed in ntp (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Paul Crawford (psc-sat) wrote :

This appears to be broken again, the 10.04 default profile has:

# vim:syntax=apparmor
# Last Modified: Tue Aug 11 16:14:21 CDT 2009
# Updated for Ubuntu by: Jamie Strandboge <email address hidden>

<snip>

  @{NTPD_DEVICE} r,

So it only allows read-access to the devices. Also broken/reverted is the tunables which has:

# Last Modified: Thu Aug 2 14:37:03 2007
# $Id: usr.sbin.ntpd 1102 2008-02-19 10:35:19Z jrjohansen $
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2005 Novell/SUSE
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# ------------------------------------------------------------------

#Add your ntpd devices here eg. if you have a DCF clock
# @{NTPD_DEVICE}=/dev/ttyS*
@{NTPD_DEVICE}="/dev/tty10"

Again, no default access to serial ports and modification date is before the message #4 (above). Can this be fixed again and pushed back to debian so it stays fixed?

Revision history for this message
Robie Basak (racb) wrote :

Paul,

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I've just checked the current development version, and I see "@{NTPD_DEVICE} rw" in /etc/apparmor.d/usr.sbin.ntpd and "@{NTPD_DEVICE}="/dev/null"" in /etc/apparmor.d/tunables/ntpd.

You said that you're using 10.04. This is an older release than where the bug was fixed in, so this would make sense. If you are using an old release, a workaround is to fix /etc/apparmor.d/usr.sbin.ntpd by hand. Even in the current release, it appears that it is intended and required to specify the serial port device in /etc/apparmor.d/tunables/ntpd.

So as far as I can determine, this bug is fixed in the current development version and there has been no regression. But if I'm mistaken, please let us know!

Revision history for this message
Paul Crawford (psc-sat) wrote :

Thanks Robie for the quick reply, but I though 10.04.4 LTS would have such bug-fixes included?

After all the ISO used to install is from after the date of the fix, and the major package numbers are the same (comment #1 mentions 1:4.2.4p8+dfsg-1ubuntu4 and my machine is reporting 1:4.2.4p8+dfsg-1ubuntu2.1)

Revision history for this message
Robie Basak (racb) wrote :

Paul,

In order to maintain stability, a stable release only gets bugfixes backported if they are deemed severe enough. I'm not sure that this bug qualifies, because it only affects a small number of users (those with hardware clocks) and a trivial workaround is available.

More details of the policy and process are here: https://wiki.ubuntu.com/StableReleaseUpdates

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.