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

Contents 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.6 - (show annotations) (download)
Fri Mar 10 02:27:28 2023 UTC (20 months, 3 weeks ago) by trevorb
Branch: MAIN
CVS Tags: smeserver-phpvirtualbox-5_2_1-4_el7_sme, smeserver-phpvirtualbox-5_2_1-5_el7_sme, HEAD
Changes since 1.5: +7 -1 lines
Error occurred while calculating annotation data.
remove defaults for User Group

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

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