热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Apache服务器的搭建_站点的安全

协议http明文协议版本1.0(一次连接(三次握手),一次请求)1.1(一次连接多次请求)httpsmod_ssl协议加密httpd-2.2.3-43.el5.i386.rpmhttpd的主要httpd-devel-2.2.3-43.el5.i386.rpm关于开发的包(可以不装)httpd-manual-2.2.3-43.el5.i386.rpmhttpd的手
协议  http  明文协议 版本1.0 (一次连接(三次握手),一次请求)1.1(一次连接多次请求)      https   mod_ssl协议加密 httpd-2.2.3-43.el5.i386.rpm    httpd的主要  httpd-devel-2.2.3-43.el5.i386.rpm    关于开发的包(可以不装) httpd-manual-2.2.3-43.el5.i386.rpm    httpd的手册 Apache 的主根/etc/httpd (1)目录安全性 主配置文档 /etc/httpd/conf/httpd.conf Keepalive off    可以打开(一次连接多次请求) Maxkeepaliverequest   15  最大连接请求 父进程处理用户请求: 1.每来一个用户请求,父进程就派生一个子进程去处理用户请求 2.父进程保持几个空闲的子进程 模块:  dule prefork.c>  判断是否有该模块,有就执行中间内容,没有就判断下一个模块  StartServers       8         中间子进程数        MinSpareServers    5    最少空闲子进程             MaxSpareServers   20      最多空闲子进程          ServerLimit      256         同时在线用户数量  MaxClients       256         可以根据用户访问数量,性能来调  MaxRequestsPerChild  4000 每个子进程可以接受的请求后便终止掉,同时可释放内存垃圾            Listen  80   监听端口 Listen  800   创建基于虚拟主机的监听端口 LoadModule  后面是可以动态调用的模块   User apache   运行apache的用户 Group apache   运行apache的用户组 UseCanonicalName Off     做虚拟主机就为off DocumentRoot "/var/www/html"  默认该站点的主目录 目录安全性,实现站点得安全          Options FollowSymLinks     AllowOverride None   保证基本站点的安全性: Options Indexes FollowSymLinks  选项indexes  目录浏览属性,主页没人内容时可以看到主目录的一些文件   fllowsymlinks  在主目录中可以防止符号链接进行跳转 AllowOverride None   身份验证(all)  AllowOverride  all   Order allow,deny  先看deny,再看allow      Allow from all  允许访问的主机(可以设定某个ip)        Allow from all 做身份验证 编译一个文件:/var/www/html/.htaccess(身份验证的说明) authuserfile  /var/www/html/.httpasswd (验证时的账号文件,取名可随意) authtype  basic  (验证类型为基本)   authname “plesae input your name”  交互文字 require   valid-user (有效的账号来访问,或者直接指定某个用户)      创建账号文件:  htpasswd -c  /var/www/html/.httpasswd   user1(认可的账户)       -c表示创建一个新的  

Httpd -l  可以查看httpd的模块 访问日志 /var/log/httpd------>/etc/httpd/log /var/www/html    基本站点 /etc/httpd/run   记录apache在运行时状态参数 /etc/httpd/run/httpd.pid   记录apache服务器运行时进程的id号(父进程号) Ps -aux   查询所有进程  父进程不会为用户服务,子进程为用户服务  父进程管理子进程

(2)证书安全性

一、利用windows2008ca

 

 

此时CA服务器器已经做好

CA客户端得像CA服务器做一个请求,使用一个工具openssl,用这个工具产生一个请求文件

[root@workstation253 ~]# cd /etc/httpd/

[root@workstation253 httpd]# mkdir certs (创建一个目录,存放所有请求文件,钥匙等)

[root@workstation253 httpd]# cd certs/

先做钥匙,在根据钥匙产生请求文件

[root@workstation253 certs]# openssl genrsa 1024     (产生非对称加密算法,1024位长度)

Generating RSA private key, 1024 bit long modulus

..............................................++++++

..++++++

e is 65537 (0x10001)

-----BEGIN RSA PRIVATE KEY-----

MIICXQIBAAKBgQDImDeuIH3QvvlQJOFHomeSEosRNb6+WbKmkNzkwC9dDr6h2YOp

K9JBM/d+ajQbJy0h94qaRqx6GurJCBCTCwuABEqZAzAUL4N/SmMbNnNGI7kV51C0

2GAIeBIOVMaCE7FUvlIpnGt7kA6hEWXtRPA1pT3NHQMC1Hy6qqDh2P1gjQIDAQAB

