Daenou / ansible-multiroom-audio

9 stars 0 forks source link

mpd with/without zeroconf (was: access to mpd via trusted uplink.) #69

Closed nis65 closed 1 year ago

nis65 commented 1 year ago

Usually, the uplink interface should be locked down as much as possible as the network connected there is out of our own control (e.g. a public access point).

However, when the uplink is connected to a trusted network (e.g. your home network) and you can connect the mpd clients to that same network, direct access to the mpd ports is needed via uplink.

The implementation should be controlled by a Setting in a file, e.g.

UPLINK_TRUSTED=yes
nis65 commented 1 year ago

When we are connected to a trusted uplink (via Ethernet and/or External USB WLAN Dongle),

nis65 commented 1 year ago

the current mpd config (raspbian default) with enabled mpd.socket does not allow to use mDNS (zeroconf). Enabled zeroconf for test purposes manually by adding two lines to mpd.conf:

zeroconf_enabled               "yes"
zeroconf_name                  "MPD @ %h"

and disabling the systemd mpd.socket (does stop make sense?):

systemctl stop mpd.socket
systemctl disable mpd.socket

This finally gives in mpd.log

avahi: Service 'MPD @ myhostname' successfully established.

See also this discussion which says:

But combining socket activation with zeroconf would be a rather pointless exercise. You would only be able to find MPD after you already connected to MPD.

Ah, indeed, that is a chicken-and-egg.

I believe that I never really use socket activation (as mpd is started on boot and never stopped after), or to be precise: I was always a bit astonished that my mpd kept starting up after a systemctl stop just because one of my tools was polling its state...

So I guess it's safe to disable mpd socket activation to get zeroconf...

What do you @Daenou think about mpd socket activation?

nis65 commented 1 year ago

Talking to myself: Well, this is not that a good idea after all. What I want to achieve is to use my standalone camper Pi in the same way as at home (i.e. a plain music device without any routing/secuity requirements. In other words: *Not apply the accesspoint and uplink roles.

So what is left from that feature request (at the moment)

nis65 commented 1 year ago

temporarily disable all features...

systemctl stop hostapd
systemctl stop dnsmasq
systemctl stop firewalld

is enough. After a reboot, all is back to normal.

It would be nice if ap0 ... could be used ... as normal uplink.

I don't think that this could be done in a way that reverts automatically on reboot. With the current implementation, it would mean to remove /etc/systemd/system/dhcpcd.service.d/zzoverride.conf "temporarily" and restart dhcpcd. How to ensure that override file is present on next boot again?

nis65 commented 1 year ago

Manual stopping is solved (previous comment).

The additional issue (zeroconf) is solved with #71.