add: avahi service

This commit is contained in:
root 2022-12-20 09:23:45 +00:00
parent f251eaf075
commit 8123388a94
6 changed files with 117 additions and 0 deletions

32
avahi/README.md Normal file
View File

@ -0,0 +1,32 @@
# Avahi
# Import notes
To allow avahi to work, you will want to use it on your lan, with the macvtap driver. This is because avahi need to broadcast to your lan network.
You may need to enable macvlan:
```
networks:
lan:
name: lan
driver: macvlan
driver_opts:
parent: enp1s0
ipam:
config:
# This should be your lan network
- subnet: 192.168.42.0/24
#- subnet: 192.168.42.144/28
# 192.168.42.145 -> 192.168.42.158
# 192.168.42.159
services:
avahi:
networks:
lan:
# This IP is outside my DNS range of my lan
ipv4_address: 192.168.42.100
```

2
avahi/conf/hosts Normal file
View File

@ -0,0 +1,2 @@
# Example:
# 192.168.42.18 files.local

View File

@ -0,0 +1,34 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<!--
This file is part of avahi.
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
avahi is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
-->
<!-- See avahi.service(5) for more information about this configuration file -->
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_sftp-ssh._tcp</type>
<port>22</port>
</service>
</service-group>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">files.domain</name>
<service>
<type>_smb._tcp</type>
<port>139</port>
<host-name>files.local</host-name>
<txt-record>model=Samba server</txt-record>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Docker</txt-record>
<host-name>files.local</host-name>
</service>
</service-group>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<!-- See avahi.service(5) for more information about this configuration file -->
<service-group>
<name replace-wildcards="yes">domain.org</name>
<service>
<type>_ssh._tcp</type>
<port>22</port>
<host-name>domain.org</host-name>
</service>
</service-group>

19
avahi/docker-compose.yml Normal file
View File

@ -0,0 +1,19 @@
version: "3.7"
networks:
lan:
services:
avahi:
image: flungo/avahi
volumes:
- $app_dir_conf/hosts:/etc/avahi/hosts
- $app_dir_conf/services:/etc/avahi/services
# See: https://linux.die.net/man/5/avahi-daemon.conf
# See: https://hub.docker.com/r/flungo/avahi
environment:
SERVER_HOST_NAME: mdns
#SERVER_HOST_NAME: $app_fqdn
#SERVER_DOMAIN_NAME: faketest
networks:
lan: