Debian之CA认证

2023-05-16

安装服务
root@debian:/etc/chrony# apt install -y openssl

配置文件
root@debian:/etc/chrony# cd /etc/ssl/
root@debian:/etc/ssl# ls
certs  openssl.cnf  private
root@debian:/etc/ssl# vim openssl.cnf 

在这里插入图片描述
在这里插入图片描述
创建目录

root@debian:/etc/ssl# cd CA/
root@debian:/etc/ssl/CA# ls -l
total 0
root@debian:/etc/ssl/CA# mkdir certs
root@debian:/etc/ssl/CA# mkdir crl
root@debian:/etc/ssl/CA# touch index.txt
root@debian:/etc/ssl/CA# mkdir newcerts
root@debian:/etc/ssl/CA# echo "01" > serial
root@debian:/etc/ssl/CA# ls -l
total 16
drwxr-xr-x 2 root root 4096 Apr 30 02:55 certs
drwxr-xr-x 2 root root 4096 Apr 30 02:56 crl
-rw-r--r-- 1 root root    0 Apr 30 02:57 index.txt
drwxr-xr-x 2 root root 4096 Apr 30 02:57 newcerts
-rw-r--r-- 1 root root    3 Apr 30 02:58 serial
root@debian:/etc/ssl/CA# mkdir private


root@debian:/etc/ssl/CA# openssl genrsa -out private/cakey.pem
Generating RSA private key, 2048 bit long modulus (2 primes)
...........................+++++
....+++++
e is 65537 (0x010001)
root@debian:/etc/ssl/CA# openssl req -new -x509 -key private/cakey.pem -out cacert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:ca.jnds.com
Email Address []:

在客户端操作

root@debian:~# apt install openssl 
root@debian:/etc/apache2/ssl# openssl genrsa -out www.key
Generating RSA private key, 2048 bit long modulus (2 primes)
........+++++
...............+++++
e is 65537 (0x010001)

e is 65537 (0x010001)

root@debian:/etc/apache2/ssl# openssl req -new -key www.key -out www.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:www.jnds.com
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
root@debian:/etc/apache2/ssl# ls -l
总用量 8
-rw-r--r-- 1 root root  989 4月  30 15:45 www.csr
-rw------- 1 root root 1675 4月  30 15:43 www.key
root@debian:/etc/apache2/ssl# scp www.csr root@192.168.10.150:/root

回到服务器

root@debian:~# openssl ca -in www.csr -out www.crt
Using configuration from /usr/lib/ssl/openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 1 (0x1)
        Validity
            Not Before: Apr 30 07:48:01 2021 GMT
            Not After : Apr 30 07:48:01 2022 GMT
        Subject:
            countryName               = CN
            stateOrProvinceName       = Some-State
            organizationName          = Internet Widgits Pty Ltd
            commonName                = www.jnds.com
        X509v3 extensions:
            X509v3 Basic Constraints: 
                CA:FALSE
            Netscape Comment: 
                OpenSSL Generated Certificate
            X509v3 Subject Key Identifier: 
                DA:18:CB:41:4C:0B:68:8A:1A:1C:B6:23:90:72:34:8C:AC:DC:54:C1
            X509v3 Authority Key Identifier: 
                keyid:48:AB:7C:46:74:D2:36:B9:AC:CC:20:07:7C:BD:10:09:AF:8F:65:71

