Merge lp:~jtv/maas/bug-977752 into lp:~maas-committers/maas/trunk
Proposed by
Jeroen T. Vermeulen
Status: | Merged |
---|---|
Approved by: | Jeroen T. Vermeulen |
Approved revision: | no longer in the source branch. |
Merged at revision: | 430 |
Proposed branch: | lp:~jtv/maas/bug-977752 |
Merge into: | lp:~maas-committers/maas/trunk |
Diff against target: |
153 lines (+64/-38) 3 files modified
etc/pserv.yaml (+6/-0) src/provisioningserver/plugin.py (+57/-38) src/provisioningserver/tests/test_plugin.py (+1/-0) |
To merge this branch: | bzr merge lp:~jtv/maas/bug-977752 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Review via email: mp+101346@code.launchpad.net |
Commit message
Don't just expose pserv on the network.
Description of the change
With thanks to Julian for showing me what I couldn't find documentation for (“pre-imp”). This makes the provisioning server listen only on the loopback interface. I can't easily do the same for txlongpoll, because its twistd setup is hidden away in upstream code.
After mulling it over with Gavin, I refactored the service setup code a bit so that I could unit-test the resulting smaller methods. But I didn't manage to inject a fake into TCPServer, which apparently is a bit weird and generated on the fly. And so I ended up deleting the test. Better ideas welcome.
Jeroen
To post a comment you must log in.
approve
On Apr 10, 2012 12:18 PM, "Jeroen T. Vermeulen" <email address hidden> wrote:
> Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/bug-977752 into reviewers) /bugs.launchpad .net/maas/ +bug/975450 /code.launchpad .net/~jtv/ maas/bug- 977752/ +merge/ 101346 /code.launchpad .net/~jtv/ maas/bug- 977752/ +merge/ 101346 ngserver/ plugin. py' gserver/ plugin. py 2012-03-15 22:43:55 +0000 gserver/ plugin. py 2012-04-10 10:19:21 +0000 if_empty= b"", if_missing= b"127.0. 0.1") if_empty= b"pserv. log", if_missing= b"pserv. log") "config- file"] load(config_ file) config[ "logfile" ]) setServiceParen t(services) (self, config): config[ "logfile" ]) e(self, log_service, oops_config): "directory" ] "reporter" ] log_service, oops_dir, oops_reporter) setServiceParen t(services) log_service, oops_dir, ...
> lp:maas.
>
> Requested reviews:
> Launchpad code reviewers (launchpad-
> Related bugs:
> Bug #975450 in MAAS: "bind all services not required by the nodes to the
> loopback interface or add ingress firewall rules for these services"
> https:/
>
> For more details, see:
> https:/
>
> With thanks to Julian for showing me what I couldn't find documentation
> for (“pre-imp”). This makes the provisioning server listen only on the
> loopback interface. I can't easily do the same for txlongpoll, because its
> twistd setup is hidden away in upstream code.
>
> After mulling it over with Gavin, I refactored the service setup code a
> bit so that I could unit-test the resulting smaller methods. But I didn't
> manage to inject a fake into TCPServer, which apparently is a bit weird and
> generated on the fly. And so I ended up deleting the test. Better ideas
> welcome.
>
>
> Jeroen
> --
> https:/
> You are subscribed to branch lp:maas.
>
> === modified file 'etc/pserv.yaml'
> --- etc/pserv.yaml 2012-04-02 07:06:37 +0000
> +++ etc/pserv.yaml 2012-04-10 10:19:21 +0000
> @@ -6,6 +6,12 @@
> #
> # port: 5241
>
> +## Network interface to bind the service on.
> +# Keep this pointed at the loopback interface unless you really know what
> +# you're doing.
> +#
> +# interface: "127.0.0.1"
> +
> ## Where to log. This log can be rotated by sending SIGUSR1 to the
> ## running server.
> #
>
> === modified file 'src/provisioni
> --- src/provisionin
> +++ src/provisionin
> @@ -89,6 +89,7 @@
>
> if_key_missing = None
>
> + interface = String(
> port = Int(min=1, max=65535, if_missing=5241)
> logfile = String(
> oops = ConfigOops
> @@ -126,56 +127,74 @@
> self.tapname = name
> self.description = description
>
> - def makeService(self, options):
> - """Construct a service."""
> - services = MultiService()
> -
> - config_file = options[
> - config = Config.
> -
> - log_service = LogService(
> - log_service.
> -
> - oops_config = config["oops"]
> + def _makeLogService
> + """Create the log service."""
> + return LogService(
> +
> + def _makeOopsServic
> + """Create the oops service."""
> oops_dir = oops_config[
> oops_reporter = oops_config[
> - oops_service = OOPSService(
> - oops_service.
> -
> - broker_config = config["broker"]
> + return OOPSService(