Cleanup Windows wizard and prepare for enhanced CSR signing

refs #5681
This commit is contained in:
Michael Friedrich 2017-10-16 18:01:43 +02:00
parent d6caf4aa46
commit 2a7cdf2fdc
2 changed files with 154 additions and 218 deletions

View File

@ -54,14 +54,13 @@
this.lblListenerPort = new System.Windows.Forms.Label();
this.rdoListener = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnEditEndpoint = new System.Windows.Forms.Button();
this.btnRemoveEndpoint = new System.Windows.Forms.Button();
this.btnAddEndpoint = new System.Windows.Forms.Button();
this.lvwEndpoints = new System.Windows.Forms.ListView();
this.colInstanceName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colHost = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colPort = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.rdoNoMaster = new System.Windows.Forms.RadioButton();
this.rdoNewMaster = new System.Windows.Forms.RadioButton();
this.tbcPages = new System.Windows.Forms.TabControl();
this.tabRetrieveCertificate = new System.Windows.Forms.TabPage();
this.lblRetrieveCertificate = new System.Windows.Forms.Label();
@ -81,7 +80,6 @@
this.txtError = new System.Windows.Forms.TextBox();
this.lblError = new System.Windows.Forms.Label();
this.picBanner = new System.Windows.Forms.PictureBox();
this.btnEditEndpoint = new System.Windows.Forms.Button();
this.tabFinish.SuspendLayout();
this.tabConfigure.SuspendLayout();
this.tabParameters.SuspendLayout();
@ -200,9 +198,9 @@
this.groupBox3.Controls.Add(this.chkInstallNSCP);
this.groupBox3.Controls.Add(this.chkAcceptConfig);
this.groupBox3.Controls.Add(this.chkAcceptCommands);
this.groupBox3.Location = new System.Drawing.Point(308, 359);
this.groupBox3.Location = new System.Drawing.Point(308, 291);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(301, 135);
this.groupBox3.Size = new System.Drawing.Size(301, 188);
this.groupBox3.TabIndex = 5;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Advanced Options";
@ -210,7 +208,7 @@
// txtUser
//
this.txtUser.Enabled = false;
this.txtUser.Location = new System.Drawing.Point(28, 111);
this.txtUser.Location = new System.Drawing.Point(28, 88);
this.txtUser.Name = "txtUser";
this.txtUser.Size = new System.Drawing.Size(267, 20);
this.txtUser.TabIndex = 8;
@ -219,22 +217,22 @@
// chkRunServiceAsThisUser
//
this.chkRunServiceAsThisUser.AutoSize = true;
this.chkRunServiceAsThisUser.Location = new System.Drawing.Point(9, 88);
this.chkRunServiceAsThisUser.Location = new System.Drawing.Point(9, 65);
this.chkRunServiceAsThisUser.Name = "chkRunServiceAsThisUser";
this.chkRunServiceAsThisUser.Size = new System.Drawing.Size(142, 17);
this.chkRunServiceAsThisUser.Size = new System.Drawing.Size(183, 17);
this.chkRunServiceAsThisUser.TabIndex = 7;
this.chkRunServiceAsThisUser.Text = "Run service as this user:";
this.chkRunServiceAsThisUser.Text = "Run Icinga 2 service as this user:";
this.chkRunServiceAsThisUser.UseVisualStyleBackColor = true;
this.chkRunServiceAsThisUser.CheckedChanged += new System.EventHandler(this.chkRunServiceAsThisUser_CheckedChanged);
//
// chkInstallNSCP
//
this.chkInstallNSCP.AutoSize = true;
this.chkInstallNSCP.Location = new System.Drawing.Point(9, 65);
this.chkInstallNSCP.Location = new System.Drawing.Point(9, 114);
this.chkInstallNSCP.Name = "chkInstallNSCP";
this.chkInstallNSCP.Size = new System.Drawing.Size(149, 17);
this.chkInstallNSCP.Size = new System.Drawing.Size(190, 17);
this.chkInstallNSCP.TabIndex = 6;
this.chkInstallNSCP.Text = "Install/Update NSClient++";
this.chkInstallNSCP.Text = "Install/Update bundled NSClient++";
this.chkInstallNSCP.UseVisualStyleBackColor = true;
//
// chkAcceptConfig
@ -242,9 +240,9 @@
this.chkAcceptConfig.AutoSize = true;
this.chkAcceptConfig.Location = new System.Drawing.Point(9, 42);
this.chkAcceptConfig.Name = "chkAcceptConfig";
this.chkAcceptConfig.Size = new System.Drawing.Size(190, 17);
this.chkAcceptConfig.Size = new System.Drawing.Size(230, 17);
this.chkAcceptConfig.TabIndex = 1;
this.chkAcceptConfig.Text = "Accept config updates from master";
this.chkAcceptConfig.Text = "Accept config updates from master/satellite";
this.chkAcceptConfig.UseVisualStyleBackColor = true;
//
// chkAcceptCommands
@ -252,16 +250,16 @@
this.chkAcceptCommands.AutoSize = true;
this.chkAcceptCommands.Location = new System.Drawing.Point(9, 19);
this.chkAcceptCommands.Name = "chkAcceptCommands";
this.chkAcceptCommands.Size = new System.Drawing.Size(171, 17);
this.chkAcceptCommands.Size = new System.Drawing.Size(211, 17);
this.chkAcceptCommands.TabIndex = 0;
this.chkAcceptCommands.Text = "Accept commands from master";
this.chkAcceptCommands.Text = "Accept commands from master/satellite";
this.chkAcceptCommands.UseVisualStyleBackColor = true;
//
// txtTicket
//
this.txtTicket.Location = new System.Drawing.Point(98, 45);
this.txtTicket.Location = new System.Drawing.Point(144, 45);
this.txtTicket.Name = "txtTicket";
this.txtTicket.Size = new System.Drawing.Size(340, 20);
this.txtTicket.Size = new System.Drawing.Size(459, 20);
this.txtTicket.TabIndex = 1;
//
// lblTicket
@ -269,15 +267,15 @@
this.lblTicket.AutoSize = true;
this.lblTicket.Location = new System.Drawing.Point(9, 48);
this.lblTicket.Name = "lblTicket";
this.lblTicket.Size = new System.Drawing.Size(71, 13);
this.lblTicket.Size = new System.Drawing.Size(117, 13);
this.lblTicket.TabIndex = 4;
this.lblTicket.Text = "Setup Ticket:";
this.lblTicket.Text = "Setup Ticket (optional):";
//
// txtInstanceName
//
this.txtInstanceName.Location = new System.Drawing.Point(98, 16);
this.txtInstanceName.Location = new System.Drawing.Point(144, 16);
this.txtInstanceName.Name = "txtInstanceName";
this.txtInstanceName.Size = new System.Drawing.Size(340, 20);
this.txtInstanceName.Size = new System.Drawing.Size(459, 20);
this.txtInstanceName.TabIndex = 0;
//
// lblInstanceName
@ -285,9 +283,9 @@
this.lblInstanceName.AutoSize = true;
this.lblInstanceName.Location = new System.Drawing.Point(9, 20);
this.lblInstanceName.Name = "lblInstanceName";
this.lblInstanceName.Size = new System.Drawing.Size(82, 13);
this.lblInstanceName.Size = new System.Drawing.Size(121, 13);
this.lblInstanceName.TabIndex = 3;
this.lblInstanceName.Text = "Instance Name:";
this.lblInstanceName.Text = "Instance Name (FQDN):";
//
// groupBox2
//
@ -295,9 +293,9 @@
this.groupBox2.Controls.Add(this.txtListenerPort);
this.groupBox2.Controls.Add(this.lblListenerPort);
this.groupBox2.Controls.Add(this.rdoListener);
this.groupBox2.Location = new System.Drawing.Point(8, 359);
this.groupBox2.Location = new System.Drawing.Point(12, 291);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(294, 135);
this.groupBox2.Size = new System.Drawing.Size(294, 188);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "TCP Listener";
@ -338,9 +336,9 @@
this.rdoListener.AutoSize = true;
this.rdoListener.Location = new System.Drawing.Point(11, 24);
this.rdoListener.Name = "rdoListener";
this.rdoListener.Size = new System.Drawing.Size(250, 17);
this.rdoListener.Size = new System.Drawing.Size(247, 17);
this.rdoListener.TabIndex = 7;
this.rdoListener.Text = "Listen for connections from the master instance:";
this.rdoListener.Text = "Listen for connections from the master/satellite:";
this.rdoListener.UseVisualStyleBackColor = true;
this.rdoListener.CheckedChanged += new System.EventHandler(this.RadioListener_CheckedChanged);
//
@ -350,19 +348,28 @@
this.groupBox1.Controls.Add(this.btnRemoveEndpoint);
this.groupBox1.Controls.Add(this.btnAddEndpoint);
this.groupBox1.Controls.Add(this.lvwEndpoints);
this.groupBox1.Controls.Add(this.rdoNoMaster);
this.groupBox1.Controls.Add(this.rdoNewMaster);
this.groupBox1.Location = new System.Drawing.Point(8, 77);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(601, 276);
this.groupBox1.Size = new System.Drawing.Size(601, 208);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Master Instance";
this.groupBox1.Text = "Master/Satellite Instance(s)";
//
// btnEditEndpoint
//
this.btnEditEndpoint.Enabled = false;
this.btnEditEndpoint.Location = new System.Drawing.Point(520, 48);
this.btnEditEndpoint.Name = "btnEditEndpoint";
this.btnEditEndpoint.Size = new System.Drawing.Size(75, 23);
this.btnEditEndpoint.TabIndex = 7;
this.btnEditEndpoint.Text = "Edit";
this.btnEditEndpoint.UseVisualStyleBackColor = true;
this.btnEditEndpoint.Click += new System.EventHandler(this.btnEditEndpoint_Click);
//
// btnRemoveEndpoint
//
this.btnRemoveEndpoint.Enabled = false;
this.btnRemoveEndpoint.Location = new System.Drawing.Point(520, 141);
this.btnRemoveEndpoint.Location = new System.Drawing.Point(520, 77);
this.btnRemoveEndpoint.Name = "btnRemoveEndpoint";
this.btnRemoveEndpoint.Size = new System.Drawing.Size(75, 23);
this.btnRemoveEndpoint.TabIndex = 6;
@ -372,7 +379,7 @@
//
// btnAddEndpoint
//
this.btnAddEndpoint.Location = new System.Drawing.Point(520, 83);
this.btnAddEndpoint.Location = new System.Drawing.Point(520, 19);
this.btnAddEndpoint.Name = "btnAddEndpoint";
this.btnAddEndpoint.Size = new System.Drawing.Size(75, 23);
this.btnAddEndpoint.TabIndex = 5;
@ -387,7 +394,7 @@
this.colHost,
this.colPort});
this.lvwEndpoints.FullRowSelect = true;
this.lvwEndpoints.Location = new System.Drawing.Point(11, 83);
this.lvwEndpoints.Location = new System.Drawing.Point(11, 19);
this.lvwEndpoints.Name = "lvwEndpoints";
this.lvwEndpoints.Size = new System.Drawing.Size(500, 176);
this.lvwEndpoints.TabIndex = 4;
@ -410,32 +417,6 @@
this.colPort.Text = "Port";
this.colPort.Width = 80;
//
// rdoNoMaster
//
this.rdoNoMaster.AutoSize = true;
this.rdoNoMaster.Checked = true;
this.rdoNoMaster.Location = new System.Drawing.Point(11, 50);
this.rdoNoMaster.Name = "rdoNoMaster";
this.rdoNoMaster.Size = new System.Drawing.Size(374, 17);
this.rdoNoMaster.TabIndex = 3;
this.rdoNoMaster.TabStop = true;
this.rdoNoMaster.Text = "This instance should report its check results to an existing Icinga 2 master:";
this.rdoNoMaster.UseVisualStyleBackColor = true;
this.rdoNoMaster.CheckedChanged += new System.EventHandler(this.RadioMaster_CheckedChanged);
//
// rdoNewMaster
//
this.rdoNewMaster.AutoSize = true;
this.rdoNewMaster.Enabled = false;
this.rdoNewMaster.Location = new System.Drawing.Point(11, 22);
this.rdoNewMaster.Name = "rdoNewMaster";
this.rdoNewMaster.Size = new System.Drawing.Size(167, 17);
this.rdoNewMaster.TabIndex = 2;
this.rdoNewMaster.TabStop = true;
this.rdoNewMaster.Text = "This is a new master instance.";
this.rdoNewMaster.UseVisualStyleBackColor = true;
this.rdoNewMaster.CheckedChanged += new System.EventHandler(this.RadioMaster_CheckedChanged);
//
// tbcPages
//
this.tbcPages.Appearance = System.Windows.Forms.TabAppearance.FlatButtons;
@ -628,17 +609,6 @@
this.picBanner.TabIndex = 1;
this.picBanner.TabStop = false;
//
// btnEditEndpoint
//
this.btnEditEndpoint.Enabled = false;
this.btnEditEndpoint.Location = new System.Drawing.Point(520, 112);
this.btnEditEndpoint.Name = "btnEditEndpoint";
this.btnEditEndpoint.Size = new System.Drawing.Size(75, 23);
this.btnEditEndpoint.TabIndex = 7;
this.btnEditEndpoint.Text = "Edit";
this.btnEditEndpoint.UseVisualStyleBackColor = true;
this.btnEditEndpoint.Click += new System.EventHandler(this.btnEditEndpoint_Click);
//
// SetupWizard
//
this.AcceptButton = this.btnNext;
@ -667,7 +637,6 @@
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.tbcPages.ResumeLayout(false);
this.tabRetrieveCertificate.ResumeLayout(false);
this.tabRetrieveCertificate.PerformLayout();
@ -707,8 +676,6 @@
private System.Windows.Forms.ListView lvwEndpoints;
private System.Windows.Forms.ColumnHeader colHost;
private System.Windows.Forms.ColumnHeader colPort;
private System.Windows.Forms.RadioButton rdoNoMaster;
private System.Windows.Forms.RadioButton rdoNewMaster;
private System.Windows.Forms.TabControl tbcPages;
private System.Windows.Forms.TabPage tabVerifyCertificate;
private System.Windows.Forms.Label lblX509Prompt;

