Latest interface: 0.3.1
Latest system: 010
karmantyu
User

160 posts

Posted on 3 May 2017 @ 20:24edited 27 February 2018 @ 07:23
The idea was first to give a sort explanation for those people who may have upgraded their system's packages for some reason and would like to have working Samba4 and WEB interface too. Many thanks to 'arr bee' we have modified webinterface files too. So we have two methods. One for those who would like to stick to the unmodified ZFSguru webinterface and one for those who are brave enough to modify the webinterface files. Please note here is everything on your own responsibility.

********** Let see the first solution **************
If you do
# pkg upgrade
- for some obvious security reasons -
or doing a system upgrade described here http://zfsguru.com/forum/zfsgurusupport/1166
you will most likely promptly lose web interface access. To repair this SSH in your server and as su type
# chown -R 888:888 /var/spool/lighttpd
# chown -R 888:888 /var/log/lighttpd
# service lighttpd restart
and you will have the web interface back.

Previously, Samba did not check the execution bit of files. As a consequence, users could execute files, such as when upgrading from a previous version, your executable files can be missing the x-bit.
So add please the following line to /usr/local/etc/smb.conf in the global section.
acl allow execute always = yes

The upgrade process most likely replaced your Samba3 with Samba4. To have working Samba you have to copy some files to new locations and edit rc.conf.
# cp /usr/local/etc/smb.conf /usr/local/etc/smb4.conf
# cp /usr/local/etc/samba/* /var/db/samba4/private/

Finally, in /etc/rc.conf replace samba_enable="YES" with samba_enable="NO" to prevent accidentally leftover Samba3 from starting, and add samba_server_enable="YES".

After reboot you will have working Samba4 with the Samba3 presets. Remember that you can't start/stop samba service from the web interface system services page anymore. If you need this from a peculiar reason you can stop samba with service samba_server onestop
and can restart with # service samba_server onerestart
as superuser.

If you modify your samba setting on the web interface, you have to stop samba, copy the configuration files again (see above) and restart samba to kick in the changes.


*******************************************************
********** Let see the second solution for the brave ones thanks 'arr bee' **************
Disclaimer:
First of all, the edits made may not be all that is required. There may be other aspects of the webGUI that needs updating or does not work with Samba 4 which has not been tested and discovered yet.
Treat this as a work in progress to be added to as new information comes to hand.
So let's assume you have Samba4 on your server and webinterface 0.3.1 running.

At first edit /etc/rc.conf replace samba_enable="YES" with samba_enable="NO" to prevent accidentally leftover Samba3 from starting and add samba_server_enable="YES".

I've uploaded some webinterfaces here:
https://www.dropbox.com/sh/juh8hm43dlg0qky/AAD4s_hPPrrdHkREzD11ZCb0a?dl=0

Here is the link for the full 0.3.1 modified WEBinterface
https://www.dropbox.com/s/06cjssq838j0t5f/ZFSguru-0.3.1SMB4-webinterface.tar.gz?dl=0

Here is the link for the modified WEBinterface files only
https://www.dropbox.com/s/0h0ybmcawvcaej5/ZFSguru-0.3.1XSMB4-webinterface.tar.gz?dl=0

Let's stop the running interface services:
# service samba_server onestop
# service lighttpd onestop

# get in the ZFSguru directory
# cd /usr/local/www/zfsguru/

# fetch the modified webinterface files
# fetch https://www.dropbox.com/s/0h0ybmcawvcaej5/ZFSguru-0.3.1XSMB4-webinterface.tar.gz?dl=0

# extract the fetched files
# tar -xzvf ZFSguru-0.3.1XSMB4-webinterface.tar.gz

# Change owner to default to be sure
# chown -R zfsguru-web:zfsguru-web /usr/local/www/zfsguru


# Let's start services for samba and the webinterface
# service samba_server onerestart
# service lighttpd onestart

You should have working Samba4 with working ZFSguru WEBUI now.

Previously, Samba did not check the execution bit of files. As a consequence, users could execute files, such as when upgrading from a previous version, your executable files can be missing the x-bit.
On the ACCESS SETTINGS WEBUI page 'Insert new global variable' section you should select the second option with a value YES (Means adding acl allow execute always = yes to smb4.conf) click update configuration and restart samba buttons.

If something goes wrong you should get in the webinterface directory (cd /usr/local/www/zfsguru/) and fetch and extract the original 0.3.1 webinterface
# fetch https://www.dropbox.com/s/mz1vf74tqt2r0ge/ZFSguru-0.3.1-webinterface.txz?dl=0
# tar -xzvf ZFSguru-0.3.1-webinterface.txz

Have fun :)
arr bee
User

13 posts

Posted on 22 February 2018 @ 12:36
I guess you could link smb.conf to smb4.conf so that the gui updates the new file...?

In any case, I just tested updating the WEBui to use the smb4.conf instead.
Seems to be an update to /usr/local/www/zfsguru/includes/main.php does the trick.

I got the start/stop working in the GUI by updating the rc.d values in:
/usr/local/www/zfsguru/includes/main.php
/usr/local/www/zfsguru/includes/internalservice.php

I havent done extensive testing. only confirming that creating and deleting shares in the GUI updates the smb4.conf file and start/stop/autostart actually works.
karmantyu
User

160 posts

Posted on 23 February 2018 @ 08:31
arr bee wrote: I guess you could link smb.conf to smb4.conf so that the gui updates the new file...?
Good work. Could You make the working modifications public?
arr bee
User

13 posts

Posted on 23 February 2018 @ 12:19
Here you go.
I'd suggest merging this into the original post (once verified by yourself?) so that anyone else wanting to add to it has there additions merged in the one (original) post.
apologies for maybe going overboard here...

UPDATING WEB-GUI TO SUPPORT SAMBA4
==================================

Disclaimer:
First of all, the following steps may not be all that is required. There may be other aspects of the webGUI that needs updating or does not work with Samba 4 which has not been tested and discovered yet.
Treat this as a work in progress to be added to as new information comes to hand.
These edits update delivered code in the ZFSguru WebUI. Any reinstall/update of the WebUI will likely overwrite the changes you are about to make and so they may need to be made again.


Precautions:
To easily recover from making bad/incorrect changes, I'd recommend:
1- Taking a snapshot of your boot volume.
#zfs snap <boot vol>@<snapshot name>
eg."zfs snap bootpool/zfsguru/10.2-003@pre-smb4GUI-fix"

2- Backing up each file that you are about edit with an easily searchable suffix or prefix. I like to make the identifier unique to the project so that I can find all file backups related to a set of edits.
#cp <file to be edited> <back up name>
eg.#cp /usr/local/www/zfsguru/includes/main.php /usr/local/www/zfsguru/includes/main.php.GUI4SMB


Update GUI to control Samba4 stop/start:
----------------------------------------
The main difference relating to stop start activities in version 4 is the service name. It changes from "samba" to "samba_server".
The ZFSguru scripts use "samba" as a variable a fair bit so care needs to be taken to not update every instance of "samba" to be "samba_server". So far I have foud the below entries that need to be updated, there may be more.

1. edit /usr/local/www/zfsguru/includes/main.php and update the following line:
Old: 'Samba' => '/usr/local/etc/rc.d/samba',
New: 'Samba' => '/usr/local/etc/rc.d/samba_server',

2. edit /usr/local/www/zfsguru/includes/internalservice.php and update the following line:
Old: 'script' => '/usr/local/etc/rc.d/samba',
New: 'script' => '/usr/local/etc/rc.d/samba_server',

3. edit /usr/local/www/zfsguru/scripts/advanced_benchmark.php and update the following line:
Old: exec('/usr/local/etc/rc.d/samba onestop > /dev/null 2>&1');
New: exec('/usr/local/etc/rc.d/samba_server onestop > /dev/null 2>&1');

4. Restart the GUI
Under services ==> system services, restart Lighttpd. (Or leave until other changes are done.)



Update GUI to remove deprecated Samba4 security value:
------------------------------------------------------
In Samba 4 "share" level security is no longer a valid value in the conf file.
It should be manually changed in the global settings of smb4.conf as part of getting Samba4 up and running, but to prevent ZFSguru from reverting the smb4.conf to an old Samba3 value we should block the WebUI from presenting the depricated value to the user.

1. edit /usr/local/www/zfsguru/pages/access/samba_settings.page and update the following line:
Old: <option value="share" %%CLASS_SM_SHARE%%>Share-level security</option>
New: <!--option value="share" %%CLASS_SM_SHARE%%>Share-level security</option-->

2. Restart the GUI
Under services ==> system services, restart Lighttpd. (Or leave until other changes are done.)



Update libraries to point to new Samba config file:
---------------------------------------------------
Samba 4 uses a different file for it's configuration. As part of getting Samba running, you will have copied the old file to the new file, and possibly made some manual edits.
To prevent the need to manually copy old file to new every time the WebUI is used to make changes (add a new Samba share, etc) and allow ZFSguru to edit the new file directly, we need to update the config file name in the ZFSguru libraries.

1. edit /usr/local/www/zfsguru/includes/main.php and update the following line:
Old: 'Samba' => '/usr/local/etc/smb.conf',
New: 'Samba' => '/usr/local/etc/smb4.conf',

2. I dont think this is needed, but for completness the old value contained in here should be updated
edit /usr/local/www/zfsguru/pages/system/migration.page and update the following line:
Old: <td class="grey">/usr/local/etc/samba, /usr/local/etc/smb.conf</td>
New: <td class="grey">/usr/local/etc/samba, /usr/local/etc/smb4.conf</td>

3. I think the occurance of smb.conf inside the /usr/local/www/zfsguru/scripts/zfsguru_install.php can be ignored as I *guess* this is only used when installing ZFSguru.

4. Restart the GUI
Under services ==> system services, restart Lighttpd. (Or leave until other changes are done.)



Other possible updates that *might* be required:
------------------------------------------------
In general, any files or locations that change between Samba3 and Samba4 are possible targets for requiring a WebUI update. The changes already detailed cover starting/stoping the Samba service and allowing the Samba config to be updated.
I haven't performed the following updates therefore they are untested and may/may not be required.
1. /usr/local/etc/samba
The steps to get Samba4 up and running include copying the contents of /usr/local/etc/samba/ to /var/db/samba4/private/
as such any value in the ZFSguru files that is "/usr/local/etc/samba/" may need to be updated to "/var/db/samba4/private/"



Handy commands:
---------------
1. to find files that contain a string (so that you can update all occurances of something) and display the file name where the string is found
#find <starting directory> [-type f] -exec grep "<string you are looking for>" {} +
eg. find /usr/local/www/zfsguru -type f -exec grep "smb.conf" {} +


karmantyu
User

160 posts

Posted on 23 February 2018 @ 19:52edited 27 February 2018 @ 07:20
Thank You arr bee,
I've checked your findings and I agree about this is a more elegant solution. I've merged it in the first post and shared the modified files too.
arr bee
User

13 posts

Posted on 2 March 2018 @ 15:07
no problem. I had some spare time and was just messing around with a VM.
I love the interface of ZFSguru and would hate to see it die.
Last Page

Valid XHTML 1.1