Skip to content

Commit

Permalink
Add password to command line
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSyfuhs committed Jul 15, 2021
1 parent 26fb84f commit 8293e38
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Bruce/CommandLine/KerberosInitCommand.cs
Expand Up @@ -117,6 +117,9 @@ public KerberosInitCommand(CommandLineParameters parameters)
[CommandLineParameter("config", Description = "Config")]
public override string ConfigurationPath { get; set; }

[CommandLineParameter("password", Description = "Password")]
public string Password { get; set; }

public override async Task<bool> Execute()
{
if (await base.Execute())
Expand Down Expand Up @@ -297,9 +300,14 @@ private KerberosCredential ParseCredential(Krb5Config config)
}
else
{
this.Write(SR.Resource("CommandLine_KInit_PassPrompt", this.PrincipalName));
string password = this.Password;

var password = this.ReadMasked();
if (string.IsNullOrWhiteSpace(password))
{
this.Write(SR.Resource("CommandLine_KInit_PassPrompt", this.PrincipalName));

password = this.ReadMasked();
}

if (string.IsNullOrWhiteSpace(password))
{
Expand Down
18 changes: 18 additions & 0 deletions Bruce/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Bruce/Strings.resx
Expand Up @@ -216,6 +216,9 @@
<data name="CommandLine_KerberosInitCommand_Certificate" xml:space="preserve">
<value>Locate a certificate and use PKINIT to authenticate the user.</value>
</data>
<data name="CommandLine_KerberosInitCommand_Config" xml:space="preserve">
<value>Provide the path to a configuration to use for initialization.</value>
</data>
<data name="CommandLine_KerberosInitCommand_CredNotFound" xml:space="preserve">
<value>Error: Credential not found</value>
</data>
Expand Down Expand Up @@ -255,6 +258,9 @@
<data name="CommandLine_KerberosInitCommand_NoProxy" xml:space="preserve">
<value>Do not request a proxiable ticket.</value>
</data>
<data name="CommandLine_KerberosInitCommand_Password" xml:space="preserve">
<value>Optionally provide the password to authenticate the user.</value>
</data>
<data name="CommandLine_KerberosInitCommand_Proxy" xml:space="preserve">
<value>Request a proxiable ticket.</value>
</data>
Expand Down

0 comments on commit 8293e38

Please sign in to comment.