How do I execute a command in cmder using powershell? - powershell

as part of an onboarding process I write a .ps1 script that installs every neccessary program, sets up the dev environments,...
Also I create SSH keys, therefore I have to use openSSL. The command openssl genrsa 4096 | openssl pkcs8 -topk8 -inform PEM -out key.p8 works fine using cmder (and the pub key as well).
But:
The onboarding script is a .ps1 script. Inside this script I install the CMDER (which is used later on in VS Code). I can't create the openssl key using PowerShell. Is there a way to open the CMDER window in the .ps1 script?
So far the Start-Process C:\cmder\cmder.exe -ArgumentList "\task 'openssl genrsa 4096 | openssl pkcs8 -topk8 -inform PEM -out key.p8'" creates an error. Either the command is not recognized or I use the wrong parameter for executing a command (see this link to the CMDER gitlab project: https://github.com/cmderdev/cmder#cmderexe-command-line-arguments).

Related

Poly1305 command line in OpenSSL

I am trying to execute basic ChaCha20-Poly1305 cipher suite using OpenSSL without any TLS or any Apache server. I have succesfully encrypted my text with Chacha20 openssl command but I am unable to produce Poly1305 MAC authentication. I am using dgst command and it seems it only generates SHA algorithm. I am using 1.1.1 openssl version. Can somebody tell me which command shall I use?
If you have a file F you can compute the Poly1305 with the following command:
openssl dgst -mac poly1305 -macopt key:abcd1234abcd1234abcd1234abcd1234 <PATH_TO_F>
The key may also be a hex value with 32 bytes:
openssl dgst -mac poly1305 -macopt hexkey:ee00000000000000000000000000000000000000000000ffffffffffffffffff <PATH_TO_F>

I can't run postgresql server after I change ssl = on in postgresql.conf in Windows Server 2012.

After changing ssl = on in postgresql.conf, postgresql server can't run anymore. What settings are needed more to enable SSL. I am using postgresql on Windows Server 2012.
Here is my research
https://www.postgresql.org/docs/current/static/ssl-tcp.html#SSL-FILE-USAGE
As in the link, you need to create a Self-signed Certificate first.
To do that you need OPENSSL. I use apache 2.4.12 and it has OpenSSL 1.01.1m ver.
You can also download and install easily from internet.
Then go to the folder that Openssl install from cmd. In my case, "cd C:\Program Files\Apache Software Foundation\Apache 24\bin".
Then execute the command as in the above link says.
openssl req -new -text -out server.req
openssl rsa -in privkey.pem -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt (In Windows OS you can only do those steps.)
Then copy server.key C:\ (Anywhere you want..)
copy server.crt C:\
Look for the files you copy (server.key & server.crt) and copy them to PostgreSQL data folder.
Then change ssl = on in postgresql.conf file.
Restart the postgresql service.
Done!!!

makecert requesting password

Given the following powershell function:
function CreateRootCertificate($certificateName, $path, $certificatePassword){
makecert -r -pe -n "CN=$certificateName" -sky exchange $path\$certificateName.cer -sv $path\$certificateName.pvk
pvk2pfx.exe -pvk $path\$certificateName.pvk -spc $path\$certificateName.cer -pfx $path\$certificateName.pfx -po $certificatePassword
}
makecert is prompting me to enter the certificate password. From what I understand it wont do this, if the *.pvk file already exists, and has a password set upon it.
SO my question is, how do I split my single makecert command in two separate commands, one to create the *.pvk and another to create the *.cer?
Many Thanks
“Makecert.exe” will always prompt for password when creating a private key.
One way around this prompt may be to write code/macro, to find the password input window and enter your password in it.
The other is to use OpenSSL. In OpenSSL use
openssl genrsa -aes128 -passout pass:password -out $certificateName.pvk 2048
to generate a private key with passphrase.
If you do work with certificates a lot, I would recomend to forget “makecert.exe” altogether and use OpenSSL instead.

How to generate certificate file for svn server, and import

I would like to use svn server to share source code in a repository among computers on a home network. I have svnserver and openssl installed on the computer with the repository. Can someone give me step by step instructions on generating a certificate, incorporating into svnserver, putting the certificate on the other computers, and accessing the repository from eclipse.
The computers are running versions of windows.
I'm following the steps at
http://community.spiceworks.com/how_to/show/1469-how-to-become-your-own-certificate-authority-and-secure-spiceworks
and have put the following commands into a script file for cygwin
# Generate CA root certificate
openssl req -new -x509 -extensions v3_ca \
-keyout cakey.pem -out cacert.pem -days 3650
# Move to /etc/ssl
mv cakey.pem /etc/ssl/private
mv cacert.pem /etc/ssl/certs.
# Generate Secure and Insecure Keys
openssl genrsa -des3 -out server.key 2048
openssl rsa -in server.key -out server.key.insecure
mv server.key server.key.secure
mv server.key.insecure server.key
At this point, I think I copy the contents of server.key and server.key.insecure into the file
C:\Program Files (x86)\VisualSVN Server\certs\server.pem
but, I'm not sure about that. Also, what file do I copy to the other computers and how to connect eclipse to the repository.
Also, is there an easier way to do this besides using svnserver, since all the machines are on the same home network, and they are running versions of windows?

Convert .p12 file to .pem using Terminal app in Mac "No such file or directory" error?

I have export the "Apple Development IOS Push Service" certificate from Keychain Access and save the "apns-dev-cert.p12" in my desktop. I want to enable Apple Push Notification I have followed these blogs to convert apns-dev-cert.p12 to apns-dev-cert.pem from Terminal app,
http://bhaveshkumbhani.blogspot.in/2011/12/convert-p12-to-pem-for-apns.html
http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12
Apple Document RemoteNotificationPG.pdf
I have used these commands in Terminal,
1.V******-Ms-iMac-2:~ c*****$ openssl pkcs12 -in apns-dev-cert.p12 -out apns-dev-cert.pem -nodes -clcerts
Response : Error opening input file apns-dev-cert.p12
Certificates.p12: No such file or directory
2.V******-Ms-iMac-2:~ c*****$ openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
Response : Error opening input file apns-dev-cert.p12
Certificates.p12: No such file or directory
3.V******-Ms-iMac-2:~ c*****$ ls
All_iOS_Applications_Document.doc Pictures
AppStoreSubmissionSteps.doc Public
Desktop Sites
Documents Softwares
Downloads Untitled.txt
Dropbox pic
Library pic.zip
Movies pricelist.txt
Music sms.txt
Nana_User_Case_Documents.odt
4. V******-Ms-iMac-2:~ c*****$ cd
5.V******-Ms-iMac-2:~ c*****$ cd/Users/c*****/Desktop/A
-bash: cd/Users/c*****/Desktop/A: No such file or directory
I can't understand why the terminal always saying "No such file or directory"?. Where i need to save the .p12 file in my Mac?
Am using Terminal app Version 2.1.2 (273.1). Mac OS X version 10.6.8.
Can you please what i need to do? I need to enable the APNS by using the .pem file. Please help me. Thanks in advance.
EDIT:
I have added tried Raywenderlich.com termial code in my mac Terminal app
1. V******-Ms-iMac-2:~ c*****$ pwd
/Users/creagx
2. V******-Ms-iMac-2:~ c*****$ cd/ Users/creagx/Desktop/A
-bash: cd/: No such file or directory
Type in:
cd /Users/creagx/Desktop/A (Space between cd and Slash: cd[SPACE]/Users/creagx/Desktop/A
if there is a Folder named "A" on your Desktop where the p12 files are in.
Then go on with the other Commands
openssl pkcs12 -in apns-dev-cert.p12 -out apns-dev-cert.pem -nodes -clcerts
openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12