Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

Generate self signed certificate for localhost

openssl req -x509 -out localhost.crt -keyout localhost.key 
-newkey rsa:2048 -nodes -sha256 
-subj '/CN=localhost' -extensions EXT -config <( 
printf "[dn]
CN=localhost
[req]
distinguished_name = dn
[EXT]
subjectAltName=DNS:localhost
keyUsage=digitalSignature
extendedKeyUsage=serverAuth")
Comment

use localhost for self signed cert

######################
# Become a Certificate Authority
######################

# Generate private key
openssl genrsa -des3 -out myCA.key 2048
# Generate root certificate
openssl req -x509 -new -nodes -key myCA.key -sha256 -days 825 -out myCA.pem

######################
# Create CA-signed certs
######################

NAME=mydomain.com # Use your own domain name
# Generate a private key
openssl genrsa -out $NAME.key 2048
# Create a certificate-signing request
openssl req -new -key $NAME.key -out $NAME.csr
# Create a config file for the extensions
>$NAME.ext cat <<-EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = $NAME # Be sure to include the domain name here because Common Name is not so commonly honoured by itself
DNS.2 = bar.$NAME # Optionally, add additional domains (I've added a subdomain here)
IP.1 = 192.168.0.13 # Optionally, add an IP address (if the connection which you have planned requires it)
EOF
# Create the signed certificate
openssl x509 -req -in $NAME.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial 
-out $NAME.crt -days 825 -sha256 -extfile $NAME.ext
Comment

PREVIOUS NEXT
Code Example
Shell :: run sh file 
Shell :: time command windows 
Shell :: linux file full permission 
Shell :: boot pendrive windows cmd 
Shell :: edit alias terminal 
Shell :: linux calculator 
Shell :: install visual studio code ubuntu using command line 
Shell :: check for installed chaincode 
Shell :: git to png linux 
Shell :: Chaotic-AUR Team <team@chaotic.cx 
Shell :: apache2 enable xml extension 
Shell :: git push 
Shell :: remove image docker 
Shell :: start-process argumentlist with spaces powershell 
Shell :: sed disable disallow root login 
Shell :: cannot find module descriptiondatamatcherruleplugin 
Shell :: share folder from windows to ubuntu oracle VM 
Shell :: edit git commit 
Shell :: gradle init scala 
Shell :: Install Caddy on Debian 
Shell :: logger command to remote syslog 
Shell :: install adb on mac 
Shell :: how to stop a website running on port 8000 or any other port 
Shell :: ssh passwordless ssh-copy-id 
Shell :: bash get line from file 
Shell :: mkdir -p exemple 
Shell :: linux remove non-ascii characters from file 
Shell :: open download folder in mac 
Shell :: linux subsystem mount file into windows 
Shell :: git submodule update init no url found 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =