opsi with Samba4
-
- Beiträge: 22
- Registriert: 03 Feb 2013, 09:46
opsi with Samba4
I am keen to implement an opsi solution on my server running CentOS 6. The problem is Samba. Opsi uses Samba, and the opsi-depotserver RPM has been built with samba (ie Samba3) as a dependency. But I already have a working installation of Samba4 with AD setup and running. I do NOT want Samba3. So, my questions are:
1. How do I get around the opsi installation dependency problem? One idea I had was to download the source RPM of opsi-depotserver and rebuild it after editing the spec file to delete 'samba' from the 'requires' section. It seems I would also have to delete the scripts from the 'pre' and maybe 'post' sections that add users, groups, etc. Any advice from the developers or someone who may have done this would be appreciated.
2. Assuming that item 1 is feasible, the setup of Samba4 with opsi would then be done manually. Any instruction on this would also be helpful.
In my experience, creating a RPM package with something like Samba as a dependency is bad practice because it just creates headaches. Samba is a complex package in its own right, with many options and different ways of setting it up. It would be better to exclude it from the dependency list and just instruct users in the documentation that they must install Samba if not already. Then provide instructions to add user account(s), file shares, etc. for opsi. This avoids dependency issues and also gives the administrator more flexibility in the setup.
Regards,
Stephen Jones
Re: opsi with Samba4
for debian/ubuntu we build an package
opsi-depotserver-expert
without dependencies to samba. I am not sure, why this package is missing for CentOS, we will have a look at this in the next days.
Anyway the default user pcpatch:pcpatch , opsiconfd has to be modified similar to the notes on ucs3 in http://download.uib.de/opsi4.0/doc/html ... n-base-ucs for working with samba4.
regards,
Bardo Wolf
Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.
Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.
uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de
-
- Beiträge: 22
- Registriert: 03 Feb 2013, 09:46
Re: opsi with Samba4
Thanks for your reply. Do you know when the opsi-depotserver-expert package for CentOS might be available?
I read the notes on UCS and, while it provides some information, it is rather UCS-specific and therefore not entirely helpful. There are still blanks to fill in.
In the meantime I have been playing around with the demo VM version, which has been far more troublesome than I expected. I may write a separate post on that. It has given me a better idea of how opsi works and what may need to be changed to integrate with Samba4.
This is what I understand from the documentation and observation:
1. The user pcpatch changes from a unix account to an AD user account (Domain Users).
2. The group pcpatch changes from a unix group to an AD group with name opsifileadmins. User pcpatch is added to this group.
3. The user opsiconfd remains as a unix system account.
These things are unclear:
1. System user opsiconfd is created during the install with its primary group as pcpatch, which no longer exists. What is the primary group for opsiconfd? Can it be opsifileadmins - an AD group?
2. What happens with the group opsiadmin and user adminuser? Both adminuser and opsiconfd are members of the opsiadmin group.
I have also been looking through the code of the opsi-setup program, wondering what aspects should or should not be used in this scenario. Obviously avoid using the auto-configure-samba option. Samba4 AD must be setup manually and ACLs defined. What about the set-rights option that sets file ownership and permissions? Will this work successfully with Samba4 AD? If not, what would you suggest?
Any guidance would be appreciated.
Regards,
Stephen Jones
Re: opsi with Samba4
We are working on it, but I'm sorry cause I can not say, when it will be available.lloydsystems hat geschrieben:Hi,
Do you know when the opsi-depotserver-expert package for CentOS might be available?
Another way around might be, if you build a dummy samba-rpm or build a samba4-package with provides the required dependency
Regarding your samba4 questions:
On ucs3
1. The user pcpatch changes from a unix account to an AD user account (but is not member of (Domain Users)).
2. The user opsiconfd changes from a unix account to an AD user account (but is not member of (Domain Users))
3. The group pcpatch changes from a unix group to an AD group with name opsifileadmins. User pcpatch and opsiconfd members of this group.
Adminusers should be members of opsifileadmins.
Actually we are testing the debian-package opsi-depotserver-expert with the SerNet Samba 4 Appliance 0.6 but not finished at the moment.
In my testserver here is a problem regarding
Code: Alles auswählen
getent group opsifileadmins
the default acl.conf in /etc/opsi/backendManager is not working. We are in contact with samba4 people to solve this issue, which might be a misconfiguration of winbind.
May be end of next week we have more info which we could share
regards,
Bardo Wolf
Vielen Dank für die Nutzung von opsi. Im Forum ist unser Support begrenzt.
Für den professionellen Einsatz und individuelle Beratung empfehlen wir einen Support-Vertrag und eine Schulung.
Gerne informieren wir Sie zu unserem Angebot.
uib GmbH
Telefon: +49 6131 27561 0
E-Mail: sales@uib.de
-
- Beiträge: 22
- Registriert: 03 Feb 2013, 09:46
Re: opsi with Samba4
Creating a dummy samba RPM does not entirely solve the problem. It would satisfy the dependency of opsi-depotserver, allowing it to install, but the install routine runs code to create unix/samba users and groups. For example, unix user and group pcptch rather than AD user pcpatch and group opsifileadmins.
My preferred workaround would be to just build the opsi-depotserver-expert RPM with samba removed from the dependencies. To do this I would:
1. Download the source RPM of opsi-depotserver and install in build environment
2. Rename the spec file to opsi-depotserver-expert and edit
3. Change the package name, remove samba from 'requires', edit 'confilicts'
4. Remove code manipulating users/groups from the %pre, %post and %postun sections
5. Extra - I would also replace /opt/pcbin/install with /var/lib/opsi/depot
6. Build the RPM
This is not difficult. The opsi-depotserver package, other than creating users/groups, only makes a few directories and installs opsi-setup. The hard part is working out what to do afterwards in resolving users/groups, file ownership/permissions/ACLs, and potential issues with opsi-setup in a Samba4 AD environment rather than Samba3. This, I imagine, is what you guys are looking at too.
Sorry if I'm asking the same question again, but I'm confused by your comment that opsiconfd changes to an AD account. opsiconfd is the account running the daemon so I thought it would remain a local system account, and there is nothing in the document that says it changes. Is there a reason it must be an AD user? Also you say adminusers should be members of opsifileadmins, but what about the group opsiadmins? The code in opsi-setup is still looking for group opsiadmins.
You mention you have a problem with 'getent group opsifileadmins'. As opsifileadmins is an AD group, getent will not return anything unless /etc/nsswitch.conf is modified to use winbind thus:
passwd: files winbind
group: files winbind
Then 'getent group' will return AD groups, but won't show the group members. Maybe this is your problem. I believe this behaviour is intentional. It is certainly this way on my CentOS 6 Samba4 server. I have seen examples where getent does show AD group membership, but only with older Samba3. If it's any help Samba4 can return AD group membership with:
Code: Alles auswählen
samba-tool group listmembers opsifileadmins
auth required pam_env.so
auth sufficient pam_unix.so nullok try_first_pass
auth requisite pam_succeed_if.so uid >= 500 quiet
auth sufficient pam_krb5.so use_first_pass
auth sufficient /lib/security/pam_winbind.so use_first_pass
auth required pam_deny.so
account required pam_unix.so
account sufficient pam_localuser.so
account sufficient pam_succeed_if.so uid < 500 quiet
account sufficient pam_krb5.so
account sufficient /lib/security/pam_winbind.so
account required pam_permit.so
password requisite pam_cracklib.so try_first_pass retry=3 type=
password sufficient pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password sufficient pam_krb5.so use_authtok
password sufficient /lib/security/pam_winbind.so use_authtok
password required pam_deny.so
session optional pam_keyinit.so revoke
session required pam_limits.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
session optional pam_krb5.so
It is also necessary to edit smb.conf to add:
template shell = /bin/bash
otherwise AD users get no shell (/bin/false) by default.
Sorry for the long post but I hope it is helpful. looking forward to further progress.
Regards,
Stephen Jones
-
- Beiträge: 22
- Registriert: 03 Feb 2013, 09:46
Re: opsi with Samba4
Well, with a little work, I have managed to produce a working installation of opsi with Samba4 running on CentOS 6.3, so I would like to post the procedure here.
I am using Samba4 version 4.0.1 installed from RPM built by SOGo, as RedHat/CentOS have not yet released their official version. SOGo use Samba4 with their OpenChange product.
First step is to rebuild the opsi-depotserver RPM to remove the dependency on samba (ie. Samba3). Download the opsi-depotserver source RPM and install into the rpmbuild environment of a non-root user:
Code: Alles auswählen
rpm -i opsi-depotserver-4.0.2.3-1.1.src.rpm
Code: Alles auswählen
rpmbuild -ba opsi-depotserver.spec
Code: Alles auswählen
yum localinstall opsi-depotserver-4.0.2.3-1.1.noarch.rpm
Despite removing the user/group creation from the rebuilt opsi-depotserver package, they had still been added, obviously from another opsi RPM. Therefore I remove the users/groups so as I can recreate them in a way to work with Samba4.
Code: Alles auswählen
userdel pcpatch
userdel opsiconfd
groupdel pcpatch
groupdel opsiadmin
groupdel shadow
Code: Alles auswählen
groupadd -g 993 opsiconfd
useradd -u 993 -g 993 -c "opsi depotserver" -s /bin/bash -d /var/lib/opsi -r opsiconfd
groupadd -g 1000 opsiadmin
usermod -G opsiadmin opsiconfd
Edit /etc/opsi/opsi.conf and change it to read:
Code: Alles auswählen
fileadmingroup = opsifileadmins
Code: Alles auswählen
usermod -aG opsiadmin aduser
Code: Alles auswählen
passwd: files winbind
group: files winbind
Code: Alles auswählen
template shell = /bin/bash
Code: Alles auswählen
cd /home/DOMAIN
ln -s /var/lib/opsi pcpatch
Run opsi-setup with 'configure-mysql', 'init-current-config', and 'set-rights' as per the guide. All worked OK. Do not use 'auto-configure-samba' as we setup Samba4 manually. I do not see the point in creating 3 different samba shares like the standard setup, especially since everything is under one place and fine-grain access control is available with ACLs. Create the share 'opsi' by adding to /etc/samba4/smb.conf:
Code: Alles auswählen
[opsi]
comment = opsi Depot Server
path = /var/lib/opsi
read only = no
Code: Alles auswählen
[depotshare]
remoteurl = smb://server/opsi/depot
With opsiconfd running, I now try to connect to the server from opsi-configed on a Windows client, but it kept failing. The client log file on the server was showing PAM authentication errors, even though aduser can login by SSH, and aduser belongs to opsiadmin group. This really had me stumped for a while. Eventually, I found the problem to be in BackendManager.py in class BackendAccessControl. The code tries to identify the OS distribution and accordingly find the PAM service granting access. In the case of RHEL/CentOS it should be password-auth or system-auth (depending on version). There must be a problem with this because it obviously fails the OS test and so binds to neither. There is also a fallback called opsi-auth, which does not exist, so PAM authentication fails entirely. Rather than try to debug this (I am not a python programmer) I created a link called opsi-auth connected to my updated password-auth:
Code: Alles auswählen
cd /etc/pam.d
ln -s password-auth-local opsi-auth
I ran opsi-product-manager to populate the repository, and packages were now visible in opsi-configed.
From the Windows client I installed the opsi-client-agent from the opsi file share. After reboot the client was visible in opsi-configed. I then installed software (eg. javavm) to the client successfully. I also created a package and added it to the depot. When adding the package to the depot with opsi-package-manager it produced the error:
"Error: Backend Error: Failed to install package..."
The log file shows:
Failed to set rights for path '/var/lib/opsi/config/products/mypkg.localboot': [Errno 1] Operation not permitted
Failed to set rights for path '/var/lib/opsi/config/depots/server.domain.local.ini': [Errno 1] Operation not permitted
However, the files are added to the depot and the depot config is updated. The package appears in opsi-configed and can be installed to the client, so everything works. Perhaps there is a workaround to stop the program producing these errors. Any advice would be great.
Overall opsi appears to be working properly. I hope this information is helpful to others and the developers. Any feedback is appreciated.
Regards,
Stephen Jones
Re: opsi with Samba4
And what benefit does the Debian package opsi-depotserver-expert exactly bring? It removes the dependency to Samba3 only, right? And I still have to tinker with users and permissions manually, don't I?
Is there a rough schedule for Debian / Opsi / Samba4 so that I can estimate if I'd rather tinker, wait or get rid of one part in the game?
Re: opsi with Samba4
But i cant tell when OPSI will support Jessie. The current 4.0.4 just featured support for operation on wheezy
- n.wenselowski
- Ex-uib-Team
- Beiträge: 3194
- Registriert: 04 Apr 2013, 12:15
Re: opsi with Samba4
afaik UCS 3.2 can run Samba 4 OOB just now.
Also openSuse 13.1 and the upcoming Ubuntu releases run Samba 4.
As the opsi userbase running Debian / Ubuntu is quite large we aim to provide support for that and are yet working on it. But - as always - we will only release when it's stable enough to have a pleasant experience

With kind regards
Niko
Code: Alles auswählen
import OPSI
Re: opsi with Samba4
I was wondering if there is a documentation somewhere where you describe in detail how it is supposed to work. Right now I'm trying to fix permission issues in the Windows side. What does the client pc (with opsi-client-agent installed) actually do when it collects updates? Which AD user does what and how does the client-agent connect to the server (which user? which type of connection?). What does pcpatch do and what does the opsiconfd user do? If I am right, pcpatch installs the software on the client. Does it need to be in more AD groups than in "opsifileadmins"? I mean if I create that user manually in AD how does it get the permission to install stuff?
Do you have a document somewhere online where I can read that kind of information?