Bug 26838 - Erweiterte DHCP-Optionen konfigurierbar machen
Erweiterte DHCP-Optionen konfigurierbar machen
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: DHCP
UCS 3.0
Other Linux
: P5 enhancement (vote)
: UCS 3.0-2
Assigned To: Andreas Büsching
Philipp Hahn
: interim-2
: 7617 27146 27362 (view as bug list)
Depends on:
Blocks: 31383 32557 33223 43748
  Show dependency treegraph
 
Reported: 2012-04-19 12:14 CEST by Tim Petersen
Modified: 2017-04-21 10:08 CEST (History)
6 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Petersen univentionstaff 2012-04-19 12:14:53 CEST
Angefragt an Ticket #2012041821001871:
"im Zuge unseres bevorstehenden Windows-Rollouts wollen wir die Clients
automatisch mit einer wpad.dat-Datei per DHCP versorgen. Nach Internetrecherchen ist hierzu folgendes in der dhcpd.conf einzutragen:

option wpad code 252 = text;

subnet X.X.X.0 netmask 255.255.255.0 {
…
option wpad “http://XXX/wpad.dat ”;
…
}

Die erste Zeile habe ich in der Datei /etc/dhcp/dhcpd.local
untergebracht. Die Einträge am jeweiligen Subnetz erfolgt ja über die
UMC - dort habe ich allerdings keine passende Richtlinie gefunden, um
die Zeile "option wpad “http://XXX/wpad.dat ”;"
einzutragen."
Comment 1 Philipp Hahn univentionstaff 2012-04-19 15:22:56 CEST
Dummerweise verwendet UCS seine eigenen LDAP-Objekte (univentionDhcpSubnet statt dhcpSubnet), in denen "dhcpOption" nicht erlaubt ist, weshalb man "extensibleObject" benutzen muß, um das Attribute zu definieren. Damit funktioniert (an UDM vorbei) folgendes:

#!/bin/bash
echo 'option wpad code 252 = text;' >>/etc/dhcp/local.conf

wpad=http://xen5.knut.univention.de/wpad.dat
admin="cn=admin,$(ucr get ldap/base)"
service=$(udm dhcp/service list | sed -ne 's/^DN: //p')
subnet=$(udm dhcp/subnet list --superordinate "$service" | sed -ne 's/^DN: //;T;p;q')

ldapmodify -x -D "$admin" -w "$(</etc/ldap.secret)" <<__LDIF__
dn: $subnet
changetype: modify
add: objectclass
objectclass: extensibleObject
-
add: dhcpOption
dhcpOption: wpad "$wpad"
__LDIF__

Getestet werden kann das ganze per busybox auf einer VM:
 echo '#!/bin/sh' >/tmp/dump.sh
 echo 'set | grep wpad' >>/tmp/dump.sh
 chmod +x /tmp/dump.sh
 udhcpc -f -q -R -i eth0 -O wpad -s /tmp/dump.sh