AoGAQwJ+jz+xZ/t0A67eRvTcznI9XLlsh+AlCvmXoR8Gc3rKefzUu7201i1K/0Lx

NyTmMdOkzJbRZVT6m7+C8ewdocWrkvlsZpq+eZWqCLFghDBTbSObLBFpD45L/bvb

j8D94ICWZWzU2QLNHEcQ3CzCP2HWnPrZrXFtDgBv5QiyiGECQQDvZqjtluWlG+m6

Aq1/gLczkEx9bSikoBLgva56MhzxB9julQlyUnuto7nFJ8Rhr1+RlC5NofdH6Y8d

mkxR/JBZAkEA1oC/jrZnIlt3WNaYor04CSz3rvIKFa9d9fTgG2ROKdWVseMa6VlZ

aXYazfFMGboj5O+8MJPHVF8SXp3RoqarVQJBALWax9zr0isM4KGldF27k73+4bdn

/iPb9lYcLeYua7wAOvTJhBAAOCgBgmPoBdYghjvWD8X+bqpTp6hKK0kqcYkCQCUq

O4Zjji0CwgPvcpTHyhy04Nk78IlfUB1cZzP3xh8zdXNT0QbbR0Whg/VouHHAsZVq

ACY+hIvWyR0BpR/UVt0CQQCmPbK1k9pom9PaFK9iBdM9WiOq56GjFnMIU9T+j+9z

oc+MO+YEh2lFZxriy3IE2bcAeKayESTfHbDlHfFIGMu0

-----END RSA PRIVATE KEY-----  (产生了私钥,但是里面包含公钥)

[root@workstation253 certs]# openssl genrsa 1024 >httpd.key   (产生钥匙文件)

Generating RSA private key, 1024 bit long modulus

........++++++

.............................++++++

e is 65537 (0x10001)

[root@workstation253 certs]# chmod 600 httpd.key  (为了安全起见更改钥匙文件的权限)

根据钥匙文件产生一个证书的请求 

[root@workstation253 certs]# openssl req -new -key httpd.key -out httpd.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) [GB]:CN    国家

State or Province Name (full name) [Berkshire]:HENAN   省份

Locality Name (eg, city) [Newbury]:ZHENGZHOU    城市

Organization Name (eg, company) [My Company Ltd]:ll   单位名

Organizational Unit Name (eg, section) []:tec     部门名

Common Name (eg, your name or your server's hostname) []:www.ll.com   为哪个服务器申请

Email Address []:

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:

[root@workstation253 certs]# ll

total 8

-rw-r--r-- 1 root root 643 Sep  8 00:55 httpd.csr   产生了这个请求文件

-rw------- 1 root root 887 Sep  8 00:47 httpd.key

CA客户端把请求文件发给CA

 

 

CA客户端证书的下载:

将证书转移:

root@ttttttttt Server]# cd /etc/httpd/certs/

[root@ttttttttt certs]# ll

-rw-r--r-- 1 root root 1016 09-04 11:38 certnew.cer

-rw-r--r-- 1 root root  643 09-04 11:01 httpd.csr

-rw------- 1 root root  891 09-04 11:00 httpd.key

CA客户端证书的安装:

[root@ttttttttt Server]# yum -y install  mod_ssl    安装mod_ss

[root@ttttttttt certs]# vim /etc/httpd/conf.d/ssl.conf     编译mod_ss的配置文件

LoadModule ssl_module modules/mod_ssl.so        ssl动态模块

Listen 443                             监听端口为443

SSLCertificateFile /etc/httpd/certs/certnew.cer      指明证书文件  

SSLCertificateKeyFile /etc/httpd/certs/httpd.key     指明证书对应密钥文件

然后重启http服务

www服务器客户端访问这个接受过证书的CA证书的www服务器时,将服务器的证书设置为受信任:

 

 

 

 

使用linuxCA

自己做自签发的证书:

(1)产生自己的私钥并指明CA的目录

[root@ttttttttt ~]# cd /etc/pki/CA/       切换待CA目录下

[root@ttttttttt CA]# ll

drwx------ 2 root root 4096 2010-03-12 private        

[root@ttttttttt CA]# openssl genrsa 1024 >private/cakey.pem

Generating RSA private key, 1024 bit long modulus

....................................................................................++++++

..................++++++

e is 65537 (0x10001)

[root@ttttttttt CA]# chmod 600 private/*             更改私钥文件的权限

 编译[root@ttttttttt ~]# vim /etc/pki/tls/openssl.cnf 

45 dir             = /etc/pki/CA       指明CA的目录

2)产生一个自签发的证书(不需要请求文件)

[root@ttttttttt CA]# openssl  req -x509 -new -key private/cakey.pem -out cacert.pem -days 3655 

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) [GB]:CN

State or Province Name (full name) [Berkshire]:HENAN

Locality Name (eg, city) [Newbury]:ZHENGZHOU

Organization Name (eg, company) [My Company Ltd]:TT

Organizational Unit Name (eg, section) []:TEC

Common Name (eg, your name or your server's hostname) []:rootca.tt.com

Email Address []:

[root@ttttttttt CA]# ll

-rw-r--r-- 1 root root 1123 09-05 03:09 cacert.pem  产生的证书文件

drwx------ 2 root root 4096 09-05 03:03 private

3)让CA给服务器颁发证

[root@ttttttttt CA]# cd /etc/httpd/certs/

[root@ttttttttt certs]# opensslgenrsa 1024 >httpd.key

-bash: opensslgenrsa: command not found

You have new mail in /var/spool/mail/root

[root@ttttttttt certs]# openssl genrsa 1024 >httpd.key

Generating RSA private key, 1024 bit long modulus

...++++++

......................................++++++

e is 65537 (0x10001)               产生一个钥匙文件

[root@ttttttttt certs]# openssl req -new -key httpd.key -out httpd.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) [GB]:CN   

State or Province Name (full name) [Berkshire]:HENAN

Locality Name (eg, city) [Newbury]:ZHENGZHOU

Organization Name (eg, company) [My Company Ltd]:LL

[root@ttttttttt certs]# openssl req -new -key httpd.key -out httpd.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) [GB]:CN

State or Province Name (full name) [Berkshire]:HENAN

Locality Name (eg, city) [Newbury]:ZHENGZHOU

Organization Name (eg, company) [My Company Ltd]:TT

Organizational Unit Name (eg, section) []:TEC

Common Name (eg, your name or your server's hostname) []:www.ll.com

Email Address []:

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:

 产生一个请求

[root@ttttttttt certs]# ll

-rw-r--r-- 1 root root 643 09-05 03:23 httpd.csr    产生的请求文件

-rw-r--r-- 1 root root 887 09-05 03:20 httpd.key    产生的密钥文件

4)为客户端签发证书

[root@ttttttttt etc]# cd /etc/httpd/certs/

[root@ttttttttt certs]# openssl ca -in httpd.csr -out httpd.crt

Using configuration from /etc/pki/tls/openssl.cnf

Check that the request matches the signature

Signature ok

Certificate Details:

        Serial Number: 1 (0x1)

        Validity

            Not Before: Sep  4 19:50:10 2011 GMT

            Not After : Sep  3 19:50:10 2012 GMT var cpro_id = "u6885494";

