"csr contains no data" when signing CSR on a local instance of Vault on a windows machine - hashicorp-vault

I'm trying to sign an ICA with Vault following this tutorial
And I am the stage where I'm signing the intermediate and I keep getting a "csr contains no data" error, I tried #file, I also tried getting the file contents on a variable and even in-lining the entire file, someone mentioned backticks and online but it doesn't read it properly on the powershell terminal
here is the command I'm using
vault write -format=json rootCA/root/sign-intermediate `
>> issuer_ref="root" `
>> csr=#nt.csr `
>> format=pem_bundle ttl="43800h" `
>> | jq -r ".data.certificate" > int.cert.pem
and the full error
Error writing data to rootCA/root/sign-intermediate: Error making API request.
URL: PUT http://localhost:8200/v1/rootCA/root/sign-intermediate
Code: 400. Errors:
* csr contains no data
EDIT: I used wireshark to investigate the message and if I am using the # notation then I send it with \u0000 between each character...
but if I inline it, it seems fine and yet I still get the error...

I inlined the CSR again, but this time ensuring to keep the new lines...
This worked

Related

SSH Key - How can I add a new key to github?

I'm attempting to add pbcopy < ~/.ssh/id_rsa.pub in GitHub but this is the error message I'm getting: Key is invalid. You must supply a key in OpenSSH public key format.
Any suggestions on how I can add this? I've googles several different commands.
Thanks in advance!
libsecp256k1-static/stable 20200902-1 arm
Static libraries for libsecp256k1
Try to go to the file destination (~/.ssh/id_rsa.pub) and copy past it into GitHub. Follow steps 1, 2 & 3 to get to where you want to paste it. After Copy pasting use command (in Git Bash) ssh -t git#github.com to authenticate.
For Windows users, there are two things to consider
your console should parse quotation and double quotation in the right order.
curl needs quotation for JSON properties and keys.
So how can we debug it:
Add "-v --trace-ascii -" to the curl command to see log for command.
Use echo or write-host for your data in cmd or PowerShell
It is so important to make sure that curl receives valid JSON data.
See an example for Windows PowerShell here

AgeStore Fails to Remove Expired Debug Symbol Files

I’m trying to use AgeStore to remove some expired symbol files. I’ve written a Powershell script in which the AgeStore command works sometimes, but, not always.
For example, my symbol store contains symbol files dating back to 2010. I’d like to clean out the “expired” symbols because they are no longer needed. To that end, I use the -date command line argument to specify “-date=10-01-2010”. Additionally, I use the “-l” switch to force AgeStore to
Causes AgeStore not to delete any files, but merely to list all the
files that would be deleted if this same command were run without the
-l option.
Here’s a snippet of the script code that runs…
$AgeStore = "$DebuggingToolsPath\AgeStore"
$asArgs = "`"$SymbolStorePath`" -date=$CutoffDate -s -y "
if ($WhatIf.IsPresent) { $asArgs += "-l" }
# determine size of the symbol store before delete operation.
Write-Verbose ">> Calculating current size of $SymbolStorePath before deletion.`n" -Verbose
">> $SymbolStorePath currently uses {0:0,0.00} GB`n" -f (((Get-ChildItem -R $SymbolStorePath | measure-object length -Sum ).Sum / 1GB))
Write-Verbose ">> Please wait...processing`n`n" -Verbose
& $AgeStore $asArgs
When the above code runs, it returns the following output…
processing all files last accessed before 10-01-2010 12:00 AM
0 bytes would be deleted
The program 'RemoveOldDebugSymbols.ps1: PowerShell Script' has exited
with code 0 (0x0).
I have verified that there are symbol files with dates earlier than “10-01-2010” in the symbol store. I’ve subsequently tried the same experiment with a different cutoff date, “11-01-2015” and the output indicates that there are several files it would have deleted, but, not those that are from 2010. I’m at a loss as to what may cause the discrepancy.
Has anyone tried to delete symbol files from a symbol store using AgeStore? If so, have you run into this problem? How did you resolve it?
I’ve tried to resolve this many different ways using AgeStore. For the sake of moving forward with a project, I’ve decided to rewrite the script to use the SymStore command with a delete transaction. Basically, I created a list of the debug symbol transactions that should be removed and wrote a loop that iterates over the list and deletes each entry one at a time.
Hope this is helpful for anyone who runs into the same problems.
EDIT: Per request....I cannot post the entire script, but, I used the following code in a loop as a replacement for the AgeStore command.
$ssArgs = ".\symstore.exe del /i $SymbolEntryTransactionID /s `"$SymbolStorePath`""
Invoke-Expression $ssArgs

Unsure of how to proceed with creating ec2-consisten-snapshot

I was just put on a task to try and debug and figure out why our ec2-consistent-snapshot script isn't working.
Our lead programmer followed this blog post.
We have a .sh script that we'd like to take the snapshot and it looks like this:
#!/bin/sh
/opt/aws/bin/ec2-consistent-snapshot --aws-access-key-id MYACCESSKEY --aws-secret-access-key MYSECRETKEY --freeze-filesystem /vol --mysql --mysql-host localhost --mysql-socket /var/lib/mysql/mysql.sock --mysql-username USERNAME --mysql-password PASSWORD --description "Demo MySQL data volume: $(date +%c)" vol-MYVOL
If I run this by doing sudo ./snapshot_script.sh I get a single error:
ec2-consistent-snapshot: ERROR: create_snapshot: File does not exist: at /usr/share/perl5/vendor_perl/Net/Amazon/EC2.pm line 232
I of course followed this error and line 232 in EC2.pm is this:
my $ref = $xs->XMLin($xml);
I have 0 perl experience and I don't know what this could be doing.
Any help would be wonderful.
The Net::Amazon::EC2 that I'm looking at on CPAN has that line at 252, not 232 so perhaps you are not on the latest version. Looking above that line, the program has attempted to do a "query to sign" using lots of the security parms. I suspect there is a problem with the authentication keys you are using. There is a debug flag, you might want to turn that on to generate more messages.
If you go to this page, you will see that XMLin() is a function of XML::Simple, and it takes a file as an argument. So, $xml is presumably a variable that contains an xml file name. That file does not exist.
The next step would be to trace the error back into the source code of ec2-consistent-snapshot, in order to see how it is calling XML::Simple and where the bad value gets passed in.

Can't create a key of the Subject <'MyCAContainerName'>

using makecert i have written the commade:
makecert -pe -n "CN=Myauthority" -sr localmachine -ss Root -a sha256 -cy authority -r -sk MyCAContainerName -sky exchange -sp "Microsoft RSA Schannel Cryptographic Provider " -sy 12 -len 2048 certif.cer;
i recieved an error
Error: Can't create the key of the Subject <'MyCAContainerName'>
In seeking the solution, I discovered that the problem arises because I did not Authorizations on machineKey file : (C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys ), the
following link explains better what I'm saying;
http://support.microsoft.com/kb/278381
I followed the same procedures in order to have enough permissions to the a machine key, but the problem is always posed
It seems that Can't create the key of the subject is a fairly generic error, however, what follows after it may give a clue.
While it may be caused by permissions errors (e.g. makecert.exe error: Can't create the key of the subject), I have also seen the error of the form Can't create the key of the subject ('<some guid>') caused by an incorrect parameter to the -sp argument.
In your case, Error: Can't create the key of the Subject <'MyCAContainerName'> would make me guess that there is something wrong with the -sk MyCAContainerName portion of the command, but the upshot is, if it is not something with permissions, than it is likely an incorrect command argument or combination of arguments.
Master,
I Ran on the same error. I solved it running command prompt as an administrator user.
MV
Its late but I have the solution to this. First execute the command as you are, it will give the error Error: Can't create the key of the Subject <'MyCAContainerName'>. But it will create a .pvk file. Don't delete it. Instead execute the command again, but this time remove -sk MyCAContainerName from the command. And it will create your certificate.
In my case the C drive did not have enough space. I cleared some unwanted files and folders and it worked.

Perl script not sending mail and not unlink - ing

I have some scripts that I didn't write... they search a Squid log database and then create a spreadsheet and email it and then delete the .pid and .xls files it created.
The scripts were using NTLM for one of it's variables (request_user)... I changed it to a manually entered text field.
I don't know perl and the scripts are not working.
The .pid and .xls are getting created but nothing gets emailed and the files don't get deleted (unlink)
Here is are the links to the request and generate files
http://www.the-greenes.net/spreadsheet_request-test.txt
http://www.the-greenes.net/spreadsheet_gen.txt
Can anyone help a limited guy with very limited perl skills?
Thanks
In the spreadsheet_gen script you have this line to setup address to smtp server:
my $mail_server=`10.0.1.98`;
Using backticks make it run command named 10.0.1.98 and assign its output into $mail_server variable. This is most likely wrong, try to replace backticks with regular apostrophes to create string:
my $mail_server = '10.0.1.98';
Can you see any error in your error.log? If $message->send ... fails, it dies with error message and nothing gets sent nor unlinked.