diff -urN smeserver-phpvirtualbox-5.2.1.old/createlinks smeserver-phpvirtualbox-5.2.1/createlinks --- smeserver-phpvirtualbox-5.2.1.old/createlinks 2022-10-18 09:49:44.000000000 +1100 +++ smeserver-phpvirtualbox-5.2.1/createlinks 2023-03-01 16:58:09.000000000 +1100 @@ -9,17 +9,22 @@ #see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event foreach my $file (qw( - /etc/php-fpm.d/phpvirtualbox.conf - /opt/phpvirtualbox/config.php + /etc/httpd/conf/httpd.conf + /etc/opt/remi/php74/php-fpm.d/www.conf + /etc/samba/smb.conf + /opt/phpvirtualbox/config.php )) { templates2events( $file, $event ); }; +#we need to expand /opt/phpvirtualbox/config.php when changing the vboxweb runtime user passwd +templates2events( '/opt/phpvirtualbox/config.php', 'smeserver-virtualbox-update'); + #action needed in case we have a systemd unit #event_link('systemd-default', $event, '10'); #event_link('systemd-reload', $event, '50'); #services we need to restart -#event_services($event, 'vboxdrv' => 'restart', 'vboxweb-service' => 'restart'); +event_services($event, 'httpd-e-smith' => 'restart', 'php74-php-fpm' => 'restart', 'smbd' => 'restart'); #backup_includes("smeserver-virtualbox", qw( #/home/e-smith/files/users/vbox diff -urN smeserver-phpvirtualbox-5.2.1.old/README.md smeserver-phpvirtualbox-5.2.1/README.md --- smeserver-phpvirtualbox-5.2.1.old/README.md 2015-08-08 21:37:59.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/README.md 1970-01-01 10:00:00.000000000 +1000 @@ -1,2 +0,0 @@ -smeserver-phpvirtualbox -======================= diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser 1970-01-01 10:00:00.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser 2023-02-25 16:29:54.000000000 +1100 @@ -0,0 +1 @@ +admin diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype 2022-10-17 09:14:35.000000000 +1100 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype 2023-02-25 16:29:54.000000000 +1100 @@ -1 +1 @@ -disabled +WebAuth diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type 2015-08-08 21:37:59.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type 2023-02-25 16:29:54.000000000 +1100 @@ -1 +1 @@ -service +configuration diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups 1970-01-01 10:00:00.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups 2023-02-28 17:37:52.000000000 +1100 @@ -0,0 +1 @@ +vboxusers \ No newline at end of file diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/40phpvirtualbox-change-webauth-to-enabled smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/40phpvirtualbox-change-webauth-to-enabled --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/40phpvirtualbox-change-webauth-to-enabled 2015-08-08 21:37:59.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/40phpvirtualbox-change-webauth-to-enabled 1970-01-01 10:00:00.000000000 +1000 @@ -1,8 +0,0 @@ -{ - my $PVBwebauth = $DB->get_prop('phpvirtualbox', 'webauth') or return; - if ($PVBwebauth eq 'disabled') - { - $DB->set_prop('phpvirtualbox',"webauth", "enabled" ); - } -} - diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/phpvirtualbox --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/phpvirtualbox 1970-01-01 10:00:00.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/phpvirtualbox 2023-02-25 16:29:54.000000000 +1100 @@ -0,0 +1,23 @@ +{ + my $rec = $DB->get('phpvirtualbox') + || $DB->new_record('phpvirtualbox', {type => 'configuration'}); + + # webauth replaced by authType, which can have multiple values + if ($rec->prop('webauth')) { + $rec->set_prop('authType', 'WebAuth'); + $rec->del_prop('webauth'); + } + + # Group has been replaced with userGroups, which already allowed for multiple groups + if ($rec->prop('Group')) { + $rec->set_prop('userGroups', $rec->prop('Group')); + $rec->del_prop('Group'); + } + + # User replaced by Users, because it already allows for multiple users + if ($rec->prop('User')) { + $rec->set_prop('Users', $rec->prop('User')); + $rec->del_prop('User'); + } + +} diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ExternalUnixGroup smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ExternalUnixGroup --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ExternalUnixGroup 1970-01-01 10:00:00.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ExternalUnixGroup 2023-03-07 12:10:50.000000000 +1100 @@ -0,0 +1 @@ +DefineExternalGroup ugroup environment /usr/bin/unixgroup diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35-group-auth smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35-group-auth --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35-group-auth 2015-08-08 21:37:59.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35-group-auth 1970-01-01 10:00:00.000000000 +1000 @@ -1,5 +0,0 @@ -{ - $OUT .= " AddExternalGroup ugroup /usr/bin/unixgroup\n"; - $OUT .= " SetExternalGroupMethod ugroup environment\n"; -} - diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost 2022-10-18 08:09:34.000000000 +1100 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost 2023-03-07 12:09:59.000000000 +1100 @@ -6,8 +6,8 @@ $OUT = ""; my $satisfy = 'all'; my $name = $phpvirtualbox{'Name'} || 'phpvirtualbox'; - my @phpvuser = split(",", ($phpvirtualbox{'User'} || "") ); - my @phpvgroup = split(",", ($phpvirtualbox{'Group'} || "") ); + my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") ); + my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") ); my $alias = ($phpvirtualbox{'URL'} || 'phpvirtualbox'); $OUT .= "#------------------------------------------------------------\n"; @@ -18,20 +18,23 @@ $OUT .= "\n"; if ($phpvirtualbox{'authtype'} ne 'disabled') { $OUT .= "\n"; - if ($phpvirtualbox{'authtype'} eq 'httpd_webauth') { + if ($phpvirtualbox{'authtype'} eq 'WebAuth') { $OUT .= " AuthName \"$name\"\n"; - $OUT .= " AuthType Basic\n"; - $OUT .= " AuthBasicProvider \n"; - $OUT .= " AuthExternal webauth\n"; - $OUT .= " GroupExternal ugroup\n"; - $OUT .= " Require user admin @phpvuser\n"; - $OUT .= " Require group @phpvgroup\n"; + $OUT .= " AuthType Basic\n"; + $OUT .= " AuthBasicProvider external\n"; + $OUT .= " AuthExternal pwauth\n"; + $OUT .= " GroupExternal ugroup\n"; + $OUT .= " Require user admin @phpvboxusers\n"; + $OUT .= " Require external-group @phpvboxgroups\n"; } elsif ($phpvirtualbox{'authtype'} eq 'httpd_LDAP') { - $OUT .= " AuthName \"$name\"\n"; - $OUT .= " AuthType Basic\n"; - $OUT .= " AuthBasicProvider ldap\n"; - $OUT .= " Require ldap-user admin @phpvuser\n"; - $OUT .= " Require ldap-group cn=@phpvgroup, o=*\n"; + $OUT .= " AuthName \"$name\"\n"; + $OUT .= " AuthType Basic\n"; + $OUT .= " AuthBasicProvider ldap\n"; + $OUT .= " AuthLDAPURL = ldap://localhost/0=$smb{'Workgroup'},%uid\n"; + $OUT .= " Require ldap-user admin @phpvboxusers\n"; + foreach my $group (@phpvboxgroups) { + $OUT .= " Require ldap-group cn=@group, o=*\n"; + } } $OUT .= "\n"; $OUT .= "\n"; @@ -46,4 +49,3 @@ $OUT .= " AddType application/x-httpd-php .php\n"; $OUT .= "\n"; } - diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/phpvirtualbox.conf/50phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/php-fpm.d/phpvirtualbox.conf/50phpvirtualbox --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/phpvirtualbox.conf/50phpvirtualbox 2022-10-12 14:58:16.000000000 +1100 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/php-fpm.d/phpvirtualbox.conf/50phpvirtualbox 1970-01-01 10:00:00.000000000 +1000 @@ -1,32 +0,0 @@ -[php74-phpvirtualbox] -user = www -group = www -listen.owner = root -listen.group = www -listen.mode = 0660 -listen = /var/run/php-fpm/php74-phpvirtualbox.sock -pm = dynamic -pm.max_children = 15 -pm.start_servers = 3 -pm.min_spare_servers = 3 -pm.max_spare_servers = 4 -pm.max_requests = 1000 -slowlog = /var/log/php/phpvirtualbox/slow.log -php_admin_value[session.save_path] = /var/lib/php/php74/phpvirtualbox/session -php_admin_value[opcache.file_cache] = /var/lib/php/php74/phpvirtualbox/opcache -php_admin_value[upload_tmp_dir] = /var/lib/php/php74/phpvirtualbox/tmp -php_admin_value[sys_temp_dir] = /var/lib/php/php74/phpvirtualbox/tmp -php_admin_flag[display_errors] = on -php_admin_flag[log_errors] = on -php_admin_value[error_log] = /var/log/php/phpvirtualbox/error.log -php_admin_value[memory_limit] = 128M -php_admin_value[max_execution_time] = 30 -php_admin_value[upload_max_filesize] = 10M -php_admin_value[max_input_time] = 60 -php_admin_flag[allow_url_fopen] = 1 -php_admin_flag[file_upload] = on -php_admin_flag[session.cookie_httponly] = on -php_admin_flag[allow_url_include] = off -php_admin_value[session.save_handler] = files -php_admin_value[open_basedir] = /opt/phpvirtualbox/:/var/lib/php/php74/phpvirtualbox/:/var/log/php/phpvirtualbox/:/var/run/php-fpm/ -php_admin_value[eaccelerator.enable] = 1 diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phpvirtualbox --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phpvirtualbox 1970-01-01 10:00:00.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/php-fpm.d/www.conf/15phpvirtualbox 2023-02-25 16:29:54.000000000 +1100 @@ -0,0 +1,65 @@ +{ + + my $phpversion = ($phpvirtulabox{Version} || '74'); + if ($PHP_VERSION eq $phpversion) { + if (($phpvirtualbox{'status'} || 'disabled') eq 'enabled') { + my $max_upload_size = ($phpvirtualbox{MaxUploadSize} || '4096'); + $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/); + my $memory_limit = ($phpvirtualbox{MemoryLimit} || '500M'); + $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/); + my $open_basedir= $phpvirtualbox{PHPBaseDir} || ''; + my $id = 'phpvirtualbox'; + $open_basedir = "/opt/phpvirtualbox/:/var/log/php/$id/:/var/lib/php/$id/:$open_basedir"; + my $max_children = $phpvirtualbox{'PHPmaxChildren'} || 20; + my $min_spare_servers = $phpvirtualbox{'PHPminServers'} || 4; + my $start_servers = $phpvirtualbox{'PHPstartServers'} || 6; + my $max_spare_servers = $phpvirtualbox{'PHPmaxServers'} || 8; + my $max_requests = $phpvirtualbox{'PHPmaxRequests'} || 1000; + $min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers; + $start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers; + + $OUT .=<<_EOF; + +[php$PHP_VERSION-$id] +user = www +group = www +listen.owner = root +listen.group = www +listen.mode = 0660 +listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock +pm = dynamic +pm.max_children = $max_children +pm.start_servers = $start_servers +pm.min_spare_servers = $min_spare_servers +pm.max_spare_servers = $max_spare_servers +pm.max_requests = $max_requests +php_admin_value[session.save_path] = /var/lib/php/$id/session +php_admin_value[session.gc_maxlifetime] = 86400 +php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache +php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp +php_admin_value[error_log] = /var/log/php/$id/error.log +slowlog = /var/log/php/$id/slow.log +php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName } +php_admin_flag[display_errors] = off +php_admin_flag[log_errors] = on +php_admin_value[memory_limit] = $memory_limit +php_admin_value[max_execution_time] = 3600 +php_admin_value[post_max_size] = $max_upload_size +php_admin_value[upload_max_filesize] = $max_upload_size +php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru, phpinfo, escapeshellarg, escapeshellcmd +php_admin_value[open_basedir] = $open_basedir +php_admin_flag[allow_url_fopen] = on +php_admin_flag[file_uploads] = on +php_admin_flag[session.cookie_httponly] = on +php_admin_flag[allow_url_include] = off +php_admin_value[session.save_handler] = files +php_admin_flag[output_buffering] = off +php_admin_flag[eaccelerator.enable] = on + +_EOF + + } else { + $OUT .= '; phpvirtualbox is disabled'; + } + } +} \ No newline at end of file diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox 1970-01-01 10:00:00.000000000 +1000 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox 2023-03-07 13:11:47.000000000 +1100 @@ -0,0 +1,33 @@ +{ + my $validusers = ''; + if ($phpvirtualbox{'adminUser'} || $phpvirtualbox{'userGroups'}) { + if ($phpvirtualbox{'adminUser'}) { + $validusers = "$phpvirtualbox{'adminUser'}"; + if ($phpvirtualbox{'userGroups'}) { + $validusers .= ",+$phpvirtualbox{'userGroups'}"; + } + } else { + if ($phpvirtualbox{'userGroups'}) { + $validusers = "+$phpvirtualbox{'userGroups'}"; + } + } + } + + $OUT .=<<_VBOX; + +[virtualbox] +comment = virtualbox ISO directory +path = /opt/vbox/ISOs +read only = no +writable = yes +printable = no +inherit permissions = yes +create mode = 0640 + +_VBOX + + if ($validusers) { + $OUT .= "valid users = $validusers\n"; + } + +} \ No newline at end of file diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2023-03-07 16:07:55.309653000 +1100 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2023-03-07 12:07:39.000000000 +1100 @@ -1,38 +1,90 @@ { +# domain stuff + my $baseDN = esmith::util::ldapBase($DomainName); + my $workgroup = $smb{'Workgroup'}; +# vboxweb parameters + my $username = (${'vboxweb-service'}{'user'} || 'vbox'); + my $password = ${'vboxweb-service'}{'password'}; + my $location = ("http://${'vboxweb-service'}{'access'}:${'vboxweb-service'}{'TCPPort'}/" || "http://127.0.0.1:18083/"); +# phpvirtualbox parameters for users + my $adminUser = ($phpvirtualbox{'adminUser'} || 'admin'); + my $adminGroup = ($phpvirtualbox{'adminGroup'} || 'admin'); + my $userGroups = $phpvirtualbox{'userGroups'}; +# phpvirtualbox config parameters + my $language = ($phpvirtualbox{'language'} || 'en'); + my $vrdeports = ($phpvirtualbox{'vrdeports'} || '19000-19100'); + my $maxProgressList = ($phpvirtualbox{'maxProgressList'} || 5); + my $deleteOnRemove = ($phpvirtualbox{'deleteOnRemove'} || true); + my $browserRestrictFiles = ($phpvirtualbox{'browserRestrictFiles'} || "'.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd'"); + my $browserRestrictFolders = ($phpvirtualbox{'browserRestrictFolders'} || "'/opt/vbox/ISOs','/opt/vbox/VMs'"); + my $hostMemInfoRefreshInterval = ($phpvirtualbox{'hostMemInfoRefreshInterval'} || 5); + my $consoleResolutions = ($phpvirtualbox{'consoleResolutions'} || "'640x480','800x600','1024x768','1280x720','1440x900'"); + my $consoleKeyboardLayout = ($phpvirtualbox{'consoleKeyboardLayout'} || 'EN'); + my $nicMax = ($phpvirtualbox{'nicMax'} || 4); +# working + my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") ); + my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") ); $OUT .=<<_PARMS; - + class phpVBoxConfig { -var \$username = 'vbox'; -var \$location = 'http://127.0.0.1:18083/'; -var \$language = 'en'; -var \$vrdeports = '9000-9100'; -var \$maxProgressList = 5; -var \$deleteOnRemove = true; -var \$browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd'); -var \$hostMemInfoRefreshInterval = 5; -var \$consoleResolutions = array('640x480','800x600','1024x768','1280x720','1440x900'); -var \$consoleKeyboardLayout = 'EN'; -var \$nicMax = 4; +# default paramaters +var \$username = '$username'; +var \$password = '$password'; +var \$location = '$location'; +var \$language = '$language'; +var \$vrdeports = '$vrdeports'; +var \$maxProgressList = $maxProgressList; +var \$deleteOnRemove = $deleteOnRemove; +var \$browserRestrictFiles = array($browserRestrictFiles); +var \$browserRestrictFolders = array($browserRestrictFolders); +var \$hostMemInfoRefreshInterval = $hostMemInfoRefreshInterval; +var \$consoleResolutions = array($consoleResolutions); +var \$consoleKeyboardLayout = '$consoleKeyboardLayout'; +var \$nicMax = $nicMax; + +# authentication parameters _PARMS - my $authtype = $phpvirtualbox{'authtype'} || 'disabled'; - if ($authtype eq 'webauth') { - $OUT .= "var \$authLib = 'WebAuth';\n"; - $OUT .= "var \$authConfig = array('adminUser' => 'admin');\n"; - } elsif ($authtype eq 'Builtin') { +# authentication stuff + my $authtype = ($phpvirtualbox{'authType'} || 'WebAuth'); + if ($authtype eq 'Builtin') { $OUT .= "var \$authLib = 'Builtin';\n"; + } elsif ($authtype eq 'WebAuth') { + $OUT .= "var \$authLib = 'WebAuth';\n"; + $OUT .= "var \$authConfig = array('adminUser' => '$adminUser');\n"; } elsif ($authtype eq 'LDAP') { $OUT .= "var \$authLib = 'LDAP';\n"; $OUT .= "var \$authConfig = array(\n"; - $OUT .= " 'host' => '127.0.0.1',\n"; - $OUT .= " 'bind_dn' => 'uid=%s, ou=Users, dc=mycompany, dc=local',\n"; - $OUT .= " 'adminUser' => 'admin');\n"; + $OUT .= " 'host' => '127.0.0.1',\n"; + $OUT .= " 'bind_dn' => 'uid=%s, ou=Users, $baseDN',\n"; + $OUT .= " 'adminUser' => $adminUser);\n"; + } elsif ($authtype eq 'AD' && $workgroup ) { + $OUT .= "var \$authLib = 'ActiveDirectory';\n"; + $OUT .= "var \$authConfig = array(\n"; + $OUT .= " 'host' => '127.0.0.1',\n"; + $OUT .= " 'domain' => '$workgroup',\n"; + $OUT .= " 'admin_group' => '$adminGroup'"; + if ($userGroups) { + foreach my $group (@phpvboxgroups) { + $OUT .= ",\n"; + $OUT .= " 'user_group' => '$group'"; + } + }; + $OUT .= ");\n"; } else { $OUT .= "var \$noAuth=true;\n"; } - + +# allow inclusion of any generic parameter stored in config db for phpvirtualbox + $OUT .= "# additional parameters defined in configuration DB\n"; + my @stdparms = qw(type status Name Users userGroups adminUser adminGroup authtype language vrdeports maxProgressList deleteOnRemove browserRestrictFiles browserRestrictFolders consolresolutions hostMemInfoRefreshInterval consoleKeyboardLayout nicMax); + while (my ($param, $value) = each (%phpvirtualbox)) { + next if ( $param ~~ @stdparms ); + $OUT .= "var \$$param = $value;\n"; + } + $OUT .= "}\n"; - + diff -urN smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/phpvirtualbox smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/phpvirtualbox --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/phpvirtualbox 2023-03-07 16:49:37.500223500 +1100 +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/phpvirtualbox 2023-03-08 10:45:22.565554001 +1100 @@ -13,11 +13,17 @@ $rec->set_prop('userGroups', $rec->prop('Group')); $rec->del_prop('Group'); } + if ( -e '/etc/e-smith/db/configuration/defaults/Group') { + unlink '/etc/e-smith/db/configuration/defaults/Group'; + } # User replaced by Users, because it already allows for multiple users if ($rec->prop('User')) { $rec->set_prop('Users', $rec->prop('User')); $rec->del_prop('User'); } + if ( -e '/etc/e-smith/db/configuration/defaults/User') { + unlink '/etc/e-smith/db/configuration/defaults/User'; + } }