Certificate is to be certified until Apr 30 07:48:01 2022 GMT (365 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated

root@debian:~# scp www.crt root@192.168.10.130:/root

进入客户端

root@debian:~# mv www.crt /etc/apache2/ssl/
root@debian:~# cd /etc/apache2/ssl/
root@debian:/etc/apache2/ssl# rm www.csr 
root@debian:/etc/apache2/ssl# ls -l
总用量 12
-rw-r--r-- 1 root root 4465 4月  30 15:49 www.crt
-rw------- 1 root root 1675 4月  30 15:43 www.key

root@debian:/etc/apache2# a2enmod ssl

如果出现以下情况就重启Apache2

root@debian:/etc/apache2# a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
  systemctl restart apache2
root@debian:/etc/apache2# systemctl restart apache2
root@debian:/etc/apache2# a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Module socache_shmcb already enabled
Module ssl already enabled

root@debian:/etc/apache2# cd sites-available/
root@debian:/etc/apache2/sites-available# ls -l
总用量 12
-rw-r--r-- 1 root root 1332 8月   8  2020 000-default.conf
-rw-r--r-- 1 root root 6338 8月   8  2020 default-ssl.conf
root@debian:/etc/apache2/sites-available# vim default-ssl.conf 

root@debian:/etc/apache2/sites-available# vim jnds.conf

在这里插入图片描述

root@debian:/etc/apache2# vim ports.conf 

在这里插入图片描述
root@debian:/etc/apache2# vim sites-available/default-ssl.conf在这里插入图片描述
重启

root@debian:/etc/apache2/sites-available# /etc/init.d/apache2 restart 

root@debian:/etc/apache2/sites-available# apt install net-tools 
root@debian:/etc/apache2/sites-available# netstat -tunlp | grep '443'

root@debian:/etc/apache2# mkdir /var/www/jnds
root@debian:/etc/apache2# echo "jnds.com" > /var/www/jnds/index.html

进入服务器安装

root@debian:/etc/ssl/CA# apt install lrzsz

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Debian之CA认证 的相关文章

随机推荐

  • HDU第六场

    1002 https vjudge net contest 387998 题目 xff1a https vjudge net contest 387998 problem B 思路 xff1a 题意是给一个等式 xff0c 判断是否能在2
  • 解决服务器不能复制粘贴的方法

    1 打开远程的服务器 在服务器的任务栏随便一块空白处右击鼠标 选择 启动任务管理器 2 在打开的任务管理器中 我们找到 rdpclip exe 这个进程 如果没有找到就算了 3 找到这个进程后 选择 34 结束进程 34 4 然后再往服务器
  • 最小二乘法,最大似然估计什么情况下统一

    机器学习中 线性回归算法用到最小二乘法 逻辑回归算法用到最大似然估计 在推导梯度的过程中 发现结果一样 这是为何呢 目录 一 最小二乘法1 基本思想2 作用3 如何求解最小二乘法 二 最大似然估计1 概念2 似然估计的思想是3 如何求解最大
  • Linux 系统目录结构

    树状目录结构 bin xff1a bin 是 Binaries 二进制文件 的缩写 这个目录存放着最经常使用的命令 boot xff1a 这里存放的是启动 Linux 时使用的一些核心文件 xff0c 包括一些连接文件以及镜像文件 dev
  • MySql8.x版本my.cnf文件配置详解

    my cnf for 8 0版本 注意 xff1a 个别建议可能需要根据实际情况作调整 xff0c 请自行判断或联系我 xff0c 本人不对这些建议结果负相应责任 本配置文件主要适用于MySQL 8 0版本 client port 61 3
  • YouTube推荐系统

    The YouTube Video Recommendation System RecSys2010 实际的YouTube推荐系统在不断的改进 我们这里看到的是2010年RecSys会议上YouTube的一篇关于推荐的文章 xff0c 事实
  • Mysql配置文件/etc/my.cnf解析

    Mysql配置文件 etc my cnf解析 客户端设置 client port 61 3306 默认情况下 xff0c socket文件应为 usr local mysql mysql socket 所以可以ln s xx tmp mys
  • 数据结构:使用链栈实现回文判断

    题目 xff1a 回文判断 试写一个算法 xff0c 判断依次读入的一个以 64 为结束符的字母序列 xff0c 是否为形如 序列1 amp 序列2 模式的字符序列 其中序列1和序列2中都不含字符 amp xff0c 且序列2是序列1的逆序
  • Python 读取pdf

    好久没有更新 xff0c 主要是工作比较忙 抽空记录一个最近用到的东西 用python 读取pdf 话不多少 还是先上代码 span class token keyword import span pdfplumber span class
  • Python中的字符串相似度

    文章目录 一 Python字符串相似度二 Python相似度评估1 在计算图片的相似度时 xff0c 我自己用到过余弦距离2 欧式距离3 曼哈顿距离4 切比雪夫距离5 闵可夫斯基距离6 标准化欧氏距离7 马氏距离8 编辑距离 一 Pytho
  • 浅谈linux开发板用户登录之getty/login/passwd

    最近在排查一个关于用户登录的问题 xff0c 需要了解开发板启动以及远程登录进行用户名和密码验证背后的原理 经过查询学习 xff0c 简单总结如下 文章目录 前言一 Linux开发板登录机制二 getty login passwd1 get
  • 【实用技巧】rpm包下载,安装。获取rpm资源

    1 rpm包下载 我们使用yum install命令的时候一般下载下来会直接安装 xff0c 但是如果我们只想下载rpm包而不安装该怎么做呢 xff1f 安装 yum utils yum span class token function
  • 新手折腾wsl

    新手折腾wsl图形界面 本文记录一些本人 xff08 未学习Linux相关知识 xff09 折腾wsl踩过的坑 xff0c 以及参考的有效的解决方案 换源 这个搞过的都懂 xff0c 不翻墙的话 xff0c 用本身的那个源 xff0c 更新
  • Windows server

    显示win server信息 xff1a 进入cmd下输入systeminfo 启动控制台 没有功能可以添加 xff1a mmc 启动服务器管理器 xff1a services msc 进入防火墙的配置 xff1a wf msc 添加Win
  • 配置与管理DNS服务器

    实训目的 项目环境及要求 win2012 1 xff08 已经安装了long com域 xff09 xff08 并且是long com的域控 xff09 win2012 4 xff08 在这台服务器上部署DNS服务 xff09 win7 x
  • 配置与管理Web和FTP服务器

    实训目的 项目环境要求 win2012 1 xff1a 已经安装long com的域并且已经安装DNS win2012 4 xff1a 部署服务 win7 安装服务 添加功能 勾选 安装完成 进入IIS管理器 在此完成网站的创建和FTP的创
  • 公式推导

    公式推导 事件为相互独立的情况 xff1a n 个相互独立且服从相同分布的事件 X 1 X 2 X n xff0c 其标准差为 期望为 则总的的事件的期望和方差分别为 xff1a E X 1 43 X 2 43 X n
  • Windows 10 docker 容器添加新端口映射的方法与步骤

    在Docker容器已经创建后 xff0c 需要添加新的端口映射 xff0c 即对已经存在的Docker容器添加新的端口映射 xff0c 可以通过以下步骤来添加 xff0c 即通过修改配置文件的方法 1 Windows 10 下 Docker
  • 配置yum源挂载mount /dev/sr0 /iso报错mount: 在 /dev/sr0 上找不到媒体

    span class token punctuation span root 64 localhost span class token punctuation span span class token comment umount de
  • Debian之CA认证

    安装服务 root 64 debian etc chrony span class token comment apt install y openssl span 配置文件 root 64 debian etc chrony span c