Hi,
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:
Edit ~/rpmbuild/SPECS/opsi-depotserver.spec and delete 'samba' from 'Requires:'. I also decided to change the locations /home/opsiproducts to /var/lib/opsi/workbench and /opt/pcbin/install to /var/lib/opsi/depot to comply with best practice, so I edited those paths under the [install] and [files] sections. I also removed the code from the %pre, %post and %postun sections of the spec file as they involve adding users/groups, which I plan to do manually. Now rebuild the package from the modified spec file (again as non-root user):
Install the modified opsi-depotserver package as root:
Code: Alles auswählen
yum localinstall opsi-depotserver-4.0.2.3-1.1.noarch.rpm
The package and all its dependencies installed successfully without Samba3.
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
In creating the philosophy for accounts in Unix/Windows AD it is important to realise that a unix user cannot belong to an AD group, but an AD user can belong to a unix group. The user account pcpatch must be created in AD. The group pcpatch is renamed to opsifileadmins (due to AD name restrictions) and created as a group in AD. pcpatch is a member of opsifileadmins. User opsiconfd remains a unix account to run the daemon. opsiconfd had pcpatch as its primary group, which is no longer possible, so I create a group opsiconfd for the user. This is standard with other services like mysql, apache, postfix, etc., so why not with opsi? The group opsiadmin remains a unix group controlling access to configuration. User opsiconfd is added to group opsiadmin, along with any user (unix or AD) given access to opsi-configed. Create the unix users and groups:
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
Open the AD Users and Computers tool on a Windows client in the domain and create the user pcpatch. Unset 'user must change password at next logon', and set 'user cannot change password' and 'password never expires'. Create the group opsifileadmins and add pcpatch as a member. Open the properties for pcpatch and under 'member of' set opsifileadmins as the primary group, then remove the group Domain Users.
Edit /etc/opsi/opsi.conf and change it to read:
Add any AD users who are to configure opsi to the opsiadmin group. Unix root account can also be added. For example:
Make sure that /etc/nsswitch.conf has been modified to use winbind thus:
It is also important that PAM has been configured to allow access via kerberos and/or winbind for AD users. I showed how to do this in a previous post in this thread. Either method is adequate, but I included both. Note also the requirement in smb.conf for:
When this is successful, aduser should be able to login to the server by SSH. In the case of user pcpatch there is a problem. The Samba4 default template homedir = /home/%D/%U translating to /home/DOMAIN/pcpatch. We don't want to change this default, but we want pcpatch home to be /var/lib/opsi, so create a link
Everything is now ready to proceed with the setup as per the guide - almost. Becasue I changed the package to relocate the undesirable /home/opsiproducts and /opt/pcbin/install, I edited one line of the opsi-setup script to make them /var/lib/opsi/workbench and /var/lib/opsi/depot as the code would not automatically pick up on this.
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
I changed the owner/group of /var/lib/opsi recursively to opsiconfd then, from Windows, modified the security settings of the opsi share to grant full control to Administrator and opsifileadmins (and opsiconfd). This is a reasonable starting point. More specific controls can be added, for example, to make the depot subdirectory read-only. Because I changed the depot share from the default, it is also necessary to edit the depot config file /var/lib/opsi/config/depots/server.domain.local.ini and set:
Starting the opsiconfd/opsipxeconfd services did produce a couple of warnings (python messages), but the services still start successfully. I will raise the warnings in a separate post.
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:
This fixed it and I could now login with opsi-configed.
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