View File

@ -189,9 +189,6 @@ namespace Icinga
string args = "";
if (rdoNewMaster.Checked)
args += " --master";
Invoke((MethodInvoker)delegate
{
string master_host, master_port;
@ -216,7 +213,9 @@ namespace Icinga
if (chkAcceptCommands.Checked)
args += " --accept-commands";
if (txtTicket.Text != "")
args += " --ticket \"" + txtTicket.Text + "\"";
args += " --trustedcert \"" + _TrustedFile + "\"";
args += " --cn \"" + txtInstanceName.Text + "\"";
args += " --zone \"" + txtInstanceName.Text + "\"";
@ -311,14 +310,8 @@ namespace Icinga
return;
}
if (txtTicket.Text.Length == 0) {
Warning("Please enter an agent ticket.");
return;
}
if (rdoNoMaster.Checked) {
if (lvwEndpoints.Items.Count == 0) {
Warning("You need to add at least one master endpoint.");
Warning("You need to add at least one master/satellite endpoint.");
return;
}
@ -327,7 +320,6 @@ namespace Icinga
Warning("Please enter a remote host and port for at least one of your endpoints.");
return;
}
}
if (rdoListener.Checked && (txtListenerPort.Text == "")) {
Warning("You need to specify a listener port.");
@ -373,35 +365,12 @@ namespace Icinga
thread.Start();
}
/*if (tbcPages.SelectedTab == tabParameters &&
!File.Exists(Icinga2DataDir + "\\etc\\icinga2\\pki\\agent\\agent.crt")) {
byte[] bytes = Convert.FromBase64String(txtBundle.Text);
MemoryStream ms = new MemoryStream(bytes);
GZipStream gz = new GZipStream(ms, CompressionMode.Decompress);
MemoryStream ms2 = new MemoryStream();
byte[] buffer = new byte[512];
int rc;
while ((rc = gz.Read(buffer, 0, buffer.Length)) > 0)
ms2.Write(buffer, 0, rc);
ms2.Position = 0;
TarReader tr = new TarReader(ms2);
tr.ReadToEnd(Icinga2DataDir + "\\etc\\icinga2\\pki\\agent");
}*/
if (tbcPages.SelectedTab == tabConfigure) {
Thread thread = new Thread(ConfigureService);
thread.Start();
}
}
private void RadioMaster_CheckedChanged(object sender, EventArgs e)
{
lvwEndpoints.Enabled = !rdoNewMaster.Checked;
btnAddEndpoint.Enabled = !rdoNewMaster.Checked;
btnRemoveEndpoint.Enabled = !rdoNewMaster.Checked && lvwEndpoints.SelectedItems.Count > 0;
}
private void RadioListener_CheckedChanged(object sender, EventArgs e)
{
txtListenerPort.Enabled = rdoListener.Checked;