Netatalk for macOS - networking classic and modern Macs

About Qemu-system-ppc, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9.0 up to Mac OS X 10.5

Moderators: Cat_7, Ronald P. Regensburg

dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

Anyone know anything about dbus? I have been working on afpstats and dbus but cannot get it to work. The way the original code is set up to work is for afpstats to use the system bus but Homebrew's dbus only provides a per user session bus. I'm not even sure it's worth the work as the macusers script provides virtually the same info. What do you think?
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mabam »

I didn’t know how to fix these:

/doc/manpages/man1/uniconv.1.xml
line 56: @DEFAULT_CNID_SCHEME@

/doc/manpages/man5/afp.conf.5.xml
line 923: @DBUS_DAEMON_PATH@
line 1785: @DEFAULT_CNID_SCHEME@
line 1786: @compiled_backends@

All other undefined variables of the html documentation should be fixed in my latest pull request.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Netatalk for macOS - networking classic and modern Macs

Post by adespoton »

dgsga wrote: Thu Apr 22, 2021 8:02 pm Anyone know anything about dbus? I have been working on afpstats and dbus but cannot get it to work. The way the original code is set up to work is for afpstats to use the system bus but Homebrew's dbus only provides a per user session bus. I'm not even sure it's worth the work as the macusers script provides virtually the same info. What do you think?
Homebrew's dbus only provides a per user session bus by default... there's instructions for setting up a launchd record for system bus use. Or maybe that was the MacPorts version... it's getting a bit fuzzy for me now that I've played around with both so much. Anyway, the script is probably the better way to go, as the dbus solution gives different results on different OS versions IIRC (Catalina and later may not have the system-wide option, now that I think of it).
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

Update:

afpstats has been removed from the repo as the not-insignificant amount of code associated with it yields no working result, even in linux. This means dbus and dbus-glib dependencies are no longer required. I have added mysql to list of dependencies in case you want to use mysql as the cnid backend (requires the mysql server to be up and running in macOS).

Also, running 'ulimit -aH' in macOS gives the following result:

Code: Select all

% ulimit -aH
-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             65532
-c: core file size (blocks)         unlimited
-v: address space (kbytes)          unlimited
-l: locked-in-memory size (kbytes)  unlimited
-u: processes                       8352
-n: file descriptors                unlimited
The resource argument "RLIMIT_NOFILE' used in the setlimits function specifies a value one greater than the maximum file descriptor number that can be opened by a process. The above output shows that the maximum file descriptor number that can be opened by a process in macOS is unlimited. So I have commented out the setlimits function in afpd and cnid_metad so those cnid_metad exit errors should be eliminated. Please let me know if you have any issues with this change and if so I will revert the commit
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mabam »

Wow, you seem to have spent your whole weekend on this!

I just tried compiling the new code and got this:

Code: Select all

$ make
[…]
Making all in libatalk
[…]
Making all in vfs
  CC       vfs.lo
  CC       unix.lo
  CC       ea_ad.lo
  CC       ea_sys.lo
  CC       extattr.lo
  CCLD     libvfs.la
  CC       dummy.lo
  CCLD     libatalk.la
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libatalk.la] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

@mabam
Try a fresh clone of the repo, made numerous changes and reverts over the weekend. I’ve double-checked here on 2 machines and all’s well...
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mabam »

The error was with a fresh clone from yesterday night. I remember the current “111 commits ahead of Netatalk:branch-netatalk-3-1” message in your repo from yesterday.

I just tried with cloning again anyway but got the same error as yesterday.
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

mabam wrote: Mon Apr 26, 2021 8:36 pm The error was with a fresh clone from yesterday night. I remember the current “111 commits ahead of Netatalk:branch-netatalk-3-1” message in your repo from yesterday.

I just tried with cloning again anyway but got the same error as yesterday.
Hmm, not sure what's going on here, I can't seem to reproduce the issue. In your compilation summary it should say:

Code: Select all