Comment 2 Philipp Hahn univentionstaff 2012-05-15 20:34:16 CEST
(In reply to comment #1)
> Dummerweise verwendet UCS seine eigenen LDAP-Objekte (univentionDhcpSubnet
> statt dhcpSubnet), in denen "dhcpOption" nicht erlaubt ist, weshalb man
> "extensibleObject" benutzen muß,

Es geht besser: "dhcpOption" kann über die AUXILIARY-Klasse "dhcpOptions" nachgerüstet werden, d.h. extensibleObject ist hier nicht notwendig:

...
> ldapmodify -x -D "$admin" -w "$(</etc/ldap.secret)" <<__LDIF__
> dn: $subnet
> changetype: modify
> add: objectclass
objectclass: dhcpOptions
> -
> add: dhcpOption
> dhcpOption: wpad "$wpad"
> __LDIF__
...

# Zum testen kann mal schnell kvm benutzen, nur muß man auf die verschiedenen Netze aufpassen und ggf. ein Testnetz für DHCP bauen:
udm dhcp/subnet create create \
 --superordinate "$service" \
 --position "$service" \
 --set subnet=192.168.17.0 \
 --set subnetmask=255.255.255.0 \
 --set broadcastaddress=192.168.17.255 \
 --set range="192.168.17.1 192.168.17.253"
subnet=$(udm dhcp/subnet list --superordinate "$service"|sed -ne 's/^DN: //;T;p;q')
udm dhcp/host create \
 --superordinate "$service" \
 --position "$service" \
 --set host=test \
 --set hwaddress='ethernet 00:11:22:33:44:55' \
 --set fixedaddress=192.168.17.222

brctl addbr testbr0
ip a a 192.168.17.254/24 dev testbr0
ip l s testbr0 up
openvpn --mktun --dev tap
brctl addif testbr0 tap0
ip l s tap0 up

kvm -m 512 \
 -kernel /boot/vmlinuz-2.6.32-ucs63-amd64 \
 -initrd /boot/initrd.img-2.6.32-ucs63-amd64 \
 -append 'break=mount verbose' \
 -netdev tap,ifname=tap0,id=hostnet0,script=no \
 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55 &
...
ip l set eth0 up
...
Comment 3 Andreas Büsching univentionstaff 2012-05-16 11:24:03 CEST
*** Bug 27146 has been marked as a duplicate of this bug. ***
Comment 4 Alexander Kläser univentionstaff 2012-05-16 13:09:22 CEST
Bitte noch einmal die letzten Änderungen überprüfen, derzeit startet das UDM-Modul nicht mehr:

> >>> import univention.management.console.modules.udm
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/__init__.py", line 59, in <module>
>     from .udm_ldap import UDM_Error, UDM_Module, UDM_Settings, check_license, ldap_dn2path, get_module, read_syntax_choices, list_objects, LDAP_Connection, LDAP_ConnectionError, set_credentials, container_modules
>   File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 63, in <module>
>     udm_modules.update()
>   File "/usr/lib/pymodules/python2.6/univention/admin/modules.py", line 82, in update
>     os.path.walk(dir, _walk, p)
>   File "/usr/lib/python2.6/posixpath.py", line 236, in walk
>     walk(name, func, arg)
>   File "/usr/lib/python2.6/posixpath.py", line 228, in walk
>     func(arg, top, names)
>   File "/usr/lib/pymodules/python2.6/univention/admin/modules.py", line 66, in _walk
>     m=__import__(mod, globals(), locals(), name)
>   File "/usr/lib/pymodules/python2.6/univention/admin/handlers/dhcp/server.py", line 75, in <module>
>     from .__common import add_dhcp_options
> ImportError: No module named __common
Comment 5 Andreas Büsching univentionstaff 2012-05-18 11:19:42 CEST
Es können nun DHCP-Optionen an dhcp/service, dhcp7server und dhcp/subnet Objekten gesetzt werden. Allerdings nur über UDM CLI

udm dhcp/service create .... --append option="wpad http://server/proxy.pac" ...


Zusätzlich müssen die Optionen über UCR definiert werden:

ucr set dhcpd/options/wpad/252=text

ChangeLog Eintrag wurde hinzugefügt
Comment 6 Stefan Gohmann univentionstaff 2012-06-06 10:01:23 CEST
*** Bug 27362 has been marked as a duplicate of this bug. ***
Comment 7 Philipp Hahn univentionstaff 2012-07-02 12:45:28 CEST
OK: ChangeLog: svn13152
OK: UCRV dhcpd/options/
OK: UDM-Module funktionieren noch
OK: univention-dhcp_6.0.22-1.509.201205240914

Auspasse muß man allerdings bzgl. der korrekten Syntax; das Beispiel ist comment #5 ist falsch, denn dort fehlt das Quoting und das abschließende Semikolon. Richtig ist folgendes:
  udm .. option='wpad "http://server/proxy.pac";'

Das Setzen funktioniert an Service und Subnet, nicht jedoch am Server (das ist aber OK so, weil sich Einstellungen am Server nur auf diesen selbst beziehen und nicht den von ihm erbrachten Service.)

Getestet:
qemu-system-x86_64 -m 512 \
 -kernel /boot/vmlinuz-2.6.32-ucs64-amd64 \
 -initrd /boot/initrd.img-2.6.32-ucs64-amd64 \
 -append 'break=mount verbose' \
 -netdev tap,ifname=tap0,id=hostnet0,script=no \
 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:11:22:33:44:55
...
udhcpc -i eth0 -O wpad -s /tmp/dump.sh -S -f -n -q -T3
Comment 8 Stefan Gohmann univentionstaff 2012-07-20 15:24:39 CEST
UCS 3.0-2 has been released: 
  http://forum.univention.de/viewtopic.php?f=54&t=1905

If this error occurs again, please use "Clone This Bug".
Comment 9 Philipp Hahn univentionstaff 2013-11-11 08:54:31 CET
*** Bug 7617 has been marked as a duplicate of this bug. ***