Merge ~mpontillo/maas:move-network-monitoring-to-maas-common into maas:master

Proposed by Mike Pontillo
Status: Merged
Approved by: Mike Pontillo
Approved revision: 07644db68232dbfc658f9d0d7249326641fc7677
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~mpontillo/maas:move-network-monitoring-to-maas-common
Merge into: maas:master
Diff against target: 996 lines (+258/-92)
31 files modified
Makefile (+6/-5)
buildout.cfg (+2/-0)
debian/changelog (+5/-2)
debian/compat (+1/-1)
debian/control (+3/-1)
debian/extras/99-maas-common-sudoers (+4/-0)
debian/extras/99-maas-sudoers (+0/-2)
debian/extras/maas-rack (+0/-0)
debian/maas-common.install (+12/-0)
debian/maas-rack-controller.install (+0/-5)
debian/maas-rack-controller.lintian-overrides (+2/-1)
dev/null (+0/-21)
scripts/beacon-monitor (+24/-0)
scripts/dhcp-monitor (+20/-0)
scripts/multicast-helper (+89/-0)
scripts/network-monitor (+21/-0)
setup.py (+3/-3)
snap/usr/lib/maas/maas-common (+1/-0)
src/provisioningserver/__main__.py (+19/-6)
src/provisioningserver/rpc/clusterservice.py (+2/-2)
src/provisioningserver/rpc/tests/test_clusterservice.py (+6/-6)
src/provisioningserver/utils/arp.py (+2/-2)
src/provisioningserver/utils/beaconing.py (+2/-2)
src/provisioningserver/utils/dhcp.py (+2/-2)
src/provisioningserver/utils/fs.py (+3/-3)
src/provisioningserver/utils/services.py (+4/-4)
src/provisioningserver/utils/tests/test_arp.py (+2/-2)
src/provisioningserver/utils/tests/test_beaconing.py (+2/-2)
src/provisioningserver/utils/tests/test_fs.py (+5/-4)
src/provisioningserver/utils/tests/test_services.py (+3/-3)
utilities/install-sudoers (+13/-13)
Reviewer Review Type Date Requested Status
Blake Rouse (community) Approve
Review via email: mp+329475@code.launchpad.net

Commit message

LP: #1702703 - Add /usr/lib/maas/maas-common command

 * Any commands not specific to the rack controller will
   now be available in /usr/lib/maas/maas-common.
 * Add a symbolic link in the snap to point to the maas-rack
   command.
 * Add buildout rules to generate bin/maas-common.
 * Change packaging to have maas-common depend on
   the Python code for the provisioning server, so that the
   command can successfully run.
 * Rename some scripts in /usr/lib/maas to remove the
   redundant maas- prefix, and prevent conflicts with
   the old packaging.
 * Update the debhelper compat level to 9, so dh-exec
   can be used to copy and rename files in the same step
   in .install files.
 * Rename get_maas_provision_command() to
   get_maas_common_command().

Description of the change

This branch isn't as large as it seems; most of the lines in the diff are renaming the script files to remove the maas- prefix.

For more information on the debhelper changes, see:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=245554
https://github.com/algernon/dh-exec

These changes have been tested end-to-end and verified to work in both the .deb (including an upgrade) and the snap.

Some packaging-related items to consider (from `man debhelper`):

       v8 Changes from v7 are:

           - Commands will fail rather than warning when they
                   are passed unknown options.

           - dh_makeshlibs will run dpkg-gensymbols on all
                   shared libraries that it generates shlibs files
                   for. So -X can be used to exclude libraries. Also,
                   libraries in unusual locations that dpkg-gensymbols
                   would not have processed before will be passed to
                   it, a behavior change that can cause some packages
                   to fail to build.

           - dh requires the sequence to run be specified as the
                   first parameter, and any switches come after it.
                   Ie, use "dh $@ --foo", not "dh --foo $@".

           - dh_auto_* prefer to use Perl's Module::Build in
                   preference to Makefile.PL.

       v9 This is the recommended mode of operation.

           Changes from v8 are:

           - Multiarch support. In particular, dh_auto_configure
                   passes multiarch directories to autoconf in
                   --libdir and --libexecdir.

           - dh is aware of the usual dependencies between
                   targets in debian/rules. So, "dh binary" will run
                   any build, build-arch, build-indep, install, etc
                   targets that exist in the rules file. There's no
                   need to define an explicit binary target with
                   explicit dependencies on the other targets.

           - dh_strip compresses debugging symbol files to
                   reduce the installed size of -dbg packages.

           - dh_auto_configure does not include the source
                   package name in --libexecdir when using autoconf.

           - dh does not default to enabling
                   --with=python-support

           - All of the dh_auto_* debhelper programs and dh set
                   environment variables listed by dpkg-buildflags,
                   unless they are already set.

           - dh_auto_configure passes dpkg-buildflags CFLAGS,
                   CPPFLAGS, and LDFLAGS to perl Makefile.PL and
                   Build.PL

           - dh_strip puts separated debug symbols in a location
                   based on their build-id.

           - Executable debhelper config files are run and their
                   output used as the configuration.

To post a comment you must log in.
Revision history for this message
Blake Rouse (blake-rouse) wrote :

This looks great. Thanks for fixing this issue. There is a bug for this defiantly somewhere, please attach before landing.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

LANDING
-b move-network-monitoring-to-maas-common lp:~mpontillo/maas into -b master lp:~maas-committers/maas

STATUS: FAILED BUILD
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/254/consoleText

07644db... by Mike Pontillo

