-
Notifications
You must be signed in to change notification settings - Fork 4
/
idmsync.iss.template
executable file
·672 lines (629 loc) · 25.7 KB
/
idmsync.iss.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
;
; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
;
; Copyright (c) 2013-2014 ForgeRock AS. All rights reserved.
;
; The contents of this file are subject to the terms
; of the Common Development and Distribution License
; (the License). You may not use this file except in
; compliance with the License.
;
; You can obtain a copy of the License at
; http://forgerock.org/license/CDDLv1.0.html
; See the License for the specific language governing
; permission and limitations under the License.
;
; When distributing Covered Code, include this CDDL
; Header Notice in each file and include the License file
; at http://forgerock.org/license/CDDLv1.0.html
; If applicable, add the following below the CDDL Header,
; with the fields enclosed by brackets [] replaced by
; your own identifying information:
; "Portions Copyrighted [2012] [ForgeRock AS]"
; "Portions Copyrighted [2024] [Wren Security]"
;
#define IDMAppName "WrenIDM Password Sync"
#define IDMAppVersion "1.1.0"
#define IDMAppPublisher "Wren Security"
#define IDMAppURL "https://wrensecurity.org"
[Setup]
AppId={{7D1925B1-E009-4417-ABB4-CD427ABA49F7}
AppName={#IDMAppName}
AppVersion={#IDMAppVersion}
AppVerName={#IDMAppName}
AppPublisher={#IDMAppPublisher}
AppPublisherURL={#IDMAppURL}
AppSupportURL={#IDMAppURL}
AppUpdatesURL={#IDMAppURL}
DefaultDirName={commonpf}\{#IDMAppName}
DefaultGroupName={#IDMAppName}
DisableProgramGroupPage=yes
LicenseFile=.\legal-notices\license.txt
OutputDir=.\out\
OutputBaseFilename=idmsync-setup
Compression=lzma
SolidCompression=yes
PrivilegesRequired=admin
ArchitecturesInstallIn64BitMode=x64
AlwaysRestart=yes
UninstallRestartComputer=yes
Uninstallable=yes
MinVersion=6.2.9200
WizardSmallImageFile=wizard/wren.bmp
[Messages]
WinVersionTooLowError=This program requires Windows Server 2012 or later.
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: ".\out\64\idmsync.dll"; DestDir: "{sys}"; DestName: "idmsync.dll"; Flags: replacesameversion restartreplace uninsrestartdelete; Check: Is64BitInstallMode
Source: ".\out\64\idmsync.exe"; DestDir: "{app}"; DestName: "idmsync.exe"; Flags: replacesameversion restartreplace uninsrestartdelete; Check: Is64BitInstallMode
Source: ".\out\32\idmsync.dll"; DestDir: "{sys}"; DestName: "idmsync.dll"; Flags: replacesameversion restartreplace uninsrestartdelete; Check: not Is64BitInstallMode
Source: ".\out\32\idmsync.exe"; DestDir: "{app}"; DestName: "idmsync.exe"; Flags: replacesameversion restartreplace uninsrestartdelete; Check: not Is64BitInstallMode
Source: ".\legal-notices\*"; DestDir: "{app}\legal-notices"; Flags: replacesameversion restartreplace uninsrestartdelete;
[Run]
Filename: "{app}\idmsync.exe"; Parameters: "--install"; StatusMsg: "Installing Wren:IDM Service..."
[UninstallRun]
Filename: "{app}\idmsync.exe"; Parameters: "--remove"; StatusMsg: "Removing Wren:IDM Service..."
[Registry]
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "idmURL"; ValueData: "{code:GetOption|idmURL}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "passwordAttr"; ValueData: "{code:GetOption|passwordAttr}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "authType"; ValueData: "{code:GetOption|authType}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "authToken0"; ValueData: "{code:GetOption|authToken0}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "authToken1"; ValueData: "{code:GetOption|authToken1}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "dataPath"; ValueData: "{code:GetXmlDir}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "pollEach"; ValueData: "{code:GetOption|pollEach}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "logPath"; ValueData: "{code:GetLogDir}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "logLevel"; ValueData: "{code:GetOption|logLevel}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "certFile"; ValueData: "{code:GetOption|certFile}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "certPassword"; ValueData: "{code:GetOption|certPassword}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "keyAlias"; ValueData: "{code:GetOption|keyAlias}"
Root: HKLM; Subkey: "SOFTWARE\WrenSecurity\WrenIDM\PasswordSync"; ValueType: string; ValueName: "keyType"; ValueData: "{code:GetOption|keyType}"
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Lsa"; ValueType: multisz; ValueName: "Notification Packages"; ValueData: "{olddata}{break}idmsync"; Check: NeedsAddDll('idmsync')
[Dirs]
Name: {code:GetXmlDir}; Flags: uninsneveruninstall
Name: {code:GetLogDir}; Flags: uninsneveruninstall
[Code]
var
InputPageA: TInputQueryWizardPage;
LogType: TComboBox;
LogTypeLabel: TNewStaticText;
AuthType: TComboBox;
AuthTypeLabel: TNewStaticText;
InputPageB: TInputQueryWizardPage;
DataDirPage: TInputDirWizardPage;
LogDirPage: TInputDirWizardPage;
CertFilePage: TInputFileWizardPage;
CertPassLabelE: TNewStaticText;
CertPassE: TPasswordEdit;
CertAliasLabelE: TNewStaticText;
CertAlias: TEdit;
PollLabel: TNewStaticText;
Poll: TEdit;
CertFilePageA: TInputFileWizardPage;
CertPassLabelA: TNewStaticText;
CertPassA: TPasswordEdit;
KeyTypeLabel: TNewStaticText;
KeyType: TComboBox;
value: String;
value0: String;
value1: String;
LoadInfFilename, SaveInfFilename: String;
function GetRegValue(Param: String): String;
var
value: String;
begin
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', Param, Value);
Result := Value;
end
else
begin
Result := '';
end;
end;
procedure UpdateInfFilenames();
begin
LoadInfFilename := ExpandFileName(ExpandConstant('{param:loadinf}'));
SaveInfFilename := ExpandFileName(ExpandConstant('{param:saveinf}'));
end;
function ShouldLoadInf(): Boolean;
begin
Result := (LoadInfFilename <> '');
end;
function ShouldSaveInf(): Boolean;
begin
Result := (SaveInfFilename <> '');
end;
function LoadInfString(Section, Key, Default: String): String;
begin
Result := GetIniString(Section, Key, Default, LoadInfFilename);
end;
procedure SaveInfString(Section, Key, Value: String);
begin
SetIniString(Section, Key, Value, SaveInfFilename);
end;
function InitializeSetup(): Boolean;
begin
UpdateInfFilenames();
Result := True;
end;
procedure DeinitializeSetup();
begin
if ShouldSaveInf() then begin
SaveInfString('Options', 'idmURL', GetRegValue('idmURL'));
SaveInfString('Options', 'passwordAttr', GetRegValue('passwordAttr'));
SaveInfString('Options', 'authType', GetRegValue('authType'));
SaveInfString('Options', 'authToken0', GetRegValue('authToken0'));
SaveInfString('Options', 'authToken1', GetRegValue('authToken1'));
SaveInfString('Options', 'dataPath', GetRegValue('dataPath'));
SaveInfString('Options', 'pollEach', GetRegValue('pollEach'));
SaveInfString('Options', 'logPath', GetRegValue('logPath'));
SaveInfString('Options', 'logLevel', GetRegValue('logLevel'));
SaveInfString('Options', 'certFile', GetRegValue('certFile'));
SaveInfString('Options', 'certPassword', GetRegValue('certPassword'));
SaveInfString('Options', 'keyAlias', GetRegValue('keyAlias'));
SaveInfString('Options', 'keyType', GetRegValue('keyType'));
end;
end;
procedure InitializeWizard;
begin
InputPageA := CreateInputQueryPage(wpLicense,
'Wren:IDM Information', 'Connection',
'Please specify Wren:IDM server deployment URL and request template information, then click Next.');
InputPageA.Add('Wren:IDM URL:', False);
InputPageA.Add('Wren:IDM User Password attribute:', False);
InputPageB := CreateInputQueryPage(InputPageA.ID,
'Wren:IDM Information', 'Authentication',
'Please specify Wren:IDM authentication parameters, then click Next.');
InputPageB.Add('Username:', False);
InputPageB.Add('Password:', True);
AuthTypeLabel := TNewStaticText.Create(InputPageB);
AuthTypeLabel.Top := 130;
AuthTypeLabel.Caption := 'Select authentication type:';
AuthTypeLabel.AutoSize := True;
AuthTypeLabel.Parent := InputPageB.Surface;
AuthType := TComboBox.Create(InputPageB);
AuthType.Top := 145;
AuthType.Width := InputPageB.SurfaceWidth;
AuthType.Parent := InputPageB.Surface;
AuthType.Style := csDropDownList;
AuthType.Items.Add('None');
AuthType.Items.Add('HTTP Basic');
AuthType.Items.Add('Wren:IDM Header');
AuthType.Items.Add('Certificate');
AuthType.ItemIndex := 0;
CertFilePageA := CreateInputFilePage(InputPageB.ID,
'Wren:IDM Information', 'Certificate authentication',
'Select Certificate file (PKCS12 format) which will be used for authentication, then click Next.');
CertFilePageA.Add('','Certificate files|*.pfx|All files|*.*','.pfx');
CertPassLabelA := TNewStaticText.Create(CertFilePageA);
CertPassLabelA.Top := 70;
CertPassLabelA.Caption := 'Password to open certificate file:';
CertPassLabelA.AutoSize := True;
CertPassLabelA.Parent := CertFilePageA.Surface;
CertPassA := TPasswordEdit.Create(CertFilePageA);
CertPassA.Top := 85;
CertPassA.Width := CertFilePageA.SurfaceWidth;
CertPassA.Parent := CertFilePageA.Surface;
CertFilePage := CreateInputFilePage(CertFilePageA.ID,
'Password Encryption', 'Data encryption',
'Select Certificate file (PKCS12 format) which will be used for data encryption, then click Next.');
CertFilePage.Add('','Certificate files|*.pfx|All files|*.*','.pfx');
CertAliasLabelE := TNewStaticText.Create(CertFilePage);
CertAliasLabelE.Top := 70;
CertAliasLabelE.Caption := 'Private Key alias (for decryption):';
CertAliasLabelE.AutoSize := True;
CertAliasLabelE.Parent := CertFilePage.Surface;
CertAlias := TEdit.Create(CertFilePage);
CertAlias.Top := 85;
CertAlias.Width := CertFilePage.SurfaceWidth;
CertAlias.Parent := CertFilePage.Surface;
CertPassLabelE := TNewStaticText.Create(CertFilePage);
CertPassLabelE.Top := 115;
CertPassLabelE.Caption := 'Password to open certificate file:';
CertPassLabelE.AutoSize := True;
CertPassLabelE.Parent := CertFilePage.Surface;
CertPassE := TPasswordEdit.Create(CertFilePage);
CertPassE.Top := 130;
CertPassE.Width := CertFilePage.SurfaceWidth;
CertPassE.Parent := CertFilePage.Surface;
KeyTypeLabel := TNewStaticText.Create(CertFilePage);
KeyTypeLabel.Top := 160;
KeyTypeLabel.Caption := 'Select encryption key type/size:';
KeyTypeLabel.AutoSize := True;
KeyTypeLabel.Parent := CertFilePage.Surface;
KeyType := TComboBox.Create(CertFilePage);
KeyType.Top := 175;
KeyType.Width := CertFilePage.SurfaceWidth;
KeyType.Parent := CertFilePage.Surface;
KeyType.Style := csDropDownList;
KeyType.Items.Add('aes128');
KeyType.Items.Add('aes192');
KeyType.Items.Add('aes256');
KeyType.ItemIndex := 0;
DataDirPage := CreateInputDirPage(CertFilePage.ID,
'Data Storage', 'Where should Service output data files be stored?',
'Select the folder in which Service will store its output data files, then click Next.',
False, 'New Folder');
PollLabel := TNewStaticText.Create(DataDirPage);
PollLabel.Top := 70;
PollLabel.Caption := 'Directory poll interval (in seconds). Empty or zero value will disable polling module:';
PollLabel.AutoSize := True;
PollLabel.Parent := DataDirPage.Surface;
Poll := TEdit.Create(DataDirPage);
Poll.Top := 85;
Poll.Width := DataDirPage.SurfaceWidth;
Poll.Parent := DataDirPage.Surface;
DataDirPage.Add('');
LogDirPage := CreateInputDirPage(DataDirPage.ID,
'Log Storage', 'Where should Service log files be stored?',
'Select the folder in which Service will store its log files, then click Next.',
False, 'New Folder');
LogTypeLabel := TNewStaticText.Create(LogDirPage);
LogTypeLabel.Top := 70;
LogTypeLabel.Caption := 'Select logging level:';
LogTypeLabel.AutoSize := True;
LogTypeLabel.Parent := LogDirPage.Surface;
LogType := TComboBox.Create(LogDirPage);
LogType.Top := 85;
LogType.Width := LogDirPage.SurfaceWidth;
LogType.Parent := LogDirPage.Surface;
LogType.Style := csDropDownList;
LogType.Items.Add('error');
LogType.Items.Add('info');
LogType.Items.Add('warning');
LogType.Items.Add('fatal');
LogType.Items.Add('debug');
LogType.ItemIndex := 0;
LogDirPage.Add('');
value := '';
if ShouldLoadInf() then begin
InputPageA.Values[0] := LoadInfString('Options', 'idmURL', 'https://localhost:8444/openidm/managed/user?_action=patch&_queryId=for-userName&uid=${samaccountname}');
end else begin
if not RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'idmURL', value) or (value = '') then begin
InputPageA.Values[0] := 'https://localhost:8444/openidm/managed/user?_action=patch&_queryId=for-userName&uid=${samaccountname}';
end else InputPageA.Values[0] := value;
end;
value := '';
if ShouldLoadInf() then begin
InputPageA.Values[1] := LoadInfString('Options', 'passwordAttr', 'adPassword');
end else begin
if not RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'passwordAttr', value) or (value = '') then begin
InputPageA.Values[1] := 'adPassword';
end else InputPageA.Values[1] := value;
end;
value := '';
if ShouldLoadInf() then begin
InputPageB.Values[0] := LoadInfString('Options', 'authToken0', '');
InputPageB.Values[1] := LoadInfString('Options', 'authToken1', '');
value := LoadInfString('Options', 'authType', '');
if (value = 'basic') then begin
AuthType.ItemIndex := 1;
end else if (value = 'idm') then begin
AuthType.ItemIndex := 2;
end else if (value = 'cert') then begin
InputPageB.Values[0] := '';
InputPageB.Values[1] := '';
AuthType.ItemIndex := 3;
CertFilePageA.Values[0] := LoadInfString('Options', 'authToken0', '');
CertPassA.Text := LoadInfString('Options', 'authToken1', '');
end else begin
InputPageB.Values[0] := '';
InputPageB.Values[1] := '';
AuthType.ItemIndex := 0;
CertFilePageA.Values[0] := '';
CertPassA.Text := '';
end;
value := '';
end else begin
RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'authType', value);
if (value = 'basic') then begin
RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'authToken0', value0);
RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'authToken1', value1);
InputPageB.Values[0] := value0;
InputPageB.Values[1] := value1;
AuthType.ItemIndex := 1;
end else if (value = 'idm') then begin
RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'authToken0', value0);
RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'authToken1', value1);
InputPageB.Values[0] := value0;
InputPageB.Values[1] := value1;
AuthType.ItemIndex := 2;
end else if (value = 'cert') then begin
RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'authToken0', value0);
RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'authToken1', value1);
InputPageB.Values[0] := '';
InputPageB.Values[1] := '';
AuthType.ItemIndex := 3;
CertFilePageA.Values[0] := value0;
CertPassA.Text := value1;
end else begin
InputPageB.Values[0] := '';
InputPageB.Values[1] := '';
AuthType.ItemIndex := 0;
CertFilePageA.Values[0] := '';
CertPassA.Text := '';
end
end;
value0 := '';
value1 := '';
value := '';
if ShouldLoadInf() then begin
CertFilePage.Values[0] := LoadInfString('Options', 'certFile', '');
end else begin
if not RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'certFile', value) or (value = '') then begin
CertFilePage.Values[0] := '';
end else CertFilePage.Values[0] := value;
end;
value := '';
if ShouldLoadInf() then begin
CertPassE.Text := LoadInfString('Options', 'certPassword', '');
end else begin
if not RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'certPassword', value) or (value = '') then begin
CertPassE.Text := '';
end else CertPassE.Text := value;
end;
value := '';
if ShouldLoadInf() then begin
CertAlias.Text := LoadInfString('Options', 'keyAlias', '');
end else begin
if not RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'keyAlias', value) or (value = '') then begin
CertAlias.Text := 'openidm-cert';
end else CertAlias.Text := value;
end;
value := '';
if ShouldLoadInf() then begin
DataDirPage.Values[0] := LoadInfString('Options', 'dataPath', '');
end else begin
if not RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'dataPath', value) or (value = '') then begin
DataDirPage.Values[0] := '';
end else DataDirPage.Values[0] := value;
end;
value := '';
if ShouldLoadInf() then begin
Poll.Text := LoadInfString('Options', 'pollEach', '');
end else begin
if not RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'pollEach', value) or (value = '') then begin
Poll.Text := '';
end else Poll.Text := value;
end;
value := '';
if ShouldLoadInf() then begin
LogDirPage.Values[0] := LoadInfString('Options', 'logPath', '');
end else begin
if not RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'logPath', value) then begin
LogDirPage.Values[0] := '';
end else LogDirPage.Values[0] := value;
end;
value := '';
if ShouldLoadInf() then begin
value := LoadInfString('Options', 'logLevel', 'error');
end else begin
RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'logLevel', value);
end;
if (value = 'error') then begin
LogType.ItemIndex := 0;
end else if (value = 'info') then begin
LogType.ItemIndex := 1;
end else if (value = 'warning') then begin
LogType.ItemIndex := 2;
end else if (value = 'fatal') then begin
LogType.ItemIndex := 3;
end else if (value = 'debug') then begin
LogType.ItemIndex := 4;
end else begin
LogType.ItemIndex := 0;
end;
value := '';
if ShouldLoadInf() then begin
value := LoadInfString('Options', 'keyType', 'aes128');
end else begin
RegQueryStringValue(HKLM, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', 'keyType', value);
end;
if (value = 'aes128') then begin
KeyType.ItemIndex := 0;
end else if (value = 'aes192') then begin
KeyType.ItemIndex := 1;
end else if (value = 'aes256') then begin
KeyType.ItemIndex := 2;
end else begin
KeyType.ItemIndex := 0;
end;
value := '';
end;
function GetOption(Param: String): String;
begin
if Param = 'idmURL' then
Result := InputPageA.Values[0]
else if Param = 'passwordAttr' then
Result := InputPageA.Values[1]
else if Param = 'authType' then
if (AuthType.ItemIndex = 1) then begin
Result := 'basic'
end else if (AuthType.ItemIndex = 2) then begin
Result := 'idm'
end else if (AuthType.ItemIndex = 3) then begin
Result := 'cert'
end else begin
Result := 'none'
end
else if Param = 'authToken0' then
if (AuthType.ItemIndex = 1) or (AuthType.ItemIndex = 2) then begin
Result := InputPageB.Values[0]
end else if (AuthType.ItemIndex = 3) then begin
Result := CertFilePageA.Values[0]
end else begin
Result := ''
end
else if Param = 'authToken1' then
if (AuthType.ItemIndex = 1) or (AuthType.ItemIndex = 2) then begin
Result := InputPageB.Values[1]
end else if (AuthType.ItemIndex = 3) then begin
Result := CertPassA.Text
end else begin
Result := ''
end
else if Param = 'pollEach' then
Result := Poll.Text
else if Param = 'logLevel' then
if (LogType.ItemIndex = 1) then begin
Result := 'error';
end else if (LogType.ItemIndex = 2) then begin
Result := 'warning'
end else if (LogType.ItemIndex = 3) then begin
Result := 'fatal'
end else if (LogType.ItemIndex = 4) then begin
Result := 'debug'
end else begin
Result := 'error'
end
else if Param = 'certFile' then
Result := CertFilePage.Values[0]
else if Param = 'certPassword' then
Result := CertPassE.Text
else if Param = 'keyAlias' then
Result := CertAlias.Text
else if Param = 'keyType' then
if (KeyType.ItemIndex = 0) then begin
Result := 'aes128'
end else if (KeyType.ItemIndex = 1) then begin
Result := 'aes192'
end else if (KeyType.ItemIndex = 2) then begin
Result := 'aes256'
end else begin
Result := 'aes128'
end
end;
function GetXmlDir(Param: String): String;
begin
Result := DataDirPage.Values[0];
end;
function GetLogDir(Param: String): String;
begin
Result := LogDirPage.Values[0];
end;
function NeedsAddDll(Param: string): boolean;
var
OrigVal: string;
begin
if not RegQueryMultiStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Lsa', 'Notification Packages', OrigVal)
then begin
Result := True;
exit;
end;
Result := Pos(Param, OrigVal) = 0;
end;
function fixDllEntry(): Boolean;
var
OrigVal: string;
begin
if RegQueryMultiStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Lsa', 'Notification Packages', OrigVal)
then begin
if StringChangeEx(OrigVal, 'idmsync'+#0, '', True) > 0 then begin
if not RegWriteMultiStringValue(HKEY_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Lsa', 'Notification Packages', OrigVal) then begin
MsgBox('Error cleaning up "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\Notification Packages" registry entry. You must remove "idmsync" value manualy.', mbError, MB_OK);
end;
end else begin
MsgBox('Error locating "idmsync" in "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\Notification Packages" registry entry', mbError, MB_OK);
end;
end;
Result := True;
end;
function fixPath(KeyName: String): Boolean;
var
OrigVal: string;
begin
if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', KeyName, OrigVal)
then begin
if StringChangeEx(OrigVal, '\', '/', True) > 0 then begin
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\WrenSecurity\WrenIDM\PasswordSync', KeyName, OrigVal);
end;
end;
Result := True;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then begin
fixPath('certFile');
fixPath('logPath');
fixPath('dataPath');
if AuthType.ItemIndex = 3 then begin
fixPath('authToken0');
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then begin
if not NeedsAddDll('idmsync') then begin
fixDllEntry();
end;
end;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := (PageID = CertFilePageA.ID) and (AuthType.ItemIndex < 3);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = InputPageA.ID then begin
if InputPageA.Values[0] = '' then begin
MsgBox('You must enter valid Wren:IDM URL.', mbError, MB_OK);
Result := False;
end else begin
Result := True;
end;
if InputPageA.Values[1] = '' then begin
MsgBox('You must enter valid Wren:IDM User Password attribute value.', mbError, MB_OK);
Result := False;
end else begin
Result := True;
end;
end else if CurPageID = InputPageB.ID then begin
if (AuthType.ItemIndex = 1) or (AuthType.ItemIndex = 2) then begin
if InputPageB.Values[0] = '' then begin
MsgBox('You must enter username.', mbError, MB_OK);
Result := False;
end else begin
Result := True;
end;
end else begin
Result := True;
end;
end else if CurPageID = CertFilePageA.ID then begin
if CertFilePageA.Values[0] = '' then begin
MsgBox('You must enter Certificate file name.', mbError, MB_OK);
Result := False;
end else begin
Result := True;
end;
end else if CurPageID = CertFilePage.ID then begin
if CertFilePage.Values[0] = '' then begin
MsgBox('You must enter Certificate file name.', mbError, MB_OK);
Result := False;
end else if CertAlias.Text = '' then begin
MsgBox('You must enter Private Key alias value.', mbError, MB_OK);
Result := False;
end else begin
Result := True;
end;
end else if CurPageID = DataDirPage.ID then begin
if DataDirPage.Values[0] = '' then begin
MsgBox('You must enter Service Data storage directory name.', mbError, MB_OK);
Result := False;
end else begin
Result := True;
end;
end else if CurPageID = LogDirPage.ID then begin
if LogDirPage.Values[0] = '' then begin
MsgBox('You must enter Service Log storage directory name.', mbError, MB_OK);
Result := False;
end else begin
Result := True;
end;
end else
Result := True;
end;