diff --git a/net/pfSense-pkg-Avahi/Makefile b/net/pfSense-pkg-Avahi/Makefile index 2ed85453ea2c..e8f1a05dfc2d 100644 --- a/net/pfSense-pkg-Avahi/Makefile +++ b/net/pfSense-pkg-Avahi/Makefile @@ -1,18 +1,17 @@ # $FreeBSD$ PORTNAME= pfSense-pkg-Avahi -PORTVERSION= 1.13 +PORTVERSION= 2.0.0 CATEGORIES= net MASTER_SITES= # empty DISTFILES= # empty -EXTRACT_ONLY= # empty MAINTAINER= coreteam@pfsense.org COMMENT= pfSense package Avahi LICENSE= APACHE20 -LIB_DEPENDS= libavahi-core.so:net/avahi-app +RUN_DEPENDS= avahi-app>=0:net/avahi-app NO_BUILD= yes NO_MTREE= yes @@ -24,22 +23,21 @@ do-extract: ${MKDIR} ${WRKSRC} do-install: - ${MKDIR} ${STAGEDIR}${PREFIX}/pkg + ${MKDIR} ${STAGEDIR}${PREFIX}/pkg/avahi ${MKDIR} ${STAGEDIR}/etc/inc/priv - ${MKDIR} ${STAGEDIR}${PREFIX}/etc/avahi + ${MKDIR} ${STAGEDIR}${PREFIX}/www ${MKDIR} ${STAGEDIR}${DATADIR} - ${INSTALL_DATA} -m 0644 ${FILESDIR}${PREFIX}/pkg/avahi.xml \ - ${STAGEDIR}${PREFIX}/pkg - ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/avahi.inc \ + ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/avahi.xml \ ${STAGEDIR}${PREFIX}/pkg + ${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/avahi/avahi.inc \ + ${STAGEDIR}${PREFIX}/pkg/avahi ${INSTALL_DATA} ${FILESDIR}/etc/inc/priv/avahi.priv.inc \ ${STAGEDIR}/etc/inc/priv - ${INSTALL_DATA} ${FILESDIR}${PREFIX}/etc/avahi/ssh.service \ - ${STAGEDIR}${PREFIX}/etc/avahi - ${INSTALL_DATA} ${FILESDIR}${PREFIX}/etc/avahi/sftp-ssh.service \ - ${STAGEDIR}${PREFIX}/etc/avahi ${INSTALL_DATA} ${FILESDIR}${DATADIR}/info.xml \ ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/avahi_settings.php \ + ${STAGEDIR}${PREFIX}/www + @${REINPLACE_CMD} -i '' -e "s|%%PKGVERSION%%|${PKGVERSION}|" \ ${STAGEDIR}${DATADIR}/info.xml diff --git a/net/pfSense-pkg-Avahi/files/etc/inc/priv/avahi.priv.inc b/net/pfSense-pkg-Avahi/files/etc/inc/priv/avahi.priv.inc index 09b7eca81f58..1cd6e3b3ab20 100644 --- a/net/pfSense-pkg-Avahi/files/etc/inc/priv/avahi.priv.inc +++ b/net/pfSense-pkg-Avahi/files/etc/inc/priv/avahi.priv.inc @@ -3,7 +3,7 @@ * avahi.priv.inc * * part of pfSense (https://www.pfsense.org) - * Copyright (c) 2015 Rubicon Communications, LLC (Netgate) + * Copyright (c) 2018 Denny Page * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,10 +22,10 @@ global $priv_list; $priv_list['page-services-avahi'] = array(); -$priv_list['page-services-avahi']['name'] = "WebCfg - Services: Avahi package"; -$priv_list['page-services-avahi']['descr'] = "Allow access to Avahi package GUI"; +$priv_list['page-services-avahi']['name'] = "WebCfg - Services: Avahi"; +$priv_list['page-services-avahi']['descr'] = "Access the Avahi package gui"; $priv_list['page-services-avahi']['match'] = array(); -$priv_list['page-services-avahi']['match'][] = "pkg_edit.php?xml=avahi.xml*"; +$priv_list['page-services-avahi']['match'][] = "avahi_settings.php*"; ?> diff --git a/net/pfSense-pkg-Avahi/files/usr/local/etc/avahi/sftp-ssh.service b/net/pfSense-pkg-Avahi/files/usr/local/etc/avahi/sftp-ssh.service deleted file mode 100644 index c65535a84599..000000000000 --- a/net/pfSense-pkg-Avahi/files/usr/local/etc/avahi/sftp-ssh.service +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - SFTP File Transfer on %h - - - _sftp-ssh._tcp - 22 - - - diff --git a/net/pfSense-pkg-Avahi/files/usr/local/etc/avahi/ssh.service b/net/pfSense-pkg-Avahi/files/usr/local/etc/avahi/ssh.service deleted file mode 100644 index a493444e169d..000000000000 --- a/net/pfSense-pkg-Avahi/files/usr/local/etc/avahi/ssh.service +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - %h - - - _ssh._tcp - 22 - - - diff --git a/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi.inc b/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi.inc deleted file mode 100644 index 9703f976e994..000000000000 --- a/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi.inc +++ /dev/null @@ -1,274 +0,0 @@ -/dev/null 2>&1\n"; - if (!$avahi_config['disable_dbus']) { - $start .= "if [ ! -d /var/run/dbus ]; then\n"; - $start .= " /bin/mkdir /var/run/dbus\n"; - $start .= " /usr/sbin/chown messagebus:messagebus /var/run/dbus\n"; - $start .= "fi\n"; - if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) { - $start .= AVAHI_BASE . "/etc/rc.d/dbus onestop\n"; - $start .= "/bin/rm /var/run/dbus/dbus.pid >/dev/null 2>&1\n"; - $start .= AVAHI_BASE . "/etc/rc.d/dbus onestart\n"; - $start .= "sleep 5\n"; - } - } - $start .= AVAHI_BASE . "/sbin/avahi-daemon -D\n"; - $start .= "/etc/rc.conf_mount_ro\n"; - - $stop = "/usr/bin/killall avahi-daemon >/dev/null 2>&1\n"; - if (!$avahi_config['disable_dbus']) { - if (file_exists(AVAHI_BASE . "/etc/rc.d/dbus")) { - $stop .= AVAHI_BASE . "/etc/rc.d/dbus onestop\n"; - $stop .= "/bin/rm /var/run/dbus/dbus.pid >/dev/null 2>&1\n"; - } - } - - write_rcfile(array( - "file" => "avahi-daemon.sh", - "start" => $start, - "stop" => $stop - ) - ); -} - -function avahi_sync() { - global $config; - conf_mount_rw(); - - if (is_service_running("avahi")) { - stop_service("avahi"); - } - avahi_write_config(); - - // Is package enabled? - if ($config['installedpackages']['avahi']['config'][0]['enable']) { - avahi_write_rcfile(); - if (file_exists("/usr/local/etc/rc.d/dbus")) { - if (!$config['installedpackages']['avahi']['config'][0]['disable_dbus']) { - chmod("/usr/local/etc/rc.d/dbus", 0755); - } - } - start_service("avahi"); - } else { - unlink_if_exists("/usr/local/etc/rc.d/avahi-daemon.sh"); - if (file_exists("/usr/local/etc/rc.d/dbus")) { - chmod("/usr/local/etc/rc.d/dbus", 0644); - } - } - - conf_mount_ro(); -} - -function avahi_upgrade_config() { - global $config; - - $avahi_config =& $config['installedpackages']['avahi']['config'][0]; - if (!is_array($avahi_config)) { - $avahi_config = array(); - } - $changes = 0; - // Convert previous disable values to enable ones - // If broken settings were configured due to lack of validation, just set to defaults - if (isset($avahi_config['disable_ipv4']) && isset($avahi_config['disable_ipv6']) && $avahi_config['disable_ipv4'] == "on" && $avahi_config['disable_ipv6'] == "on") { - $avahi_config['enable_ipv4'] = "on"; - $avahi_config['enable_ipv6'] = "on"; - unset($avahi_config['disable_ipv4']); - unset($avahi_config['disable_ipv6']); - $changes++; - } elseif (isset($avahi_config['disable_ipv4']) && $avahi_config['disable_ipv4'] != "on") { - $avahi_config['enable_ipv4'] = "on"; - unset($avahi_config['disable_ipv4']); - $changes++; - } elseif (isset($avahi_config['disable_ipv6']) && $avahi_config['disable_ipv6'] != "on") { - $avahi_config['enable_ipv6'] = "on"; - unset($avahi_config['disable_ipv6']); - $changes++; - } - if ($changes > 0 ) { - write_config("[avahi] Upgraded old package configuration."); - } -} - -function avahi_validate_input($post, &$input_errors) { - if (($post['enable_ipv4'] != "on" ) && ($post['enable_ipv6'] != "on" )) { - $input_errors[] = gettext("You cannot disable both IPv4 and IPv6!"); - } - if (($post['enable_ipv4'] != "on" ) && ($post['publish_aaaa_on_ipv4'] == "on" )) { - $input_errors[] = gettext("'Publish AAAA records on IPv4' makes no sense with IPv4 disabled."); - } - if (($post['enable_ipv6'] != "on" ) && ($post['publish_a_on_ipv6'] == "on" )) { - $input_errors[] = gettext("'Publish A records on IPv6' makes no sense with IPv6 disabled."); - } - if (!empty($post['cache_max']) && !is_numericint($post['cache_max'])) { - $input_errors[] = gettext("Maximum Cache Size must be blank, 0, or a positive numeric integer."); - } - -} - -?> diff --git a/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi.xml b/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi.xml index e4b961c6ff45..4adff4a80f8c 100644 --- a/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi.xml +++ b/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi.xml @@ -3,12 +3,12 @@ - - Services: Avahi avahi - /usr/local/pkg/avahi.inc + 2.0.0 + Services: Avahi + Change + /usr/local/pkg/avahi/avahi.inc Avahi + Avahi mDNS/DNS-SD
Services
- /pkg_edit.php?xml=avahi.xml + /avahi_settings.php
avahi avahi-daemon.sh avahi-daemon - Avahi Zeroconf/mDNS Daemon + Avahi mDNS/DNS-SD daemon - - - Server Options - listtopic - - - Enable - enable - Enable Avahi Bonjour/Zeroconf proxy. - checkbox - - - Browse Domains - browsedomains - - - (Default: local) - ]]> - - input - local - - - Deny interfaces - denyinterfaces - - - Note: WAN is always disabled (so it is not shown here). - ]]> - - interfaces_selection - (wan|loopback) - true - - - Enable IPv4 - enable_ipv4 - Enable IPv4 support in Avahi. (Default: enabled) - checkbox - on - publish_aaaa_on_ipv4 - - - Enable IPv6 - enable_ipv6 - Enable IPv6 support in Avahi. (Default: enabled) - checkbox - on - publish_a_on_ipv6 - - - Disable D-Bus - disable_dbus - Disable D-Bus client API support in Avahi. (Default: no) - checkbox - - - Maximum Cache Size - cache_max - The size of the object cache. Leave blank for default, 0 to disable. Disabling the cache can help with object duplication when reflecting. - input - - - Wide Area - listtopic - - - Enable Wide-Area DNS-SD - enable_wide_area - Enable wide-area DNS-SD, aka DNS-SD over unicast DNS. (Default: enabled) - - - If you want to maintain multiple different multicast DNS domains even with this option enabled, - use subdomains of .local, such as "kitchen.local".
- ]]> -
- checkbox - on -
- - Publishing Options - listtopic - - - Disable Publishing - disable_publishing - Disable publishing of services and address records. (Default: no) - - - Warning: Do NOT disable publishing unless absolutely required!
- ]]> -
- checkbox - off -
- - Disable User Service Publishing - disable_user_service_publishing - Disable publishing for user services (Default: no) - - - ]]> - - checkbox - off - - - Add Service Cookie - add_service_cookie - Add an implicit TXT entry to all locally registered services. (Default: disabled) - This can be used to detect if two services on two different interfaces/protocols are actually identical. - checkbox - off - - - Publish Addresses - publish_addresses - Register mDNS address records for all local IP addresses (Default: enabled) - - - ]]> - - checkbox - on - - - Publish HINFO - publish_hinfo - Register an mDNS HINFO record on all interfaces with local info. (Default: enabled) - - - This is recommended by the mDNS specification but not required. This feature may be disabled for security and privacy reasons.
- ]]> -
- checkbox - on -
- - Publish Workstation - publish_workstation - Register a service of type "_workstation._tcp" on the local LAN. (Default: enabled) - This is useful for administrative purposes, such as browsing for all PCs on the LAN. - checkbox - on - - - Publish DNS Servers - publish_resolv_conf_dns_servers - Publish the system unicast DNS servers (Default: disabled) - - System > General Setup to announce them using mDNS
- When used in conjunction with avahi-dnsconfd on the client side this allows DHCP-like configuration of unicast DNS servers.
- ]]> -
- checkbox - off -
- - Publish AAAA records on IPv4 - publish_aaaa_on_ipv4 - Publish IPv6 AAAA record via IPv4 (Default: enabled) - If enabled, Avahi will publish an IPv6 AAAA record via IPv4, allowing the local IPv6 addresses to be resolved using IPv4. - checkbox - on - - - Publish A records on IPv6 - publish_a_on_ipv6 - Publish IPv4 A record via IPv6 (Default: disabled) - If enabled, Avahi will publish an IPv4 A record via IPv6, allowing the local IPv4 addresses to be resolved using IPv6. - checkbox - off - - - Reflector Options - listtopic - - - Enable Reflector - enable_reflector - Reflect incoming mDNS requests to all local network interfaces (Default: enabled) - - - ]]> - - checkbox - on - - - Reflect IPv - reflect_ipv - Forward mDNS traffic between IPv4 and IPv6 (Default: disabled) - If enabled, Avahi will forward mDNS traffic between IPv4 and IPv6, which is usually not recommended. - checkbox - off - -
- avahi_sync(); + avahi_sync_config(); - - avahi_upgrade_config(); - - - avahi_validate_input($_POST, $input_errors); - + + avahi_deinstall_command(); +
diff --git a/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi/avahi.inc b/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi/avahi.inc new file mode 100644 index 000000000000..9ec9f1725d2e --- /dev/null +++ b/net/pfSense-pkg-Avahi/files/usr/local/pkg/avahi/avahi.inc @@ -0,0 +1,128 @@ + "avahi-daemon.sh", + "start" => $start, + "stop" => $stop + ) + ); + + if (platform_booting()) { + return; + } + + log_error("Starting service avahi"); + start_service('avahi'); +} + + +function avahi_deinstall_command() { + if (is_service_running('avahi')) { + log_error("Stopping service avahi"); + stop_service('avahi'); + } + + unlink_if_exists(AVAHI_RCFILE); +} diff --git a/net/pfSense-pkg-Avahi/files/usr/local/share/pfSense-pkg-Avahi/info.xml b/net/pfSense-pkg-Avahi/files/usr/local/share/pfSense-pkg-Avahi/info.xml index 9e808cf882eb..eac9bebc98ec 100644 --- a/net/pfSense-pkg-Avahi/files/usr/local/share/pfSense-pkg-Avahi/info.xml +++ b/net/pfSense-pkg-Avahi/files/usr/local/share/pfSense-pkg-Avahi/info.xml @@ -2,14 +2,10 @@ Avahi - https://doc.pfsense.org/index.php/Avahi_package + https://forum.netgate.com/topic/134339 http://www.avahi.org/ - + %%PKGVERSION%% avahi.xml - Please visit Services - Avahi menu, enable the service and select which interfaces you do NOT wish Avahi to listen on. Save settings to start the service. diff --git a/net/pfSense-pkg-Avahi/files/usr/local/www/avahi_settings.php b/net/pfSense-pkg-Avahi/files/usr/local/www/avahi_settings.php new file mode 100644 index 000000000000..dd058d6f02b2 --- /dev/null +++ b/net/pfSense-pkg-Avahi/files/usr/local/www/avahi_settings.php @@ -0,0 +1,373 @@ +addInput(new Form_Checkbox( + 'enable', + 'Enable', + 'Enable the Avahi daemon', + $pconfig['enable'] +)); + +$section->addInput(new Form_Select( + 'interfaces_a', + 'Interfaces', + $pconfig['interfaces_a'], + $available_interfaces, + true +))->setHelp( + 'Interfaces that the Avahi daemon will listen and send on' +); + +$section->addInput(new Form_Checkbox( + 'disable_ipv4', + 'Disable IPv4', + 'Disable support for IPv4', + $pconfig['disable_ipv4'] +)); + +$section->addInput(new Form_Checkbox( + 'disable_ipv6', + 'Disable IPv6', + 'Disable support for IPv6', + $pconfig['disable_ipv6'] +)); + +$section->addInput(new Form_Checkbox( + 'reflection', + 'Enable reflection', + 'Repeat mdns packets across subnets', + $pconfig['reflection'] +))->setHelp( + 'This option allows clients in one subnet to browse for clients and services located in different subnets.' +); + +$form->add($section); + + +$section = new Form_Section('Publishing'); + +$section->addInput(new Form_Checkbox( + 'publishing', + 'Enable publishing', + 'Enable publishing of information about the pfSense host', + $pconfig['publishing'] +))->setHelp( + 'Use with caution. Publishing can reveal a good deal of information about your pfSense host.%sNote that this option enables publishing of default system services such as ssh and ftp-ssh.', '
' +); + +$group = new Form_Group('Publish addresses'); +$group->addClass('publishing'); +$group->add(new Form_Checkbox( + 'publish_addresses', + 'Publish addresses', + 'Publish address records for the pfSense host', + $pconfig['publish_addresses'] +)); +$section->add($group); + +$group = new Form_Group('Publish host info'); +$group->addClass('publishing'); +$group->add(new Form_Checkbox( + 'publish_hinfo', + 'Publish host info', + 'Publish a host information record (OS and CPU info) for the pfSense host', + $pconfig['publish_hinfo'] +)); +$section->add($group); + +$group = new Form_Group('Publish workstation'); +$group->addClass('publishing'); +$group->add(new Form_Checkbox( + 'publish_workstation', + 'Publish workstation', + 'Publish a workstation record for the pfSense host', + $pconfig['publish_workstation'] +)); +$section->add($group); + +$group = new Form_Group('Publish domain'); +$group->addClass('publishing'); +$group->add(new Form_Checkbox( + 'publish_domain', + 'Publish Domain', + 'Publish the domain name in use by the pfSense host', + $pconfig['publish_domain'] +)); +$section->add($group); + +$button = new Form_Button( + 'advancedbutton', + 'Display Advanced', + null, + 'fa-cog' +); +$button->setAttribute('type', 'button')->addClass('btn-info btn-sm'); +$section->addInput(new Form_StaticText( + null, + $button +)); + +$form->add($section); + + +$section = new Form_Section('Advanced settings'); +$section->addClass('advanced'); + +$group = new Form_Group('Override host name'); +$group->add(new Form_Input( + 'override_hostname', + 'Override host name', + 'text', + $pconfig['override_hostname'] +))->sethelp('Override the host name used for publishing mdns records. The default is the system host name.'); +$section->add($group); + +$group = new Form_Group('Override domain'); +$group->add(new Form_Input( + 'override_domain', + 'Override domain', + 'text', + $pconfig['override_domain'] +))->sethelp('Override the domain name used for publishing mdns records. The default is "local".'); +$section->add($group); + +$group = new Form_Group('IPv4 AAAA records'); +$group->addClass('publishing'); +$group->add(new Form_Checkbox( + 'publish_ipv4_aaaa', + 'IPv4 AAAA records', + 'Enable publishing of local IPv6 addresses (AAAA records) via IPv4', + $pconfig['publish_ipv4_aaaa'] +)); +$section->add($group); + +$group = new Form_Group('IPv6 A records'); +$group->addClass('publishing'); +$group->add(new Form_Checkbox( + 'publish_ipv6_a', + 'IPv6 A records', + 'Enable publishing of local IPv4 addresses (A records) via IPv6', + $pconfig['publish_ipv6_a'] +)); +$section->add($group); +$form->add($section); + +print($form); +?> + + + + + - This enables you to plug your laptop or computer into a - network and instantly be able to view other people who - you can chat with, find printers to print to or find - files being shared.
In addition it supports some - nifty things that have never been seen elsewhere like - correct mDNS reflection across LAN segments.
- Compatible technology is found in Apple MacOS X (branded - Bonjour and sometimes Zeroconf). +Avahi is a system which facilitates host and service discovery in local +networks via mDNS (Multicast DNS) and DNS-SD (DNS Service Discovery). +This package allows mDNS/DNS-SD protocols to work across multiple LAN +segments. mDNS/DNS-SD is known in Apple circles as "Bounjour" and is +part of the Zeroconf suite of protocols. -WWW: https://doc.pfsense.org/index.php/Avahi_package +WWW: https://forum.netgate.com/topic/134339 diff --git a/net/pfSense-pkg-Avahi/pkg-message b/net/pfSense-pkg-Avahi/pkg-message deleted file mode 100644 index fb8004590b80..000000000000 --- a/net/pfSense-pkg-Avahi/pkg-message +++ /dev/null @@ -1,7 +0,0 @@ -************************************************************************ - -Please visit Services - Avahi menu, enable the service and select which -interfaces you do NOT wish Avahi to listen on. Save settings to start -the service. - -************************************************************************ diff --git a/net/pfSense-pkg-Avahi/pkg-plist b/net/pfSense-pkg-Avahi/pkg-plist index 91cc6a565ab6..c5700f08bef8 100644 --- a/net/pfSense-pkg-Avahi/pkg-plist +++ b/net/pfSense-pkg-Avahi/pkg-plist @@ -1,7 +1,6 @@ pkg/avahi.xml -pkg/avahi.inc +pkg/avahi/avahi.inc /etc/inc/priv/avahi.priv.inc -etc/avahi/ssh.service -etc/avahi/sftp-ssh.service +www/avahi_settings.php %%DATADIR%%/info.xml @dir /etc/inc/priv