Fix tests.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 8abbebd..194b0f3 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -52,6 +52,7 @@ build: \
6 bin/buildout \
7 bin/database \
8 bin/maas \
9+ bin/maas-common \
10 bin/maas-rack \
11 bin/maas-region \
12 bin/twistd.rack \
13@@ -118,7 +119,7 @@ bin/maas-region bin/twistd.region: \
14
15 bin/test.region: \
16 bin/buildout buildout.cfg versions.cfg setup.py $(js_enums) \
17- bin/maas-region bin/maas-rack
18+ bin/maas-region bin/maas-rack bin/maas-common
19 $(buildout) install region-test
20 @touch --no-create $@
21
22@@ -152,7 +153,7 @@ bin/test.testing: \
23 $(buildout) install testing-test
24 @touch --no-create $@
25
26-bin/maas-rack bin/twistd.rack: \
27+bin/maas-rack bin/twistd.rack bin/maas-common: \
28 bin/buildout buildout.cfg versions.cfg setup.py
29 $(buildout) install rack
30 @touch --no-create $@
31@@ -568,13 +569,13 @@ services/dns/@deps: bin/py
32
33 services/database/@deps: bin/database
34
35-services/rackd/@deps: bin/twistd.rack bin/maas-rack
36+services/rackd/@deps: bin/twistd.rack bin/maas-rack bin/maas-common
37
38 services/reloader/@deps:
39
40-services/regiond/@deps: bin/maas-region bin/maas-rack
41+services/regiond/@deps: bin/maas-region bin/maas-rack bin/maas-common
42
43-services/regiond2/@deps: bin/maas-region bin/maas-rack
44+services/regiond2/@deps: bin/maas-region bin/maas-rack bin/maas-common
45
46 #
47 # Package building
48diff --git a/buildout.cfg b/buildout.cfg
49index 59f18a0..43b1b77 100644
50--- a/buildout.cfg
51+++ b/buildout.cfg
52@@ -279,11 +279,13 @@ eggs =
53 ${common:test-eggs}
54 entry-points =
55 maas-rack=provisioningserver.__main__:main
56+ maas-common=provisioningserver.__main__:main
57 twistd.rack=twisted.scripts.twistd:run
58 extra-paths =
59 ${common:extra-paths}
60 scripts =
61 maas-rack
62+ maas-common
63 twistd.rack
64 initialization =
65 ${common:initialization}
66diff --git a/debian/changelog b/debian/changelog
67index cc13ac8..f3ba3d5 100644
68--- a/debian/changelog
69+++ b/debian/changelog
70@@ -1,8 +1,11 @@
71 maas (2.3.0~alpha3-0ubuntu1) UNRELEASED; urgency=medium
72
73- * UNRELEASED
74+ * Move scripts to maas-common that are used by the MAAS
75+ region controller in addition to the rack.
76+ * Add /usr/lib/maas/maas-common script.
77+ * Move to debhelper compat level 9.
78
79- -- Andres Rodriguez <andreserl@ubuntu.com> Wed, 23 Aug 2017 10:13:52 -0400
80+ -- Mike Pontillo <mike.pontillo@canonical.com> Tue, 22 Aug 2017 15:28:42 -0700
81
82 maas (2.3.0~alpha2-6194-g7fb23b0-0ubuntu1) artful; urgency=medium
83
84diff --git a/debian/compat b/debian/compat
85index 7f8f011..ec63514 100644
86--- a/debian/compat
87+++ b/debian/compat
88@@ -1 +1 @@
89-7
90+9
91diff --git a/debian/control b/debian/control
92index d3fb250..e0beb12 100644
93--- a/debian/control
94+++ b/debian/control
95@@ -4,6 +4,7 @@ Priority: optional
96 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
97 Build-Depends: debhelper (>= 8.1.0~),
98 dh-apport,
99+ dh-exec,
100 dh-python,
101 dh-systemd,
102 po-debconf,
103@@ -57,7 +58,8 @@ Description: "Metal as a Service" is a physical cloud and IPAM
104 Package: maas-common
105 Architecture: all
106 Depends: rsyslog,
107- ${misc:Depends}
108+ ${misc:Depends},
109+ python3-maas-provisioningserver
110 Breaks: maas ( <= 0.1+bzr1048+dfsg-0ubuntu1 )
111 Replaces: maas ( <= 0.1+bzr1048+dfsg-0ubuntu1 )
112 Description: MAAS server common files
113diff --git a/debian/extras/99-maas-common-sudoers b/debian/extras/99-maas-common-sudoers
114index a4e6542..da4a5af 100644
115--- a/debian/extras/99-maas-common-sudoers
116+++ b/debian/extras/99-maas-common-sudoers
117@@ -1,6 +1,10 @@
118 maas ALL= NOPASSWD: /usr/bin/lshw
119 maas ALL= NOPASSWD: /sbin/blockdev
120
121+# MAAS network monitoring tools.
122+maas ALL= NOPASSWD: /usr/lib/maas/network-monitor
123+maas ALL= NOPASSWD: /usr/lib/maas/beacon-monitor
124+
125 # Control of the NTP server: MAAS needs to reconfigure it after editing
126 # its configuration file, and start it again if stopped manually.
127 maas ALL= NOPASSWD: /bin/systemctl restart ntp
128diff --git a/debian/extras/99-maas-sudoers b/debian/extras/99-maas-sudoers
129index 5d0b0be..c36b644 100644
130--- a/debian/extras/99-maas-sudoers
131+++ b/debian/extras/99-maas-sudoers
132@@ -11,6 +11,4 @@ maas ALL= NOPASSWD: /bin/systemctl start tgt
133 maas ALL= NOPASSWD: /bin/systemctl disable maas-rackd
134 maas ALL= NOPASSWD: /bin/systemctl stop maas-rackd
135 maas ALL= NOPASSWD: /usr/sbin/maas-rack scan-network *
136-maas ALL= NOPASSWD: /usr/lib/maas/maas-network-monitor
137-maas ALL= NOPASSWD: /usr/lib/maas/maas-beacon-monitor
138 maas ALL= NOPASSWD: SETENV: /usr/sbin/tgt-admin, /usr/bin/uec2roottar
139diff --git a/debian/extras/maas-rack b/debian/extras/maas-rack
140old mode 100644
141new mode 100755
142index 4b69afa..4b69afa
143--- a/debian/extras/maas-rack
144+++ b/debian/extras/maas-rack
145diff --git a/debian/maas-common.install b/debian/maas-common.install
146old mode 100644
147new mode 100755
148index a9a647c..fa268cc
149--- a/debian/maas-common.install
150+++ b/debian/maas-common.install
151@@ -1,4 +1,16 @@
152+#!/usr/bin/dh-exec --with=install
153+
154 debian/tmp/usr/share/maas/maas-rsyslog.conf
155 debian/extras/99-maas-common-sudoers etc/sudoers.d
156 debian/tmp/usr/lib/maas/maas-delete-file
157 debian/tmp/usr/lib/maas/maas-write-file
158+
159+# Install network monitoring scripts
160+debian/tmp/usr/lib/maas/network-monitor
161+debian/tmp/usr/lib/maas/beacon-monitor
162+debian/tmp/usr/lib/maas/dhcp-monitor
163+
164+# Install an alias to maas-rack as maas-common.
165+# For information on the usage of '=>' here, see:
166+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=245554
167+debian/extras/maas-rack => /usr/lib/maas/maas-common
168diff --git a/debian/maas-rack-controller.install b/debian/maas-rack-controller.install
169index a641331..d448c3a 100644
170--- a/debian/maas-rack-controller.install
171+++ b/debian/maas-rack-controller.install
172@@ -4,11 +4,6 @@ debian/tmp/usr/bin/uec2roottar
173 # Install maas-dhcp-helper
174 debian/tmp/usr/sbin/maas-dhcp-helper
175
176-# Install network monitoring scripts
177-debian/tmp/usr/lib/maas/maas-network-monitor
178-debian/tmp/usr/lib/maas/maas-beacon-monitor
179-debian/tmp/usr/lib/maas/maas-dhcp-monitor
180-
181 # Install test scripts
182 debian/tmp/usr/lib/maas/maas-test-enlistment
183
184diff --git a/debian/maas-rack-controller.lintian-overrides b/debian/maas-rack-controller.lintian-overrides
185index a434dac..6ae74f7 100644
186--- a/debian/maas-rack-controller.lintian-overrides
187+++ b/debian/maas-rack-controller.lintian-overrides
188@@ -1 +1,2 @@
189-maas-rack-controller: binary-without-manpage usr/bin/uec2roottar usr/sbin/maas-dhcp-helper usr/lib/maas/maas-network-monitor usr/lib/maas/maas-beacon-monitor usr/lib/maas/maas-dhcp-monitor usr/lib/maas/maas-test-enlistment
190+maas-rack-controller: binary-without-manpage usr/bin/uec2roottar usr/sbin/maas-dhcp-helper usr/lib/maas/maas-test-enlistment
191+maas-common: binary-without-manpage usr/lib/maas/network-monitor usr/lib/maas/beacon-monitor usr/lib/maas/dhcp-monitor
192diff --git a/scripts/beacon-monitor b/scripts/beacon-monitor
193new file mode 100755
194index 0000000..d06a128
195--- /dev/null
196+++ b/scripts/beacon-monitor
197@@ -0,0 +1,24 @@
198+#!/bin/sh -euf
199+# Copyright 2016-2017 Canonical Ltd. This software is licensed under the
200+# GNU Affero General Public License version 3 (see the file LICENSE).
201+
202+# Utility script to wrap `tcpdump`, so that this script can be called with
203+# `sudo` without allowing MAAS access to read arbitrary network traffic.
204+# This script is designed to be as minimal as possible, to prevent arbitrary
205+# code execution.
206+
207+if [ $# -ne 1 ]; then
208+ echo "Writes beacon traffic (and beacon traffic on VLANs) to stdout" >&2
209+ echo "using tcpdump's binary PCAP format." >&2
210+ echo "" >&2
211+ echo "Usage:" >&2
212+ echo " $0 <interface>" >&2
213+ exit 32
214+fi
215+
216+FILTER="udp dst port 5240"
217+
218+exec "${SNAP:-}/usr/sbin/tcpdump" --interface "$1" --direction=in \
219+ --no-promiscuous-mode --packet-buffered --immediate-mode \
220+ --snapshot-length=16384 -n -w - \
221+ "($FILTER) or (vlan and $FILTER)"
222diff --git a/scripts/dhcp-monitor b/scripts/dhcp-monitor
223new file mode 100755
224index 0000000..450a704
225--- /dev/null
226+++ b/scripts/dhcp-monitor
227@@ -0,0 +1,20 @@
228+#!/bin/sh -euf
229+# Copyright 2016 Canonical Ltd. This software is licensed under the
230+# GNU Affero General Public License version 3 (see the file LICENSE).
231+
232+# Utility script to wrap `tcpdump`, so that this script can be called with
233+# `sudo` without allowing MAAS access to read arbitrary network traffic.
234+# This script is designed to be as minimal as possible, to prevent arbitrary
235+# code execution.
236+
237+if [ $# -ne 1 ]; then
238+ echo "Write DHCP traffic to stdout using tcpdump's binary PCAP format." >&2
239+ echo "" >&2
240+ echo "Usage:" >&2
241+ echo " $0 <interface>" >&2
242+ exit 32
243+fi
244+
245+exec /usr/sbin/tcpdump --interface "$1" --no-promiscuous-mode \
246+ --packet-buffered --immediate-mode --snapshot-length=1500 -n -w - \
247+ "udp and (port 67 or port 68) or (vlan and udp and (port 67 or port 68))"
248diff --git a/scripts/maas-beacon-monitor b/scripts/maas-beacon-monitor
249deleted file mode 100755
250index d06a128..0000000
251--- a/scripts/maas-beacon-monitor
252+++ /dev/null
253@@ -1,24 +0,0 @@
254-#!/bin/sh -euf
255-# Copyright 2016-2017 Canonical Ltd. This software is licensed under the
256-# GNU Affero General Public License version 3 (see the file LICENSE).
257-
258-# Utility script to wrap `tcpdump`, so that this script can be called with
259-# `sudo` without allowing MAAS access to read arbitrary network traffic.
260-# This script is designed to be as minimal as possible, to prevent arbitrary
261-# code execution.
262-
263-if [ $# -ne 1 ]; then
264- echo "Writes beacon traffic (and beacon traffic on VLANs) to stdout" >&2
265- echo "using tcpdump's binary PCAP format." >&2
266- echo "" >&2
267- echo "Usage:" >&2
268- echo " $0 <interface>" >&2
269- exit 32
270-fi
271-
272-FILTER="udp dst port 5240"
273-
274-exec "${SNAP:-}/usr/sbin/tcpdump" --interface "$1" --direction=in \
275- --no-promiscuous-mode --packet-buffered --immediate-mode \
276- --snapshot-length=16384 -n -w - \
277- "($FILTER) or (vlan and $FILTER)"
278diff --git a/scripts/maas-dhcp-monitor b/scripts/maas-dhcp-monitor
279deleted file mode 100755
280index d044d1e..0000000
281--- a/scripts/maas-dhcp-monitor
282+++ /dev/null
283@@ -1,20 +0,0 @@
284-#!/bin/sh -euf
285-# Copyright 2016 Canonical Ltd. This software is licensed under the
286-# GNU Affero General Public License version 3 (see the file LICENSE).
287-
288-# Utility script to wrap `tcpdump`, so that this script can be called with
289-# `sudo` without allowing MAAS access to read arbitrary network traffic.
290-# This script is designed to be as minimal as possible, to prevent arbitrary
291-# code execution.
292-
293-if [ $# -ne 1 ]; then
294- echo "Write DHCP traffic to stdout using tcpdump's binary PCAP format." >&2
295- echo "" >&2
296- echo "Usage:" >&2
297- echo " $0 <interface>" >&2
298- exit 32
299-fi
300-
301-exec /usr/sbin/tcpdump --interface "$1" --no-promiscuous-mode \
302- --packet-buffered --immediate-mode --snapshot-length=1500 -n -w - \
303- "udp and (port 67 or port 68) or (vlan and udp and (port 67 or port 68))"
304diff --git a/scripts/maas-multicast-helper b/scripts/maas-multicast-helper
305deleted file mode 100755
306index 8e2cfc2..0000000
307--- a/scripts/maas-multicast-helper
308+++ /dev/null
309@@ -1,89 +0,0 @@
310-#!/bin/sh -euf
311-# Copyright 2017 Canonical Ltd. This software is licensed under the
312-# GNU Affero General Public License version 3 (see the file LICENSE).
313-
314-# Helper script to join or leave MAAS-reserved multicast groups.
315-# See the IANA registries for more information:
316-# https://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml
317-# https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml
318-
319-IP="/sbin/ip"
320-
321-# Note: The 'ip maddr add <mcast-address> dev <ifname>' command only supports
322-# link-layer multicast addresses. Specifying an IPv4 address will not work.
323-# This is the equivalent of "224.0.0.118".
324-IPV4_GROUP="01:00:5e:00:00:76"
325-
326-# This is the equivalent of the MAAS variable-scope multicast group, and
327-# corresponds to the link-local scoped group "ff02::15a".
328-IPV6_GROUP="33:33:00:00:01:5a"
329-
330-usage()
331-{
332- echo "Usage: $0 <leave | join> [ifname...]" 1>&2
333- echo " Attempts to join or leave the MAAS multicast groups." 1>&2
334- echo " If no interfaces are specified, joins or leaves on all "`
335- `"interfaces." 1>&2
336-}
337-
338-if [ $# -lt 1 ]; then
339- usage
340- exit 1
341-
342-fi
343-
344-SUCCESSES=0
345-FAILURES=""
346-
347-success()
348-{
349- SUCCESSES=$(($SUCCESSES+1))
350- echo "$*"
351-}
352-
353-join()
354-{
355- "$IP" maddr add "$IPV4_GROUP" dev "$1" 2> /dev/null && \
356- success "$1: joined $IPV4_GROUP" || true
357- "$IP" maddr add "$IPV6_GROUP" dev "$1" 2> /dev/null && \
358- success "$1: joined $IPV6_GROUP" || true
359-}
360-
361-leave()
362-{
363- "$IP" maddr del "$IPV4_GROUP" dev "$1" 2> /dev/null && \
364- success "$1: left $IPV4_GROUP" || true
365- "$IP" maddr del "$IPV6_GROUP" dev "$1" 2> /dev/null && \
366- success "$1: left $IPV6_GROUP" || true
367-}
368-
369-cmd="$1"
370-shift
371-
372-if [ "$#" -eq 0 ]; then
373- interfaces="$(ip maddr show | awk '/^[0-9]*:/ { print $2 }')"
374-else
375- interfaces="$*"
376-fi
377-
378-
379-if [ "$cmd" = "join" ]; then
380- for ifname in $interfaces; do
381- join "$ifname"
382- done
383-elif [ "$cmd" = "leave" ]; then
384- for ifname in $interfaces; do
385- leave "$ifname"
386- done
387-else
388- usage
389- exit 1
390-fi
391-
392-if [ $SUCCESSES -eq 0 ]; then
393- echo "$0: $cmd failed. (Try re-running with 'sudo'.)" 1>&2
394- if [ "$cmd" = "leave" ]; then
395- echo "(This is normal if no groups were joined to begin with.)" 1>&2
396- fi
397- exit 2
398-fi
399diff --git a/scripts/maas-network-monitor b/scripts/maas-network-monitor
400deleted file mode 100755
401index 155f0b8..0000000
402--- a/scripts/maas-network-monitor
403+++ /dev/null
404@@ -1,21 +0,0 @@
405-#!/bin/sh -euf
406-# Copyright 2016 Canonical Ltd. This software is licensed under the
407-# GNU Affero General Public License version 3 (see the file LICENSE).
408-
409-# Utility script to wrap `tcpdump`, so that this script can be called with
410-# `sudo` without allowing MAAS access to read arbitrary network traffic.
411-# This script is designed to be as minimal as possible, to prevent arbitrary
412-# code execution.
413-
414-if [ $# -ne 1 ]; then
415- echo "Writes ARP traffic (and ARP traffic on tagged VLANs) to stdout" >&2
416- echo "using tcpdump's binary PCAP format." >&2
417- echo "" >&2
418- echo "Usage:" >&2
419- echo " $0 <interface>" >&2
420- exit 32
421-fi
422-
423-exec "${SNAP:-}/usr/sbin/tcpdump" --interface "$1" --no-promiscuous-mode \
424- --packet-buffered --immediate-mode --snapshot-length=64 -n -w - \
425- "arp or (vlan and arp)"
426diff --git a/scripts/multicast-helper b/scripts/multicast-helper
427new file mode 100755
428index 0000000..8e2cfc2
429--- /dev/null
430+++ b/scripts/multicast-helper
431@@ -0,0 +1,89 @@
432+#!/bin/sh -euf
433+# Copyright 2017 Canonical Ltd. This software is licensed under the
434+# GNU Affero General Public License version 3 (see the file LICENSE).
435+
436+# Helper script to join or leave MAAS-reserved multicast groups.
437+# See the IANA registries for more information:
438+# https://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml
439+# https://www.iana.org/assignments/ipv6-multicast-addresses/ipv6-multicast-addresses.xhtml
440+
441+IP="/sbin/ip"
442+
443+# Note: The 'ip maddr add <mcast-address> dev <ifname>' command only supports
444+# link-layer multicast addresses. Specifying an IPv4 address will not work.
445+# This is the equivalent of "224.0.0.118".
446+IPV4_GROUP="01:00:5e:00:00:76"
447+
448+# This is the equivalent of the MAAS variable-scope multicast group, and
449+# corresponds to the link-local scoped group "ff02::15a".
450+IPV6_GROUP="33:33:00:00:01:5a"
451+
452+usage()
453+{
454+ echo "Usage: $0 <leave | join> [ifname...]" 1>&2
455+ echo " Attempts to join or leave the MAAS multicast groups." 1>&2
456+ echo " If no interfaces are specified, joins or leaves on all "`
457+ `"interfaces." 1>&2
458+}
459+
460+if [ $# -lt 1 ]; then
461+ usage
462+ exit 1
463+
464+fi
465+
466+SUCCESSES=0
467+FAILURES=""
468+
469+success()
470+{
471+ SUCCESSES=$(($SUCCESSES+1))
472+ echo "$*"
473+}
474+
475+join()
476+{
477+ "$IP" maddr add "$IPV4_GROUP" dev "$1" 2> /dev/null && \
478+ success "$1: joined $IPV4_GROUP" || true
479+ "$IP" maddr add "$IPV6_GROUP" dev "$1" 2> /dev/null && \
480+ success "$1: joined $IPV6_GROUP" || true
481+}
482+
483+leave()
484+{
485+ "$IP" maddr del "$IPV4_GROUP" dev "$1" 2> /dev/null && \
486+ success "$1: left $IPV4_GROUP" || true
487+ "$IP" maddr del "$IPV6_GROUP" dev "$1" 2> /dev/null && \
488+ success "$1: left $IPV6_GROUP" || true
489+}
490+
491+cmd="$1"
492+shift
493+
494+if [ "$#" -eq 0 ]; then
495+ interfaces="$(ip maddr show | awk '/^[0-9]*:/ { print $2 }')"
496+else
497+ interfaces="$*"
498+fi
499+
500+
501+if [ "$cmd" = "join" ]; then
502+ for ifname in $interfaces; do
503+ join "$ifname"
504+ done
505+elif [ "$cmd" = "leave" ]; then
506+ for ifname in $interfaces; do
507+ leave "$ifname"
508+ done
509+else
510+ usage
511+ exit 1
512+fi
513+
514+if [ $SUCCESSES -eq 0 ]; then
515+ echo "$0: $cmd failed. (Try re-running with 'sudo'.)" 1>&2
516+ if [ "$cmd" = "leave" ]; then
517+ echo "(This is normal if no groups were joined to begin with.)" 1>&2
518+ fi
519+ exit 2
520+fi
521diff --git a/scripts/network-monitor b/scripts/network-monitor
522new file mode 100755
523index 0000000..155f0b8
524--- /dev/null
525+++ b/scripts/network-monitor
526@@ -0,0 +1,21 @@
527+#!/bin/sh -euf
528+# Copyright 2016 Canonical Ltd. This software is licensed under the
529+# GNU Affero General Public License version 3 (see the file LICENSE).
530+
531+# Utility script to wrap `tcpdump`, so that this script can be called with
532+# `sudo` without allowing MAAS access to read arbitrary network traffic.
533+# This script is designed to be as minimal as possible, to prevent arbitrary
534+# code execution.
535+
536+if [ $# -ne 1 ]; then
537+ echo "Writes ARP traffic (and ARP traffic on tagged VLANs) to stdout" >&2
538+ echo "using tcpdump's binary PCAP format." >&2
539+ echo "" >&2
540+ echo "Usage:" >&2
541+ echo " $0 <interface>" >&2
542+ exit 32
543+fi
544+
545+exec "${SNAP:-}/usr/sbin/tcpdump" --interface "$1" --no-promiscuous-mode \
546+ --packet-buffered --immediate-mode --snapshot-length=64 -n -w - \
547+ "arp or (vlan and arp)"
548diff --git a/setup.py b/setup.py
549index 5182ca5..dffe046 100644
550--- a/setup.py
551+++ b/setup.py
552@@ -117,9 +117,9 @@ setup(
553 ('/usr/sbin',
554 ['scripts/maas-dhcp-helper']),
555 ('/usr/lib/maas',
556- ['scripts/maas-dhcp-monitor',
557- 'scripts/maas-beacon-monitor',
558- 'scripts/maas-network-monitor',
559+ ['scripts/dhcp-monitor',
560+ 'scripts/beacon-monitor',
561+ 'scripts/network-monitor',
562 'scripts/maas-delete-file',
563 'scripts/maas-test-enlistment',
564 'scripts/maas-write-file']),
565diff --git a/snap/usr/lib/maas/maas-common b/snap/usr/lib/maas/maas-common
566new file mode 120000
567index 0000000..6d482d7
568--- /dev/null
569+++ b/snap/usr/lib/maas/maas-common
570@@ -0,0 +1 @@
571+../../../bin/maas-rack
572\ No newline at end of file
573diff --git a/src/provisioningserver/__main__.py b/src/provisioningserver/__main__.py
574index 4016e35..042f6b3 100644
575--- a/src/provisioningserver/__main__.py
576+++ b/src/provisioningserver/__main__.py
577@@ -4,6 +4,8 @@
578
579 """Command-line interface for the MAAS provisioning component."""
580
581+import sys
582+
583 from provisioningserver import security
584 import provisioningserver.boot.install_grub
585 import provisioningserver.cluster_config_command
586@@ -19,17 +21,20 @@ from provisioningserver.utils.script import MainScript
587 import provisioningserver.utils.send_beacons
588
589
590-script_commands = {
591- 'check-for-shared-secret': security.CheckForSharedSecretScript,
592- 'config': provisioningserver.cluster_config_command,
593- 'install-shared-secret': security.InstallSharedSecretScript,
594- 'install-uefi-config': provisioningserver.boot.install_grub,
595+COMMON_COMMANDS = {
596 'observe-arp': provisioningserver.utils.arp,
597 'observe-beacons': provisioningserver.utils.beaconing,
598 'observe-mdns': provisioningserver.utils.avahi,
599 'observe-dhcp': provisioningserver.utils.dhcp,
600 'send-beacons': provisioningserver.utils.send_beacons,
601 'scan-network': provisioningserver.utils.scan_network,
602+}
603+
604+RACK_ONLY_COMMANDS = {
605+ 'check-for-shared-secret': security.CheckForSharedSecretScript,
606+ 'config': provisioningserver.cluster_config_command,
607+ 'install-shared-secret': security.InstallSharedSecretScript,
608+ 'install-uefi-config': provisioningserver.boot.install_grub,
609 'register': provisioningserver.register_command,
610 'support-dump': provisioningserver.support_dump,
611 'upgrade-cluster': provisioningserver.upgrade_cluster,
612@@ -37,6 +42,14 @@ script_commands = {
613
614
615 main = MainScript(__doc__)
616-for name, command in sorted(script_commands.items()):
617+
618+commands = COMMON_COMMANDS.copy()
619+
620+# If 'maas-common' isn't being executed, add rack-specific commands in addition
621+# to the generic set of commands.
622+if not sys.argv[0].endswith('/maas-common'):
623+ commands.update(RACK_ONLY_COMMANDS)
624+
625+for name, command in sorted(commands.items()):
626 main.register(name, command)
627 main()
628diff --git a/src/provisioningserver/rpc/clusterservice.py b/src/provisioningserver/rpc/clusterservice.py
629index 50019d3..a7c62ab 100644
630--- a/src/provisioningserver/rpc/clusterservice.py
631+++ b/src/provisioningserver/rpc/clusterservice.py
632@@ -86,7 +86,7 @@ from provisioningserver.utils.env import (
633 set_maas_id,
634 )
635 from provisioningserver.utils.fs import (
636- get_maas_provision_command,
637+ get_maas_common_command,
638 NamedLock,
639 )
640 from provisioningserver.utils.network import (
641@@ -162,7 +162,7 @@ def get_scan_all_networks_args(
642
643 :param cidrs: an iterable of CIDR strings
644 """
645- args = [get_maas_provision_command(), 'scan-network']
646+ args = [get_maas_common_command(), 'scan-network']
647 if not is_dev_environment():
648 args = sudo(args)
649 if threads is not None:
650diff --git a/src/provisioningserver/rpc/tests/test_clusterservice.py b/src/provisioningserver/rpc/tests/test_clusterservice.py
651index 4b54fc9..e37d162 100644
652--- a/src/provisioningserver/rpc/tests/test_clusterservice.py
653+++ b/src/provisioningserver/rpc/tests/test_clusterservice.py
654@@ -110,7 +110,7 @@ from provisioningserver.service_monitor import service_monitor
655 from provisioningserver.testing.config import ClusterConfigurationFixture
656 from provisioningserver.utils.env import set_maas_id
657 from provisioningserver.utils.fs import (
658- get_maas_provision_command,
659+ get_maas_common_command,
660 NamedLock,
661 )
662 from provisioningserver.utils.network import get_all_interfaces_definition
663@@ -2470,7 +2470,7 @@ class TestClusterProtocol_ScanNetworks(
664 def test_get_scan_all_networks_args_returns_expected_binary_args(self):
665 args = get_scan_all_networks_args(scan_all=True)
666 self.assertThat(args, Equals(
667- [get_maas_provision_command().encode('utf-8'), b'scan-network']
668+ [get_maas_common_command().encode('utf-8'), b'scan-network']
669 ))
670
671 def test_get_scan_all_networks_args_sudo(self):
672@@ -2479,7 +2479,7 @@ class TestClusterProtocol_ScanNetworks(
673 is_dev_environment_mock.return_value = False
674 args = get_scan_all_networks_args(scan_all=True)
675 self.assertThat(args, Equals([
676- b'sudo', b'-n', get_maas_provision_command().encode('utf-8'),
677+ b'sudo', b'-n', get_maas_common_command().encode('utf-8'),
678 b'scan-network']
679 ))
680
681@@ -2487,7 +2487,7 @@ class TestClusterProtocol_ScanNetworks(
682 args = get_scan_all_networks_args(cidrs=[
683 IPNetwork('192.168.0.0/24'), IPNetwork('192.168.1.0/24')])
684 self.assertThat(args, Equals([
685- get_maas_provision_command().encode('utf-8'),
686+ get_maas_common_command().encode('utf-8'),
687 b'scan-network',
688 b'192.168.0.0/24',
689 b'192.168.1.0/24'
690@@ -2497,7 +2497,7 @@ class TestClusterProtocol_ScanNetworks(
691 def test_get_scan_all_networks_args_returns_supplied_interface(self):
692 args = get_scan_all_networks_args(interface='eth0')
693 self.assertThat(args, Equals([
694- get_maas_provision_command().encode('utf-8'),
695+ get_maas_common_command().encode('utf-8'),
696 b'scan-network',
697 b'eth0'
698 ]
699@@ -2510,7 +2510,7 @@ class TestClusterProtocol_ScanNetworks(
700 interface='eth0', cidrs=[
701 IPNetwork('192.168.0.0/24'), IPNetwork('192.168.1.0/24')])
702 self.assertThat(args, Equals([
703- get_maas_provision_command().encode('utf-8'),
704+ get_maas_common_command().encode('utf-8'),
705 b'scan-network',
706 b'--threads', str(threads).encode('utf-8'),
707 b'--ping',
708diff --git a/src/provisioningserver/utils/arp.py b/src/provisioningserver/utils/arp.py
709index 8e1f024..70528e7 100644
710--- a/src/provisioningserver/utils/arp.py
711+++ b/src/provisioningserver/utils/arp.py
712@@ -366,7 +366,7 @@ def add_arguments(parser):
713 parser.add_argument(
714 '-i', '--input-file', type=str, required=False,
715 help="File to read PCAP output from. Use - for stdin. Default is to "
716- "call `sudo /usr/lib/maas/maas-network-monitor` to get input.")
717+ "call `sudo /usr/lib/maas/network-monitor` to get input.")
718
719
720 def run(args, output=sys.stdout, stdin=sys.stdin,
721@@ -381,7 +381,7 @@ def run(args, output=sys.stdout, stdin=sys.stdin,
722 if args.input_file is None:
723 if args.interface is None:
724 raise ActionScriptError("Required argument: interface")
725- cmd = [get_path("/usr/lib/maas/maas-network-monitor"), args.interface]
726+ cmd = [get_path("/usr/lib/maas/network-monitor"), args.interface]
727 cmd = sudo(cmd)
728 network_monitor = subprocess.Popen(
729 cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE)
730diff --git a/src/provisioningserver/utils/beaconing.py b/src/provisioningserver/utils/beaconing.py
731index c28132c..2554725 100644
732--- a/src/provisioningserver/utils/beaconing.py
733+++ b/src/provisioningserver/utils/beaconing.py
734@@ -339,7 +339,7 @@ def add_arguments(parser):
735 parser.add_argument(
736 '-i', '--input-file', type=str, required=False,
737 help="File to read beaconing output from. Use - for stdin. Default is "
738- "to call `sudo /usr/lib/maas/maas-beacon-monitor` to get input.")
739+ "to call `sudo /usr/lib/maas/beacon-monitor` to get input.")
740
741
742 def run(args, output=sys.stdout, stdin=sys.stdin,
743@@ -355,7 +355,7 @@ def run(args, output=sys.stdout, stdin=sys.stdin,
744 if args.interface is None:
745 raise ActionScriptError("Required argument: interface")
746 cmd = sudo(
747- [get_path("/usr/lib/maas/maas-beacon-monitor"), args.interface])
748+ [get_path("/usr/lib/maas/beacon-monitor"), args.interface])
749 network_monitor = subprocess.Popen(
750 cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE)
751 infile = network_monitor.stdout
752diff --git a/src/provisioningserver/utils/dhcp.py b/src/provisioningserver/utils/dhcp.py
753index c912855..84e199a 100644
754--- a/src/provisioningserver/utils/dhcp.py
755+++ b/src/provisioningserver/utils/dhcp.py
756@@ -244,7 +244,7 @@ def add_arguments(parser):
757 parser.add_argument(
758 '-i', '--input-file', type=str, required=False,
759 help="File to read PCAP output from. Use - for stdin. Default is to "
760- "call `sudo /usr/lib/maas/maas-dhcp-monitor` to get input.")
761+ "call `sudo /usr/lib/maas/dhcp-monitor` to get input.")
762
763
764 def run(args, output=sys.stdout, stdin=sys.stdin,
765@@ -255,7 +255,7 @@ def run(args, output=sys.stdout, stdin=sys.stdin,
766 if args.interface is None:
767 raise ActionScriptError("Required argument: interface")
768 cmd = sudo(
769- [get_path("/usr/lib/maas/maas-dhcp-monitor"), args.interface])
770+ [get_path("/usr/lib/maas/dhcp-monitor"), args.interface])
771 network_monitor = subprocess.Popen(
772 cmd, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
773 stderr=subprocess.DEVNULL
774diff --git a/src/provisioningserver/utils/fs.py b/src/provisioningserver/utils/fs.py
775index 70502ef..b78ef3c 100644
776--- a/src/provisioningserver/utils/fs.py
777+++ b/src/provisioningserver/utils/fs.py
778@@ -61,7 +61,7 @@ from twisted.python.filepath import FilePath
779 from twisted.python.lockfile import FilesystemLock
780
781
782-def get_maas_provision_command():
783+def get_maas_common_command():
784 """Return path to the maas-rack command.
785
786 In production mode this will just return 'maas-rack', but in
787@@ -72,9 +72,9 @@ def get_maas_provision_command():
788 from provisioningserver.config import is_dev_environment
789 if is_dev_environment():
790 from maastesting import root
791- return os.path.join(root, "bin", "maas-rack")
792+ return os.path.join(root, "bin", "maas-common")
793 else:
794- return "maas-rack"
795+ return os.path.join(get_path("/usr/lib/maas"), "maas-common")
796
797
798 def get_library_script_path(name):
799diff --git a/src/provisioningserver/utils/services.py b/src/provisioningserver/utils/services.py
800index 68f62f5..08becc3 100644
801--- a/src/provisioningserver/utils/services.py
802+++ b/src/provisioningserver/utils/services.py
803@@ -40,7 +40,7 @@ from provisioningserver.utils.beaconing import (
804 TopologyHint,
805 )
806 from provisioningserver.utils.fs import (
807- get_maas_provision_command,
808+ get_maas_common_command,
809 NamedLock,
810 )
811 from provisioningserver.utils.network import (
812@@ -289,7 +289,7 @@ class NeighbourDiscoveryService(ProcessProtocolService):
813 return "Neighbour observation process for %s" % self.ifname
814
815 def getProcessParameters(self):
816- maas_rack_cmd = get_maas_provision_command().encode("utf-8")
817+ maas_rack_cmd = get_maas_common_command().encode("utf-8")
818 return [
819 maas_rack_cmd,
820 b"observe-arp",
821@@ -313,7 +313,7 @@ class BeaconingService(ProcessProtocolService):
822 return "Beaconing process for %s" % self.ifname
823
824 def getProcessParameters(self):
825- maas_rack_cmd = get_maas_provision_command().encode("utf-8")
826+ maas_rack_cmd = get_maas_common_command().encode("utf-8")
827 return [
828 maas_rack_cmd,
829 b"observe-beacons",
830@@ -336,7 +336,7 @@ class MDNSResolverService(ProcessProtocolService):
831 return "mDNS observation process"
832
833 def getProcessParameters(self):
834- maas_rack_cmd = get_maas_provision_command().encode("utf-8")
835+ maas_rack_cmd = get_maas_common_command().encode("utf-8")
836 return [
837 maas_rack_cmd,
838 b"observe-mdns",
839diff --git a/src/provisioningserver/utils/tests/test_arp.py b/src/provisioningserver/utils/tests/test_arp.py
840index e8622a5..86ee5ac 100644
841--- a/src/provisioningserver/utils/tests/test_arp.py
842+++ b/src/provisioningserver/utils/tests/test_arp.py
843@@ -443,7 +443,7 @@ class TestObserveARPCommand(MAASTestCase):
844 self.assertThat(
845 popen,
846 MockCalledOnceWith(
847- ['sudo', '-n', '/usr/lib/maas/maas-network-monitor', 'eth0'],
848+ ['sudo', '-n', '/usr/lib/maas/network-monitor', 'eth0'],
849 stdin=subprocess.DEVNULL, stdout=subprocess.PIPE))
850
851 def test__calls_subprocess_for_interface_sudo(self):
852@@ -459,7 +459,7 @@ class TestObserveARPCommand(MAASTestCase):
853 self.assertThat(
854 popen,
855 MockCalledOnceWith(
856- ['sudo', '-n', '/usr/lib/maas/maas-network-monitor', 'eth0'],
857+ ['sudo', '-n', '/usr/lib/maas/network-monitor', 'eth0'],
858 stdin=subprocess.DEVNULL, stdout=subprocess.PIPE))
859
860 def test__checks_for_pipe(self):
861diff --git a/src/provisioningserver/utils/tests/test_beaconing.py b/src/provisioningserver/utils/tests/test_beaconing.py
862index 514b209..708512a 100644
863--- a/src/provisioningserver/utils/tests/test_beaconing.py
864+++ b/src/provisioningserver/utils/tests/test_beaconing.py
865@@ -234,7 +234,7 @@ class TestObserveBeaconsCommand(MAASTestCase):
866 self.assertThat(
867 popen,
868 MockCalledOnceWith(
869- ['sudo', '-n', '/usr/lib/maas/maas-beacon-monitor', 'eth0'],
870+ ['sudo', '-n', '/usr/lib/maas/beacon-monitor', 'eth0'],
871 stdin=subprocess.DEVNULL, stdout=subprocess.PIPE))
872
873 def test__calls_subprocess_for_interface_sudo(self):
874@@ -250,7 +250,7 @@ class TestObserveBeaconsCommand(MAASTestCase):
875 self.assertThat(
876 popen,
877 MockCalledOnceWith(
878- ['sudo', '-n', '/usr/lib/maas/maas-beacon-monitor', 'eth0'],
879+ ['sudo', '-n', '/usr/lib/maas/beacon-monitor', 'eth0'],
880 stdin=subprocess.DEVNULL, stdout=subprocess.PIPE))
881
882 def test__checks_for_pipe(self):
883diff --git a/src/provisioningserver/utils/tests/test_fs.py b/src/provisioningserver/utils/tests/test_fs.py
884index 9954e20..cc1329d 100644
885--- a/src/provisioningserver/utils/tests/test_fs.py
886+++ b/src/provisioningserver/utils/tests/test_fs.py
887@@ -51,7 +51,7 @@ from provisioningserver.utils.fs import (
888 atomic_write,
889 FileLock,
890 get_library_script_path,
891- get_maas_provision_command,
892+ get_maas_common_command,
893 incremental_write,
894 NamedLock,
895 read_text_file,
896@@ -374,14 +374,15 @@ class TestGetMAASProvisionCommand(MAASTestCase):
897 def test__returns_just_command_for_production(self):
898 self.patch(provisioningserver.config, "is_dev_environment")
899 provisioningserver.config.is_dev_environment.return_value = False
900- self.assertEqual("maas-rack", get_maas_provision_command())
901+ self.assertEqual(
902+ "/usr/lib/maas/maas-common", get_maas_common_command())
903
904 def test__returns_full_path_for_development(self):
905 self.patch(provisioningserver.config, "is_dev_environment")
906 provisioningserver.config.is_dev_environment.return_value = True
907 self.assertEqual(
908- root.rstrip("/") + "/bin/maas-rack",
909- get_maas_provision_command())
910+ root.rstrip("/") + "/bin/maas-common",
911+ get_maas_common_command())
912
913
914 class TestGetLibraryScriptPath(MAASTestCase):
915diff --git a/src/provisioningserver/utils/tests/test_services.py b/src/provisioningserver/utils/tests/test_services.py
916index 36090ea..c83eeb7 100644
917--- a/src/provisioningserver/utils/tests/test_services.py
918+++ b/src/provisioningserver/utils/tests/test_services.py
919@@ -567,7 +567,7 @@ class TestNeighbourDiscoveryService(MAASTestCase):
920 service = NeighbourDiscoveryService(ifname, Mock())
921 args = service.getProcessParameters()
922 self.assertThat(args, HasLength(3))
923- self.assertTrue(args[0].endswith(b'maas-rack'))
924+ self.assertTrue(args[0].endswith(b'maas-common'))
925 self.assertTrue(args[1], Equals(b"observe-arp"))
926 self.assertTrue(args[2], Equals(ifname.encode('utf-8')))
927
928@@ -619,7 +619,7 @@ class TestBeaconingService(MAASTestCase):
929 service = BeaconingService(ifname, Mock())
930 args = service.getProcessParameters()
931 self.assertThat(args, HasLength(3))
932- self.assertTrue(args[0].endswith(b'maas-rack'))
933+ self.assertTrue(args[0].endswith(b'maas-common'))
934 self.assertTrue(args[1], Equals(b"observe-beacons"))
935 self.assertTrue(args[2], Equals(ifname.encode('utf-8')))
936
937@@ -670,7 +670,7 @@ class TestMDNSResolverService(MAASTestCase):
938 service = MDNSResolverService(Mock())
939 args = service.getProcessParameters()
940 self.assertThat(args, HasLength(2))
941- self.assertTrue(args[0].endswith(b"maas-rack"))
942+ self.assertTrue(args[0].endswith(b"maas-common"))
943 self.assertTrue(args[1], Equals(b"observe-mdns"))
944
945 @inlineCallbacks
946diff --git a/utilities/install-sudoers b/utilities/install-sudoers
947index ed498d6..9d421e0 100755
948--- a/utilities/install-sudoers
949+++ b/utilities/install-sudoers
950@@ -2,33 +2,33 @@
951
952 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
953
954-echo "Copying /usr/lib/maas/maas-network-monitor..."
955+echo "Copying /usr/lib/maas/network-monitor..."
956 sudo mkdir -p /usr/lib/maas
957-sudo cp "$SCRIPT_DIR/../scripts/maas-network-monitor" /usr/lib/maas/maas-network-monitor
958-echo "Copying /usr/lib/maas/maas-dhcp-monitor..."
959-sudo cp "$SCRIPT_DIR/../scripts/maas-dhcp-monitor" /usr/lib/maas/maas-dhcp-monitor
960-echo "Copying /usr/lib/maas/maas-beacon-monitor..."
961-sudo cp "$SCRIPT_DIR/../scripts/maas-beacon-monitor" /usr/lib/maas/maas-beacon-monitor
962+sudo cp "$SCRIPT_DIR/../scripts/network-monitor" /usr/lib/maas/network-monitor
963+echo "Copying /usr/lib/maas/dhcp-monitor..."
964+sudo cp "$SCRIPT_DIR/../scripts/dhcp-monitor" /usr/lib/maas/dhcp-monitor
965+echo "Copying /usr/lib/maas/beacon-monitor..."
966+sudo cp "$SCRIPT_DIR/../scripts/beacon-monitor" /usr/lib/maas/beacon-monitor
967
968 SUDOERS_FILE=/etc/sudoers.d/99-maas-dev-$USER
969
970 echo "Installing sudoers file: $SUDOERS_FILE"
971 cat << EOF | sudo tee $SUDOERS_FILE
972-$USER ALL= NOPASSWD: /usr/lib/maas/maas-network-monitor
973-$USER ALL= NOPASSWD: /usr/lib/maas/maas-dhcp-monitor
974-$USER ALL= NOPASSWD: /usr/lib/maas/maas-beacon-monitor
975+$USER ALL= NOPASSWD: /usr/lib/maas/network-monitor
976+$USER ALL= NOPASSWD: /usr/lib/maas/dhcp-monitor
977+$USER ALL= NOPASSWD: /usr/lib/maas/beacon-monitor
978 EOF
979 sudo chmod 440 $SUDOERS_FILE
980
981 echo ""
982 echo "Done. You should now be able to run the following to get raw 'tcpdump' output:"
983-echo " sudo /usr/lib/maas/maas-network-monitor <interface>"
984-echo " sudo /usr/lib/maas/maas-dhcp-monitor <interface>"
985-echo " sudo /usr/lib/maas/maas-beacon-monitor <interface>"
986+echo " sudo /usr/lib/maas/network-monitor <interface>"
987+echo " sudo /usr/lib/maas/dhcp-monitor <interface>"
988+echo " sudo /usr/lib/maas/beacon-monitor <interface>"
989 echo ""
990 echo "In addition, the following commands should now work in the dev env:"
991 echo "Done. You should now be able to do the following to get raw 'tcpdump' output:"
992-echo " sudo /usr/lib/maas/maas-dhcp-monitor <interface>"
993+echo " sudo /usr/lib/maas/dhcp-monitor <interface>"
994 echo "In addition, the following command should now work in the dev env:"
995 echo " bin/maas-rack observe-arp <interface>"
996 echo " bin/maas-rack observe-dhcp <interface>"

Subscribers

People subscribed via source and target branches