SSL:
        LIBS   =  -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/openssl@1.1 -lcrypto
        CFLAGS =  -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/openssl@1.1/include/openssl
Have you tried re-installing openssl in Homebrew? Anyone else have the same problem?
mikeboss
Space Cadet
Posts: 8
Joined: Sat Apr 17, 2021 7:54 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mikeboss »

I just tested it on my Mac mini M1 running a fresh install of macOS 11.3 and everything (installing brew, git clone make etc.) has worked flawless.
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mabam »

dgsga wrote: Tue Apr 27, 2021 7:17 pm Hmm, not sure what's going on here, I can't seem to reproduce the issue. In your compilation summary it should say:

Code: Select all

SSL:
        LIBS   =  -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/openssl@1.1 -lcrypto
        CFLAGS =  -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/openssl@1.1/include/openssl
Have you tried re-installing openssl in Homebrew? Anyone else have the same problem?

I’m abroad for the rest of the week and will check this when I’m back.
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

All done now. I have added an install.command file to the root of the repo that does it all (repo update, configure, make, install, cleanup) with a single double-click on the file. You just need to make it executable with:

Code: Select all

chmod +x install.command
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mabam »

mabam wrote: Wed Apr 28, 2021 12:39 pm
dgsga wrote: Tue Apr 27, 2021 7:17 pm Hmm, not sure what's going on here, I can't seem to reproduce the issue. In your compilation summary it should say:

Code: Select all

SSL:
        LIBS   =  -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/openssl@1.1 -lcrypto
        CFLAGS =  -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/openssl@1.1/include/openssl
Have you tried re-installing openssl in Homebrew? Anyone else have the same problem?

I’m abroad for the rest of the week and will check this when I’m back.

Just tried to compile again. Your fix to the repo did the trick. Thanks again!
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mabam »

