netatalk fails to generate unique server signatures

Bug #535517 reported by Craig Ringer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
Invalid
Undecided
Unassigned
Nominated for Lucid by Craig Ringer
eglibc (Ubuntu)
New
Undecided
Unassigned
Nominated for Lucid by Craig Ringer
glibc (Ubuntu)
New
Undecided
Unassigned
Nominated for Lucid by Craig Ringer
netatalk (Ubuntu)
Triaged
Low
Unassigned
Nominated for Lucid by Craig Ringer

Bug Description

Binary package hint: netatalk

Description: Ubuntu 9.10
Release: 9.10

ii netatalk 2.0.4~beta2-5ubuntu2 AppleTalk user binaries

NetATalk fails to generate a unique server signature. Analysis of client/server communication reveals that both NetATalk servers here report the signature 01017F0001017F0001017F0001017F00 . This confuses Mac clients, resulting in them apparently randomly directing AFP requests to one server or the other. Users will connect to SERVER1 and get a volume list from SERVER2 or vice versa.

The netatalk code for generating server signatures (etc/afpd/status.c:191) uses the libc gethostid() call to obtain a 32-bit unique identifier for the host.

GNU Libc's man page for gethostid(3) notes that:

"In the glibc implementation, the hostid is stored in the file /etc/hostid. (In glibc versions before 2.2, the file /var/adm/hostid was used.)
"In the glibc implementation, if gethostid() cannot open the file containing the host ID, then it obtains the hostname using gethostname(2), passes that hostname to gethostbyname_r(3) in order to obtain the host's IPv4
       address, and returns a value obtained by bit-twiddling the IPv4 address. (This value may not be unique.)"

Ubuntu systems do not have any /etc/hostid by default, so glibc falls back on gethostbyname_r(3). However, Ubuntu systems' /etc/hosts files map the hostname to 127.0.0.1:

127.0.0.1 localhost
127.0.1.1 HOSTNAME.localnet HOSTNAME

so gethostbyname_r for the hostname in /etc/hostname will always return 127.0.0.1 . gethostid(3) will therefore always return the same value, and NetATalk's system id will always be the same on different Ubuntu hosts.

WORKAROUND:

To each line in your afpd.conf, append an
explicit:

-signature user:SERVERNAME

(if you have more than one line in afpd.conf, make sure the signature is
unique for each one).

Revision history for this message
Craig Ringer (ringerc) wrote :
Revision history for this message
Craig Ringer (ringerc) wrote :
Revision history for this message
Craig Ringer (ringerc) wrote :

Filed upstream bug: https://sourceforge.net/tracker/index.php?func=detail&aid=2967179&group_id=8642&atid=108642

(Couldn't see how to link it to this bug in Launchpad)

Revision history for this message
Craig Ringer (ringerc) wrote :

A workaround for admins: to each line in your afpd.conf, append an
explicit:

-signature user:SERVERNAME

(if you have more than one line in afpd.conf, make sure the signature is
unique for each one).

Revision history for this message
C de-Avillez (hggdh2) wrote :

Thank you for opening this bug and helping making Ubuntu better. First of all, thank you for all the work you have done here. Given that upstream has accepted the bug, I am marking it triaged for us. Also:

* I am also adjusting the description to include the workaround you found -- it is a nice way of resolving the conflict;
* I do not know why you added a coreutils task (and this is why this bug got my attention ;-), since there is nothing related to coreutils here. I have marked this task INVALID;
* You could not add an upstream watch because netatalk has not been defined as a project in LP (yet). I will see to it.

Changed in netatalk (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Changed in coreutils (Ubuntu):
status: New → Invalid
description: updated
Revision history for this message
dmarks (markstedt) wrote :

For the record: This bug was fixed with v2.1.0 -- https://sourceforge.net/p/netatalk/bugs/362/

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

Other bug subscribers

Remote bug watches

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