Zentyal Customization (templates, hooks, LDAP)

21,760
-1

Published on

Learn how to customize your Zentyal Server by modifying configuration files templates

Published in: Technology, Business
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
21,760
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
235
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Zentyal Customization (templates, hooks, LDAP)

  1. 1. How to customize Zentyal(hooks, templates and LDAP)Zentyal Summit 201112th NovemberCarlos Pérez-Aradros <cperez@zentyal.com> Linux small business server
  2. 2. Linux small business serverZentyal... Easy to use Good integration Versatile...but sometimes you need Some specific customization Integration with external apps www.zentyal.com © eBox Technologies S.L. 2011
  3. 3. Linux small business serverCustomization options Modify source code Add new logic or functionality Breaks on upgrade Upstream! Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  4. 4. Linux small business serverCustomization options Modify source code Add new logic or functionality Breaks on upgrade Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  5. 5. Linux small business serverTemplates (I) Zentyal uses templates to write system configurations files Modify templates to: Adjust parameters to adapt Zentyal to your requirements Add/remove configuration options www.zentyal.com © eBox Technologies S.L. 2011
  6. 6. Linux small business serverTemplates (II) Mason as template processor www.zentyal.com © eBox Technologies S.L. 2011
  7. 7. Linux small business serverTemplates (III) Default templates location: /usr/share/zentyal/stubs/<module>/<template>.mas Custom templates: /etc/zentyal/stubs/<module>/<template>.mas www.zentyal.com © eBox Technologies S.L. 2011
  8. 8. Linux small business serverTemplates (IV)Default stub/usr/share/zentyal/stubs/network/resolv.conf.mas T Conf file /etc/resolv.conf TCustom stub/etc/zentyal/stubs/network/resolv.conf.mas www.zentyal.com © eBox Technologies S.L. 2011
  9. 9. Linux small business serverTemplates example: Samba hidden folders We want to add a hidden folder in File Sharing module (samba) Zentyal GUI doesnt allow this: www.zentyal.com © eBox Technologies S.L. 2011
  10. 10. Linux small business serverTemplates example: Samba hidden folders Copy and edit default template: mkdir -p /etc/zentyal/stubs/samba/ cp /usr/share/zentyal/stubs/samba/smb.conf.mas /etc/zentyal/stubs/samba/ Write custom configuration www.zentyal.com © eBox Technologies S.L. 2011
  11. 11. Linux small business serverCustomization options Modify source code Add new logic or functionality Breaks on upgrade Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  12. 12. Linux small business serverHooks (I) Execute actions (scripts) during Zentyal save changes process Create hook scripts to: Watch for changes in any module Add custom scripts before/after module actions www.zentyal.com © eBox Technologies S.L. 2011
  13. 13. Linux small business serverHooks (II): paths Before saving changes /etc/zentyal/pre-save/ After saving changes /etc/zentyal/post-save/ /etc/zentyal/hooks/ Before saving module configuration <module>.presetconf After saving module configuration <module>.postsetconf Before restarting the service <module>.preservice After restarting the service <module>.postservice www.zentyal.com © eBox Technologies S.L. 2011
  14. 14. Linux small business server one time for each moduleHooks (III) pre-save .presetconf Write conf files .postsetconf .preservice Restart daemons .postservice hook post-save Zentyal action www.zentyal.com © eBox Technologies S.L. 2011
  15. 15. Linux small business serverHooks Example: Firewall We want to block traffic from a specific country (using GeoIP) Zentyal GUI does not allow this kind of rules If we add the rule by hand: Firewall module restart will delete it Solution: Add the rule after firewall restart (postservice hook) www.zentyal.com © eBox Technologies S.L. 2011
  16. 16. Linux small business serverHooks Example: Firewall Setup GeoIP sudo apt-get install module-assistant sudo module-assistant a-i xtables-addons wget http://sourceforge.net/projects/xtables- addons/files/Xtables-addons/1.38/xtables-addons-1.38.tar.xz sudo ./xt_geoip_dl sudo ./xt_geoip_build *.csv sudo mkdir /var/geoip && sudo cp -r LE /var/geoip www.zentyal.com © eBox Technologies S.L. 2011
  17. 17. Linux small business serverHooks Example: Firewall Create the hook /etc/zentyal/hooks/firewall.postservice #!/bin/sh sudo iptables -I INPUT -m geoip --src-cc KP -j ACCEPT Dont forget to make it executable! chmod +x /etc/zentyal/hooks/firewall.postservice www.zentyal.com © eBox Technologies S.L. 2011
  18. 18. Linux small business serverHooks: Future (3.0) Users operations hooks create modify delete Backup pre-backup post-backup www.zentyal.com © eBox Technologies S.L. 2011
  19. 19. Linux small business serverCustomization options Modify source code Add new logic or functionality Breaks on upgrade Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  20. 20. Linux small business serverLDAP Integration (I) Zentyal provides great Users and Groups management LDAP integration: Central point for users management Centralized authentication Distributed: master / slave architecture www.zentyal.com © eBox Technologies S.L. 2011
  21. 21. Linux small business serverLDAP Integration (II) Integrate third apps with Zentyal Users and Groups www.zentyal.com © eBox Technologies S.L. 2011
  22. 22. Linux small business serverLDAP Integration (II): settings Users and Groups → LDAP Settings Server: ldap://localhost:389/ (port 1389 in slaves) Users DN: ou=Users,<basedn> Groups DN: ou=Groups,<basedn> www.zentyal.com © eBox Technologies S.L. 2011
  23. 23. Linux small business serverLDAP Integration (III): filtersuid=cperez,ou=Users,dc=zentyal,dc=comuid: cperez Base DN: ou=Users,dc=zentyal,dc=comloginShell: /usr/sbin/nologinuidNumber: 2002 Filter: (uid=*)gidNumber: 1901homeDirectory: /home/cperezobjectClass: inetOrgPersonobjectClass: posixAccountobjectClass: passwordHolder cn=developers,ou=Groups,dc=zentyal,dc=comgivenName: Carlos cn: developersuserPassword: {SHA}... gidNumber: 2005eboxSha1Password: {SHA}... objectClass: posixGroupeboxMd5Password: {MD5}... memberUid: cperezeboxDigestPassword: {MD5}... memberUid: jsalameroeboxRealmPassword: {MD5}... memberUid: ejhernandezcn:; Carlos Pérez-Aradros Herce memberUid: jacalvo memberUid: jamorsn:; Pérez-Aradros Herce ... www.zentyal.com © eBox Technologies S.L. 2011 c
  24. 24. Linux small business serverLDAP Integration example: Wordpress www.zentyal.com © eBox Technologies S.L. 2011
  25. 25. Linux small business serverLDAP Integration example: Wordpress Look for a LDAP Auth backend www.zentyal.com © eBox Technologies S.L. 2011
  26. 26. Linux small business serverLDAP Integration example: Wordpress www.zentyal.com © eBox Technologies S.L. 2011
  27. 27. Linux small business serverIn summary Modify source code Add new logic or functionality Breaks on upgrade Upstream! Templates Change configuration files written by Zentyal Hooks Define custom actions (scripts) on module events LDAP Integrate external applications www.zentyal.com © eBox Technologies S.L. 2011
  28. 28. Linux small business serverGet help Zentyal Support Forum http://forum.zentyal.org Users and Developers mailing lists https://lists.zentyal.com/cgi-bin/mailman/listinfo/zentyal-devel https://lists.zentyal.com/cgi-bin/mailman/listinfo/zentyal-users IRC #zentyal at freenode.net Official support and training http://www.zentyal.com/en/services/ Contribute! www.zentyal.com © eBox Technologies S.L. 2011
  29. 29. Linux small business serverFurther reading... Zentyal Documentation - Advanced Service Customisation http://doc.zentyal.org/en/develop.html Mason Documentation (Templates) http://www.masonhq.com/docs/manual/Devel.html xtables addons http://xtables-addons.sourceforge.net/ Openldap filters doc http://www.zytrax.com/books/ldap/apa/search.html www.zentyal.com © eBox Technologies S.L. 2011
  30. 30. Linux small business serverwww.zentyal.com ? © eBox Technologies S.L. 2011

×