1 <?xml version="1.0" encoding="UTF-8"?>
2 <chapter id="configuration">
3 <title>Setting up Netatalk</title>
6 <title>File Services<indexterm>
7 <primary>File Services</primary>
9 <secondary>Netatalk's File Services</secondary>
12 <para>Netatalk supplies AFP<indexterm>
13 <primary>AFP</primary>
15 <secondary>Apple Filing Protocol</secondary>
16 </indexterm> services.</para>
19 <title>Setting up the AFP file server</title>
21 <para>AFP (the Apple Filing Protocol) is the protocol Apple Macintoshes
22 use for file services. The protocol has evolved over the years. The
23 latest changes to the protocol, called "AFP 3.3", were added with the
24 release of Snow Leopard<indexterm>
25 <primary>Snow Leopard</primary>
27 <secondary>Mac OS X 10.6</secondary>
28 </indexterm> (Mac OS X 10.6).</para>
30 <para>The afpd daemon offers the fileservices to Apple clients. The only
31 configuration file is <filename>afp.conf</filename>. It uses a ini style
32 configuration syntax.</para>
34 <para>Mac OS X 10.5 (Leopard) added support for Time Machine backups
35 over AFP. Two new functions ensure that backups are written to spinning
36 disk, not just in the server's cache. Different host operating systems
37 honour this cache flushing differently. To make a volume a Time Machine
38 target use the volume option "<option>time machine =
41 <para>Starting with Netatalk 2.1 UNIX symlinks<indexterm>
42 <primary>symlink</primary>
44 <secondary>UNIX symlink</secondary>
45 </indexterm> can be used on the server. Semantics are the same as for
46 eg NFS, ie they are not resolved on the server side but instead it's
47 completely up to the client to resolve them, resulting in links that
48 point somewhere inside the clients filesystem view.</para>
50 <para>Support for <link linkend="spotlight">Spotlight</link> has been
51 added in Netatalk 3.1. See this <link
52 linkend="spotlight_compile">section</link> for information on how to
53 compile Netatalk with Spotlight support.</para>
56 <title>afp.conf</title>
58 <para><filename>afp.conf</filename> is the configuration file used by
59 afpd to determine the behaviour and configuration of the AFP file
60 serverand the AFP volume that it provides.</para>
62 <para>The <filename>afp.conf</filename> is divided into several
63 sections:<variablelist>
68 <para>The global section defines general server options</para>
76 <para>The homes section defines user home volumes</para>
79 </variablelist>Any section not called <option>Global</option> or
80 <option>Homes</option> is interpreted as an AFP volume.</para>
82 <para>For sharing user homes by defining a <option>Homes</option>
83 section you must specify the option <option>basedir regex</option>
84 which can be a simple string with the path to the parent directory of
85 all user homes or a regular expression.</para>
89 <para><programlisting>[Homes]
91 </programlisting></para>
93 <para>Now any user logging into the AFP server will have a user volume
94 available whos path is <filename>/home/NAME</filename>.</para>
96 <para>A more complex setup would be a server with a large amount of
97 user homes which are split across eg two different
98 filesystems:<itemizedlist>
100 <para>/RAID1/homes</para>
104 <para>/RAID2/morehomes</para>
106 </itemizedlist>The following configuration is
107 required:<programlisting>[Homes]
108 basedir regex = /RAID./.*homes
109 </programlisting></para>
111 <para>If <option>basedir regex</option> contains symlink, set the
112 canonicalized absolute path. When <filename>/home</filename> links to
113 <filename>/usr/home</filename>: <programlisting>[Homes]
114 basedir regex = /usr/home</programlisting></para>
116 <para>For a more detailed explanation of the available options, please
117 refer to the <citerefentry>
118 <refentrytitle>afp.conf</refentrytitle>
120 <manvolnum>5</manvolnum>
121 </citerefentry> man page.</para>
126 <title id="spotlight">Spotlight<indexterm>
127 <primary>Spotlight</primary>
130 <para>Netatalk uses Tracker as the metadata backend. Recent Linux
131 distributions will provide the libtracker-sparql library which is
132 available since Tracker version 0.7. This version is referred to as
133 Tracker SPARQL.</para>
135 <para>Other system like FreeBSD, Solaris and systems derived from
136 Solaris will only ship Tracker version 0.6 which only offers a much more
137 restrcited feature set. We refer to this version as Tracker RDF. Solaris
138 users are advised to install Tracker from OpenCSW as this is at least
139 version 0.15 and thus supports SPARQL</para>
141 <para>You can enable Spotlight and indexing either globally or on a per
142 volume basis using the <option>spotlight</option> option.</para>
144 <para>For Solaris with Tracker from OpenCSW also add:
145 <screen>dbus daemon = /opt/csw/bin/dbus-daemon</screen></para>
148 <para>Once Spotlight is enable for a single volume, all other volumes
149 for which spotlight is disabled won't be searchable at all.</para>
153 <title>Tracker RDF</title>
155 <para>Add all volume paths that should be searchable to
156 $sysconfdir/tracker/tracker.cfg:<screen>...
158 # List of directory roots to index and watch (separator=;)
159 WatchDirectoryRoots=/foo/bar;/another/volume
164 <title>Limitations and notes</title>
168 <para>Large filesystems</para>
170 <para>Tracker on Linux uses the inotify Kernel filesystem change
171 event API for tracking filesystem changes. On large filesystems
172 this may be problematic since the inotify API doesn't offer
173 recursive directory watches but instead requires that for every
174 subdirectoy watches must be added individually.</para>
176 <para>On Solaris the FEN file event notification system is used.
177 It is unkown which limitations and ressource consumption this
178 Solaris subsystem has,</para>
182 <para>Tracker RDF</para>
184 <para>The mapping of certain simple and of complex Spotlight to
185 Tracker RDF queries is imperfect. Also, Tracker RDF filename
186 searches are case sensitive! As a result there are two noticable
191 <para>On a Mac, a query entered in the Spotlight search menu
192 or in a Finder search toolbar is meant to express "search any
193 metadata field, file name or content for this string". With
194 Netatalk and Tracker RDF only filenames will be
199 <para>Searching files content must be done through explicitly
200 adding a "<emphasis>Contents</emphasis> contains ..."
206 <screeninfo>Case sensivity</screeninfo>
210 <imagedata fileref="http://netatalk.sourceforge.net/wiki/images/2/2a/Toolbar_search_is_name_search.png" />
216 <screeninfo>Searching metadata</screeninfo>
220 <imagedata fileref="http://netatalk.sourceforge.net/wiki/images/0/01/Searching_for_content.png" />
229 <title>Supported metadata attributes</title>
231 <para>The following list is the complete set of supported metadata
232 attributes in Tracker SPARQL search queries</para>
235 <title>Tracker SPARQL</title>
240 <entry align="center">Description</entry>
242 <entry align="center">Spotlight Key </entry>
250 <entry>kMDItemDisplayName, kMDItemFSName</entry>
254 <entry>Document content (full text search)</entry>
256 <entry>kMDItemTextContent</entry>
260 <entry>File type</entry>
262 <entry>_kMDItemGroupId, kMDItemContentTypeTree</entry>
266 <entry>File modification date</entry>
268 <entry>kMDItemFSContentChangeDate,
269 kMDItemContentModificationDate,
270 kMDItemAttributeChangeDate</entry>
274 <entry>Content Creation date</entry>
276 <entry>kMDItemContentCreationDate</entry>
280 <entry>The author, or authors, of the contents of the
283 <entry>kMDItemAuthors, kMDItemCreator</entry>
287 <entry>The name of the country where the item was
290 <entry>kMDItemCountry</entry>
294 <entry>Duration</entry>
296 <entry>kMDItemDurationSeconds</entry>
300 <entry>Number of pages</entry>
302 <entry>kMDItemNumberOfPages</entry>
306 <entry>Document title</entry>
308 <entry>kMDItemTitle</entry>
312 <entry>The width, in pixels, of the contents. For example, the
313 image width or the video frame width</entry>
315 <entry>kMDItemPixelWidth</entry>
319 <entry>The height, in pixels, of the contents. For example,
320 the image height or the video frame height</entry>
322 <entry>kMDItemPixelHeight</entry>
326 <entry>The color space model used by the document
329 <entry>kMDItemColorSpace</entry>
333 <entry>The number of bits per sample</entry>
335 <entry>kMDItemBitsPerSample</entry>
339 <entry>Focal length of the lens, in millimeters</entry>
341 <entry>kMDItemFocalLength</entry>
345 <entry>ISO speed</entry>
347 <entry>kMDItemISOSpeed</entry>
351 <entry>Orientation of the document. Possible values are 0
352 (landscape) and 1 (portrait)</entry>
354 <entry>kMDItemOrientation</entry>
358 <entry>Resolution width, in DPI</entry>
360 <entry>kMDItemResolutionWidthDPI</entry>
364 <entry>Resolution height, in DPI</entry>
366 <entry>kMDItemResolutionHeightDPI</entry>
370 <entry>Exposure time, in seconds</entry>
372 <entry>kMDItemExposureTimeSeconds</entry>
376 <entry>The composer of the music contained in the audio
379 <entry>kMDItemComposer</entry>
383 <entry>The musical genre of the song or composition</entry>
385 <entry>kMDItemMusicalGenre</entry>
391 <para>The following list is the complete set of supported metadata
392 attributes in Tracker RDF search queries:<table>
393 <title>Tracker RDF</title>
398 <entry align="center">Description</entry>
400 <entry align="center">Spotlight Key</entry>
408 <entry>kMDItemDisplayName, kMDItemFSName</entry>
412 <entry>Document content (full text search)</entry>
414 <entry>kMDItemTextContent</entry>
418 <entry>File type</entry>
420 <entry>_kMDItemGroupId, kMDItemContentTypeTree</entry>
424 <entry>File modification date</entry>
426 <entry>kMDItemFSContentChangeDate,
427 kMDItemContentModificationDate,
428 kMDItemAttributeChangeDate</entry>
432 <entry>Content Creation date</entry>
434 <entry>kMDItemContentCreationDate</entry>
438 <entry>The author, or authors, of the contents of the
441 <entry>kMDItemAuthors, kMDItemCreator</entry>
445 <entry>The name of the country where the item was
448 <entry>kMDItemCountry</entry>
452 <entry>Duration</entry>
454 <entry>kMDItemDurationSeconds</entry>
458 <entry>Number of pages</entry>
460 <entry>kMDItemNumberOfPages</entry>
464 <entry>Document title</entry>
466 <entry>kMDItemTitle</entry>
470 <entry>The width, in pixels, of the contents. For example,
471 the image width or the video frame width</entry>
473 <entry>kMDItemPixelWidth</entry>
477 <entry>The height, in pixels, of the contents. For example,
478 the image height or the video frame height</entry>
480 <entry>kMDItemPixelHeight</entry>
484 <entry>Focal length of the lens, in millimeters</entry>
486 <entry>kMDItemFocalLength</entry>
490 <entry>ISO speed</entry>
492 <entry>kMDItemISOSpeed</entry>
496 <entry>Orientation of the document. Possible values are 0
497 (landscape) and 1 (portrait)</entry>
499 <entry>kMDItemOrientation</entry>
503 <entry>Exposure time, in seconds</entry>
505 <entry>kMDItemExposureTimeSeconds</entry>
509 <entry>The musical genre of the song or composition</entry>
511 <entry>kMDItemMusicalGenre</entry>
519 <title>Using Tracker commandline tools on the server</title>
521 <para>Netatalk must be running and the commands must be executed
523 # export DBUS_SESSION_BUS_ADDRESS="unix:path=/tmp/spotlight.ipc"</screen></para>
525 <para>When using Tracker from OpenCSW you must also update
526 your PATH:<screen># export PATH=/opt/csw/bin:$PATH</screen></para>
528 <para>Tracker SPARQL:<screen># tracker-search QUERY
533 <para>Tracker RDF<screen># cat file.rdf
534 <rdfq:Condition>
536 <rdfq:contains>
537 <rdfq:Property name="File:Name" />
538 <rdf:String>SEARCHSTRING</rdf:String>
539 </rdfq:contains>
541 </rdfq:Condition>
542 # tracker-query -p file.rdf File:Name
544 # tracker-info -m File:Mime PATH
549 <title>References</title>
554 url="https://developer.apple.com/library/mac/#documentation/Carbon/Reference/MDItemRef/Reference/reference.html">MDItem</ulink></para>
559 url="https://live.gnome.org/Tracker/Documentation">Tracker</ulink></para>
565 <sect2 id="CNID-backends">
566 <title>CNID<indexterm>
567 <primary>CNID</primary>
569 <secondary>Catalog Node ID</secondary>
570 </indexterm> backends<indexterm>
571 <primary>Backend</primary>
573 <secondary>CNID backend</secondary>
576 <para>Unlike other protocols like SMB or NFS, the AFP protocol mostly
577 refers to files and directories by ID and not by a path (the IDs are
578 also called CNID, that means Catalog Node ID). A typical AFP request
579 uses a directory ID<indexterm>
580 <primary>DID</primary>
582 <secondary>Directory ID</secondary>
583 </indexterm> and a filename, something like <phrase>"server, please
584 open the file named 'Test' in the directory with id 167"</phrase>. For
585 example "Aliases" on the Mac basically work by ID (with a fallback to
586 the absolute path in more recent AFP clients. But this applies only to
587 Finder, not to applications).</para>
589 <para>Every file in an AFP volume has to have a unique file ID<indexterm>
590 <primary>FID</primary>
592 <secondary>File ID</secondary>
593 </indexterm>, IDs must, according to the specs, never be reused, and
594 IDs are 32 bit numbers (Directory IDs use the same ID pool). So, after
595 ~4 billion files/folders have been written to an AFP volume, the ID pool
596 is depleted and no new file can be written to the volume. No whining
599 <para>Netatalk needs to map IDs to files and folders in the host
600 filesystem. To achieve this, several different CNID backends<indexterm>
601 <primary>CNID backend</primary>
602 </indexterm> are available and can be choosed by the <option>cnid
603 scheme</option><indexterm>
604 <primary>cnidscheme</primary>
606 <secondary>specifying a CNID backend</secondary>
607 </indexterm> option in the <citerefentry>
608 <refentrytitle>afp.conf</refentrytitle>
610 <manvolnum>5</manvolnum>
611 </citerefentry> configuration file. A CNID backend is basically a
612 database storing ID <-> name mappings.</para>
614 <para>The CNID Databases are by default located in
615 <filename>/var/netatalk/CNID</filename>.</para>
617 <para>There is a command line utility called <command>dbd</command>
618 available which can be used to verify, repair and rebuild the CNID
622 <para>There are some CNID related things you should keep in mind when
623 working with netatalk:</para>
627 <para>Don't nest volumes<indexterm>
628 <primary>Nested volumes</primary>
633 <para>CNID backends are databases, so they turn afpd into a file
634 server/database mix.</para>
638 <para>If there's no more space on the filesystem left, the
639 database will get corrupted. You can work around this by either
640 using the <option>vol dbpath</option> option and put the database
641 files into another location or, if you use quotas, make sure the
642 CNID database folder is owned by a user/group without a
644 <primary>Quotas</primary>
646 <secondary>Disk usage quotas</secondary>
651 <para>Be careful with CNID databases for volumes that are mounted
652 via NFS. That is a pretty audacious decision to make anyway, but
653 putting a database there as well is really asking for trouble,
654 i.e. database corruption. Use the <option>vol dbpath</option>
655 directive to put the databases onto a local disk if you must use
657 <primary>NFS</primary>
659 <secondary>Network File System</secondary>
660 </indexterm> mounted volumes.</para>
666 <title>cdb<indexterm>
667 <primary>CDB</primary>
669 <secondary>"cdb" CNID backend</secondary>
672 <para>The "concurrent database" backend is based on Berkeley DB. With
673 this backend, several afpd daemons access the CNID database directly.
674 Berkeley DB locking is used to synchronize access, if more than one
675 afpd process is active for a volume. The drawback is, that the crash
676 of a single afpd process might corrupt the database. cdb should only
677 be used when sharing home directories for a larger number of users
678 <emphasis>and</emphasis> it has been determined that a large number of
679 <command>cnid_dbd</command> processes is problematic.</para>
683 <title>dbd<indexterm>
684 <primary>DBD</primary>
686 <secondary>"dbd" CNID backend</secondary>
689 <para>Access to the CNID database is restricted to the cnid_dbd daemon
690 process. afpd processes communicate with the daemon for database reads
691 and updates. The probability for database corruption is practically
694 <para>This is the default backend since Netatalk 2.1.</para>
698 <title>tdb<indexterm>
699 <primary>tdb</primary>
701 <secondary>"tdb" CNID backend</secondary>
704 <para><abbrev>tdb</abbrev> is another persistent CNID database, it's
705 Samba's <emphasis>Trivial Database</emphasis>. It could be used
706 instead of <abbrev>cdb</abbrev> for user volumes.<important>
707 <para>Only ever use it for volumes that are
708 <emphasis>not</emphasis> shared and accessed by multiple clients
710 </important>This backend is also used internally (as in-memory CNID
711 database) as a fallback in case opening the primary database can't be
712 opened, because <abbrev>tdb</abbrev> can work as in-memory database.
713 This of course means upon restart the CNIDs are gone.</para>
717 <title>last<indexterm>
718 <primary>Last</primary>
720 <secondary>"last" CNID backend</secondary>
723 <para>The last backend is a in-memory tdb database. It is not
724 persistent. Starting with netatalk 3.0, it becomes the <emphasis> read
725 only mode</emphasis> automatically. This is useful e.g. for
730 <sect2 id="charsets">
731 <title>Charsets<indexterm>
732 <primary>Charset</primary>
734 <secondary>character set</secondary>
735 </indexterm>/Unicode<indexterm>
736 <primary>Unicode</primary>
742 <title>Why Unicode?</title>
744 <para>Internally, computers don't know anything about characters and
745 texts, they only know numbers. Therefore, each letter is assigned a
746 number. A character set, often referred to as
747 <emphasis>charset</emphasis> or
748 <emphasis>codepage</emphasis><indexterm>
749 <primary>Codepage</primary>
750 </indexterm>, defines the mappings between numbers and
753 <para>If two or more computer systems need to communicate with each
754 other, the have to use the same character set. In the 1960s the
756 <primary>ASCII</primary>
758 <secondary>American Standard Code for Information
759 Interchange</secondary>
760 </indexterm> (American Standard Code for Information Interchange)
761 character set was defined by the American Standards Association. The
762 original form of ASCII represented 128 characters, more than enough to
763 cover the English alphabet and numerals. Up to date, ASCII has been
764 the normative character scheme used by computers.</para>
766 <para>Later versions defined 256 characters to produce a more
767 international fluency and to include some slightly esoteric graphical
768 characters. Using this mode of encoding each character takes exactly
769 one byte. Obviously, 256 characters still wasn't enough to map all the
770 characters used in the various languages into one character
773 <para>As a result localized character sets were defined later, e.g the
774 ISO-8859 character sets. Most operating system vendors introduced
775 their own characters sets to satisfy their needs, e.g. IBM defined the
776 <emphasis>codepage 437 (DOSLatinUS)</emphasis>, Apple introduced the
777 <emphasis>MacRoman</emphasis><indexterm>
778 <primary>MacRoman</primary>
780 <secondary>MacRoman charset</secondary>
781 </indexterm> codepage and so on. The characters that were assigned
782 number larger than 127 were referred to as
783 <emphasis>extended</emphasis> characters. These character sets
784 conflict with another, as they use the same number for different
785 characters, or vice versa.</para>
787 <para>Almost all of those characters sets defined 256 characters,
788 where the first 128 (0-127) character mappings are identical to ASCII.
789 As a result, communication between systems using different codepages
790 was effectively limited to the ASCII charset.</para>
792 <para>To solve this problem new, larger character sets were defined.
793 To make room for more character mappings, these character sets use at
794 least 2 bytes to store a character. They are therefore referred to as
795 <emphasis>multibyte</emphasis> character sets.</para>
797 <para>One standardized multibyte charset encoding scheme is known as
798 <ulink url="http://www.unicode.org/">unicode</ulink>. A big advantage
799 of using a multibyte charset is that you only need one. There is no
800 need to make sure two computers use the same charset when they are
801 communicating.</para>
805 <title>character sets used by Apple</title>
807 <para>In the past, Apple clients used single-byte charsets to
808 communicate over the network. Over the years Apple defined a number of
809 codepages, western users will most likely be using the
810 <emphasis>MacRoman</emphasis> codepage.</para>
812 <para>Codepages defined by Apple include:</para>
816 <para>MacArabic, MacFarsi</para>
820 <para>MacCentralEurope</para>
824 <para>MacChineseSimple</para>
828 <para>MacChineseTraditional</para>
832 <para>MacCroation</para>
836 <para>MacCyrillic</para>
840 <para>MacDevanagari</para>
844 <para>MacGreek</para>
848 <para>MacHebrew</para>
852 <para>MacIcelandic</para>
856 <para>MacJapanese</para>
860 <para>MacKorean</para>
864 <para>MacRoman</para>
868 <para>MacRomanian</para>
876 <para>MacTurkish</para>
880 <para>Starting with Mac OS X and AFP3, <ulink
881 url="http://www.utf-8.com/">UTF-8</ulink> is used. UTF-8 encodes
882 Unicode characters in an ASCII compatible way, each Unicode character
883 is encoded into 1-6 ASCII characters. UTF-8 is therefore not really a
884 charset itself, it's an encoding of the Unicode charset.</para>
886 <para>To complicate things, Unicode defines several <emphasis> <ulink
887 url="http://www.unicode.org/reports/tr15/index.html">normalization</ulink>
888 </emphasis> forms. While <ulink
889 url="http://www.samba.org">samba</ulink><indexterm>
890 <primary>Samba</primary>
891 </indexterm> uses <emphasis>precomposed</emphasis><indexterm>
892 <primary>Precomposed</primary>
894 <secondary>Precomposed Unicode normalization</secondary>
895 </indexterm> Unicode, which most Unix tools prefer as well, Apple
896 decided to use the <emphasis>decomposed</emphasis><indexterm>
897 <primary>Decomposed</primary>
899 <secondary>Decomposed Unicode normalization</secondary>
900 </indexterm> normalization.</para>
902 <para>For example lets take the German character
903 '<keycode>ä</keycode>'. Using the precomposed normalization, Unicode
904 maps this character to 0xE4. In decomposed normalization, 'ä' is
905 actually mapped to two characters, 0x61 and 0x308. 0x61 is the mapping
906 for an 'a', 0x308 is the mapping for a <emphasis>COMBINING
907 DIAERESIS</emphasis>.</para>
909 <para>Netatalk refers to precomposed UTF-8 as
910 <emphasis>UTF8</emphasis><indexterm>
911 <primary>UTF8</primary>
913 <secondary>Netatalk's precomposed UTF-8 encoding</secondary>
914 </indexterm> and to decomposed UTF-8 as
915 <emphasis>UTF8-MAC</emphasis><indexterm>
916 <primary>UTF8-MAC</primary>
918 <secondary>Netatalk's decomposed UTF-8 encoding</secondary>
923 <title>afpd and character sets</title>
925 <para>To support new AFP 3.x and older AFP 2.x clients at the same
926 time, afpd needs to be able to convert between the various charsets
927 used. AFP 3.x clients always use UTF8-MAC, AFP 2.x clients use one of
928 the Apple codepages.</para>
930 <para>At the time of this writing, netatalk supports the following
931 Apple codepages:</para>
935 <para>MAC_CENTRALEUROPE</para>
939 <para>MAC_CHINESE_SIMP</para>
943 <para>MAC_CHINESE_TRAD</para>
947 <para>MAC_CYRILLIC</para>
951 <para>MAC_GREEK</para>
955 <para>MAC_HEBREW</para>
959 <para>MAC_JAPANESE</para>
963 <para>MAC_KOREAN</para>
967 <para>MAC_ROMAN</para>
971 <para>MAC_TURKISH</para>
975 <para>afpd handles three different character set options:</para>
979 <term>unix charset<indexterm>
980 <primary>unix charset</primary>
982 <secondary>afpd's unix charset setting</secondary>
986 <para>This is the codepage used internally by your operating
987 system. If not specified, it defaults to <option>UTF8</option>.
988 If <option>LOCALE</option> is specified and your system support
989 Unix locales, afpd tries to detect the codepage. afpd uses this
990 codepage to read its configuration files, so you can use
991 extended characters for volume names, login messages, etc. see
993 <refentrytitle>afp.conf</refentrytitle>
995 <manvolnum>5</manvolnum>
996 </citerefentry>.</para>
1001 <term>mac charset<indexterm>
1002 <primary>mac charset</primary>
1004 <secondary>afpd's mac charset setting</secondary>
1008 <para>As already mentioned, older Mac OS clients (up to AFP 2.2)
1009 use codepages to communicate with afpd. However, there is no
1010 support for negotiating the codepage used by the client in the
1011 AFP protocol. If not specified otherwise, afpd assumes the
1012 <emphasis>MacRoman</emphasis> codepage is used. In case you're
1013 clients use another codepage, e.g.
1014 <emphasis>MacCyrillic</emphasis>, you'll <emphasis
1015 role="bold">have</emphasis> to explicitly configure this. see
1017 <refentrytitle>afp.conf</refentrytitle>
1019 <manvolnum>5</manvolnum>
1020 </citerefentry>.</para>
1025 <term>vol charset<indexterm>
1026 <primary>vol charset</primary>
1028 <secondary>afpd's vol charset setting</secondary>
1032 <para>This defines the charset afpd should use for filenames on
1033 disk. By default, it is the same as <option>unix
1034 charset</option>. If you have <ulink
1035 url="http://www.gnu.org/software/libiconv/">iconv</ulink><indexterm>
1036 <primary>Iconv</primary>
1038 <secondary>iconv encoding conversion engine</secondary>
1039 </indexterm> installed, you can use any iconv provided charset
1042 <para>afpd needs a way to preserve extended macintosh
1043 characters, or characters illegal in unix filenames, when saving
1044 files on a unix filesystem. Earlier versions used the the so
1045 called CAP encoding<indexterm>
1046 <primary>CAP encoding</primary>
1048 <secondary>CAP style character encoding</secondary>
1049 </indexterm>. An extended character (>0x7F) would be
1050 converted to a :xx hex sequence, e.g. the Apple Logo (MacRoman:
1051 0xF0) was saved as :f0. Some special characters will be
1052 converted as to :xx notation as well. '/' will be encoded to
1053 :2f, if <option>usedots</option> was not specified, a leading
1054 dot '.' will be encoded as :2e.</para>
1056 <para>Even though this version now uses <option>UTF8</option> as
1057 the default encoding for filenames, '/' will be converted to
1058 ':'. For western users another useful setting could be
1059 <option>vol charset = ISO-8859-15</option>.</para>
1061 <para>If a character cannot be converted from the <option>mac
1062 charset</option> to the selected <option>vol charset</option>,
1063 afpd will save it as a CAP encoded character. For AFP3 clients,
1064 afpd will convert the UTF8 character to <option>mac
1065 charset</option> first. If this conversion fails, you'll receive
1066 a -50 error on the mac. <emphasis>Note</emphasis>: Whenever you
1067 can, please stick with the default UTF8 volume format. see
1069 <refentrytitle>afp.conf</refentrytitle>
1071 <manvolnum>5</manvolnum>
1072 </citerefentry>.</para>
1079 <sect2 id="authentication">
1080 <title>Authentication<indexterm>
1081 <primary>Authentication</primary>
1083 <secondary>between AFP client and server</secondary>
1084 </indexterm></title>
1087 <title>AFP authentication basics</title>
1089 <para>Apple chose a flexible model called "User Authentication
1091 <primary>UAM</primary>
1093 <secondary>User Authentication Module</secondary>
1094 </indexterm> (UAMs) for authentication purposes between AFP client
1095 and server. An AFP client initially connecting to an AFP server will
1096 ask for the list of UAMs which the server provides, and will choose
1097 the one with strongest encryption that the client supports.</para>
1099 <para>Several UAMs have been developed by Apple over the time, some by
1100 3rd-party developers.</para>
1104 <title>UAMs supported by Netatalk</title>
1106 <para>Netatalk supports the following ones by default:</para>
1110 <para>"No User Authent"<indexterm>
1111 <primary>No User Authent</primary>
1113 <secondary>"No User Authent" UAM (guest access)</secondary>
1114 </indexterm> UAM (guest access without authentication)</para>
1118 <para>"Cleartxt Passwrd"<indexterm>
1119 <primary>Cleartxt Passwrd</primary>
1121 <secondary>"Cleartxt Passwrd" UAM</secondary>
1122 </indexterm> UAM (no password encryption)</para>
1126 <para>"Randnum exchange"<indexterm>
1127 <primary>Randnum exchange</primary>
1129 <secondary>"Randnum exchange" UAM</secondary>
1130 </indexterm>/"2-Way Randnum exchange"<indexterm>
1131 <primary>2-Way Randnum exchange</primary>
1133 <secondary>"2-Way Randnum exchange" UAM</secondary>
1134 </indexterm> UAMs (weak password encryption, separate password
1139 <para>"DHCAST128"<indexterm>
1140 <primary>DHCAST128</primary>
1142 <secondary>"DHCAST128" UAM</secondary>
1143 </indexterm> UAM (stronger password encryption)</para>
1147 <para>"DHX2"<indexterm>
1148 <primary>DHX2</primary>
1150 <secondary>"DHX2" UAM</secondary>
1151 </indexterm> UAM (successor of DHCAST128)</para>
1155 <para>There exist other optional UAMs as well:</para>
1159 <para>"PGPuam 1.0"<indexterm>
1160 <primary>PGPuam 1.0</primary>
1162 <secondary>"PGPuam 1.0" UAM</secondary>
1163 </indexterm><indexterm>
1164 <primary>uams_pgp.so</primary>
1166 <secondary>"PGPuam 1.0" UAM</secondary>
1167 </indexterm> UAM (PGP-based authentication for pre-Mac OS X
1168 clients. You'll also need the <ulink
1169 url="http://www.vmeng.com/vinnie/papers/pgpuam.html">PGPuam
1170 client</ulink> to let this work)</para>
1172 <para>You'll have to add <filename>"--enable-pgp-uam"</filename>
1173 to your configure switches to have this UAM available.</para>
1177 <para>"Kerberos IV"<indexterm>
1178 <primary>Kerberos IV</primary>
1180 <secondary>"Kerberos IV" UAM</secondary>
1181 </indexterm><indexterm>
1182 <primary>uams_krb4.so</primary>
1184 <secondary>"Kerberos IV" UAM</secondary>
1185 </indexterm>/"AFS Kerberos"<indexterm>
1186 <primary>AFS Kerberos</primary>
1188 <secondary>"AFS Kerberos" UAM (Kerberos IV)</secondary>
1189 </indexterm> UAMs (suitable to use <ulink
1190 url="http://web.mit.edu/macdev/KfM/Common/Documentation/faq.html">Kerberos
1191 v4 based authentication</ulink> and AFS file servers)</para>
1193 <para>Use <filename>"--enable-krb4-uam"</filename> at compile time
1194 to activate the build of this UAM.</para>
1198 <para>"Client Krb v2"<indexterm>
1199 <primary>Client Krb v2</primary>
1201 <secondary>"Client Krb v2" UAM (Kerberos V)</secondary>
1202 </indexterm> UAM (Kerberos V, suitable for "Single Sign On"
1203 Scenarios with OS X clients -- see below)</para>
1205 <para><filename>"--enable-krbV-uam"</filename> will provide you
1206 with the ability to use this UAM.</para>
1210 <para>You can configure which UAMs should be activated by defining
1211 "<option>uam list</option>" in <option>Global</option> section.
1212 <command>afpd</command> will log which UAMs it's using and if problems
1213 occur while activating them in either
1214 <filename>netatalk.log</filename> or syslog at startup time.
1216 <refentrytitle>asip-status.pl</refentrytitle>
1218 <manvolnum>1</manvolnum>
1219 </citerefentry> can be used to query the available UAMs of AFP
1220 servers as well.</para>
1222 <para>Having a specific UAM available at the server does not
1223 automatically mean that a client can use it. Client-side support is
1224 also necessary. For older Macintoshes running Mac OS < X DHCAST128
1225 support exists since AppleShare client 3.8.x.</para>
1227 <para>On OS X, there exist some client-side techniques to make the
1228 AFP-client more verbose, so one can have a look what's happening while
1229 negotiating the UAMs to use. Compare with this <ulink
1230 url="http://article.gmane.org/gmane.network.netatalk.devel/7383/">hint</ulink>.</para>
1234 <title>Which UAMs to activate?</title>
1236 <para>It depends primarily on your needs and on the kind of Mac OS
1237 versions you have to support. Basically one should try to use
1238 DHCAST128 and DHX2 where possible because of its strength of password
1243 <para>Unless you really have to supply guest access to your
1244 server's volumes ensure that you disable "No User Authent" since
1245 it might lead accidentally to unauthorized access. In case you
1246 must enable guest access take care that you enforce this on a per
1247 volume base using the access controls.</para>
1251 <para>The "ClearTxt Passwrd" UAM is as bad as it sounds since
1252 passwords go unencrypted over the wire. Try to avoid it at both
1253 the server's side as well as on the client's. Note: If you want to
1254 provide Mac OS 8/9 clients with NetBoot-services then you need
1255 uams_cleartext.so since the AFP-client integrated into the Mac's
1256 firmware can only deal with this basic form of
1257 authentication.</para>
1261 <para>Since "Randnum exchange"/"2-Way Randnum exchange" uses only
1262 56 bit DES for encryption it should be avoided as well. Another
1263 disadvantage is the fact that the passwords have to be stored in
1264 cleartext on the server and that it doesn't integrate into both
1265 PAM scenarios or classic /etc/shadow (you have to administrate
1266 passwords separately by using the <citerefentry>
1267 <refentrytitle>afppasswd</refentrytitle>
1269 <manvolnum>1</manvolnum>
1270 </citerefentry> utility, if clients should use these
1275 <para>"DHCAST128" or "DHX2" should be a good compromise for most
1276 people since it combines stronger encryption with PAM
1281 <para>Using the Kerberos V<indexterm>
1282 <primary>Kerberos V</primary>
1284 <secondary>"Client Krb v2" UAM</secondary>
1285 </indexterm> ("Client Krb v2") UAM, it's possible to implement
1286 real single sign on scenarios using Kerberos tickets. The password
1287 is not sent over the network. Instead, the user password is used
1288 to decrypt a service ticket for the appleshare server. The service
1289 ticket contains an encryption key for the client and some
1290 encrypted data (which only the appleshare server can decrypt). The
1291 encrypted portion of the service ticket is sent to the server and
1292 used to authenticate the user. Because of the way that the afpd
1293 service principal detection is implemented, this authentication
1294 method is vulnerable to man-in-the-middle attacks.</para>
1298 <para>For a more detailed overview over the technical implications of
1299 the different UAMs, please have a look at Apple's <ulink
1300 url="http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/AFP/AFPSecurity/AFPSecurity.html#//apple_ref/doc/uid/TP40000854-CH232-SW1">File
1301 Server Security</ulink> pages.</para>
1305 <title>Using different authentication sources with specific
1308 <para>Some UAMs provide the ability to use different authentication
1309 "backends", namely <filename>uams_cleartext.so</filename>,
1310 <filename>uams_dhx.so</filename> and
1311 <filename>uams_dhx2.so</filename>. They can use either classic Unix
1312 passwords from <filename>/etc/passwd</filename>
1313 (<filename>/etc/shadow</filename>) or PAM if the system supports that.
1314 <filename>uams_cleartext.so</filename> can be symlinked to either
1315 <filename>uams_passwd.so</filename> or
1316 <filename>uams_pam.so</filename>, <filename>uams_dhx.so</filename> to
1317 <filename>uams_dhx_passwd.so</filename> or
1318 <filename>uams_dhx_pam.so</filename> and
1319 <filename>uams_dhx2.so</filename> to
1320 <filename>uams_dhx2_passwd.so</filename> or
1321 <filename>uams_dhx2_pam.so</filename>.</para>
1323 <para>So, if it looks like this in Netatalk's UAMs folder (per default
1324 <filename>/etc/netatalk/uams/</filename>):<programlisting>uams_clrtxt.so -> uams_pam.so
1325 uams_dhx.so -> uams_dhx_pam.so
1326 uams_dhx2.so -> uams_dhx2_pam.so</programlisting> then you're using PAM,
1327 otherwise classic Unix passwords. The main advantage of using PAM is
1328 that one can integrate Netatalk in centralized authentication
1329 scenarios, eg. via LDAP, NIS and the like. Please always keep in mind
1330 that the protection of your user's login credentials in such scenarios
1331 also depends on the strength of encryption that the UAM in question
1332 supplies. So think about eliminating weak UAMs like "ClearTxt Passwrd"
1333 and "Randnum exchange" completely from your network.</para>
1337 <title>Netatalk UAM overview table</title>
1339 <para>A small overview of the most common used UAMs.</para>
1341 <table orient="land">
1342 <title>Netatalk UAM overview</title>
1344 <tgroup align="center" cols="7">
1345 <colspec colname="col1" colnum="1" colwidth="0.5*" />
1347 <colspec colname="uam_guest" colnum="2" colwidth="1*" />
1349 <colspec colname="uam_clrtxt" colnum="3" colwidth="1*" />
1351 <colspec colname="uam_randnum" colnum="4" colwidth="1*" />
1353 <colspec colname="uam_dhx" colnum="5" colwidth="1*" />
1355 <colspec colname="uam_dhx2" colnum="6" colwidth="1*" />
1357 <colspec colname="uam_gss" colnum="7" colwidth="1*" />
1361 <entry align="center" rotate="0" valign="middle">UAM</entry>
1363 <entry>No User Authent<indexterm>
1364 <primary>uams_guest.so</primary>
1366 <secondary>"No User Authent" UAM (guest
1368 </indexterm></entry>
1370 <entry>Cleartxt Passwrd<indexterm>
1371 <primary>uams_cleartxt.so</primary>
1373 <secondary>"Cleartxt Passwrd" UAM</secondary>
1374 </indexterm></entry>
1376 <entry>(2-Way) Randnum exchange<indexterm>
1377 <primary>uams_randnum.so</primary>
1379 <secondary>"(2-Way) Randnum exchange" UAM</secondary>
1380 </indexterm></entry>
1382 <entry>DHCAST128<indexterm>
1383 <primary>uams_dhx.so</primary>
1385 <secondary>"DHCAST128" UAM</secondary>
1386 </indexterm></entry>
1388 <entry>DHX2<indexterm>
1389 <primary>uams_dhx2.so</primary>
1391 <secondary>"DHX2" UAM</secondary>
1392 </indexterm></entry>
1394 <entry>Client Krb v2<indexterm>
1395 <primary>uams_gss.so</primary>
1397 <secondary>"Client Krb v2" UAM (Kerberos V)</secondary>
1398 </indexterm></entry>
1402 <entry align="center" rotate="0" valign="middle">pssword
1405 <entry>guest access</entry>
1407 <entry>max. 8 characters</entry>
1409 <entry>max. 8 characters</entry>
1411 <entry>max. 64 characters</entry>
1413 <entry>max. 256 characters</entry>
1415 <entry>Kerberos tickets</entry>
1419 <entry align="center" rotate="0" valign="middle">Client
1422 <entry>built-in into all Mac OS versions</entry>
1424 <entry>built-in in all Mac OS versions except 10.0. Has to be
1425 activated explicitly in recent Mac OS X versions</entry>
1427 <entry>built-in into almost all Mac OS versions</entry>
1429 <entry>built-in since AppleShare client 3.8.4, available as a
1430 plug-in for 3.8.3, integrated in Mac OS X' AFP client</entry>
1432 <entry>built-in since Mac OS X 10.2</entry>
1434 <entry>built-in since Mac OS X 10.2</entry>
1438 <entry align="center" rotate="0"
1439 valign="middle">Encryption</entry>
1441 <entry>Enables guest access without authentication between
1442 client and server.</entry>
1444 <entry>Password will be sent in cleartext over the wire. Just
1445 as bad as it sounds, therefore avoid at all if possible (note:
1446 providing NetBoot services requires the ClearTxt UAM)</entry>
1448 <entry>8-byte random numbers are sent over the wire,
1449 comparable with DES, 56 bits. Vulnerable to offline dictionary
1450 attack. Requires passwords in clear on the server.</entry>
1452 <entry>Password will be encrypted with 128 bit SSL, user will
1453 be authenticated against the server but not vice versa.
1454 Therefor weak against man-in-the-middle attacks.</entry>
1456 <entry>Password will be encrypted using libgcrypt with CAST
1457 128 in CBC mode. User will be authenticated against the server
1458 but not vice versa. Therefor weak against man-in-the-middle
1461 <entry>Password is not sent over the network. Due to the
1462 service principal detection method, this authentication method
1463 is vulnerable to man-in-the-middle attacks.</entry>
1467 <entry align="center" rotate="0" valign="middle">Server
1470 <entry align="center" valign="middle">uams_guest.so</entry>
1472 <entry align="center" valign="middle">uams_cleartxt.so</entry>
1474 <entry align="center" valign="middle">uams_randnum.so</entry>
1476 <entry align="center" valign="middle">uams_dhx.so</entry>
1478 <entry align="center" valign="middle">uams_dhx2.so</entry>
1480 <entry align="center" valign="middle">uams_gss.so</entry>
1484 <entry align="center" rotate="0" valign="middle">Password
1485 storage method</entry>
1487 <entry align="center" valign="middle">None</entry>
1489 <entry align="center" valign="middle">Either /etc/passwd
1490 (/etc/shadow) or PAM</entry>
1492 <entry align="center" valign="middle">Passwords stored in
1493 clear text in a separate text file</entry>
1495 <entry align="center" valign="middle">Either /etc/passwd
1496 (/etc/shadow) or PAM</entry>
1498 <entry align="center" valign="middle">Either /etc/passwd
1499 (/etc/shadow) or PAM</entry>
1501 <entry align="center" valign="middle">At the Kerberos Key
1502 Distribution Center*</entry>
1508 <para>* Have a look at this <ulink
1509 url="http://cryptnet.net/fdp/admin/kerby-infra/en/kerby-infra.html">Kerberos
1510 overview</ulink></para>
1513 <sect3 id="sshtunnel">
1514 <title>SSH tunneling</title>
1516 <para>Tunneling and all sort of VPN stuff has nothing to do with AFP
1517 authentication and UAMs in general. But since Apple introduced an
1518 option called "Allow Secure Connections Using SSH" and many people
1519 tend to confuse both things, we'll speak about that here too.</para>
1521 <sect4 id="manualsshtunnel">
1522 <title>Manually tunneling an AFP session</title>
1524 <para>This works since the first AFP servers that spoke "AFP over
1525 TCP" appeared in networks. One simply tunnels the remote server's
1526 AFP port to a local port different than 548 and connects locally to
1527 this port afterwards. On OS X this can be done by</para>
1529 <programlisting>ssh -l $USER $SERVER -L 10548:127.0.0.1:548 sleep 3000</programlisting>
1531 <para>After establishing the tunnel one will use
1532 <filename>"afp://127.0.0.1:10548"</filename> in the "Connect to
1533 server" dialog. All AFP traffic including the initial connection
1534 attempts will be sent encrypted over the wire since the local AFP
1535 client will connect to the Mac's local port 10548 which will be
1536 forwarded to the remote server's AFP port (we used the default 548)
1539 <para>These sorts of tunnels are an ideal solution if you've to
1540 access an AFP server providing weak authentications mechanisms
1541 through the Internet without having the ability to use a "real" VPN.
1542 Note that you can let <command>ssh</command> compress the data by
1543 using its "-C" switch and that the tunnel endpoints can be different
1544 from both AFP client and server (compare with the SSH documentation
1545 for details).</para>
1548 <sect4 id="autosshtunnel">
1549 <title>Automatically establishing a tunneled AFP connection</title>
1551 <para>From Mac OS X 10.2 to 10.4, Apple added an "Allow Secure
1552 Connections Using SSH" checkbox to the "Connect to Server" dialog.
1553 The idea behind: When the server signals that it can be contacted by
1554 SSH then Mac OS X' AFP client tries to establish the tunnel and
1555 automagically sends all AFP traffic through it.</para>
1557 <para>But it took until the release of Mac OS X 10.3 that this
1558 feature worked the first time... partly. In case, the SSH tunnel
1559 can't be established the AFP client <emphasis
1560 role="strong">silently</emphasis> fell back to an unencrypted AFP
1561 connection attempt.</para>
1563 <para>Netatalk's afpd will report that it is capable of handling SSH
1564 tunneled AFP requests, when both "<option>advertise ssh</option>"
1565 and "<option>fqdn</option>" options are set in
1566 <option>Global</option> section (double check with <citerefentry>
1567 <refentrytitle>asip-status.pl</refentrytitle>
1569 <manvolnum>1</manvolnum>
1570 </citerefentry> after you restarted afpd when you made changes to
1571 the settings). But there are a couple of reasons why you don't want
1572 to use this option at all:</para>
1576 <para>Tunneling TCP over TCP (as SSH does) is not the best idea.
1577 There exist better solutions like VPNs based on the IP
1582 <para>Since this SSH kludge isn't a normal UAM that integrates
1583 directly into the AFP authentication mechanisms but instead uses
1584 a single flag signalling clients whether they can <emphasis
1585 role="strong">try</emphasis> to establish a tunnel or not, it
1586 makes life harder to see what's happening when things go
1591 <para>You cannot control which machines are logged on by
1592 Netatalk tools like a <command>macusers</command> since all
1593 connection attempts seem to be made from localhost.</para>
1597 <para>On the other side you've to limit access to afpd to
1598 localhost only (TCP wrappers) when you want to ensure that all
1599 AFP sessions are SSH encrypted or...</para>
1603 <para>...when you're using 10.2 - 10.3.3 then you get the
1604 opposite of what you'd expect: potentially unencrypted AFP
1605 communication (including logon credentials) on the network
1606 without a single notification that establishing the tunnel
1607 failed. Apple fixed that not until Mac OS X 10.3.4.</para>
1611 <para>Encrypting all AFP sessions via SSH can lead to a
1612 significantly higher load on the Netatalk server</para>
1620 <title>ACL Support<indexterm>
1621 <primary>ACLs</primary>
1622 </indexterm></title>
1624 <para>ACL support for AFP is implemented for ZFS ACLs on Solaris and
1625 derived platforms and for POSIX 1e ACLs on Linux.</para>
1628 <title>Configuration</title>
1630 <para>For a basic mode of operation there's nothing to configure.
1631 Netatalk reads ACLs on the fly and calculates effective permissions
1632 which are then send to the AFP client via the so called
1634 <primary>UARights</primary>
1635 </indexterm> permission bits. On a Mac, the Finder uses these bits
1636 to adjust permission in Finder windows. For example folder whos UNIX
1637 mode would only result in in read-only permissions for a user will not
1638 be displayed with a read-only icon and the user will be able to write
1639 to the folder given the folder has an ACL giving the user write
1642 <para>By default, the effective permission of the authenticated user
1643 are only mapped to the mentioned UARights<indexterm>
1644 <primary>UARights</primary>
1645 </indexterm>permission structure, not the UNIX mode. You can adjust
1646 this behaviour with the configuration option <link
1647 linkend="map_acls">map acls</link>.</para>
1649 <para>However, neither in Finder "Get Info" windows nor in Terminal
1650 will you be able to see the ACLs, that's a result of how ACLs in OS X
1651 are designed. If you want to be able to display ACLs on the client,
1652 things get more involved as you must then setup both client and server
1653 to be part on a authentication domain (directory service, eg LDAP,
1654 OpenDirectory). The reason is, that in OS X ACLs are bound to UUIDs,
1655 not just uid's or gid's. Therefor afpd must be able to map every
1656 filesystem uid and gid to a UUID so that it can return the server side
1657 ACLs which are bound to UNIX uid and gid mapped to OS X UUIDs.</para>
1659 <para>Netatalk can query a directory server using LDAP queries. Either
1660 the directory server already provides an UUID attribute for user and
1661 groups (Active Directory, Open Directory) or you reuse an unused
1662 attribute (or add a new one) to you directory server (eg
1665 <para>In detail:</para>
1669 <para>For Solaris/ZFS: ZFS Volumes</para>
1671 <para>You should configure a ZFS ACL know for any volume you want
1672 to use with Netatalk:</para>
1674 <screen>aclinherit = passthrough
1675 aclmode = passthrough</screen>
1677 <para>For an explanation of what this knob does and how to apply
1678 it, check your hosts ZFS documentation (eg man zfs).</para>
1682 <para>Authentication Domain</para>
1684 <para>Your server and the clients must be part of a security
1685 association where identity data is coming from a common source.
1686 ACLs in Darwin are based on UUIDs and so is the ACL specification
1687 in AFP 3.2. Therefor your source of identity data has to provide
1688 an attribute for every user and group where a UUID is stored as a
1689 ASCII string. In other words:</para>
1693 <para>you need an Open Directory Server or an LDAP server
1694 where you store UUIDs in some attribute</para>
1698 <para>your clients must be configured to use this
1703 <para>your server should be configured to use this server via
1704 nsswitch and PAM</para>
1708 <para>configure Netatalk via the special <link
1709 linkend="acl_options">LDAP options for ACLs</link> in <link
1710 linkend="afp.conf.5">afp.conf</link> so that Netatalk is able
1711 to retrieve the UUID for users and groups via LDAP search
1720 <title>OS X ACLs</title>
1722 <para>With Access Control Lists (ACLs) Mac OS X offers a powerful
1723 extension of the traditional UNIX permissions model. An ACL is an
1724 ordered list of Access Control Entries (ACEs) explicitly granting or
1725 denying a set of permissions to a given user or group.</para>
1727 <para>Unlike UNIX permissions, which are bound to user or group IDs,
1728 ACLs are tied to UUIDs. For this reason accessing an object's ACL
1729 requires server and client to use a common directory service which
1730 translates between UUIDs and user/group IDs.</para>
1732 <para>ACLs and UNIX permissions interact in a rather simple way. As
1733 ACLs are optional UNIX permissions act as a default mechanism for
1734 access control. Changing an objects's UNIX permissions will leave it's
1735 ACL intact and modifying an ACL will never change the object's UNIX
1736 permissions. While doing access checks, OS X first examines an
1737 object's ACL evaluating ACEs in order until all requested rights have
1738 been granted, a requested right has been explicitly denied by an ACE
1739 or the end of the list has been reached. In case there is no ACL or
1740 the permissions granted by the ACL are not sufficient to fulfill the
1741 request, OS X next evaluates the object's UNIX permissions. Therefore
1742 ACLs always have precedence over UNIX permissions.</para>
1746 <title>ZFS ACLs</title>
1748 <para>ZFS ACLs closely match OS X ACLs. Both offer mostly identical
1749 fine grained permissions and inheritance settings.</para>
1753 <title>POSIX ACLs</title>
1756 <title>Overview</title>
1758 <para>Compared to OS X or NFSv4 ACLs, Posix ACLs represent a
1759 different, less versatile approach to overcome the limitations of
1760 the traditional UNIX permissions. Implementations are based on the
1761 withdrawn Posix 1003.1e standard.</para>
1763 <para>The standard defines two types of ACLs. Files and directories
1764 can have access ACLs which are consulted for access checks.
1765 Directories can also have default ACLs irrelevant to access checks.
1766 When a new object is created inside a directory with a default ACL,
1767 the default ACL is applied to the new object as it's access ACL.
1768 Subdirectories inherit default ACLs from their parent. There are no
1769 further mechanisms of inheritance control.</para>
1771 <para>Architectural differences between Posix ACLs and OS X ACLs
1772 especially involve:</para>
1774 <para><itemizedlist>
1776 <para>No fine-granular permissions model. Like UNIX
1777 permissions Posix ACLs only differentiate between read, write
1778 and execute permissions.</para>
1782 <para>Entries within an ACL are unordered.</para>
1786 <para>Posix ACLs can only grant rights. There is no way to
1787 explicitly deny rights by an entry.</para>
1791 <para>UNIX permissions are integrated into an ACL as special
1794 </itemizedlist></para>
1796 <para>Posix 1003.1e defines 6 different types of ACL entries. The
1797 first three types are used to integrate standard UNIX permissions.
1798 They form a minimal ACL, their presence is mandatory and only one
1799 entry of each type is allowed within an ACL.</para>
1801 <para><itemizedlist>
1803 <para>ACL_USER_OBJ: the owner's access rights.</para>
1807 <para>ACL_GROUP_OBJ: the owning group's access rights.</para>
1811 <para>ACL_OTHER: everybody's access rights.</para>
1813 </itemizedlist></para>
1815 <para>The remaining entry types expand the traditional permissions
1818 <para><itemizedlist>
1820 <para>ACL_USER: grants access rights to a certain user.</para>
1824 <para>ACL_GROUP: grants access rights to a certain
1829 <para>ACL_MASK: limits the maximum access rights which can be
1830 granted by entries of type ACL_GROUP_OBJ, ACL_USER and
1831 ACL_GROUP. As the name suggests, this entry acts as a mask.
1832 Only one ACL_MASK entry is allowed per ACL. If an ACL contains
1833 ACL_USER or ACL_GROUP entries, an ACL_MASK entry must be
1834 present too, otherwise it is optional.</para>
1836 </itemizedlist></para>
1838 <para>In order to maintain compatibility with applications not aware
1839 of ACLs, Posix 1003.1e changes the semantics of system calls and
1840 utilities which retrieve or manipulate an objects UNIX permissions.
1841 In case an object only has a minimal ACL, the group permissions bits
1842 of the UNIX permissions correspond to the value of the ACL_GROUP_OBJ
1845 <para>However, if the ACL also contains an ACL_MASK entry, the
1846 behavior of those system calls and utilities is different. The group
1847 permissions bits of the UNIX permissions correspond to the value of
1848 the ACL_MASK entry, i. e. calling "chmod g-w" will not only revoke
1849 write access for the group, but for all entities which have been
1850 granted write access by ACL_USER or ACL_GROUP entries.</para>
1854 <title>Mapping POSIX ACLs to OS X ACLs</title>
1856 <para>When a client wants to read an object's ACL, afpd maps it's
1857 Posix ACL onto an equivalent OS X ACL. Writing an object's ACL
1858 requires afpd to map an OS X ACL onto a Posix ACL. Due to
1859 architectural restrictions of Posix ACLs, it is usually impossible
1860 to find an exact mapping so that the result of the mapping process
1861 will be an approximation of the original ACL's semantic.</para>
1863 <para><itemizedlist>
1865 <para>afpd silently discard entries which deny a set of
1866 permissions because they they can't be represented within the
1867 Posix architecture.</para>
1871 <para>As entries within Posix ACLs are unordered, it is
1872 impossible to preserve order.</para>
1876 <para>Inheritance control is subject to severe limitations as
1879 <para>Entries with the only_inherit flag set will only
1880 become part of the directory's default ACL.</para>
1884 <para>Entries with at least one of the flags
1885 file_inherit, directory_inherit or limit_inherit set,
1886 will become part of the directory's access and default
1887 ACL, but the restrictions they impose on inheritance
1888 will be ignored.</para>
1890 </itemizedlist></para>
1894 <para>The lack of a fine-granular permission model on the
1895 Posix side will normally result in an increase of granted
1898 </itemizedlist></para>
1900 <para>As OS X clients aren't aware of the Posix 1003.1e specific
1901 relationship between UNIX permissions and ACL_MASK, afpd does not
1902 expose this feature to the client to avoid compatibility issues and
1903 handles *unix permissions and ACLs the same way as Apple's reference
1904 implementation of AFP does. When an object's UNIX permissions are
1905 requested, afpd calculates proper group rights and returns the
1906 result together with the owner's and everybody's access rights to
1907 the caller via "permissions" and "ua_permissions" members of the
1908 FPUnixPrivs structure (see Apple Filing Protocol Reference, page
1909 181). Changing an object's permissions, afpd always updates
1910 ACL_USER_OBJ, ACL_GROUP_OBJ and ACL_OTHERS. If an ACL_MASK entry is
1911 present too, afpd recalculates it's value so that the new group
1912 rights become effective and existing entries of type ACL_USER or
1913 ACL_GROUP stay intact.</para>
1919 <title>Filesystem Change Events<indexterm>
1920 <primary>FCE</primary>
1921 </indexterm></title>
1923 <para>Netatalk includes a nifty filesystem change event mechanism where
1924 afpd processes notfiy interested listeners about certain filesystem
1925 event by UDP network datagrams.</para>
1927 <para>For the format of the UDP packets and for an example C application
1928 that demonstrates how to use these in a listener, take a look at the
1929 Netatalk sourcefile <filename>bin/misc/fce.c</filename>.</para>
1931 <para>The currently supported FCE events are<itemizedlist>
1933 <para>file modification (fmod)</para>
1937 <para>file deletion (fdel)</para>
1941 <para>directory deletion (ddel)</para>
1945 <para>file creation (fcre)</para>
1949 <para>directory deletion (ddel)</para>
1951 </itemizedlist></para>
1953 <para>For details on the available simple configuration options take a
1954 look at <filename><link
1955 linkend="fceconf">afp.conf</link></filename>.</para>
1960 <title>Starting and stopping Netatalk</title>
1962 <para>The Netatalk distribution comes with several operating system
1963 specific startup script templates that are tailored according to the
1964 options given to the "configure" script before compiling. Currently,
1965 templates are provided for RedHat (sysv style), RedHat (systemd style),
1966 SUSE (sysv style), SUSE (systemd style), Gentoo, NetBSD, Debian and
1967 Solaris. You can select to install the generated startup script(s)
1969 <primary>Startscript</primary>
1971 <secondary>startup script</secondary>
1972 </indexterm> by specifying a system type to "configure". To
1973 automatically install startup scripts give one of the available
1974 <option>--with-init-style</option> option to "configure".</para>
1976 <para>Since new releases of Linux distributions appear all the time and
1977 the startup procedure for the other systems mentioned above might change
1978 as well, it is probably a good idea to not blindly install a startup
1979 script but to look at it first to see if it will work on your system. If
1980 you use Netatalk as part of a fixed setup, like a Linux distribution, an
1981 RPM or a BSD package, things will probably have been arranged properly for
1982 you. The following therefore applies mostly for people who have compiled
1983 Netatalk themselves.</para>
1985 <para>The following daemon need to be started by whatever startup script
1986 mechanism is used:</para>
1990 <para>netatalk<indexterm>
1991 <primary>netatalk</primary>
1996 <para>Additionally, make sure that the configuration file
1997 <filename>afp.conf</filename> is in the right place.</para>