@dgsga:
I just figured that “sudo make uninstall” doesn’t work anymore (make: *** No rule to make target `uninstall'. Stop.).
I suppose that got deleted with some cleanup. Is it possible to revert this?
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

Have removed make distclean auto-cleanup from install. command so all should be fine now...
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mabam »

Thank you, works as advertised!
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

Revisited the repo to update. It now uses macOS native PAM authentication, OpenSSL 3 and can be installed using Homebrew. The Extended Attributes macro has been fixed so filesystem EA’s are used by default rather than Apple Double
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mabam »

That’s good news – thank you and well done!

Are there also plans to add it to homebrew as a formula?
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

mabam wrote: Fri Nov 26, 2021 1:50 am That’s good news – thank you and well done!

Are there also plans to add it to homebrew as a formula?
Thanks @mabam. I had to revert openssl@3 because DHX authentication failed even though the code compiled. Some of the functions that the netatalk code uses for DHX authentication are now deprecated in openssl@3 so presumably they'll be removed at some point. At that stage I'll incorporate openssl 1.1.1l into the code so we never have to look elsewhere for it. As for the formula, have thought about it but Homebrew maintainers would probably want to have installation possible on linux as well as macOS and I've removed all the code for other OSes. Can't face re-instating it!
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

Update:
Please clone a new copy of the repo to ensure you have access to new features. CVE security issues have been fixed and there is now a menu-driven install script. Shared volume detection via Bonjour in 10.4+ clients also works correctly. Enjoy!
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

Update: Migrated whole repo to the meson build system. A vast improvement...
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Netatalk for macOS - networking classic and modern Macs

Post by adespoton »

[deleted - edit below]
Last edited by adespoton on Thu Nov 03, 2022 8:19 pm, edited 1 time in total.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Netatalk for macOS - networking classic and modern Macs

Post by adespoton »

adespoton wrote: Thu Nov 03, 2022 8:00 pm
dgsga wrote: Thu Nov 03, 2022 7:30 pm Update: Migrated whole repo to the meson build system. A vast improvement...
That's great!
I had to revert openssl@3
Er... I hope you have applied the latest patch? 3.0.0 through 3.0.6 have a significant security hole:

https://www.openssl.org/blog/blog/2022/ ... overflows/
[edit] Nevermind... you reverted FROM OpenSSL 3. 1.x doesn't have the issues and is still supported for another year. Not sure what's going to happen after that....

Are we at a point now where a Homebrew formula/cask could be created?
User avatar
mabam
Master Emulator
Posts: 497
Joined: Wed Apr 10, 2013 9:32 am

Re: Netatalk for macOS - networking classic and modern Macs

Post by mabam »

dgsga wrote: Sat Jun 25, 2022 4:53 pm Update:
Please clone a new copy of the repo to ensure you have access to new features. CVE security issues have been fixed and there is now a menu-driven install script. Shared volume detection via Bonjour in 10.4+ clients also works correctly. Enjoy!

Thanks for your hard work!

After upgrading to Ventura I have done a new install of netatalk on my machine the day before yesterday. After loading the launch daemon

Code: Select all

sudo launchctl load /Library/LaunchDaemons/com.netatalk.daemon.plist
I could connect to it at first. But after a restart, though the network machine name shared via netatalk is visible on other machines, trying to connect to it fails.

In System Preferences under General > Login Items “netatalkd” is listed.
And under Privacy & Security > Full Disk Access is granted to “afpd”, “cnid_metad”, and “netatalkd”.

For recent versions of macOS, accessing the machine via Samba works.

Do you have any tips or thoughts as to where to look for a solution for this?
dgsga
Tinkerer
Posts: 45
Joined: Wed Feb 17, 2021 8:13 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by dgsga »

Hi @mabam
I've done quite a lot of code tweaking recently to ensure that the repo compiles cleanly with the default compiler flags used by meson. So start with a fresh clone before going any further. I'm also on Ventura and I think the problem might be that you need to add the -w flag to the launchctl command to have it load on every boot. Otherwise it only loads for the current boot. I tend to unload the launch daemon first then reload it when I re-install:

Code: Select all

sudo launchctl unload -w /Library/LaunchDaemons/com.netatalk.daemon.plist

Code: Select all

sudo launchctl load -w /Library/LaunchDaemons/com.netatalk.daemon.plist
Once you've reached the desktop after booting, three Netatalk-related processes should be present in Activity Monitor (afpd, cnid_metad and netatalk). I have found that file exchange seems to work fine without giving full disk access to any daemon.
krolingo
Space Cadet
Posts: 1
Joined: Fri Feb 17, 2023 8:35 pm

Re: Netatalk for macOS - networking classic and modern Macs

Post by krolingo »

:cool: I just started using netatalk on a Monterey machine.

My findings:
I order to share files from a drive in /Volumes I gave full disk access to bash, sh, zsh

(I don't know which one the system is using so I gave access to all of them)

I also gave Full Disk Access to afpd, cnid_dbd, cnid_metad, netatalk,

but I believe all you need is:
System Shell (zsh on Monterey?) + 2) afpd and 3) cnid_metad

This is my shared volume (from a thumdrive [formated for GUID HFS+]

[Global]
; Global server settings
vol preset = default_for_all_vol
loglevel = default:maxdebug,afpdaemon:maxdebug,logger:maxdebug,uamsdaemon:maxdebug
log file = /var/log/afpd.log
afp listen = 192.168.1.199
uam list = uams_dhx.so uams_dhx2.so

[default_for_all_vol]
file perm = 0664
directory perm = 0774
ea = auto
cnid scheme = dbd

[Homes]
basedir regex = /Users
home name = $u @some_server_name
;rwlist = nobody

[HFSJ]
path = /Volumes/HFSJ
appledouble = v2
ea = none
valid users = krolingo
file perm = 0660
directory perm = 0770
; time machine = yes
rwlist = krolingo

I will test on another machine, enable just the 3 things I believe need full disk access and report back here. if anyone is interested.

Krolingo
Last edited by krolingo on Fri Feb 17, 2023 8:44 pm, edited 1 time in total.
Post Reply