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 :: how to fetch all git branches 
Shell :: git clone directory from repository 
Shell :: laravel nginx 404 not found 
Shell :: TestStand hexadecimal chars 
Shell :: stop openhab2 service 
Shell :: delphes install 
Shell :: mkdir -p exemple 
Shell :: Install SWAY on debin ubuntu 
Shell :: hadoop change directory ownership 
Shell :: nextcloud config.php location docker 
Shell :: créer un fichier powershell 
Shell :: jenkins graphic installation ubuntu 18.04 
Shell :: linux repeat command every second 
Shell :: kill traffic to port linux 
Shell :: curl cookie get 
Shell :: CHROME_EXECUTABLE brave 
Shell :: To permanently fix this problem, please run: npm ERR! sudo chown -R 1000:1000 
Shell :: navigate to C drive in bash on WSL-Ubuntu 
Shell :: linux cli chart 
Shell :: kent c dodds 
Shell :: aws code commit Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights 
Shell :: whatsapp web for ubuntu 
Shell :: powershell add to list 
Shell :: sublimetext 
Shell :: linux find command 
Shell :: adding directory to path 
Shell :: bash array number range from var 
Shell :: kill a port in linux 
Shell :: importerror no module named numpy ubuntu 
Shell :: after installing cypress is there a cypress directory 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =