/[smecontribs]/rpms/smeserver-phpvirtualbox/contribs10/smeserver-phpvirtualbox-5.2.1-multiple_changes.patch
ViewVC logotype

Annotation of /rpms/smeserver-phpvirtualbox/contribs10/smeserver-phpvirtualbox-5.2.1-multiple_changes.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (hide annotations) (download)
Fri Mar 10 01:23:20 2023 UTC (20 months, 3 weeks ago) by trevorb
Branch: MAIN
Changes since 1.4: +1 -20 lines
revert bad patch

1 trevorb 1.2 diff -urN smeserver-phpvirtualbox-5.2.1.old/createlinks smeserver-phpvirtualbox-5.2.1/createlinks
2     --- smeserver-phpvirtualbox-5.2.1.old/createlinks 2022-10-18 09:49:44.000000000 +1100
3     +++ smeserver-phpvirtualbox-5.2.1/createlinks 2023-03-01 16:58:09.000000000 +1100
4     @@ -9,17 +9,22 @@
5     #see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
6    
7     foreach my $file (qw(
8     - /etc/php-fpm.d/phpvirtualbox.conf
9     - /opt/phpvirtualbox/config.php
10     + /etc/httpd/conf/httpd.conf
11     + /etc/opt/remi/php74/php-fpm.d/www.conf
12     + /etc/samba/smb.conf
13     + /opt/phpvirtualbox/config.php
14     ))
15     {
16     templates2events( $file, $event );
17     };
18     +#we need to expand /opt/phpvirtualbox/config.php when changing the vboxweb runtime user passwd
19     +templates2events( '/opt/phpvirtualbox/config.php', 'smeserver-virtualbox-update');
20     +
21     #action needed in case we have a systemd unit
22     #event_link('systemd-default', $event, '10');
23     #event_link('systemd-reload', $event, '50');
24     #services we need to restart
25     -#event_services($event, 'vboxdrv' => 'restart', 'vboxweb-service' => 'restart');
26     +event_services($event, 'httpd-e-smith' => 'restart', 'php74-php-fpm' => 'restart', 'smbd' => 'restart');
27    
28     #backup_includes("smeserver-virtualbox", qw(
29     #/home/e-smith/files/users/vbox
30     diff -urN smeserver-phpvirtualbox-5.2.1.old/README.md smeserver-phpvirtualbox-5.2.1/README.md
31     --- smeserver-phpvirtualbox-5.2.1.old/README.md 2015-08-08 21:37:59.000000000 +1000
32     +++ smeserver-phpvirtualbox-5.2.1/README.md 1970-01-01 10:00:00.000000000 +1000
33     @@ -1,2 +0,0 @@
34     -smeserver-phpvirtualbox
35     -=======================
36     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
37     --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser 1970-01-01 10:00:00.000000000 +1000
38     +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/adminUser 2023-02-25 16:29:54.000000000 +1100
39     @@ -0,0 +1 @@
40     +admin
41     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
42     --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype 2022-10-17 09:14:35.000000000 +1100
43     +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/authtype 2023-02-25 16:29:54.000000000 +1100
44     @@ -1 +1 @@
45     -disabled
46     +WebAuth
47     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
48     --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type 2015-08-08 21:37:59.000000000 +1000
49     +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/type 2023-02-25 16:29:54.000000000 +1100
50     @@ -1 +1 @@
51     -service
52     +configuration
53     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
54     --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups 1970-01-01 10:00:00.000000000 +1000
55     +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/defaults/phpvirtualbox/userGroups 2023-02-28 17:37:52.000000000 +1100
56     @@ -0,0 +1 @@
57     +vboxusers
58     \ No newline at end of file
59     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
60     --- 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
61     +++ 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
62     @@ -1,8 +0,0 @@
63     -{
64     - my $PVBwebauth = $DB->get_prop('phpvirtualbox', 'webauth') or return;
65     - if ($PVBwebauth eq 'disabled')
66     - {
67     - $DB->set_prop('phpvirtualbox',"webauth", "enabled" );
68     - }
69     -}
70     -
71     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
72     --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/db/configuration/migrate/phpvirtualbox 1970-01-01 10:00:00.000000000 +1000
73     +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/db/configuration/migrate/phpvirtualbox 2023-02-25 16:29:54.000000000 +1100
74     @@ -0,0 +1,23 @@
75     +{
76     + my $rec = $DB->get('phpvirtualbox')
77     + || $DB->new_record('phpvirtualbox', {type => 'configuration'});
78     +
79     + # webauth replaced by authType, which can have multiple values
80     + if ($rec->prop('webauth')) {
81     + $rec->set_prop('authType', 'WebAuth');
82     + $rec->del_prop('webauth');
83     + }
84     +
85     + # Group has been replaced with userGroups, which already allowed for multiple groups
86     + if ($rec->prop('Group')) {
87     + $rec->set_prop('userGroups', $rec->prop('Group'));
88     + $rec->del_prop('Group');
89     + }
90     +
91     + # User replaced by Users, because it already allows for multiple users
92     + if ($rec->prop('User')) {
93     + $rec->set_prop('Users', $rec->prop('User'));
94     + $rec->del_prop('User');
95     + }
96     +
97     +}
98     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
99     --- 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
100     +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/35ExternalUnixGroup 2023-03-07 12:10:50.000000000 +1100
101     @@ -0,0 +1 @@
102     +DefineExternalGroup ugroup environment /usr/bin/unixgroup
103     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
104     --- 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
105     +++ 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
106     @@ -1,5 +0,0 @@
107     -{
108     - $OUT .= " AddExternalGroup ugroup /usr/bin/unixgroup\n";
109     - $OUT .= " SetExternalGroupMethod ugroup environment\n";
110     -}
111     -
112     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
113     --- 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
114     +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/92phpvirtualhost 2023-03-07 12:09:59.000000000 +1100
115     @@ -6,8 +6,8 @@
116     $OUT = "";
117     my $satisfy = 'all';
118     my $name = $phpvirtualbox{'Name'} || 'phpvirtualbox';
119     - my @phpvuser = split(",", ($phpvirtualbox{'User'} || "") );
120     - my @phpvgroup = split(",", ($phpvirtualbox{'Group'} || "") );
121     + my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") );
122     + my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") );
123     my $alias = ($phpvirtualbox{'URL'} || 'phpvirtualbox');
124    
125     $OUT .= "#------------------------------------------------------------\n";
126     @@ -18,20 +18,23 @@
127     $OUT .= "\n";
128     if ($phpvirtualbox{'authtype'} ne 'disabled') {
129     $OUT .= "<Location /$alias>\n";
130     - if ($phpvirtualbox{'authtype'} eq 'httpd_webauth') {
131     + if ($phpvirtualbox{'authtype'} eq 'WebAuth') {
132     $OUT .= " AuthName \"$name\"\n";
133     - $OUT .= " AuthType Basic\n";
134     - $OUT .= " AuthBasicProvider \n";
135     - $OUT .= " AuthExternal webauth\n";
136     - $OUT .= " GroupExternal ugroup\n";
137     - $OUT .= " Require user admin @phpvuser\n";
138     - $OUT .= " Require group @phpvgroup\n";
139     + $OUT .= " AuthType Basic\n";
140     + $OUT .= " AuthBasicProvider external\n";
141     + $OUT .= " AuthExternal pwauth\n";
142     + $OUT .= " GroupExternal ugroup\n";
143     + $OUT .= " Require user admin @phpvboxusers\n";
144     + $OUT .= " Require external-group @phpvboxgroups\n";
145     } elsif ($phpvirtualbox{'authtype'} eq 'httpd_LDAP') {
146     - $OUT .= " AuthName \"$name\"\n";
147     - $OUT .= " AuthType Basic\n";
148     - $OUT .= " AuthBasicProvider ldap\n";
149     - $OUT .= " Require ldap-user admin @phpvuser\n";
150     - $OUT .= " Require ldap-group cn=@phpvgroup, o=*\n";
151     + $OUT .= " AuthName \"$name\"\n";
152     + $OUT .= " AuthType Basic\n";
153     + $OUT .= " AuthBasicProvider ldap\n";
154     + $OUT .= " AuthLDAPURL = ldap://localhost/0=$smb{'Workgroup'},%uid\n";
155     + $OUT .= " Require ldap-user admin @phpvboxusers\n";
156     + foreach my $group (@phpvboxgroups) {
157     + $OUT .= " Require ldap-group cn=@group, o=*\n";
158     + }
159     }
160     $OUT .= "</Location>\n";
161     $OUT .= "\n";
162     @@ -46,4 +49,3 @@
163     $OUT .= " AddType application/x-httpd-php .php\n";
164     $OUT .= "</Directory>\n";
165     }
166     -
167     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
168     --- 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
169     +++ 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
170     @@ -1,32 +0,0 @@
171     -[php74-phpvirtualbox]
172     -user = www
173     -group = www
174     -listen.owner = root
175     -listen.group = www
176     -listen.mode = 0660
177     -listen = /var/run/php-fpm/php74-phpvirtualbox.sock
178     -pm = dynamic
179     -pm.max_children = 15
180     -pm.start_servers = 3
181     -pm.min_spare_servers = 3
182     -pm.max_spare_servers = 4
183     -pm.max_requests = 1000
184     -slowlog = /var/log/php/phpvirtualbox/slow.log
185     -php_admin_value[session.save_path] = /var/lib/php/php74/phpvirtualbox/session
186     -php_admin_value[opcache.file_cache] = /var/lib/php/php74/phpvirtualbox/opcache
187     -php_admin_value[upload_tmp_dir] = /var/lib/php/php74/phpvirtualbox/tmp
188     -php_admin_value[sys_temp_dir] = /var/lib/php/php74/phpvirtualbox/tmp
189     -php_admin_flag[display_errors] = on
190     -php_admin_flag[log_errors] = on
191     -php_admin_value[error_log] = /var/log/php/phpvirtualbox/error.log
192     -php_admin_value[memory_limit] = 128M
193     -php_admin_value[max_execution_time] = 30
194     -php_admin_value[upload_max_filesize] = 10M
195     -php_admin_value[max_input_time] = 60
196     -php_admin_flag[allow_url_fopen] = 1
197     -php_admin_flag[file_upload] = on
198     -php_admin_flag[session.cookie_httponly] = on
199     -php_admin_flag[allow_url_include] = off
200     -php_admin_value[session.save_handler] = files
201     -php_admin_value[open_basedir] = /opt/phpvirtualbox/:/var/lib/php/php74/phpvirtualbox/:/var/log/php/phpvirtualbox/:/var/run/php-fpm/
202     -php_admin_value[eaccelerator.enable] = 1
203     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
204     --- 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
205     +++ 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
206     @@ -0,0 +1,65 @@
207     +{
208     +
209     + my $phpversion = ($phpvirtulabox{Version} || '74');
210     + if ($PHP_VERSION eq $phpversion) {
211     + if (($phpvirtualbox{'status'} || 'disabled') eq 'enabled') {
212     + my $max_upload_size = ($phpvirtualbox{MaxUploadSize} || '4096');
213     + $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/);
214     + my $memory_limit = ($phpvirtualbox{MemoryLimit} || '500M');
215     + $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/);
216     + my $open_basedir= $phpvirtualbox{PHPBaseDir} || '';
217     + my $id = 'phpvirtualbox';
218     + $open_basedir = "/opt/phpvirtualbox/:/var/log/php/$id/:/var/lib/php/$id/:$open_basedir";
219     + my $max_children = $phpvirtualbox{'PHPmaxChildren'} || 20;
220     + my $min_spare_servers = $phpvirtualbox{'PHPminServers'} || 4;
221     + my $start_servers = $phpvirtualbox{'PHPstartServers'} || 6;
222     + my $max_spare_servers = $phpvirtualbox{'PHPmaxServers'} || 8;
223     + my $max_requests = $phpvirtualbox{'PHPmaxRequests'} || 1000;
224     + $min_spare_servers = ( $min_spare_servers > $max_spare_servers ) ? printf("%.0f",$max_spare_servers/2) : $min_spare_servers;
225     + $start_servers = ( $start_servers > $max_spare_servers ) ? printf("%.0f", $max_spare_servers /2 + $min_spare_servers/2 ) : $start_servers;
226     +
227     + $OUT .=<<_EOF;
228     +
229     +[php$PHP_VERSION-$id]
230     +user = www
231     +group = www
232     +listen.owner = root
233     +listen.group = www
234     +listen.mode = 0660
235     +listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
236     +pm = dynamic
237     +pm.max_children = $max_children
238     +pm.start_servers = $start_servers
239     +pm.min_spare_servers = $min_spare_servers
240     +pm.max_spare_servers = $max_spare_servers
241     +pm.max_requests = $max_requests
242     +php_admin_value[session.save_path] = /var/lib/php/$id/session
243     +php_admin_value[session.gc_maxlifetime] = 86400
244     +php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
245     +php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
246     +php_admin_value[error_log] = /var/log/php/$id/error.log
247     +slowlog = /var/log/php/$id/slow.log
248     +php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
249     +php_admin_flag[display_errors] = off
250     +php_admin_flag[log_errors] = on
251     +php_admin_value[memory_limit] = $memory_limit
252     +php_admin_value[max_execution_time] = 3600
253     +php_admin_value[post_max_size] = $max_upload_size
254     +php_admin_value[upload_max_filesize] = $max_upload_size
255     +php_admin_value[disable_functions] = system, show_source, symlink, dl, passthru, phpinfo, escapeshellarg, escapeshellcmd
256     +php_admin_value[open_basedir] = $open_basedir
257     +php_admin_flag[allow_url_fopen] = on
258     +php_admin_flag[file_uploads] = on
259     +php_admin_flag[session.cookie_httponly] = on
260     +php_admin_flag[allow_url_include] = off
261     +php_admin_value[session.save_handler] = files
262     +php_admin_flag[output_buffering] = off
263     +php_admin_flag[eaccelerator.enable] = on
264     +
265     +_EOF
266     +
267     + } else {
268     + $OUT .= '; phpvirtualbox is disabled';
269     + }
270     + }
271     +}
272     \ No newline at end of file
273     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
274     --- smeserver-phpvirtualbox-5.2.1.old/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox 1970-01-01 10:00:00.000000000 +1000
275     +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/etc/smb.conf/60phpvirtualbox 2023-03-07 13:11:47.000000000 +1100
276     @@ -0,0 +1,33 @@
277     +{
278     + my $validusers = '';
279     + if ($phpvirtualbox{'adminUser'} || $phpvirtualbox{'userGroups'}) {
280     + if ($phpvirtualbox{'adminUser'}) {
281     + $validusers = "$phpvirtualbox{'adminUser'}";
282     + if ($phpvirtualbox{'userGroups'}) {
283     + $validusers .= ",+$phpvirtualbox{'userGroups'}";
284     + }
285     + } else {
286     + if ($phpvirtualbox{'userGroups'}) {
287     + $validusers = "+$phpvirtualbox{'userGroups'}";
288     + }
289     + }
290     + }
291     +
292     + $OUT .=<<_VBOX;
293     +
294     +[virtualbox]
295     +comment = virtualbox ISO directory
296     +path = /opt/vbox/ISOs
297     +read only = no
298     +writable = yes
299     +printable = no
300     +inherit permissions = yes
301     +create mode = 0640
302     +
303     +_VBOX
304     +
305     + if ($validusers) {
306     + $OUT .= "valid users = $validusers\n";
307     + }
308     +
309     +}
310     \ No newline at end of file
311     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
312     --- 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
313     +++ smeserver-phpvirtualbox-5.2.1/root/etc/e-smith/templates/opt/phpvirtualbox/config.php/config.php 2023-03-07 12:07:39.000000000 +1100
314     @@ -1,38 +1,90 @@
315     {
316     +# domain stuff
317     + my $baseDN = esmith::util::ldapBase($DomainName);
318     + my $workgroup = $smb{'Workgroup'};
319     +# vboxweb parameters
320     + my $username = (${'vboxweb-service'}{'user'} || 'vbox');
321     + my $password = ${'vboxweb-service'}{'password'};
322     + my $location = ("http://${'vboxweb-service'}{'access'}:${'vboxweb-service'}{'TCPPort'}/" || "http://127.0.0.1:18083/");
323     +# phpvirtualbox parameters for users
324     + my $adminUser = ($phpvirtualbox{'adminUser'} || 'admin');
325     + my $adminGroup = ($phpvirtualbox{'adminGroup'} || 'admin');
326     + my $userGroups = $phpvirtualbox{'userGroups'};
327     +# phpvirtualbox config parameters
328     + my $language = ($phpvirtualbox{'language'} || 'en');
329     + my $vrdeports = ($phpvirtualbox{'vrdeports'} || '19000-19100');
330     + my $maxProgressList = ($phpvirtualbox{'maxProgressList'} || 5);
331     + my $deleteOnRemove = ($phpvirtualbox{'deleteOnRemove'} || true);
332     + my $browserRestrictFiles = ($phpvirtualbox{'browserRestrictFiles'} || "'.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd'");
333     + my $browserRestrictFolders = ($phpvirtualbox{'browserRestrictFolders'} || "'/opt/vbox/ISOs','/opt/vbox/VMs'");
334     + my $hostMemInfoRefreshInterval = ($phpvirtualbox{'hostMemInfoRefreshInterval'} || 5);
335     + my $consoleResolutions = ($phpvirtualbox{'consoleResolutions'} || "'640x480','800x600','1024x768','1280x720','1440x900'");
336     + my $consoleKeyboardLayout = ($phpvirtualbox{'consoleKeyboardLayout'} || 'EN');
337     + my $nicMax = ($phpvirtualbox{'nicMax'} || 4);
338     +# working
339     + my @phpvboxusers = split(",", ($phpvirtualbox{'Users'} || "") );
340     + my @phpvboxgroups = split(",", ($phpvirtualbox{'userGroups'} || "") );
341    
342     $OUT .=<<_PARMS;
343     -
344     +
345     class phpVBoxConfig {
346     -var \$username = 'vbox';
347     -var \$location = 'http://127.0.0.1:18083/';
348     -var \$language = 'en';
349     -var \$vrdeports = '9000-9100';
350     -var \$maxProgressList = 5;
351     -var \$deleteOnRemove = true;
352     -var \$browserRestrictFiles = array('.iso','.vdi','.vmdk','.img','.bin','.vhd','.hdd','.ovf','.ova','.xml','.vbox','.cdr','.dmg','.ima','.dsk','.vfd');
353     -var \$hostMemInfoRefreshInterval = 5;
354     -var \$consoleResolutions = array('640x480','800x600','1024x768','1280x720','1440x900');
355     -var \$consoleKeyboardLayout = 'EN';
356     -var \$nicMax = 4;
357     +# default paramaters
358     +var \$username = '$username';
359     +var \$password = '$password';
360     +var \$location = '$location';
361     +var \$language = '$language';
362     +var \$vrdeports = '$vrdeports';
363     +var \$maxProgressList = $maxProgressList;
364     +var \$deleteOnRemove = $deleteOnRemove;
365     +var \$browserRestrictFiles = array($browserRestrictFiles);
366     +var \$browserRestrictFolders = array($browserRestrictFolders);
367     +var \$hostMemInfoRefreshInterval = $hostMemInfoRefreshInterval;
368     +var \$consoleResolutions = array($consoleResolutions);
369     +var \$consoleKeyboardLayout = '$consoleKeyboardLayout';
370     +var \$nicMax = $nicMax;
371     +
372     +# authentication parameters
373     _PARMS
374    
375     - my $authtype = $phpvirtualbox{'authtype'} || 'disabled';
376     - if ($authtype eq 'webauth') {
377     - $OUT .= "var \$authLib = 'WebAuth';\n";
378     - $OUT .= "var \$authConfig = array('adminUser' => 'admin');\n";
379     - } elsif ($authtype eq 'Builtin') {
380     +# authentication stuff
381     + my $authtype = ($phpvirtualbox{'authType'} || 'WebAuth');
382     + if ($authtype eq 'Builtin') {
383     $OUT .= "var \$authLib = 'Builtin';\n";
384     + } elsif ($authtype eq 'WebAuth') {
385     + $OUT .= "var \$authLib = 'WebAuth';\n";
386     + $OUT .= "var \$authConfig = array('adminUser' => '$adminUser');\n";
387     } elsif ($authtype eq 'LDAP') {
388     $OUT .= "var \$authLib = 'LDAP';\n";
389     $OUT .= "var \$authConfig = array(\n";
390     - $OUT .= " 'host' => '127.0.0.1',\n";
391     - $OUT .= " 'bind_dn' => 'uid=%s, ou=Users, dc=mycompany, dc=local',\n";
392     - $OUT .= " 'adminUser' => 'admin');\n";
393     + $OUT .= " 'host' => '127.0.0.1',\n";
394     + $OUT .= " 'bind_dn' => 'uid=%s, ou=Users, $baseDN',\n";
395     + $OUT .= " 'adminUser' => $adminUser);\n";
396     + } elsif ($authtype eq 'AD' && $workgroup ) {
397     + $OUT .= "var \$authLib = 'ActiveDirectory';\n";
398     + $OUT .= "var \$authConfig = array(\n";
399     + $OUT .= " 'host' => '127.0.0.1',\n";
400     + $OUT .= " 'domain' => '$workgroup',\n";
401     + $OUT .= " 'admin_group' => '$adminGroup'";
402     + if ($userGroups) {
403     + foreach my $group (@phpvboxgroups) {
404     + $OUT .= ",\n";
405     + $OUT .= " 'user_group' => '$group'";
406     + }
407     + };
408     + $OUT .= ");\n";
409     } else {
410     $OUT .= "var \$noAuth=true;\n";
411     }
412     -
413     +
414     +# allow inclusion of any generic parameter stored in config db for phpvirtualbox
415     + $OUT .= "# additional parameters defined in configuration DB\n";
416     + my @stdparms = qw(type status Name Users userGroups adminUser adminGroup authtype language vrdeports maxProgressList deleteOnRemove browserRestrictFiles browserRestrictFolders consolresolutions hostMemInfoRefreshInterval consoleKeyboardLayout nicMax);
417     + while (my ($param, $value) = each (%phpvirtualbox)) {
418     + next if ( $param ~~ @stdparms );
419     + $OUT .= "var \$$param = $value;\n";
420     + }
421     +
422     $OUT .= "}\n";
423     -
424     +
425     }
426 trevorb 1.5

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed