private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AgentWizard));
- this.tbcPages = new System.Windows.Forms.TabControl();
- this.tabAgentKey = new System.Windows.Forms.TabPage();
- this.lblHostKey = new System.Windows.Forms.Label();
- this.prgHostKey = new System.Windows.Forms.ProgressBar();
- this.tabCSR = new System.Windows.Forms.TabPage();
- this.txtCSR = new System.Windows.Forms.TextBox();
- this.lblCSRPrompt = new System.Windows.Forms.Label();
- this.tabCertificateBundle = new System.Windows.Forms.TabPage();
- this.txtBundle = new System.Windows.Forms.TextBox();
- this.lblBundlePrompt = new System.Windows.Forms.Label();
+ this.btnBack = new System.Windows.Forms.Button();
+ this.btnNext = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.tabFinish = new System.Windows.Forms.TabPage();
+ this.lblSetupCompleted = new System.Windows.Forms.Label();
+ this.tabConfigure = new System.Windows.Forms.TabPage();
+ this.lblConfigStatus = new System.Windows.Forms.Label();
+ this.prgConfig = new System.Windows.Forms.ProgressBar();
this.tabParameters = new System.Windows.Forms.TabPage();
this.txtInstanceName = new System.Windows.Forms.TextBox();
- this.label5 = new System.Windows.Forms.Label();
- this.groupBox3 = new System.Windows.Forms.GroupBox();
- this.rdoNoConnect = new System.Windows.Forms.RadioButton();
- this.txtPeerPort = new System.Windows.Forms.TextBox();
- this.lblPeerPort = new System.Windows.Forms.Label();
- this.txtPeerHost = new System.Windows.Forms.TextBox();
- this.lblPeerHost = new System.Windows.Forms.Label();
- this.rdoConnect = new System.Windows.Forms.RadioButton();
+ this.lblInstanceName = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.rdoNoListener = new System.Windows.Forms.RadioButton();
this.txtListenerPort = new System.Windows.Forms.TextBox();
this.lblListenerPort = new System.Windows.Forms.Label();
this.rdoListener = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.txtMasterInstance = new System.Windows.Forms.TextBox();
- this.lblMasterInstance = new System.Windows.Forms.Label();
+ this.btnRemoveEndpoint = new System.Windows.Forms.Button();
+ this.btnAddEndpoint = new System.Windows.Forms.Button();
+ this.lvwEndpoints = new System.Windows.Forms.ListView();
+ 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.tabVerifyCertificate = new System.Windows.Forms.TabPage();
+ this.grpX509Fields = new System.Windows.Forms.GroupBox();
+ this.txtX509Field = new System.Windows.Forms.TextBox();
+ this.lvwX509Fields = new System.Windows.Forms.ListView();
+ this.colField = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.colValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.txtX509Subject = new System.Windows.Forms.TextBox();
+ this.txtX509Issuer = new System.Windows.Forms.TextBox();
+ this.lblX509Subject = new System.Windows.Forms.Label();
+ this.lblX509Issuer = new System.Windows.Forms.Label();
+ this.lblX509Prompt = new System.Windows.Forms.Label();
this.picBanner = new System.Windows.Forms.PictureBox();
- this.btnBack = new System.Windows.Forms.Button();
- this.btnNext = new System.Windows.Forms.Button();
- this.btnCancel = new System.Windows.Forms.Button();
- this.tabConfigure = new System.Windows.Forms.TabPage();
- this.prgConfig = new System.Windows.Forms.ProgressBar();
- this.lblConfigStatus = new System.Windows.Forms.Label();
- this.tabFinish = new System.Windows.Forms.TabPage();
- this.label1 = new System.Windows.Forms.Label();
- this.tbcPages.SuspendLayout();
- this.tabAgentKey.SuspendLayout();
- this.tabCSR.SuspendLayout();
- this.tabCertificateBundle.SuspendLayout();
+ this.lblRetrieveCertificate = new System.Windows.Forms.Label();
+ this.prgRetrieveCertificate = new System.Windows.Forms.ProgressBar();
+ this.tabFinish.SuspendLayout();
+ this.tabConfigure.SuspendLayout();
this.tabParameters.SuspendLayout();
- this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
+ this.tbcPages.SuspendLayout();
+ this.tabRetrieveCertificate.SuspendLayout();
+ this.tabVerifyCertificate.SuspendLayout();
+ this.grpX509Fields.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picBanner)).BeginInit();
- this.tabConfigure.SuspendLayout();
- this.tabFinish.SuspendLayout();
this.SuspendLayout();
//
- // tbcPages
+ // btnBack
//
- this.tbcPages.Appearance = System.Windows.Forms.TabAppearance.FlatButtons;
- this.tbcPages.Controls.Add(this.tabAgentKey);
- this.tbcPages.Controls.Add(this.tabCSR);
- this.tbcPages.Controls.Add(this.tabCertificateBundle);
- this.tbcPages.Controls.Add(this.tabParameters);
- this.tbcPages.Controls.Add(this.tabConfigure);
- this.tbcPages.Controls.Add(this.tabFinish);
- this.tbcPages.ItemSize = new System.Drawing.Size(0, 1);
- this.tbcPages.Location = new System.Drawing.Point(0, 80);
- this.tbcPages.Margin = new System.Windows.Forms.Padding(0);
- this.tbcPages.Name = "tbcPages";
- this.tbcPages.SelectedIndex = 0;
- this.tbcPages.Size = new System.Drawing.Size(625, 509);
- this.tbcPages.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
- this.tbcPages.TabIndex = 0;
- this.tbcPages.SelectedIndexChanged += new System.EventHandler(this.tbcPages_SelectedIndexChanged);
+ this.btnBack.Enabled = false;
+ this.btnBack.Location = new System.Drawing.Point(367, 592);
+ this.btnBack.Name = "btnBack";
+ this.btnBack.Size = new System.Drawing.Size(75, 23);
+ this.btnBack.TabIndex = 1;
+ this.btnBack.Text = "< &Back";
+ this.btnBack.UseVisualStyleBackColor = true;
+ this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
+ //
+ // btnNext
+ //
+ this.btnNext.Location = new System.Drawing.Point(448, 592);
+ this.btnNext.Name = "btnNext";
+ this.btnNext.Size = new System.Drawing.Size(75, 23);
+ this.btnNext.TabIndex = 2;
+ this.btnNext.Text = "&Next >";
+ this.btnNext.UseVisualStyleBackColor = true;
+ this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
+ //
+ // btnCancel
//
- // tabAgentKey
- //
- this.tabAgentKey.Controls.Add(this.lblHostKey);
- this.tabAgentKey.Controls.Add(this.prgHostKey);
- this.tabAgentKey.Location = new System.Drawing.Point(4, 5);
- this.tabAgentKey.Name = "tabAgentKey";
- this.tabAgentKey.Padding = new System.Windows.Forms.Padding(3);
- this.tabAgentKey.Size = new System.Drawing.Size(617, 500);
- this.tabAgentKey.TabIndex = 0;
- this.tabAgentKey.Text = "Agent Key";
- this.tabAgentKey.UseVisualStyleBackColor = true;
- //
- // lblHostKey
- //
- this.lblHostKey.AutoSize = true;
- this.lblHostKey.Location = new System.Drawing.Point(118, 222);
- this.lblHostKey.Name = "lblHostKey";
- this.lblHostKey.Size = new System.Drawing.Size(197, 13);
- this.lblHostKey.TabIndex = 1;
- this.lblHostKey.Text = "Generating a host key for this machine...";
- //
- // prgHostKey
- //
- this.prgHostKey.Location = new System.Drawing.Point(118, 254);
- this.prgHostKey.Name = "prgHostKey";
- this.prgHostKey.Size = new System.Drawing.Size(369, 23);
- this.prgHostKey.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
- this.prgHostKey.TabIndex = 0;
- //
- // tabCSR
- //
- this.tabCSR.Controls.Add(this.txtCSR);
- this.tabCSR.Controls.Add(this.lblCSRPrompt);
- this.tabCSR.Location = new System.Drawing.Point(4, 5);
- this.tabCSR.Name = "tabCSR";
- this.tabCSR.Padding = new System.Windows.Forms.Padding(3);
- this.tabCSR.Size = new System.Drawing.Size(617, 500);
- this.tabCSR.TabIndex = 1;
- this.tabCSR.Text = "Certificate Signing Request";
- this.tabCSR.UseVisualStyleBackColor = true;
- //
- // txtCSR
- //
- this.txtCSR.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.txtCSR.Location = new System.Drawing.Point(24, 42);
- this.txtCSR.Multiline = true;
- this.txtCSR.Name = "txtCSR";
- this.txtCSR.ReadOnly = true;
- this.txtCSR.Size = new System.Drawing.Size(564, 452);
- this.txtCSR.TabIndex = 1;
- //
- // lblCSRPrompt
- //
- this.lblCSRPrompt.AutoSize = true;
- this.lblCSRPrompt.Location = new System.Drawing.Point(21, 15);
- this.lblCSRPrompt.Name = "lblCSRPrompt";
- this.lblCSRPrompt.Size = new System.Drawing.Size(373, 13);
- this.lblCSRPrompt.TabIndex = 0;
- this.lblCSRPrompt.Text = "Please sign the following certificate signing request (CSR) using the agent CA:";
- //
- // tabCertificateBundle
- //
- this.tabCertificateBundle.Controls.Add(this.txtBundle);
- this.tabCertificateBundle.Controls.Add(this.lblBundlePrompt);
- this.tabCertificateBundle.Location = new System.Drawing.Point(4, 5);
- this.tabCertificateBundle.Name = "tabCertificateBundle";
- this.tabCertificateBundle.Padding = new System.Windows.Forms.Padding(3);
- this.tabCertificateBundle.Size = new System.Drawing.Size(617, 500);
- this.tabCertificateBundle.TabIndex = 2;
- this.tabCertificateBundle.Text = "Certificate Bundle";
- this.tabCertificateBundle.UseVisualStyleBackColor = true;
- //
- // txtBundle
- //
- this.txtBundle.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.txtBundle.Location = new System.Drawing.Point(24, 42);
- this.txtBundle.Multiline = true;
- this.txtBundle.Name = "txtBundle";
- this.txtBundle.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- this.txtBundle.Size = new System.Drawing.Size(564, 452);
- this.txtBundle.TabIndex = 1;
- //
- // lblBundlePrompt
- //
- this.lblBundlePrompt.AutoSize = true;
- this.lblBundlePrompt.Location = new System.Drawing.Point(21, 15);
- this.lblBundlePrompt.Name = "lblBundlePrompt";
- this.lblBundlePrompt.Size = new System.Drawing.Size(239, 13);
- this.lblBundlePrompt.TabIndex = 0;
- this.lblBundlePrompt.Text = "Paste the certificate bundle in the text box below:";
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Location = new System.Drawing.Point(538, 592);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 3;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // tabFinish
+ //
+ this.tabFinish.Controls.Add(this.lblSetupCompleted);
+ this.tabFinish.Location = new System.Drawing.Point(4, 5);
+ this.tabFinish.Name = "tabFinish";
+ this.tabFinish.Padding = new System.Windows.Forms.Padding(3);
+ this.tabFinish.Size = new System.Drawing.Size(617, 500);
+ this.tabFinish.TabIndex = 5;
+ this.tabFinish.Text = "Finish";
+ this.tabFinish.UseVisualStyleBackColor = true;
+ //
+ // lblSetupCompleted
+ //
+ this.lblSetupCompleted.AutoSize = true;
+ this.lblSetupCompleted.Location = new System.Drawing.Point(34, 35);
+ this.lblSetupCompleted.Name = "lblSetupCompleted";
+ this.lblSetupCompleted.Size = new System.Drawing.Size(214, 13);
+ this.lblSetupCompleted.TabIndex = 0;
+ this.lblSetupCompleted.Text = "The Icinga 2 agent was set up successfully.";
+ //
+ // tabConfigure
+ //
+ this.tabConfigure.Controls.Add(this.lblConfigStatus);
+ this.tabConfigure.Controls.Add(this.prgConfig);
+ this.tabConfigure.Location = new System.Drawing.Point(4, 5);
+ this.tabConfigure.Name = "tabConfigure";
+ this.tabConfigure.Padding = new System.Windows.Forms.Padding(3);
+ this.tabConfigure.Size = new System.Drawing.Size(617, 500);
+ this.tabConfigure.TabIndex = 4;
+ this.tabConfigure.Text = "Configure Icinga 2";
+ this.tabConfigure.UseVisualStyleBackColor = true;
+ //
+ // lblConfigStatus
+ //
+ this.lblConfigStatus.AutoSize = true;
+ this.lblConfigStatus.Location = new System.Drawing.Point(184, 204);
+ this.lblConfigStatus.Name = "lblConfigStatus";
+ this.lblConfigStatus.Size = new System.Drawing.Size(141, 13);
+ this.lblConfigStatus.TabIndex = 1;
+ this.lblConfigStatus.Text = "Updating the configuration...";
+ //
+ // prgConfig
+ //
+ this.prgConfig.Location = new System.Drawing.Point(184, 223);
+ this.prgConfig.Name = "prgConfig";
+ this.prgConfig.Size = new System.Drawing.Size(289, 23);
+ this.prgConfig.TabIndex = 0;
//
// tabParameters
//
this.tabParameters.Controls.Add(this.txtInstanceName);
- this.tabParameters.Controls.Add(this.label5);
- this.tabParameters.Controls.Add(this.groupBox3);
+ this.tabParameters.Controls.Add(this.lblInstanceName);
this.tabParameters.Controls.Add(this.groupBox2);
this.tabParameters.Controls.Add(this.groupBox1);
this.tabParameters.Location = new System.Drawing.Point(4, 5);
//
this.txtInstanceName.Location = new System.Drawing.Point(98, 16);
this.txtInstanceName.Name = "txtInstanceName";
- this.txtInstanceName.ReadOnly = true;
this.txtInstanceName.Size = new System.Drawing.Size(240, 20);
this.txtInstanceName.TabIndex = 0;
//
- // label5
- //
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(9, 20);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(82, 13);
- this.label5.TabIndex = 3;
- this.label5.Text = "Instance Name:";
- //
- // groupBox3
- //
- this.groupBox3.Controls.Add(this.rdoNoConnect);
- this.groupBox3.Controls.Add(this.txtPeerPort);
- this.groupBox3.Controls.Add(this.lblPeerPort);
- this.groupBox3.Controls.Add(this.txtPeerHost);
- this.groupBox3.Controls.Add(this.lblPeerHost);
- this.groupBox3.Controls.Add(this.rdoConnect);
- this.groupBox3.Location = new System.Drawing.Point(8, 305);
- this.groupBox3.Name = "groupBox3";
- this.groupBox3.Size = new System.Drawing.Size(601, 140);
- this.groupBox3.TabIndex = 3;
- this.groupBox3.TabStop = false;
- this.groupBox3.Text = "TCP Connect";
- //
- // rdoNoConnect
- //
- this.rdoNoConnect.AutoSize = true;
- this.rdoNoConnect.Checked = true;
- this.rdoNoConnect.Location = new System.Drawing.Point(11, 108);
- this.rdoNoConnect.Name = "rdoNoConnect";
- this.rdoNoConnect.Size = new System.Drawing.Size(209, 17);
- this.rdoNoConnect.TabIndex = 3;
- this.rdoNoConnect.TabStop = true;
- this.rdoNoConnect.Text = "Do not connect to the master instance.";
- this.rdoNoConnect.UseVisualStyleBackColor = true;
- this.rdoNoConnect.CheckedChanged += new System.EventHandler(this.RadioConnect_CheckedChanged);
- //
- // txtPeerPort
- //
- this.txtPeerPort.Enabled = false;
- this.txtPeerPort.Location = new System.Drawing.Point(131, 79);
- this.txtPeerPort.Name = "txtPeerPort";
- this.txtPeerPort.Size = new System.Drawing.Size(84, 20);
- this.txtPeerPort.TabIndex = 2;
- this.txtPeerPort.Text = "5665";
- //
- // lblPeerPort
- //
- this.lblPeerPort.AutoSize = true;
- this.lblPeerPort.Location = new System.Drawing.Point(45, 82);
- this.lblPeerPort.Name = "lblPeerPort";
- this.lblPeerPort.Size = new System.Drawing.Size(29, 13);
- this.lblPeerPort.TabIndex = 6;
- this.lblPeerPort.Text = "Port:";
- //
- // txtPeerHost
- //
- this.txtPeerHost.Enabled = false;
- this.txtPeerHost.Location = new System.Drawing.Point(131, 53);
- this.txtPeerHost.Name = "txtPeerHost";
- this.txtPeerHost.Size = new System.Drawing.Size(240, 20);
- this.txtPeerHost.TabIndex = 1;
- //
- // lblPeerHost
- //
- this.lblPeerHost.AutoSize = true;
- this.lblPeerHost.Location = new System.Drawing.Point(45, 54);
- this.lblPeerHost.Name = "lblPeerHost";
- this.lblPeerHost.Size = new System.Drawing.Size(58, 13);
- this.lblPeerHost.TabIndex = 1;
- this.lblPeerHost.Text = "Hostname:";
- //
- // rdoConnect
- //
- this.rdoConnect.AutoSize = true;
- this.rdoConnect.Location = new System.Drawing.Point(11, 25);
- this.rdoConnect.Name = "rdoConnect";
- this.rdoConnect.Size = new System.Drawing.Size(175, 17);
- this.rdoConnect.TabIndex = 0;
- this.rdoConnect.Text = "Connect to the master instance:";
- this.rdoConnect.UseVisualStyleBackColor = true;
- this.rdoConnect.CheckedChanged += new System.EventHandler(this.RadioConnect_CheckedChanged);
+ // lblInstanceName
+ //
+ 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.TabIndex = 3;
+ this.lblInstanceName.Text = "Instance Name:";
//
// groupBox2
//
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, 178);
+ this.groupBox2.Location = new System.Drawing.Point(8, 330);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(601, 111);
this.groupBox2.TabIndex = 2;
//
// groupBox1
//
- this.groupBox1.Controls.Add(this.txtMasterInstance);
- this.groupBox1.Controls.Add(this.lblMasterInstance);
+ 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, 48);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(601, 112);
+ this.groupBox1.Size = new System.Drawing.Size(601, 276);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Master Instance";
//
- // txtMasterInstance
+ // btnRemoveEndpoint
+ //
+ this.btnRemoveEndpoint.Enabled = false;
+ this.btnRemoveEndpoint.Location = new System.Drawing.Point(520, 112);
+ this.btnRemoveEndpoint.Name = "btnRemoveEndpoint";
+ this.btnRemoveEndpoint.Size = new System.Drawing.Size(75, 23);
+ this.btnRemoveEndpoint.TabIndex = 4;
+ this.btnRemoveEndpoint.Text = "Remove";
+ this.btnRemoveEndpoint.UseVisualStyleBackColor = true;
+ this.btnRemoveEndpoint.Click += new System.EventHandler(this.btnRemoveEndpoint_Click);
//
- this.txtMasterInstance.Location = new System.Drawing.Point(132, 78);
- this.txtMasterInstance.Name = "txtMasterInstance";
- this.txtMasterInstance.Size = new System.Drawing.Size(240, 20);
- this.txtMasterInstance.TabIndex = 2;
+ // btnAddEndpoint
//
- // lblMasterInstance
+ this.btnAddEndpoint.Location = new System.Drawing.Point(520, 83);
+ this.btnAddEndpoint.Name = "btnAddEndpoint";
+ this.btnAddEndpoint.Size = new System.Drawing.Size(75, 23);
+ this.btnAddEndpoint.TabIndex = 3;
+ this.btnAddEndpoint.Text = "Add";
+ this.btnAddEndpoint.UseVisualStyleBackColor = true;
+ this.btnAddEndpoint.Click += new System.EventHandler(this.btnAddEndpoint_Click);
//
- this.lblMasterInstance.AutoSize = true;
- this.lblMasterInstance.Location = new System.Drawing.Point(40, 81);
- this.lblMasterInstance.Name = "lblMasterInstance";
- this.lblMasterInstance.Size = new System.Drawing.Size(86, 13);
- this.lblMasterInstance.TabIndex = 2;
- this.lblMasterInstance.Text = "Master Instance:";
+ // lvwEndpoints
+ //
+ this.lvwEndpoints.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.colHost,
+ this.colPort});
+ this.lvwEndpoints.Location = new System.Drawing.Point(11, 83);
+ this.lvwEndpoints.Name = "lvwEndpoints";
+ this.lvwEndpoints.Size = new System.Drawing.Size(500, 176);
+ this.lvwEndpoints.TabIndex = 2;
+ this.lvwEndpoints.UseCompatibleStateImageBehavior = false;
+ this.lvwEndpoints.View = System.Windows.Forms.View.Details;
+ this.lvwEndpoints.SelectedIndexChanged += new System.EventHandler(this.lvwEndpoints_SelectedIndexChanged);
+ //
+ // colHost
+ //
+ this.colHost.Text = "Host";
+ this.colHost.Width = 300;
+ //
+ // colPort
+ //
+ this.colPort.Text = "Port";
+ this.colPort.Width = 120;
//
// rdoNoMaster
//
this.rdoNoMaster.Checked = true;
this.rdoNoMaster.Location = new System.Drawing.Point(11, 50);
this.rdoNoMaster.Name = "rdoNoMaster";
- this.rdoNoMaster.Size = new System.Drawing.Size(383, 17);
+ this.rdoNoMaster.Size = new System.Drawing.Size(374, 17);
this.rdoNoMaster.TabIndex = 1;
this.rdoNoMaster.TabStop = true;
- this.rdoNoMaster.Text = "This instance should report its check results to an existing Icinga 2 instance:";
+ 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);
//
this.rdoNewMaster.UseVisualStyleBackColor = true;
this.rdoNewMaster.CheckedChanged += new System.EventHandler(this.RadioMaster_CheckedChanged);
//
+ // tbcPages
+ //
+ this.tbcPages.Appearance = System.Windows.Forms.TabAppearance.FlatButtons;
+ this.tbcPages.Controls.Add(this.tabParameters);
+ this.tbcPages.Controls.Add(this.tabRetrieveCertificate);
+ this.tbcPages.Controls.Add(this.tabVerifyCertificate);
+ this.tbcPages.Controls.Add(this.tabConfigure);
+ this.tbcPages.Controls.Add(this.tabFinish);
+ this.tbcPages.ItemSize = new System.Drawing.Size(0, 1);
+ this.tbcPages.Location = new System.Drawing.Point(0, 80);
+ this.tbcPages.Margin = new System.Windows.Forms.Padding(0);
+ this.tbcPages.Name = "tbcPages";
+ this.tbcPages.SelectedIndex = 0;
+ this.tbcPages.Size = new System.Drawing.Size(625, 509);
+ this.tbcPages.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
+ this.tbcPages.TabIndex = 0;
+ this.tbcPages.SelectedIndexChanged += new System.EventHandler(this.tbcPages_SelectedIndexChanged);
+ //
+ // tabRetrieveCertificate
+ //
+ this.tabRetrieveCertificate.Controls.Add(this.lblRetrieveCertificate);
+ this.tabRetrieveCertificate.Controls.Add(this.prgRetrieveCertificate);
+ this.tabRetrieveCertificate.Location = new System.Drawing.Point(4, 5);
+ this.tabRetrieveCertificate.Name = "tabRetrieveCertificate";
+ this.tabRetrieveCertificate.Padding = new System.Windows.Forms.Padding(3);
+ this.tabRetrieveCertificate.Size = new System.Drawing.Size(617, 500);
+ this.tabRetrieveCertificate.TabIndex = 7;
+ this.tabRetrieveCertificate.Text = "Checking Certificate";
+ this.tabRetrieveCertificate.UseVisualStyleBackColor = true;
+ //
+ // tabVerifyCertificate
+ //
+ this.tabVerifyCertificate.Controls.Add(this.grpX509Fields);
+ this.tabVerifyCertificate.Controls.Add(this.txtX509Subject);
+ this.tabVerifyCertificate.Controls.Add(this.txtX509Issuer);
+ this.tabVerifyCertificate.Controls.Add(this.lblX509Subject);
+ this.tabVerifyCertificate.Controls.Add(this.lblX509Issuer);
+ this.tabVerifyCertificate.Controls.Add(this.lblX509Prompt);
+ this.tabVerifyCertificate.Location = new System.Drawing.Point(4, 5);
+ this.tabVerifyCertificate.Name = "tabVerifyCertificate";
+ this.tabVerifyCertificate.Padding = new System.Windows.Forms.Padding(3);
+ this.tabVerifyCertificate.Size = new System.Drawing.Size(617, 500);
+ this.tabVerifyCertificate.TabIndex = 6;
+ this.tabVerifyCertificate.Text = "Verify Certificate";
+ this.tabVerifyCertificate.UseVisualStyleBackColor = true;
+ //
+ // grpX509Fields
+ //
+ this.grpX509Fields.Controls.Add(this.txtX509Field);
+ this.grpX509Fields.Controls.Add(this.lvwX509Fields);
+ this.grpX509Fields.Location = new System.Drawing.Point(11, 115);
+ this.grpX509Fields.Name = "grpX509Fields";
+ this.grpX509Fields.Size = new System.Drawing.Size(598, 369);
+ this.grpX509Fields.TabIndex = 8;
+ this.grpX509Fields.TabStop = false;
+ this.grpX509Fields.Text = "X509 Fields";
+ //
+ // txtX509Field
+ //
+ this.txtX509Field.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.txtX509Field.Location = new System.Drawing.Point(6, 197);
+ this.txtX509Field.Multiline = true;
+ this.txtX509Field.Name = "txtX509Field";
+ this.txtX509Field.ReadOnly = true;
+ this.txtX509Field.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.txtX509Field.Size = new System.Drawing.Size(586, 166);
+ this.txtX509Field.TabIndex = 9;
+ //
+ // lvwX509Fields
+ //
+ this.lvwX509Fields.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.colField,
+ this.colValue});
+ this.lvwX509Fields.Location = new System.Drawing.Point(6, 19);
+ this.lvwX509Fields.Name = "lvwX509Fields";
+ this.lvwX509Fields.Size = new System.Drawing.Size(586, 172);
+ this.lvwX509Fields.TabIndex = 8;
+ this.lvwX509Fields.UseCompatibleStateImageBehavior = false;
+ this.lvwX509Fields.View = System.Windows.Forms.View.Details;
+ this.lvwX509Fields.SelectedIndexChanged += new System.EventHandler(this.lvwX509Fields_SelectedIndexChanged);
+ //
+ // colField
+ //
+ this.colField.Text = "Field";
+ this.colField.Width = 200;
+ //
+ // colValue
+ //
+ this.colValue.Text = "Value";
+ this.colValue.Width = 350;
+ //
+ // txtX509Subject
+ //
+ this.txtX509Subject.Location = new System.Drawing.Point(71, 73);
+ this.txtX509Subject.Name = "txtX509Subject";
+ this.txtX509Subject.ReadOnly = true;
+ this.txtX509Subject.Size = new System.Drawing.Size(532, 20);
+ this.txtX509Subject.TabIndex = 4;
+ //
+ // txtX509Issuer
+ //
+ this.txtX509Issuer.Location = new System.Drawing.Point(71, 47);
+ this.txtX509Issuer.Name = "txtX509Issuer";
+ this.txtX509Issuer.ReadOnly = true;
+ this.txtX509Issuer.Size = new System.Drawing.Size(532, 20);
+ this.txtX509Issuer.TabIndex = 3;
+ //
+ // lblX509Subject
+ //
+ this.lblX509Subject.AutoSize = true;
+ this.lblX509Subject.Location = new System.Drawing.Point(8, 77);
+ this.lblX509Subject.Name = "lblX509Subject";
+ this.lblX509Subject.Size = new System.Drawing.Size(46, 13);
+ this.lblX509Subject.TabIndex = 2;
+ this.lblX509Subject.Text = "Subject:";
+ //
+ // lblX509Issuer
+ //
+ this.lblX509Issuer.AutoSize = true;
+ this.lblX509Issuer.Location = new System.Drawing.Point(8, 50);
+ this.lblX509Issuer.Name = "lblX509Issuer";
+ this.lblX509Issuer.Size = new System.Drawing.Size(38, 13);
+ this.lblX509Issuer.TabIndex = 1;
+ this.lblX509Issuer.Text = "Issuer:";
+ //
+ // lblX509Prompt
+ //
+ this.lblX509Prompt.AutoSize = true;
+ this.lblX509Prompt.Location = new System.Drawing.Point(8, 15);
+ this.lblX509Prompt.Name = "lblX509Prompt";
+ this.lblX509Prompt.Size = new System.Drawing.Size(201, 13);
+ this.lblX509Prompt.TabIndex = 0;
+ this.lblX509Prompt.Text = "Please verify the master\'s SSL certificate:";
+ //
// picBanner
//
this.picBanner.Image = global::Icinga.Properties.Resources.icinga_banner;
this.picBanner.TabIndex = 1;
this.picBanner.TabStop = false;
//
- // btnBack
+ // lblRetrieveCertificate
//
- this.btnBack.Enabled = false;
- this.btnBack.Location = new System.Drawing.Point(367, 592);
- this.btnBack.Name = "btnBack";
- this.btnBack.Size = new System.Drawing.Size(75, 23);
- this.btnBack.TabIndex = 1;
- this.btnBack.Text = "< &Back";
- this.btnBack.UseVisualStyleBackColor = true;
- this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
+ this.lblRetrieveCertificate.AutoSize = true;
+ this.lblRetrieveCertificate.Location = new System.Drawing.Point(164, 229);
+ this.lblRetrieveCertificate.Name = "lblRetrieveCertificate";
+ this.lblRetrieveCertificate.Size = new System.Drawing.Size(110, 13);
+ this.lblRetrieveCertificate.TabIndex = 3;
+ this.lblRetrieveCertificate.Text = "Checking certificate...";
//
- // btnNext
+ // prgRetrieveCertificate
//
- this.btnNext.Enabled = false;
- this.btnNext.Location = new System.Drawing.Point(448, 592);
- this.btnNext.Name = "btnNext";
- this.btnNext.Size = new System.Drawing.Size(75, 23);
- this.btnNext.TabIndex = 2;
- this.btnNext.Text = "&Next >";
- this.btnNext.UseVisualStyleBackColor = true;
- this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
- //
- // btnCancel
- //
- this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(538, 592);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(75, 23);
- this.btnCancel.TabIndex = 3;
- this.btnCancel.Text = "Cancel";
- this.btnCancel.UseVisualStyleBackColor = true;
- this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
- //
- // tabConfigure
- //
- this.tabConfigure.Controls.Add(this.lblConfigStatus);
- this.tabConfigure.Controls.Add(this.prgConfig);
- this.tabConfigure.Location = new System.Drawing.Point(4, 5);
- this.tabConfigure.Name = "tabConfigure";
- this.tabConfigure.Padding = new System.Windows.Forms.Padding(3);
- this.tabConfigure.Size = new System.Drawing.Size(617, 500);
- this.tabConfigure.TabIndex = 4;
- this.tabConfigure.Text = "Configure Icinga 2";
- this.tabConfigure.UseVisualStyleBackColor = true;
- //
- // prgConfig
- //
- this.prgConfig.Location = new System.Drawing.Point(184, 223);
- this.prgConfig.Name = "prgConfig";
- this.prgConfig.Size = new System.Drawing.Size(289, 23);
- this.prgConfig.TabIndex = 0;
- //
- // lblConfigStatus
- //
- this.lblConfigStatus.AutoSize = true;
- this.lblConfigStatus.Location = new System.Drawing.Point(184, 204);
- this.lblConfigStatus.Name = "lblConfigStatus";
- this.lblConfigStatus.Size = new System.Drawing.Size(141, 13);
- this.lblConfigStatus.TabIndex = 1;
- this.lblConfigStatus.Text = "Updating the configuration...";
- //
- // tabFinish
- //
- this.tabFinish.Controls.Add(this.label1);
- this.tabFinish.Location = new System.Drawing.Point(4, 5);
- this.tabFinish.Name = "tabFinish";
- this.tabFinish.Padding = new System.Windows.Forms.Padding(3);
- this.tabFinish.Size = new System.Drawing.Size(617, 500);
- this.tabFinish.TabIndex = 5;
- this.tabFinish.Text = "Finish";
- this.tabFinish.UseVisualStyleBackColor = true;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(34, 35);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(214, 13);
- this.label1.TabIndex = 0;
- this.label1.Text = "The Icinga 2 agent was set up successfully.";
+ this.prgRetrieveCertificate.Location = new System.Drawing.Point(164, 248);
+ this.prgRetrieveCertificate.Name = "prgRetrieveCertificate";
+ this.prgRetrieveCertificate.Size = new System.Drawing.Size(289, 23);
+ this.prgRetrieveCertificate.TabIndex = 2;
//
// AgentWizard
//
+ this.AcceptButton = this.btnNext;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(625, 624);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnNext);
this.Name = "AgentWizard";
this.Text = "Icinga 2 Agent Wizard";
this.Shown += new System.EventHandler(this.AgentWizard_Shown);
- this.tbcPages.ResumeLayout(false);
- this.tabAgentKey.ResumeLayout(false);
- this.tabAgentKey.PerformLayout();
- this.tabCSR.ResumeLayout(false);
- this.tabCSR.PerformLayout();
- this.tabCertificateBundle.ResumeLayout(false);
- this.tabCertificateBundle.PerformLayout();
+ this.tabFinish.ResumeLayout(false);
+ this.tabFinish.PerformLayout();
+ this.tabConfigure.ResumeLayout(false);
+ this.tabConfigure.PerformLayout();
this.tabParameters.ResumeLayout(false);
this.tabParameters.PerformLayout();
- this.groupBox3.ResumeLayout(false);
- this.groupBox3.PerformLayout();
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();
+ this.tabVerifyCertificate.ResumeLayout(false);
+ this.tabVerifyCertificate.PerformLayout();
+ this.grpX509Fields.ResumeLayout(false);
+ this.grpX509Fields.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picBanner)).EndInit();
- this.tabConfigure.ResumeLayout(false);
- this.tabConfigure.PerformLayout();
- this.tabFinish.ResumeLayout(false);
- this.tabFinish.PerformLayout();
this.ResumeLayout(false);
}
#endregion
- private System.Windows.Forms.TabControl tbcPages;
- private System.Windows.Forms.TabPage tabAgentKey;
- private System.Windows.Forms.TabPage tabCSR;
private System.Windows.Forms.PictureBox picBanner;
private System.Windows.Forms.Button btnBack;
private System.Windows.Forms.Button btnNext;
private System.Windows.Forms.Button btnCancel;
- private System.Windows.Forms.Label lblHostKey;
- private System.Windows.Forms.ProgressBar prgHostKey;
- private System.Windows.Forms.TextBox txtCSR;
- private System.Windows.Forms.Label lblCSRPrompt;
- private System.Windows.Forms.TabPage tabCertificateBundle;
- private System.Windows.Forms.TextBox txtBundle;
- private System.Windows.Forms.Label lblBundlePrompt;
+ private System.Windows.Forms.TabPage tabFinish;
+ private System.Windows.Forms.Label lblSetupCompleted;
+ private System.Windows.Forms.TabPage tabConfigure;
+ private System.Windows.Forms.Label lblConfigStatus;
+ private System.Windows.Forms.ProgressBar prgConfig;
private System.Windows.Forms.TabPage tabParameters;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.TextBox txtMasterInstance;
- private System.Windows.Forms.Label lblMasterInstance;
- private System.Windows.Forms.RadioButton rdoNoMaster;
- private System.Windows.Forms.RadioButton rdoNewMaster;
+ private System.Windows.Forms.TextBox txtInstanceName;
+ private System.Windows.Forms.Label lblInstanceName;
private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.RadioButton rdoNoListener;
private System.Windows.Forms.TextBox txtListenerPort;
private System.Windows.Forms.Label lblListenerPort;
private System.Windows.Forms.RadioButton rdoListener;
- private System.Windows.Forms.RadioButton rdoNoListener;
- private System.Windows.Forms.GroupBox groupBox3;
- private System.Windows.Forms.Label lblPeerHost;
- private System.Windows.Forms.RadioButton rdoConnect;
- private System.Windows.Forms.TextBox txtPeerPort;
- private System.Windows.Forms.Label lblPeerPort;
- private System.Windows.Forms.TextBox txtPeerHost;
- private System.Windows.Forms.RadioButton rdoNoConnect;
- private System.Windows.Forms.TextBox txtInstanceName;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.TabPage tabConfigure;
- private System.Windows.Forms.Label lblConfigStatus;
- private System.Windows.Forms.ProgressBar prgConfig;
- private System.Windows.Forms.TabPage tabFinish;
- private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.Button btnRemoveEndpoint;
+ private System.Windows.Forms.Button btnAddEndpoint;
+ 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;
+ private System.Windows.Forms.TextBox txtX509Subject;
+ private System.Windows.Forms.TextBox txtX509Issuer;
+ private System.Windows.Forms.Label lblX509Subject;
+ private System.Windows.Forms.Label lblX509Issuer;
+ private System.Windows.Forms.GroupBox grpX509Fields;
+ private System.Windows.Forms.ListView lvwX509Fields;
+ private System.Windows.Forms.ColumnHeader colField;
+ private System.Windows.Forms.ColumnHeader colValue;
+ private System.Windows.Forms.TextBox txtX509Field;
+ private System.Windows.Forms.TabPage tabRetrieveCertificate;
+ private System.Windows.Forms.Label lblRetrieveCertificate;
+ private System.Windows.Forms.ProgressBar prgRetrieveCertificate;
}
}
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices;
+using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Net.NetworkInformation;
using Microsoft.Win32;
using System.Diagnostics;
using System.ServiceProcess;
using System.Security.AccessControl;
-using tar_cs;
namespace Icinga
{
public partial class AgentWizard : Form
{
- [DllImport("base", CallingConvention = CallingConvention.Cdecl)]
- private extern static int MakeX509CSR(string cn, string keyfile, string csrfile);
-
- delegate void FormCallback();
-
public AgentWizard()
{
InitializeComponent();
}
}
- private void GenerateHostKey()
- {
- if (!File.Exists(Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent\\agent.key") ||
- !File.Exists(Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent\\agent.csr")) {
- try {
- MakeX509CSR(Icinga2InstanceName,
- Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent\\agent.key",
- Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent\\agent.csr");
- } catch (Exception ex) {
- FatalError("MakeX509CSR failed: " + ex.Message);
- }
- }
-
- FinishHostKey();
- }
-
- private void FinishHostKey()
+ private void SetRetrievalStatus(int pct)
{
if (InvokeRequired) {
- Invoke(new FormCallback(FinishHostKey));
+ Invoke((MethodInvoker)delegate { SetRetrievalStatus(pct); });
return;
}
- txtCSR.Text = File.ReadAllText(Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent\\agent.csr").Replace("\n", "\r\n");
-
- if (!File.Exists(Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent\\agent.crt"))
- tbcPages.SelectedTab = tabCSR;
- else
- tbcPages.SelectedTab = tabParameters;
+ prgRetrieveCertificate.Value = pct;
}
private void SetConfigureStatus(int pct, string message)
{
if (InvokeRequired) {
- Invoke(new FormCallback(() => SetConfigureStatus(pct, message)));
+ Invoke((MethodInvoker)delegate { SetConfigureStatus(pct, message); });
return;
}
lblConfigStatus.Text = message;
}
+ private void VerifyCertificate(string host, string port)
+ {
+ SetRetrievalStatus(25);
+
+ string pathPrefix = Icinga2InstallDir + "\\etc\\icinga2\\pki\\" + txtInstanceName.Text;
+
+ ProcessStartInfo psi;
+
+ if (!File.Exists(pathPrefix + ".crt")) {
+ psi = new ProcessStartInfo();
+ psi.FileName = Icinga2InstallDir + "\\sbin\\icinga2.exe";
+ psi.Arguments = "pki new-cert --cn \"" + txtInstanceName.Text + "\" --keyfile \"" + pathPrefix + ".key\" --certfile \"" + pathPrefix + ".crt\"";
+ psi.CreateNoWindow = true;
+ psi.UseShellExecute = false;
+
+ using (Process proc = Process.Start(psi)) {
+ proc.WaitForExit();
+
+ if (proc.ExitCode != 0) {
+ Invoke((MethodInvoker)delegate { FatalError("The Windows service could not be installed."); });
+ return;
+ }
+ }
+ }
+
+ SetRetrievalStatus(50);
+
+ string trustedfile = Path.GetTempFileName();
+
+ psi = new ProcessStartInfo();
+ psi.FileName = Icinga2InstallDir + "\\sbin\\icinga2.exe";
+ psi.Arguments = "pki save-cert --host \"" + host + "\" --port \"" + port + "\" --keyfile \"" + pathPrefix + ".key\" --certfile \"" + pathPrefix + ".crt\" --trustedfile \"" + trustedfile + "\"";
+ psi.CreateNoWindow = true;
+ psi.UseShellExecute = false;
+
+ using (Process proc = Process.Start(psi)) {
+ proc.WaitForExit();
+
+ if (proc.ExitCode != 0) {
+ Invoke((MethodInvoker)delegate { FatalError("Could not retrieve the master's X509 certificate."); });
+ return;
+ }
+ }
+
+ SetRetrievalStatus(100);
+
+ X509Certificate2 cert = new X509Certificate2(trustedfile);
+ Invoke((MethodInvoker)delegate { ShowCertificatePrompt(cert); });
+ }
+
private void ConfigureService()
{
SetConfigureStatus(0, "Updating configuration files...");
" ca_path = SysconfDir + \"/icinga2/pki/agent/ca.crt\"\n"
);
- if (rdoNoMaster.Checked)
- sw.Write(" upstream_name = \"{0}\"\n", txtMasterInstance.Text);
+ /*if (rdoNoMaster.Checked)
+ sw.Write(" upstream_name = \"{0}\"\n", txtMasterInstance.Text);*/
if (rdoListener.Checked)
sw.Write(" bind_port = \"{0}\"\n", txtListenerPort.Text);
- if (rdoConnect.Checked)
+ /*if (rdoConnect.Checked)
sw.Write(
" upstream_host = \"{0}\"\n" +
" upstream_port = \"{1}\"\n", txtPeerHost.Text, txtPeerPort.Text
- );
+ );*/
sw.Write("}\n");
}
}
- EnableFeature("agent");
+ EnableFeature("api");
EnableFeature("checker");
SetConfigureStatus(50, "Setting ACLs for the Icinga 2 directory...");
di.SetAccessControl(ds);
SetConfigureStatus(75, "Installing the Icinga 2 service...");
+
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = Icinga2InstallDir + "\\sbin\\icinga2.exe";
- psi.Arguments = "--scm-install -c \"" + Icinga2InstallDir + "\\etc\\icinga2\\icinga2.conf\"";
+ psi.Arguments = "--scm-uninstall";
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
using (Process proc = Process.Start(psi)) {
proc.WaitForExit();
+ }
+
+ psi = new ProcessStartInfo();
+ psi.FileName = Icinga2InstallDir + "\\sbin\\icinga2.exe";
+ psi.Arguments = "--scm-install daemon";
+ psi.CreateNoWindow = true;
+ psi.UseShellExecute = false;
- if (proc.ExitCode != 0)
- FatalError("The Windows service could not be installed.");
+ using (Process proc = Process.Start(psi)) {
+ proc.WaitForExit();
+
+ if (proc.ExitCode != 0) {
+ Invoke((MethodInvoker)delegate { FatalError("The Windows service could not be installed."); });
+ return;
+ }
}
SetConfigureStatus(100, "Finished.");
private void FinishConfigure()
{
if (InvokeRequired) {
- Invoke(new FormCallback(FinishConfigure));
+ Invoke((MethodInvoker)FinishConfigure);
return;
}
Directory.CreateDirectory(installDir + "\\etc\\icinga2\\pki\\agent");
- Thread thread = new Thread(GenerateHostKey);
- thread.IsBackground = true;
- thread.Start();
+
}
private void btnBack_Click(object sender, EventArgs e)
{
- tbcPages.SelectedIndex--;
+ int offset = 1;
+
+ if (tbcPages.SelectedTab == tabVerifyCertificate)
+ offset++;
+
+ tbcPages.SelectedIndex -= offset;
}
private void btnNext_Click(object sender, EventArgs e)
{
if (tbcPages.SelectedTab == tabParameters) {
- if (rdoNoMaster.Checked && txtMasterInstance.Text == "") {
- Warning("You need to enter the name of the master instance.");
+ if (txtInstanceName.Text.Length == 0) {
+ Warning("Please enter an instance name.");
return;
}
- if (rdoConnect.Checked && (txtPeerHost.Text == "" || txtPeerPort.Text == "")) {
- Warning("You need to specify a host and port.");
+ if (rdoNoMaster.Checked && lvwEndpoints.Items.Count == 0) {
+ Warning("You need to add at least one master endpoint.");
return;
}
Warning("You need to specify a listener port.");
return;
}
-
- if (rdoNoListener.Checked && rdoNoConnect.Checked) {
- Warning("You need to enable the listener or outbound connects.");
- return;
- }
}
if (tbcPages.SelectedTab == tabFinish)
Application.Exit();
tbcPages.SelectedIndex++;
- btnBack.Enabled = true;
}
private void btnCancel_Click(object sender, EventArgs e)
{
Refresh();
- btnBack.Enabled = (tbcPages.SelectedTab != tabCSR && tbcPages.SelectedTab != tabFinish);
- btnNext.Enabled = true;
+ btnBack.Enabled = (tbcPages.SelectedTab == tabVerifyCertificate);
+ btnNext.Enabled = (tbcPages.SelectedTab == tabParameters || tbcPages.SelectedTab == tabVerifyCertificate || tbcPages.SelectedTab == tabFinish);
if (tbcPages.SelectedTab == tabFinish) {
btnNext.Text = "&Finish >";
btnCancel.Enabled = false;
}
- if (tbcPages.SelectedTab == tabParameters &&
+ if (tbcPages.SelectedTab == tabRetrieveCertificate) {
+ ListViewItem lvi = lvwEndpoints.Items[0];
+
+ Thread thread = new Thread((ThreadStart)delegate { VerifyCertificate(lvi.SubItems[0].Text, lvi.SubItems[1].Text); });
+ thread.Start();
+ }
+
+ /*if (tbcPages.SelectedTab == tabParameters &&
!File.Exists(Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent\\agent.crt")) {
byte[] bytes = Convert.FromBase64String(txtBundle.Text);
MemoryStream ms = new MemoryStream(bytes);
ms2.Position = 0;
TarReader tr = new TarReader(ms2);
tr.ReadToEnd(Icinga2InstallDir + "\\etc\\icinga2\\pki\\agent");
- }
+ }*/
if (tbcPages.SelectedTab == tabConfigure) {
Thread thread = new Thread(ConfigureService);
private void RadioMaster_CheckedChanged(object sender, EventArgs e)
{
- txtMasterInstance.Enabled = !rdoNewMaster.Checked;
+ 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;
}
- private void RadioConnect_CheckedChanged(object sender, EventArgs e)
+ private void AddCertificateField(string name, string shortValue, string longValue = null)
+ {
+ ListViewItem lvi = new ListViewItem();
+ lvi.Text = name;
+ lvi.SubItems.Add(shortValue);
+ if (longValue == null)
+ longValue = shortValue;
+ lvi.Tag = longValue;
+ lvwX509Fields.Items.Add(lvi);
+ }
+
+ private string PadText(string input)
{
- txtPeerHost.Enabled = rdoConnect.Checked;
- txtPeerPort.Enabled = rdoConnect.Checked;
+ string output = "";
+
+ for (int i = 0; i < input.Length; i += 2) {
+ if (output != "")
+ output += " ";
+
+ int len = 2;
+ if (input.Length - i < 2)
+ len = input.Length - i;
+ output += input.Substring(i, len);
+ }
+
+ return output;
+ }
+
+ private void ShowCertificatePrompt(X509Certificate2 certificate)
+ {
+ txtX509Issuer.Text = certificate.Issuer;
+ txtX509Subject.Text = certificate.Subject;
+
+ AddCertificateField("Version", "V" + certificate.Version.ToString());
+ AddCertificateField("Serial number", certificate.SerialNumber);
+ AddCertificateField("Signature algorithm", certificate.SignatureAlgorithm.FriendlyName);
+ AddCertificateField("Valid from", certificate.NotBefore.ToString());
+ AddCertificateField("Valid to", certificate.NotAfter.ToString());
+
+ string pkey = BitConverter.ToString(certificate.PublicKey.EncodedKeyValue.RawData).Replace("-", " ");
+ AddCertificateField("Public key", certificate.PublicKey.Oid.FriendlyName + " (" + certificate.PublicKey.Key.KeySize + " bits)", pkey);
+
+ string thumbprint = PadText(certificate.Thumbprint);
+ AddCertificateField("Thumbprint", thumbprint);
+
+ tbcPages.SelectedTab = tabVerifyCertificate;
+ }
+
+ private void btnAddEndpoint_Click(object sender, EventArgs e)
+ {
+ EndpointInputBox eib = new EndpointInputBox();
+
+ if (eib.ShowDialog(this) == DialogResult.Cancel)
+ return;
+
+ ListViewItem lvi = new ListViewItem();
+ lvi.Text = eib.txtHost.Text;
+ lvi.SubItems.Add(eib.txtPort.Text);
+
+ lvwEndpoints.Items.Add(lvi);
+ }
+
+ private void lvwEndpoints_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ btnRemoveEndpoint.Enabled = lvwEndpoints.SelectedItems.Count > 0;
+ }
+
+ private void lvwX509Fields_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (lvwX509Fields.SelectedItems.Count == 0)
+ return;
+
+ ListViewItem lvi = lvwX509Fields.SelectedItems[0];
+
+ txtX509Field.Text = (string)lvi.Tag;
+ }
+
+ private void btnRemoveEndpoint_Click(object sender, EventArgs e)
+ {
+ while (lvwEndpoints.SelectedItems.Count > 0) {
+ lvwEndpoints.Items.Remove(lvwEndpoints.SelectedItems[0]);
+ }
}
}
}