2016-06-16 4 views
1

Ich versuche, Mandos in einem Docker-Container einzurichten und mit dbus-Fehlern fehlgeschlagen. Es ist möglich, den Server ohne dbus auszuführen, aber mandos-ctl und mandos-monitor benötigen dbus, um zu laufen.Mandos in Docker

mein Dockerfile

FROM ubuntu:16.04 
RUN locale-gen de_DE.UTF-8 
ENV TERM=xterm 
RUN apt-get update \ 
    && apt-get install -y mandos \ 
     fping \ 
     dbus \ 
    && rm -rf /var/lib/apt/lists/* 

es Körperbau: docker build -t mandos-server .

Wenn ich /var/run/dbus Host montieren und den Behälter beginnen mit: docker run -v /dev/log:/dev/log -v /var/run/dbus:/var/run/dbus -it mandos-server bash und starten mandos --debug ich folgende Fehler:

2016-06-16 15:26:30,278 root [11]: DEBUG: Did setuid/setgid to 108:111 
2016-06-16 15:26:30,280 root [11]: ERROR: Disabling D-Bus: 
Traceback (most recent call last): 
    File "/usr/sbin/mandos", line 3009, in main 
    do_not_queue=True) 
    File "/usr/lib/python2.7/dist-packages/dbus/service.py", line 131, in __new__ 
    retval = bus.request_name(name, name_flags) 
    File "/usr/lib/python2.7/dist-packages/dbus/bus.py", line 303, in request_name 
    'su', (name, flags)) 
    File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking 
    message, timeout) 
DBusException: org.freedesktop.DBus.Error.AccessDenied: Connection ":1.362" is not allowed to own the service "se.recompile.Mandos" due to security policies in the configuration file 

Zweiter Versuch: Starten des Containers ohne Montage dbus docker run -v /dev/log:/dev/log -it mandos-server bash und Start-dbus von Hand: /etc/init.d/dbus start * Starting system message bus dbus [ OK ]

mandos --debug leeds zu dem folgenden Fehler:

2016-06-16 15:36:38,338 root [40]: DEBUG: Did setuid/setgid to 108:111 
2016-06-16 15:36:38,353 root [40]: WARNING: Could not load persistent state: No such file or directory 
2016-06-16 15:36:38,359 root [40]: WARNING: No clients defined 
2016-06-16 15:36:38,361 root [40]: INFO: Now listening on address '::', port 39145, flowinfo 0, scope_id 0 
2016-06-16 15:36:38,363 dbus.proxies [40]: ERROR: Introspect error on org.freedesktop.Avahi:/: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.FileInvalid: Cannot do system-bus activation with no user 

2016-06-16 15:36:38,363 dbus.proxies [40]: DEBUG: Executing introspect queue due to error 
2016-06-16 15:36:38,363 root [40]: CRITICAL: D-Bus Exception 
Traceback (most recent call last): 
    File "/usr/sbin/mandos", line 3415, in main 
    service.activate() 
    File "/usr/sbin/mandos", line 470, in activate 
    self.server_state_changed(self.server.GetState()) 
    File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__ 
    return self._proxy_method(*args, **keywords) 
    File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__ 
    **keywords) 
    File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking 
    message, timeout) 
DBusException: org.freedesktop.DBus.Error.Spawn.FileInvalid: Cannot do system-bus activation with no user 

Jede Idee, was falsch läuft und vielleicht eine Lösung?

+1

Laufen Sie Avahi im Container? – Teddy

+0

Hast du das funktioniert? Ich verstehe Teddys Aussage über Avahi beim Gastgeber, hoffe aber, dass ich das Rad nicht neu erfinden muss. – claytond

Antwort

1

Ich weiß nicht, was falsch ... aber meine Antwort auf diesen Beitrag gelöscht ... Hier ist die vollständige Lösung:

Dockerfile:

FROM ubuntu:14.04 

RUN apt-get update \ 
    && apt-get install -y supervisor \ 
     mandos \ 
     fping \ 
     rsyslog \ 
     dbus \ 
     avahi-daemon \ 
     avahi-utils \ 
     libnss-mdns \ 
    && mkdir -p /var/log/supervisor \ 
    && mkdir -p /var/run/rsyslog \ 
    && mkdir -p /var/run/dbus \ 
    && sed -i.bak s/xconsole/console/g /etc/rsyslog.conf \ 
    && rm -rf /var/lib/apt/lists/* 

COPY ./config/mandos.conf /etc/mandos/mandos.conf 
COPY ./config/clients.conf /etc/mandos/clients.conf 
COPY ./config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf 

EXPOSE 55555 
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] 

supervisord config file:

[supervisord] 
nodaemon=true 
#loglevel=debug 

[program:rsyslog] 
command=/usr/sbin/rsyslogd -n 
autostart=true 
autorestart=true 
redirect_stderr=true 

[program:dbus] 
command=/bin/sh -c "rm /var/run/dbus/pid || true && dbus-daemon --system --nofork" 
priority=1 
redirect_stderr=true 

[program:avahi-daemon] 
command=/usr/sbin/avahi-daemon --no-chroot 

[program:mandos] 
command=mandos --foreground 

Die Dateien mandos.conf und stammen aus einer Standardmandos-Installation.

Ich hoffe, das funktioniert für andere.

2

Diese Fehlermeldung (in dieser Zeile) bezieht sich nicht auf Mandos Verwendung von D-Bus, um von mandos-ctl und mandos-monitor gesteuert werden kann - es bezieht sich auf die Verwendung von D-Bus Mandos zur Kommunikation mit Avahi in um Avahi zu bitten, den Zeroconf-Service von Mandos anzukündigen. Sie können entweder die Ankündigung eines Zercoconf-Dienstes vermeiden (aber beachten Sie, dass Mandos-Clients Zeroconf standardmäßig verwenden, um den Server zu finden), indem Sie die Option --no-zeroconf, oder verwenden, um sicherzustellen, dass Mandos mit Avahi aus dem Docker-Container kommunizieren kann .

1

Docker Plex bietet die folgenden Anweisungen, um ein vergleichbares Problem zu beheben:

Secure method

NOTE: due to some problems inside Plex, it appears not to know it's local IP address inside Docker subnet, avoiding the local discovery to work. If you really want to use this feature, look below for the insecure method.

Avahi daemon is commonly used to help your computers to find the services provided by a server.

Avahi isn't built into this Docker image because, due to Docker's networking limitations, Avahi can't spread it's messages to announce the services out of the Docker virtual network.

If you want to enable this feature, you can install Avahi daemon in your host following this steps (Ubuntu version):

  • Install avahi-daemon: run sudo apt-get install avahi-daemon avahi-utils
  • Copy the file from avahi/nsswitch.conf to /etc/nsswitch.conf
  • Copy the service description file from avahi/plex.service to /etc/avahi/services/plex.service
  • Restart Avahi's daemon: sudo /etc/init.d/avahi-daemon restart

But why you need to install this on your host and not in the container? Because if you don't do it this way, the discovery message won't be able to reach your computers.

What will I get with this approach?: The service will be announced on the network, but you will have to login with your account to detect your server. Also, all the streaming you receive is going to be reduced as if you are in an external network.

Während dies die richtigen ermöglichen angenehme nicht in der Lage war, sein kann genug Parallelen in Mandos zu vervollständigen das Verfahren erfolgreich zu finden. Insbesondere habe ich kein mandos.service (oder ähnliches) in einem der Installationsverzeichnisse gefunden. Ich werde auch auf die Aussage The service will be announced on the network, but you will have to login with your account to detect your server. hinweisen Ich bin nicht klar, ob dies für Mandos fatal wäre oder nicht.

+0

Mandos überwacht standardmäßig eine dynamische Portnummer.Servicedatei - Mandos meldet sich über die D-Bus-Schnittstelle bei Avahi an. Wenn Sie den Mandos-Server jedoch so konfiguriert haben, dass er einen bestimmten Port in seiner Konfiguration verwendet, können Sie ZeroConf in Mandos deaktivieren und eine Servicedatei (die diesen Port ankündigt) für Avahi verwenden. – Teddy