推荐阅读
  • 如何在服务器主机上实现文件共享的方法和工具
    本文介绍了在服务器主机上实现文件共享的方法和工具,包括Linux主机和Windows主机的文件传输方式,Web运维和FTP/SFTP客户端运维两种方式,以及使用WinSCP工具将文件上传至Linux云服务器的操作方法。此外,还介绍了在迁移过程中需要安装迁移Agent并输入目的端服务器所在华为云的AK/SK,以及主机迁移服务会收集的源端服务器信息。 ... [详细]
  • 图解redis的持久化存储机制RDB和AOF的原理和优缺点
    本文通过图解的方式介绍了redis的持久化存储机制RDB和AOF的原理和优缺点。RDB是将redis内存中的数据保存为快照文件,恢复速度较快但不支持拉链式快照。AOF是将操作日志保存到磁盘,实时存储数据但恢复速度较慢。文章详细分析了两种机制的优缺点,帮助读者更好地理解redis的持久化存储策略。 ... [详细]
  • CentOS 7部署KVM虚拟化环境之一架构介绍
    本文介绍了CentOS 7部署KVM虚拟化环境的架构,详细解释了虚拟化技术的概念和原理,包括全虚拟化和半虚拟化。同时介绍了虚拟机的概念和虚拟化软件的作用。 ... [详细]
  • Linux服务器密码过期策略、登录次数限制、私钥登录等配置方法
    本文介绍了在Linux服务器上进行密码过期策略、登录次数限制、私钥登录等配置的方法。通过修改配置文件中的参数,可以设置密码的有效期、最小间隔时间、最小长度,并在密码过期前进行提示。同时还介绍了如何进行公钥登录和修改默认账户用户名的操作。详细步骤和注意事项可参考本文内容。 ... [详细]
  • 这是原文链接:sendingformdata许多情况下,我们使用表单发送数据到服务器。服务器处理数据并返回响应给用户。这看起来很简单,但是 ... [详细]
  • Centos7.6安装Gitlab教程及注意事项
    本文介绍了在Centos7.6系统下安装Gitlab的详细教程,并提供了一些注意事项。教程包括查看系统版本、安装必要的软件包、配置防火墙等步骤。同时,还强调了使用阿里云服务器时的特殊配置需求,以及建议至少4GB的可用RAM来运行GitLab。 ... [详细]
  • 禁止程序接收鼠标事件的工具_VNC Viewer for Mac(远程桌面工具)免费版
    VNCViewerforMac是一款运行在Mac平台上的远程桌面工具,vncviewermac版可以帮助您使用Mac的键盘和鼠标来控制远程计算机,操作简 ... [详细]
  • Webmin远程命令执行漏洞复现及防护方法
    本文介绍了Webmin远程命令执行漏洞CVE-2019-15107的漏洞详情和复现方法,同时提供了防护方法。漏洞存在于Webmin的找回密码页面中,攻击者无需权限即可注入命令并执行任意系统命令。文章还提供了相关参考链接和搭建靶场的步骤。此外,还指出了参考链接中的数据包不准确的问题,并解释了漏洞触发的条件。最后,给出了防护方法以避免受到该漏洞的攻击。 ... [详细]
  • Nginx使用AWStats日志分析的步骤及注意事项
    本文介绍了在Centos7操作系统上使用Nginx和AWStats进行日志分析的步骤和注意事项。通过AWStats可以统计网站的访问量、IP地址、操作系统、浏览器等信息,并提供精确到每月、每日、每小时的数据。在部署AWStats之前需要确认服务器上已经安装了Perl环境,并进行DNS解析。 ... [详细]
  • 阿里Treebased Deep Match(TDM) 学习笔记及技术发展回顾
    本文介绍了阿里Treebased Deep Match(TDM)的学习笔记,同时回顾了工业界技术发展的几代演进。从基于统计的启发式规则方法到基于内积模型的向量检索方法,再到引入复杂深度学习模型的下一代匹配技术。文章详细解释了基于统计的启发式规则方法和基于内积模型的向量检索方法的原理和应用,并介绍了TDM的背景和优势。最后,文章提到了向量距离和基于向量聚类的索引结构对于加速匹配效率的作用。本文对于理解TDM的学习过程和了解匹配技术的发展具有重要意义。 ... [详细]
  • Windows下配置PHP5.6的方法及注意事项
    本文介绍了在Windows系统下配置PHP5.6的步骤及注意事项,包括下载PHP5.6、解压并配置IIS、添加模块映射、测试等。同时提供了一些常见问题的解决方法,如下载缺失的msvcr110.dll文件等。通过本文的指导,读者可以轻松地在Windows系统下配置PHP5.6,并解决一些常见的配置问题。 ... [详细]
  • 生成对抗式网络GAN及其衍生CGAN、DCGAN、WGAN、LSGAN、BEGAN介绍
    一、GAN原理介绍学习GAN的第一篇论文当然由是IanGoodfellow于2014年发表的GenerativeAdversarialNetworks(论文下载链接arxiv:[h ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • 计算机存储系统的层次结构及其优势
    本文介绍了计算机存储系统的层次结构,包括高速缓存、主存储器和辅助存储器三个层次。通过分层存储数据可以提高程序的执行效率。计算机存储系统的层次结构将各种不同存储容量、存取速度和价格的存储器有机组合成整体,形成可寻址存储空间比主存储器空间大得多的存储整体。由于辅助存储器容量大、价格低,使得整体存储系统的平均价格降低。同时,高速缓存的存取速度可以和CPU的工作速度相匹配,进一步提高程序执行效率。 ... [详细]
  • 本文介绍了南邮ctf-web的writeup,包括签到题和md5 collision。在CTF比赛和渗透测试中,可以通过查看源代码、代码注释、页面隐藏元素、超链接和HTTP响应头部来寻找flag或提示信息。利用PHP弱类型,可以发现md5('QNKCDZO')='0e830400451993494058024219903391'和md5('240610708')='0e462097431906509019562988736854'。 ... [详细]
author-avatar
-晴天2602926075
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有