当前位置:   article > 正文

CENTOS上的网络安全工具(十五)cascade的部署_centos7 sysmon

centos7 sysmon

       这一篇,我们尝试在CentOS上安装并运用一款“小众”安全工具——Cascade。这个工具给人的感觉只是作为验证ATT&CK理念的一个存在,而且由于其运转还需要依托CAR,所以对数据的处理停留在主机log类的层面,可能暂时还不太受安全公司的待见吧。但是我们还是很关心它验证的那个理念,所以装起来把玩一下。

        一、Cascade简介

        Cascade是近年来相当火热的MITRE公司的ATT&CK框架的关联产品,在Github上开源。

         根据官方的介绍,Cascade主要目的是自动化“蓝队”(也就是安全防护一方)的大部分调查工作,以减轻调查人员在面对大量主机log时的晕眩感,帮助调查人员确定使用主机数据的可疑或恶意网络行动的程度。

        二、Cascade的安装部署

        1. 预备条件        

        根据官方给出的安装条件:

         一是需要在部署cascade前,安装Python3。对于Centos-Stream-8来说,这个条件基本是具备的。另外需要在此基础上安装requirements.txt中所列出的所有支持项——只不过对于有多版本python的系统来说,最好是在虚拟环境中去做这件事,否则安装过程中会出现模块匹配方面的错误。

        二是需要安装MongoDB服务

        三是说Cascade可疑读取Splunk或者ES中的数据,但是这些数据需要整理成CAR中规定的数据模型格式。另外,名为Unfetter Analytic的Github项目提供了一个将主机上通过sysmon获取的进程创建、网络访问等日志信息转储成为数据模型的一个参考实现。但是这一片在我们的测试中暂时还是不需要的。

        下面我们挨个安装这些内容。

        (1)Centos-Stream-8相关配置

        关闭Selinux

        Selinux配置文件在/etc/selinux/下,名为config

[root@bogon ~]# vim /etc/selinux/config

        修改SELINUX为disabled即可 

  1. # This file controls the state of SELinux on the system.
  2. # SELINUX= can take one of these three values:
  3. # enforcing - SELinux security policy is enforced.
  4. # permissive - SELinux prints warnings instead of enforcing.
  5. # disabled - No SELinux policy is loaded.
  6. SELINUX=disabled
  7. # SELINUXTYPE= can take one of these three values:
  8. # targeted - Targeted processes are protected,
  9. # minimum - Modification of targeted policy. Only selected processes are protected.
  10. # mls - Multi Level Security protection.
  11. SELINUXTYPE=targeted

        关闭防火墙

  1. [root@bogon ~]# systemctl stop firewalld.service
  2. [root@bogon ~]# systemctl disable firewalld.service
  3. Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
  4. Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
  5. [root@bogon ~]#

        (2)安装MongoDB

        由于Cascade的最近更新也在2年前了,所以可支持的MongoDB、ES的版本相应也都挺老的,如果使用较新的软件,Cascade会不支持。

        这里我们安装的是MongoDB的4.0.28版本版本,访问MongoDB的官方网站,在下载页面选择RedHat/CentOS 8.0的Server,4.0.28版本,在Download标签上右键鼠标,选择复制链接,可得到下载地址。

        下载

        在Centos-Stream-8下,使用wget,基于刚获得的链接下载rpm文件

  1. [root@bogon ~]# wget https://repo.mongodb.org/yum/redhat/8/mongodb-org/4.0/x86_64/RPMS/mongodb-org-server-4.0.28-1.el8.x86_64.rpm
  2. --2022-12-07 08:06:18-- https://repo.mongodb.org/yum/redhat/8/mongodb-org/4.0/x86_64/RPMS/mongodb-org-server-4.0.28-1.el8.x86_64.rpm
  3. 正在解析主机 repo.mongodb.org (repo.mongodb.org)... 18.65.185.55, 18.65.185.2, 18.65.185.40, ...
  4. 正在连接 repo.mongodb.org (repo.mongodb.org)|18.65.185.55|:443... 已连接。
  5. 已发出 HTTP 请求,正在等待回应... 200 OK
  6. 长度:17833400 (17M)
  7. 正在保存至: “mongodb-org-server-4.0.28-1.el8.x86_64.rpm”
  8. mongodb-org-server-4.0.28-1.el8.x8 100%[================================================================>] 17.01M 7.06MB/s 用时 2.4s
  9. 2022-12-07 08:06:21 (7.06 MB/s) - 已保存 “mongodb-org-server-4.0.28-1.el8.x86_64.rpm” [17833400/17833400])

         安装

  1. [root@bogon ~]# ls
  2. 公共 模板 视频 图片 文档 下载 音乐 桌面 anaconda-ks.cfg initial-setup-ks.cfg mongodb-org-server-4.0.28-1.el8.x86_64.rpm
  3. [root@bogon ~]# rpm -ivh mongodb-org-server-4.0.28-1.el8.x86_64.rpm
  4. 警告:mongodb-org-server-4.0.28-1.el8.x86_64.rpm: 头V3 RSA/SHA1 Signature, 密钥 ID e52529d4: NOKEY
  5. Verifying... ################################# [100%]
  6. 准备中... ################################# [100%]
  7. 正在升级/安装...
  8. 1:mongodb-org-server-4.0.28-1.el8 ################################# [100%]
  9. Created symlink /etc/systemd/system/multi-user.target.wants/mongod.service → /usr/lib/systemd/system/mongod.service.
  10. [root@bogon ~]#

        启动服务

  1. [root@bogon ~]# systemctl start mongod.service
  2. [root@bogon ~]# systemctl enable mongod
  3. [root@bogon ~]#

         查看状态,MongoDB使用的是27017端口

  1. [root@bogon ~]# systemctl status mongod.service
  2. ● mongod.service - MongoDB Database Server
  3. Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
  4. Active: active (running) since Wed 2022-12-07 08:09:58 EST; 1min 18s ago
  5. Docs: https://docs.mongodb.org/manual
  6. Main PID: 40639 (mongod)
  7. Memory: 56.3M
  8. CGroup: /system.slice/mongod.service
  9. └─40639 /usr/bin/mongod -f /etc/mongod.conf
  10. 12月 07 08:09:58 bogon systemd[1]: Starting MongoDB Database Server...
  11. 12月 07 08:09:58 bogon mongod[40637]: about to fork child process, waiting until server is ready for connections.
  12. 12月 07 08:09:58 bogon mongod[40638]: forked process: 40639
  13. 12月 07 08:09:58 bogon mongod[40637]: child process started successfully, parent exiting
  14. 12月 07 08:09:58 bogon systemd[1]: Started MongoDB Database Server.
  15. [root@bogon ~]#
  16. [root@bogon ~]# netstat -ltnp|grep 'mongo'
  17. tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 40639/mongod
  18. [root@bogon ~]#

         命令与查看版本

  1. [root@bogon ~]# mongod --version
  2. db version v4.0.28
  3. git version: af1a9dc12adcfa83cc19571cb3faba26eeddac92
  4. OpenSSL version: OpenSSL 1.1.1k FIPS 25 Mar 2021
  5. allocator: tcmalloc
  6. modules: none
  7. build environment:
  8. distmod: rhel80
  9. distarch: x86_64
  10. target_arch: x86_64
  11. [root@bogon ~]#

        (3)安装ElasticSearch

        虽然cascade不一定需要ES,它只是读取ES的数据。但秉承着既然装了,就都装上的原则(主要还是担心不装也许就在哪掉坑里的恐惧心里),我们还是把它装上的好。

        JAVA版本

        Java和ElasticSearch这两个家伙是一对儿活宝:java版本众多,版本号蜜汁魔幻,前面我们有掉过这样的坑

        比如,JDK1.8.0 可能也叫JDK8,而JDK1.1并不叫JDK11;我一直在用的版本叫做JDK11,而现在最新的版本似乎已经到了JDK20。从网上扒了一阵扒下来一张表和一张图,大致能够说明这种混乱的历史:

版本号别名发布时间
JDK 1.0  Oak(橡树)1996/1/23
JDK 1.1 1997/2/19
JDK 1.1.4 Sparkler(宝石)1997/9/12
JDK 1.1.5  Pumpkin(南瓜)1997/12/13
JDK 1.1.6  Abigail(阿比盖尔–人名)1998/4/24
JDK 1.1.7 Brutus(布鲁图-人名)1998/9/28
JDK 1.1.8  Chelsea(切尔西–城市名)1999/4/8
J2SE 1.2    Playground(运动场)1998/12/4
J2SE 1.2.1  none(无)1999/3/30
J2SE 1.2.2  Cricket(蟋蟀)1999/7/8
J2SE 1.3  Kestrel(美洲红隼)2000/5/8
J2SE 1.3.1  Ladybird(瓢虫)2001/5/17
J2SE 1.4.0  Merlin(灰背隼)2002/2/13
J2SE 1.4.1  grasshopper(蚱蜢)2002/9/16
J2SE 1.4.2  Mantis(螳螂)2003/6/26
Java SE 5.0 (1.5.0)  Tiger(老虎)2004/9/30
Java SE 6.0 (1.6.0)  Mustang(野马)Apr-06
Java SE 7.0 (1.7.0)  Dolphin(海豚)2011/7/28
Java SE 8.0 (1.8.0)  Spider(蜘蛛)2014/3/18
Java SE 9.0      2017/9/21
Java SE 10.0     2018/3/21
Java SE 11.0     2018/9/25

        这个图更清楚一些,精彩不精彩。

        更有甚之,当安装了openjdk 1.8.0,也就是openjdk 8,执行java -version,还能看到另一个版本号——Java虚拟机的版本号:

  1. [root@pig ~]# java -version
  2. openjdk version "1.8.0_322"
  3. OpenJDK Runtime Environment (build 1.8.0_322-b06)
  4. OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode)
  5. [root@pig ~]#

        清理Java环境

        安装Java前,还是需要尝试使用一下java指令,并且使用rpm指令确认一下centos有没有好心帮助我们预装我们不需要的版本。

  1. [root@bogon ~]# java -version
  2. bash: java: 未找到命令...
  3. [root@bogon ~]# rpm -qa|grep 'jdk'
  4. [root@bogon ~]# rpm -qa|grep 'java'
  5. [root@bogon ~]#

        列出可安装的Jdk

  1. [root@bogon ~]# yum list *jdk*
  2. 上次元数据过期检查:1:16:20 前,执行于 2022年12月07日 星期三 08时10分39秒。
  3. 可安装的软件包
  4. copy-jdk-configs.noarch 4.0-2.el8 appstream
  5. java-1.8.0-openjdk.x86_64 1:1.8.0.322.b06-11.el8 appstream
  6. java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.322.b06-11.el8 appstream
  7. java-1.8.0-openjdk-demo.x86_64 1:1.8.0.322.b06-11.el8 appstream
  8. java-1.8.0-openjdk-devel.x86_64 1:1.8.0.322.b06-11.el8 appstream
  9. java-1.8.0-openjdk-headless.x86_64 1:1.8.0.322.b06-11.el8 appstream
  10. java-1.8.0-openjdk-headless-slowdebug.x86_64 1:1.8.0.322.b06-11.el8 appstream
  11. java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.322.b06-11.el8 appstream
  12. java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.322.b06-11.el8 appstream
  13. java-1.8.0-openjdk-slowdebug.x86_64 1:1.8.0.322.b06-11.el8 appstream
  14. java-1.8.0-openjdk-src.x86_64 1:1.8.0.322.b06-11.el8 appstream
  15. java-11-openjdk.x86_64 1:11.0.17.0.8-2.el8 appstream
  16. java-11-openjdk-demo.x86_64 1:11.0.17.0.8-2.el8 appstream
  17. java-11-openjdk-devel.x86_64 1:11.0.17.0.8-2.el8 appstream
  18. java-11-openjdk-headless.x86_64 1:11.0.17.0.8-2.el8 appstream
  19. java-11-openjdk-javadoc.x86_64 1:11.0.17.0.8-2.el8 appstream
  20. java-11-openjdk-javadoc-zip.x86_64 1:11.0.17.0.8-2.el8 appstream
  21. java-11-openjdk-jmods.x86_64 1:11.0.17.0.8-2.el8 appstream
  22. java-11-openjdk-src.x86_64 1:11.0.17.0.8-2.el8 appstream
  23. java-11-openjdk-static-libs.x86_64 1:11.0.17.0.8-2.el8 appstream
  24. java-17-openjdk.x86_64 1:17.0.5.0.8-2.el8 appstream
  25. java-17-openjdk-demo.x86_64 1:17.0.5.0.8-2.el8 appstream
  26. java-17-openjdk-devel.x86_64 1:17.0.5.0.8-2.el8 appstream
  27. java-17-openjdk-headless.x86_64 1:17.0.5.0.8-2.el8 appstream
  28. java-17-openjdk-javadoc.x86_64 1:17.0.5.0.8-2.el8 appstream
  29. java-17-openjdk-javadoc-zip.x86_64 1:17.0.5.0.8-2.el8 appstream
  30. java-17-openjdk-jmods.x86_64 1:17.0.5.0.8-2.el8 appstream
  31. java-17-openjdk-src.x86_64 1:17.0.5.0.8-2.el8 appstream
  32. java-17-openjdk-static-libs.x86_64 1:17.0.5.0.8-2.el8 appstream
  33. prometheus-jmx-exporter-openjdk11.noarch 0.12.0-8.el8 appstream
  34. [root@bogon ~]#

        主要还是JDK8,JDK11,JDK17

        因为以前装JDK8掉坑,JDK17又太新,还是我们熟悉的JDK11吧:

        JDK11的安装

  1. [root@bogon ~]# yum install java-11* -y
  2. 上次元数据过期检查:1:22:02 前,执行于 2022年12月07日 星期三 08时10分39秒。
  3. 依赖关系解决。
  4. ============================================================================================================================================
  5. 软件包 架构 版本 仓库 大小
  6. ============================================================================================================================================
  7. 安装:
  8. java-11-openjdk x86_64 1:11.0.17.0.8-2.el8 appstream 468 k
  9. java-11-openjdk-demo x86_64 1:11.0.17.0.8-2.el8 appstream 4.4 M
  10. java-11-openjdk-devel x86_64 1:11.0.17.0.8-2.el8 appstream 3.4 M
  11. java-11-openjdk-headless x86_64 1:11.0.17.0.8-2.el8 appstream 41 M
  12. java-11-openjdk-javadoc x86_64 1:11.0.17.0.8-2.el8 appstream 16 M
  13. java-11-openjdk-javadoc-zip x86_64 1:11.0.17.0.8-2.el8 appstream 42 M
  14. java-11-openjdk-jmods x86_64 1:11.0.17.0.8-2.el8 appstream 337 M
  15. java-11-openjdk-src x86_64 1:11.0.17.0.8-2.el8 appstream 50 M
  16. java-11-openjdk-static-libs x86_64 1:11.0.17.0.8-2.el8 appstream 30 M
  17. 安装依赖关系:
  18. copy-jdk-configs noarch 4.0-2.el8 appstream 31 k
  19. javapackages-filesystem noarch 5.3.0-1.module_el8.0.0+11+5b8c10bd appstream 30 k
  20. lksctp-tools x86_64 1.0.18-3.el8 baseos 100 k
  21. ttmkfdir x86_64 3.0.9-54.el8 appstream 62 k
  22. tzdata-java noarch 2022d-1.el8 appstream 186 k
  23. xorg-x11-fonts-Type1 noarch 7.5-19.el8 appstream 522 k
  24. 启用模块流:
  25. javapackages-runtime 201801
  26. 事务概要
  27. ============================================================================================================================================
  28. 安装 15 软件包
  29. 总下载:527 M
  30. 安装大小:1.1 G
  31. 下载软件包:
  32. (1/15): copy-jdk-configs-4.0-2.el8.noarch.rpm 102 kB/s | 31 kB 00:00
  33. (2/15): java-11-openjdk-demo-11.0.17.0.8-2.el8.x86_64.rpm 3.8 MB/s | 4.4 MB 00:01
  34. (3/15): java-11-openjdk-11.0.17.0.8-2.el8.x86_64.rpm 397 kB/s | 468 kB 00:01
  35. (4/15): java-11-openjdk-devel-11.0.17.0.8-2.el8.x86_64.rpm 3.8 MB/s | 3.4 MB 00:00
  36. (5/15): java-11-openjdk-javadoc-11.0.17.0.8-2.el8.x86_64.rpm 2.8 MB/s | 16 MB 00:05
  37. (6/15): java-11-openjdk-javadoc-zip-11.0.17.0.8-2.el8.x86_64.rpm 2.2 MB/s | 42 MB 00:19
  38. (7/15): java-11-openjdk-headless-11.0.17.0.8-2.el8.x86_64.rpm 2.1 MB/s | 41 MB 00:19
  39. (8/15): java-11-openjdk-static-libs-11.0.17.0.8-2.el8.x86_64.rpm 2.1 MB/s | 30 MB 00:14
  40. (9/15): javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch.rpm 124 kB/s | 30 kB 00:00
  41. (10/15): ttmkfdir-3.0.9-54.el8.x86_64.rpm 226 kB/s | 62 kB 00:00
  42. (11/15): tzdata-java-2022d-1.el8.noarch.rpm 768 kB/s | 186 kB 00:00
  43. (12/15): xorg-x11-fonts-Type1-7.5-19.el8.noarch.rpm 1.1 MB/s | 522 kB 00:00
  44. (13/15): lksctp-tools-1.0.18-3.el8.x86_64.rpm 531 kB/s | 100 kB 00:00
  45. (14/15): java-11-openjdk-src-11.0.17.0.8-2.el8.x86_64.rpm 2.4 MB/s | 50 MB 00:20
  46. (15/15): java-11-openjdk-jmods-11.0.17.0.8-2.el8.x86_64.rpm 2.6 MB/s | 337 MB 02:10
  47. --------------------------------------------------------------------------------------------------------------------------------------------
  48. 总计 3.8 MB/s | 527 MB 02:19
  49. CentOS Stream 8 - AppStream 1.6 MB/s | 1.6 kB 00:00
  50. 导入 GPG 公钥 0x8483C65D:
  51. Userid: "CentOS (CentOS Official Signing Key) <security@centos.org>"
  52. 指纹: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
  53. 来自: /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
  54. 导入公钥成功
  55. 运行事务检查
  56. 事务检查成功。
  57. 运行事务测试
  58. 事务测试成功。
  59. 运行事务
  60. 运行脚本: copy-jdk-configs-4.0-2.el8.noarch 1/1
  61. 运行脚本: java-11-openjdk-headless-1:11.0.17.0.8-2.el8.x86_64 1/1
  62. 准备中 : 1/1
  63. 安装 : javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch 1/15
  64. 安装 : lksctp-tools-1.0.18-3.el8.x86_64 2/15
  65. 运行脚本: lksctp-tools-1.0.18-3.el8.x86_64 2/15
  66. 安装 : tzdata-java-2022d-1.el8.noarch 3/15
  67. 安装 : ttmkfdir-3.0.9-54.el8.x86_64 4/15
  68. 安装 : xorg-x11-fonts-Type1-7.5-19.el8.noarch 5/15
  69. 运行脚本: xorg-x11-fonts-Type1-7.5-19.el8.noarch 5/15
  70. 安装 : copy-jdk-configs-4.0-2.el8.noarch 6/15
  71. 安装 : java-11-openjdk-headless-1:11.0.17.0.8-2.el8.x86_64 7/15
  72. 运行脚本: java-11-openjdk-headless-1:11.0.17.0.8-2.el8.x86_64 7/15
  73. 安装 : java-11-openjdk-1:11.0.17.0.8-2.el8.x86_64 8/15
  74. 运行脚本: java-11-openjdk-1:11.0.17.0.8-2.el8.x86_64 8/15
  75. 安装 : java-11-openjdk-devel-1:11.0.17.0.8-2.el8.x86_64 9/15
  76. 运行脚本: java-11-openjdk-devel-1:11.0.17.0.8-2.el8.x86_64 9/15
  77. 安装 : java-11-openjdk-jmods-1:11.0.17.0.8-2.el8.x86_64 10/15
  78. 安装 : java-11-openjdk-static-libs-1:11.0.17.0.8-2.el8.x86_64 11/15
  79. 安装 : java-11-openjdk-demo-1:11.0.17.0.8-2.el8.x86_64 12/15
  80. 安装 : java-11-openjdk-javadoc-1:11.0.17.0.8-2.el8.x86_64 13/15
  81. 安装 : java-11-openjdk-javadoc-zip-1:11.0.17.0.8-2.el8.x86_64 14/15
  82. 安装 : java-11-openjdk-src-1:11.0.17.0.8-2.el8.x86_64 15/15
  83. 运行脚本: copy-jdk-configs-4.0-2.el8.noarch 15/15
  84. 运行脚本: java-11-openjdk-headless-1:11.0.17.0.8-2.el8.x86_64 15/15
  85. 运行脚本: java-11-openjdk-1:11.0.17.0.8-2.el8.x86_64 15/15
  86. 运行脚本: java-11-openjdk-devel-1:11.0.17.0.8-2.el8.x86_64 15/15
  87. 运行脚本: java-11-openjdk-javadoc-1:11.0.17.0.8-2.el8.x86_64 15/15
  88. 运行脚本: java-11-openjdk-javadoc-zip-1:11.0.17.0.8-2.el8.x86_64 15/15
  89. 运行脚本: java-11-openjdk-src-1:11.0.17.0.8-2.el8.x86_64 15/15
  90. 验证 : copy-jdk-configs-4.0-2.el8.noarch 1/15
  91. 验证 : java-11-openjdk-1:11.0.17.0.8-2.el8.x86_64 2/15
  92. 验证 : java-11-openjdk-demo-1:11.0.17.0.8-2.el8.x86_64 3/15
  93. 验证 : java-11-openjdk-devel-1:11.0.17.0.8-2.el8.x86_64 4/15
  94. 验证 : java-11-openjdk-headless-1:11.0.17.0.8-2.el8.x86_64 5/15
  95. 验证 : java-11-openjdk-javadoc-1:11.0.17.0.8-2.el8.x86_64 6/15
  96. 验证 : java-11-openjdk-javadoc-zip-1:11.0.17.0.8-2.el8.x86_64 7/15
  97. 验证 : java-11-openjdk-jmods-1:11.0.17.0.8-2.el8.x86_64 8/15
  98. 验证 : java-11-openjdk-src-1:11.0.17.0.8-2.el8.x86_64 9/15
  99. 验证 : java-11-openjdk-static-libs-1:11.0.17.0.8-2.el8.x86_64 10/15
  100. 验证 : javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch 11/15
  101. 验证 : ttmkfdir-3.0.9-54.el8.x86_64 12/15
  102. 验证 : tzdata-java-2022d-1.el8.noarch 13/15
  103. 验证 : xorg-x11-fonts-Type1-7.5-19.el8.noarch 14/15
  104. 验证 : lksctp-tools-1.0.18-3.el8.x86_64 15/15
  105. 已安装:
  106. copy-jdk-configs-4.0-2.el8.noarch java-11-openjdk-1:11.0.17.0.8-2.el8.x86_64
  107. java-11-openjdk-demo-1:11.0.17.0.8-2.el8.x86_64 java-11-openjdk-devel-1:11.0.17.0.8-2.el8.x86_64
  108. java-11-openjdk-headless-1:11.0.17.0.8-2.el8.x86_64 java-11-openjdk-javadoc-1:11.0.17.0.8-2.el8.x86_64
  109. java-11-openjdk-javadoc-zip-1:11.0.17.0.8-2.el8.x86_64 java-11-openjdk-jmods-1:11.0.17.0.8-2.el8.x86_64
  110. java-11-openjdk-src-1:11.0.17.0.8-2.el8.x86_64 java-11-openjdk-static-libs-1:11.0.17.0.8-2.el8.x86_64
  111. javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch lksctp-tools-1.0.18-3.el8.x86_64
  112. ttmkfdir-3.0.9-54.el8.x86_64 tzdata-java-2022d-1.el8.noarch
  113. xorg-x11-fonts-Type1-7.5-19.el8.noarch
  114. 完毕!

        验证        

  1. [root@bogon ~]# java -version
  2. openjdk version "11.0.17" 2022-10-18 LTS
  3. OpenJDK Runtime Environment (Red_Hat-11.0.17.0.8-2.el8) (build 11.0.17+8-LTS)
  4. OpenJDK 64-Bit Server VM (Red_Hat-11.0.17.0.8-2.el8) (build 11.0.17+8-LTS, mixed mode, sharing)

        JDK11的版本号还是要比JDK8清爽不少,至少数字都是一样的不是…… 

        ElasticSearch下载

        同样的,ES的版本不仅要能够和Cascade配合,还要能够和JDK11配合起来,我们选择的是7.11.2版本。但是这个下载链接是相当的不好找——直接通过下载链接是进不去的,通过网页方式去找合适的版本的话,如下图所示,应该是从Guide进去,在左上角选择others以后,才能找到比较老的版本,然后在网页中向下找到“Downlaod and install the RPM manually”,安装地址会出现在这里:

        直接使用这个下载地址把rpm下载下来安装就行:

        wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.11.2-x86_64.rpm

  1. [root@bogon ~]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.11.2-x86_64.rpm
  2. --2022-12-07 20:24:59-- https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.11.2-x86_64.rpm
  3. 正在解析主机 artifacts.elastic.co (artifacts.elastic.co)... 34.120.127.130, 2600:1901:0:1d7::
  4. 正在连接 artifacts.elastic.co (artifacts.elastic.co)|34.120.127.130|:443... 已连接。
  5. 已发出 HTTP 请求,正在等待回应... 200 OK
  6. 长度:322917736 (308M) [binary/octet-stream]
  7. 正在保存至: “elasticsearch-7.11.2-x86_64.rpm”
  8. elasticsearch-7.11.2-x86_64.rpm 100%[================================================================>] 307.96M 5.90MB/s 用时 66s
  9. 2022-12-07 20:26:06 (4.66 MB/s) - 已保存 “elasticsearch-7.11.2-x86_64.rpm” [322917736/322917736])

        ElasticSearch安装

  1. [root@bogon ~]# rpm -ivh elasticsearch-7.11.2-x86_64.rpm
  2. 警告:elasticsearch-7.11.2-x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID d88e42b4: NOKEY
  3. Verifying... ################################# [100%]
  4. 准备中... ################################# [100%]
  5. Creating elasticsearch group... OK
  6. Creating elasticsearch user... OK
  7. 正在升级/安装...
  8. 1:elasticsearch-0:7.11.2-1 ################################# [100%]
  9. ### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
  10. sudo systemctl daemon-reload
  11. sudo systemctl enable elasticsearch.service
  12. ### You can start elasticsearch service by executing
  13. sudo systemctl start elasticsearch.service
  14. Created elasticsearch keystore in /etc/elasticsearch/elasticsearch.keystore
  15. Couldn't write '1' to 'vm/unprivileged_userfaultfd', ignoring: No such file or directory
  16. [/usr/lib/tmpfiles.d/elasticsearch.conf:1] Line references path below legacy directory /var/run/, updating /var/run/elasticsearch → /run/elasticsearch; please update the tmpfiles.d/ drop-in file accordingly.

        ES在某个版本(大约是8)之后,加入了安全性支持,导致服务启动后直接访问localhost会出现安全错误,这个需要在elasticsearch.yml配置文件中关闭安全设置:

  1. [root@bogon ~]# cd /etc/elasticsearch/
  2. [root@bogon elasticsearch]# ls
  3. elasticsearch.keystore elasticsearch.yml jvm.options jvm.options.d log4j2.properties role_mapping.yml roles.yml users users_roles
  4. [root@bogon elasticsearch]# vim elasticsearch.yml

         修改 xpack.security.enabled为false:

  1. #----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
  2. #
  3. # The following settings, TLS certificates, and keys have been automatically
  4. # generated to configure Elasticsearch security features on 07-11-2022 02:03:08
  5. #
  6. # --------------------------------------------------------------------------------
  7. # Enable security features
  8. xpack.security.enabled: false
  9. xpack.security.enrollment.enabled: true
  10. # Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents

        然后启动ES服务        

  1. [root@bogon elasticsearch]# systemctl start elasticsearch.service
  2. [root@bogon elasticsearch]# systemctl enable elasticsearch.service
  3. Synchronizing state of elasticsearch.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
  4. Executing: /usr/lib/systemd/systemd-sysv-install enable elasticsearch
  5. Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service → /usr/lib/systemd/system/elasticsearch.service.
  6. [root@bogon elasticsearch]# systemctl status elasticsearch.service
  7. ● elasticsearch.service - Elasticsearch
  8. Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
  9. Active: active (running) since Wed 2022-12-07 21:18:36 EST; 28s ago
  10. Docs: https://www.elastic.co
  11. Main PID: 44800 (java)
  12. Tasks: 72 (limit: 49135)
  13. Memory: 4.1G
  14. CGroup: /system.slice/elasticsearch.service
  15. ├─44800 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.t>
  16. └─45004 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
  17. 12月 07 21:17:41 bogon systemd[1]: Starting Elasticsearch...
  18. 12月 07 21:18:36 bogon systemd[1]: Started Elasticsearch.
  19. lines 1-13/13 (END)

         验证

        查看ES服务主进程号对应的端口,与ES默认端口一致,为9200

  1. [root@bogon elasticsearch]# systemctl status elasticsearch.service
  2. ● elasticsearch.service - Elasticsearch
  3. Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
  4. Active: active (running) since Wed 2022-12-07 21:18:36 EST; 28s ago
  5. Docs: https://www.elastic.co
  6. Main PID: 44800 (java)
  7. Tasks: 72 (limit: 49135)
  8. Memory: 4.1G
  9. CGroup: /system.slice/elasticsearch.service
  10. ├─44800 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.t>
  11. └─45004 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
  12. 12月 07 21:17:41 bogon systemd[1]: Starting Elasticsearch...
  13. 12月 07 21:18:36 bogon systemd[1]: Started Elasticsearch.
  14. [root@bogon elasticsearch]#
  15. [root@bogon elasticsearch]# netstat -ltnp |grep '44800'
  16. tcp6 0 0 127.0.0.1:9200 :::* LISTEN 44800/java
  17. tcp6 0 0 ::1:9200 :::* LISTEN 44800/java
  18. tcp6 0 0 127.0.0.1:9300 :::* LISTEN 44800/java
  19. tcp6 0 0 ::1:9300 :::* LISTEN 44800/java
  20. [root@bogon elasticsearch]#

         访问一下ES的接口,如下图说明安装成功

  1. [root@bogon elasticsearch]# curl localhost:9200
  2. {
  3.   "name" : "bogon",
  4.   "cluster_name" : "elasticsearch",
  5.   "cluster_uuid" : "Gf8XNyGUTpeTVtbJI0pALQ",
  6.   "version" : {
  7.     "number" : "7.11.2",
  8.     "build_flavor" : "default",
  9.     "build_type" : "rpm",
  10.     "build_hash" : "3e5a16cfec50876d20ea77b075070932c6464c7d",
  11.     "build_date" : "2021-03-06T05:54:38.141101Z",
  12.     "build_snapshot" : false,
  13.     "lucene_version" : "8.7.0",
  14.     "minimum_wire_compatibility_version" : "6.8.0",
  15.     "minimum_index_compatibility_version" : "6.0.0-beta1"
  16.   },
  17.   "tagline" : "You Know, for Search"
  18. }
  19. [root@bogon elasticsearch]

                (4)安装Python、虚拟环境

        在Centos-stream-8的含GUI安装中,python3和pip3都是默认安装的:

  1. [root@bogon ~]# python3
  2. Python 3.6.8 (default, Mar 25 2022, 11:15:52)
  3. [GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
  4. Type "help", "copyright", "credits" or "license" for more information.
  5. >>> quit()
  6. [root@bogon ~]# pip3 --version
  7. pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
  8. [root@bogon ~]#

       而且除了python3和pip3,没有其它的了

  1. [root@bogon ~]# which python3
  2. /usr/bin/python3
  3. [root@bogon ~]# which python
  4. /usr/bin/which: no python in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/root/bin)
  5. [root@bogon ~]# which pip3
  6. /usr/bin/pip3
  7. [root@bogon ~]# which pip
  8. /usr/bin/which: no pip in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/root/bin)
  9. [root@bogon ~]#

        安装VirtualEnv

        后续安装cascade的requirements,需要在虚拟python环境中安装,否则组件的兼容性问题会把人搞疯。所以安装virtualenv工具备用。

  1. [root@bogon ~]# pip3 install virtualenv
  2. WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
  3. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
  4. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
  5. Collecting virtualenv
  6. Downloading virtualenv-20.17.1-py3-none-any.whl (8.8 MB)
  7. |████████████████████████████████| 8.8 MB 317 kB/s
  8. Collecting distlib<1,>=0.3.6
  9. Downloading distlib-0.3.6-py2.py3-none-any.whl (468 kB)
  10. |████████████████████████████████| 468 kB 11.9 MB/s
  11. Collecting importlib-metadata>=4.8.3
  12. Downloading importlib_metadata-4.8.3-py3-none-any.whl (17 kB)
  13. Collecting platformdirs<3,>=2.4
  14. Downloading platformdirs-2.4.0-py3-none-any.whl (14 kB)
  15. Collecting importlib-resources>=5.4
  16. Downloading importlib_resources-5.4.0-py3-none-any.whl (28 kB)
  17. Collecting filelock<4,>=3.4.1
  18. Downloading filelock-3.4.1-py3-none-any.whl (9.9 kB)
  19. Collecting zipp>=0.5
  20. Downloading zipp-3.6.0-py3-none-any.whl (5.3 kB)
  21. Collecting typing-extensions>=3.6.4
  22. Downloading typing_extensions-4.1.1-py3-none-any.whl (26 kB)
  23. Installing collected packages: zipp, typing-extensions, platformdirs, importlib-resources, importlib-metadata, filelock, distlib, virtualenv
  24. Successfully installed distlib-0.3.6 filelock-3.4.1 importlib-metadata-4.8.3 importlib-resources-5.4.0 platformdirs-2.4.0 typing-extensions-4.1.1 virtualenv-20.17.1 zipp-3.6.0
  25. WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

        2. 安装Cascade

        好了,到目前为止,Cascade的准备工作就已经搞定了。下面可以下载并安装了。

        (1)安装git工具

        在命令行中键入git命令,centos会提示是否安装,y就行了

  1. [root@bogon ~]# git
  2. bash: git: 未找到命令...
  3. 安装软件包“git-core”以提供命令“git”? [N/y] y
  4. * 正在队列中等待...
  5. * 装入软件包列表...
  6. 下列软件包必须安装:
  7. git-core-2.31.1-2.el8.x86_64 Core package of git with minimal functionality
  8. 继续更改? [N/y] y
  9. * 正在队列中等待...
  10. * 正在等待认证...
  11. * 正在队列中等待...
  12. * 正在下载软件包...
  13. * 正在请求数据...
  14. * 正在测试更改...
  15. * 正在安装软件包...
  16. 用法:git [--version] [--help] [-C <path>] [-c <name>=<value>]
  17. [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
  18. [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
  19. [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
  20. [--super-prefix=<path>] [--config-env=<name>=<envvar>]
  21. <command> [<args>]
  22. 这些是各种场合常见的 Git 命令:
  23. 开始一个工作区(参见:git help tutorial)
  24. clone 克隆仓库到一个新目录
  25. init 创建一个空的 Git 仓库或重新初始化一个已存在的仓库
  26. 在当前变更上工作(参见:git help everyday)
  27. add 添加文件内容至索引
  28. mv 移动或重命名一个文件、目录或符号链接
  29. restore 恢复工作区文件
  30. rm 从工作区和索引中删除文件
  31. sparse-checkout 初始化及修改稀疏检出
  32. 检查历史和状态(参见:git help revisions)
  33. bisect 通过二分查找定位引入 bug 的提交
  34. diff 显示提交之间、提交和工作区之间等的差异
  35. grep 输出和模式匹配的行
  36. log 显示提交日志
  37. show 显示各种类型的对象
  38. status 显示工作区状态
  39. 扩展、标记和调校您的历史记录
  40. branch 列出、创建或删除分支
  41. commit 记录变更到仓库
  42. merge 合并两个或更多开发历史
  43. rebase 在另一个分支上重新应用提交
  44. reset 重置当前 HEAD 到指定状态
  45. switch 切换分支
  46. tag 创建、列出、删除或校验一个 GPG 签名的标签对象
  47. 协同(参见:git help workflows)
  48. fetch 从另外一个仓库下载对象和引用
  49. pull 获取并整合另外的仓库或一个本地分支
  50. push 更新远程引用和相关的对象
  51. 命令 'git help -a''git help -g' 显示可用的子命令和一些概念帮助。
  52. 查看 'git help <命令>''git help <概念>' 以获取给定子命令或概念的
  53. 帮助。
  54. 有关系统的概述,查看 'git help git'

        (2)克隆cascade到本地

        cascade的克隆地址可以在Code按钮中找到,点击复制按钮即可

         使用git clone下载

  1. [root@bogon ~]# git clone https://github.com/mitre/cascade-server.git
  2. 正克隆到 'cascade-server'...
  3. remote: Enumerating objects: 501, done.
  4. remote: Counting objects: 100% (173/173), done.
  5. remote: Compressing objects: 100% (124/124), done.
  6. remote: Total 501 (delta 64), reused 115 (delta 47), pack-reused 328
  7. 接收对象中: 100% (501/501), 6.43 MiB | 4.76 MiB/s, 完成.
  8. 处理 delta 中: 100% (117/117), 完成.
  9. [root@bogon ~]#

        当然,如果克隆一直得到如下的失败结果:

  1. [root@bogon /]# git clone https://github.com/mitre/cascade-server.git
  2. 正克隆到 'cascade-server'...
  3. fatal: 无法访问 'https://github.com/mitre/cascade-server.git/':Failed to connect to 192.168.1.26 port 1080: 拒绝连接
  4. [root@bogon /]#

         那可能需要考虑调整一下你的网络设置(懂的都懂):

        一个是需要在CentOS中将网络代理设置成手动,代理IP选择宿主机IP,端口1080。(这个类似于在主机Chrome上设置Proxy SwitchyOmega一样的效果,都是指示将数据流发往宿主机的代理软件)

        另一个,是需要在宿主机的软件上勾选本地代理的允许来自局域网的连接项——不要选择全局模式这么暴力高调,过于高调的通信会造成网络~~~~~~抖动~~~~~~,所以选择直连模式就好,勾选这个选项的目的是允许内部的CentOS能够使用软件的代理。

        克隆完成,命令目录下应该就多了一个叫做cascade的目录:

  1. [root@bogon ~]# cd cascade-server/
  2. [root@bogon cascade-server]# pwd
  3. /root/cascade-server
  4. [root@bogon cascade-server]# ls
  5. app cascade.py docker_defaults.yml docs NOTICE README.md
  6. AUTHORS conf Dockerfile LICENSE Pipfile requirements.txt
  7. brawl-demo docker-compose.yml docker_start.sh misc Pipfile.lock www
  8. [root@bogon cascade-server]#

         (3)创建虚拟环境

        前面我们已经安装了virtualenv,这里我们需要使用该工具来构建python的虚拟环境:

        先找到本机上我们建立需要依托的python工具所在的位置,作为virtualenv -p选项的参数,然后指定虚拟环境所在的目录,比如我们指定vcascade,执行完成后,在当前目录下,会建立一个vcascade的子目录来放置虚拟环境。

  1. [root@bogon ~]# which python3
  2. /usr/bin/python3
  3. [root@bogon ~]# virtualenv -p /usr/bin/python3 vcascade
  4. created virtual environment CPython3.6.8.final.0-64 in 412ms
  5. creator CPython3Posix(dest=/root/vcascade, clear=False, no_vcs_ignore=False, global=False)
  6. seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
  7. added seed packages: pip==21.3.1, setuptools==59.6.0, wheel==0.37.1
  8. activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
  9. [root@bogon ~]# ls
  10. 公共 视频 文档 音乐 anaconda-ks.cfg elasticsearch-7.11.2-x86_64.rpm mongodb-org-server-4.0.28-1.el8.x86_64.rpm
  11. 模板 图片 下载 桌面 cascade-server initial-setup-ks.cfg vcascade
  12. [root@bogon ~]#

         完成创建后,需要激活虚拟环境,这一步需要进入到刚刚创建的虚拟环境子目录进行:

  1. [root@bogon vcascade]# ls
  2. bin lib lib64 pyvenv.cfg
  3. [root@bogon vcascade]# source bin/activate
  4. (vcascade) [root@bogon vcascade]#

        使用source命令执行bin/activate,就好像使用docker一样,进入一个虚拟的子系统。在命令提示符前会多出一个使用圆括号括住的虚拟系统名称,如(vcascade)。

        若是从该子系统退出,可使用deactive命令:

  1. [root@bogon vcascade]# source bin/activate
  2. (vcascade) [root@bogon vcascade]# deactivate
  3. [root@bogon vcascade]#

        (4)安装requirements

        进入虚拟子系统后,切换到cascade-server目录下,安装requirements.txt:

        当然,这里也可能出现网络不畅的情况,如上问所述调整配置就好:

  1. [root@bogon cascade-server]# cd ..
  2. [root@bogon ~]# cd vcascade/
  3. [root@bogon vcascade]# source bin/activate
  4. (vcascade) [root@bogon vcascade]# cd ..
  5. (vcascade) [root@bogon ~]# cd cascade-server/
  6. (vcascade) [root@bogon cascade-server]# pip install -r requirements.txt
  7. Collecting antlr4-python3-runtime==4.9.1
  8. Downloading antlr4-python3-runtime-4.9.1.tar.gz (173 kB)
  9. |████████████████████████████████| 173 kB 250 kB/s
  10. Preparing metadata (setup.py) ... done
  11. Collecting certifi==2020.12.5
  12. Downloading certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
  13. |████████████████████████████████| 147 kB 1.4 MB/s
  14. Collecting cffi==1.14.5
  15. Downloading cffi-1.14.5-cp36-cp36m-manylinux1_x86_64.whl (401 kB)
  16. |████████████████████████████████| 401 kB 1.6 MB/s
  17. Collecting chardet==4.0.0
  18. Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
  19. |████████████████████████████████| 178 kB 3.2 MB/s
  20. Collecting click==7.1.2
  21. Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
  22. |████████████████████████████████| 82 kB 2.7 MB/s
  23. Collecting cryptography==3.4.6
  24. Downloading cryptography-3.4.6-cp36-abi3-manylinux2014_x86_64.whl (3.2 MB)
  25. |████████████████████████████████| 3.2 MB 3.7 MB/s
  26. Collecting elasticsearch==7.11.0
  27. Downloading elasticsearch-7.11.0-py2.py3-none-any.whl (325 kB)
  28. |████████████████████████████████| 325 kB 4.9 MB/s
  29. Collecting flask==1.1.2
  30. Downloading Flask-1.1.2-py2.py3-none-any.whl (94 kB)
  31. |████████████████████████████████| 94 kB 3.5 MB/s
  32. Collecting gevent-websocket==0.10.1
  33. Downloading gevent_websocket-0.10.1-py3-none-any.whl (22 kB)
  34. Collecting gevent==21.1.2
  35. Downloading gevent-21.1.2-cp36-cp36m-manylinux2010_x86_64.whl (5.5 MB)
  36. |████████████████████████████████| 5.5 MB 5.7 MB/s
  37. Collecting greenlet==1.0.0
  38. Downloading greenlet-1.0.0-cp36-cp36m-manylinux2010_x86_64.whl (156 kB)
  39. |████████████████████████████████| 156 kB 9.4 MB/s
  40. Collecting idna==2.10
  41. Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
  42. |████████████████████████████████| 58 kB 12.5 MB/s
  43. Collecting importlib-metadata==3.7.2
  44. Downloading importlib_metadata-3.7.2-py3-none-any.whl (11 kB)
  45. Collecting itsdangerous==1.1.0
  46. Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
  47. Collecting jinja2==2.11.3
  48. Downloading Jinja2-2.11.3-py2.py3-none-any.whl (125 kB)
  49. |████████████████████████████████| 125 kB 6.7 MB/s
  50. Collecting markdown==3.3.4
  51. Downloading Markdown-3.3.4-py3-none-any.whl (97 kB)
  52. |████████████████████████████████| 97 kB 7.2 MB/s
  53. Collecting markupsafe==1.1.1
  54. Downloading MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl (32 kB)
  55. Collecting mongoengine==0.23.0
  56. Downloading mongoengine-0.23.0-py3-none-any.whl (107 kB)
  57. |████████████████████████████████| 107 kB 6.9 MB/s
  58. Collecting passlib==1.7.4
  59. Downloading passlib-1.7.4-py2.py3-none-any.whl (525 kB)
  60. |████████████████████████████████| 525 kB 6.7 MB/s
  61. Collecting pycparser==2.20
  62. Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
  63. |████████████████████████████████| 112 kB 11.5 MB/s
  64. Collecting pymongo==3.11.3
  65. Downloading pymongo-3.11.3-cp36-cp36m-manylinux2014_x86_64.whl (509 kB)
  66. |████████████████████████████████| 509 kB 5.5 MB/s
  67. Collecting pyopenssl==20.0.1
  68. Downloading pyOpenSSL-20.0.1-py2.py3-none-any.whl (54 kB)
  69. |████████████████████████████████| 54 kB 7.4 MB/s
  70. Collecting python-dateutil==2.8.1
  71. Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
  72. |████████████████████████████████| 227 kB 12.5 MB/s
  73. Collecting pyyaml==5.4.1
  74. Downloading PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (640 kB)
  75. |████████████████████████████████| 640 kB 4.1 MB/s
  76. Collecting requests==2.25.1
  77. Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
  78. |████████████████████████████████| 61 kB 10.8 MB/s
  79. Collecting six==1.15.0
  80. Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
  81. Collecting splunk-sdk==1.6.15
  82. Downloading splunk-sdk-1.6.15.tar.gz (105 kB)
  83. |████████████████████████████████| 105 kB 12.0 MB/s
  84. Preparing metadata (setup.py) ... done
  85. Collecting typing-extensions==3.7.4.3
  86. Downloading typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
  87. Collecting urllib3==1.26.3
  88. Downloading urllib3-1.26.3-py2.py3-none-any.whl (137 kB)
  89. |████████████████████████████████| 137 kB 2.2 MB/s
  90. Collecting werkzeug==1.0.1
  91. Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
  92. |████████████████████████████████| 298 kB 4.9 MB/s
  93. Collecting zipp==3.4.1
  94. Downloading zipp-3.4.1-py3-none-any.whl (5.2 kB)
  95. Collecting zope.event==4.5.0
  96. Downloading zope.event-4.5.0-py2.py3-none-any.whl (6.8 kB)
  97. Collecting zope.interface==5.2.0
  98. Downloading zope.interface-5.2.0-cp36-cp36m-manylinux2010_x86_64.whl (236 kB)
  99. |████████████████████████████████| 236 kB 8.3 MB/s
  100. Requirement already satisfied: setuptools in /root/vcascade/lib/python3.6/site-packages (from gevent==21.1.2->-r requirements.txt (line 11)) (59.6.0)
  101. WARNING: The candidate selected for download or install is a yanked version: 'splunk-sdk' candidate (version 1.6.15 at https://files.pythonhosted.org/packages/9d/65/ca741361b7199b279cd83753ebbc9671e5364a850859864200a6caee6f63/splunk-sdk-1.6.15.tar.gz#sha256=922b4541b9764a65e450e5437638a357f8aff5c7e6a4cd2637355a7a4197301a (from https://pypi.org/simple/splunk-sdk/))
  102. Reason for being yanked: <none given>
  103. Building wheels for collected packages: antlr4-python3-runtime, splunk-sdk
  104. Building wheel for antlr4-python3-runtime (setup.py) ... done
  105. Created wheel for antlr4-python3-runtime: filename=antlr4_python3_runtime-4.9.1-py3-none-any.whl size=144443 sha256=38390d924ad295d5c4674c8564516924aa65e3c80913a8288bbae5dd64758971
  106. Stored in directory: /root/.cache/pip/wheels/4d/7e/ea/a6f1a9354b440cbc29549054287e778525ad2fe9331e399ab0
  107. Building wheel for splunk-sdk (setup.py) ... done
  108. Created wheel for splunk-sdk: filename=splunk_sdk-1.6.15-py3-none-any.whl size=123209 sha256=2bc33cea6d0dacb5f4d92f396435b3c450f2fe0748fba4dead641c8a5db7cd6b
  109. Stored in directory: /root/.cache/pip/wheels/a5/da/59/8dcdcff87134b7d910a88a15db3c8280fd3640abf86abed14d
  110. Successfully built antlr4-python3-runtime splunk-sdk
  111. Installing collected packages: pycparser, zope.interface, zope.event, zipp, typing-extensions, markupsafe, greenlet, cffi, werkzeug, urllib3, six, pymongo, jinja2, itsdangerous, importlib-metadata, idna, gevent, cryptography, click, chardet, certifi, splunk-sdk, requests, pyyaml, python-dateutil, pyopenssl, passlib, mongoengine, markdown, gevent-websocket, flask, elasticsearch, antlr4-python3-runtime
  112. Successfully installed antlr4-python3-runtime-4.9.1 certifi-2020.12.5 cffi-1.14.5 chardet-4.0.0 click-7.1.2 cryptography-3.4.6 elasticsearch-7.11.0 flask-1.1.2 gevent-21.1.2 gevent-websocket-0.10.1 greenlet-1.0.0 idna-2.10 importlib-metadata-3.7.2 itsdangerous-1.1.0 jinja2-2.11.3 markdown-3.3.4 markupsafe-1.1.1 mongoengine-0.23.0 passlib-1.7.4 pycparser-2.20 pymongo-3.11.3 pyopenssl-20.0.1 python-dateutil-2.8.1 pyyaml-5.4.1 requests-2.25.1 six-1.15.0 splunk-sdk-1.6.15 typing-extensions-3.7.4.3 urllib3-1.26.3 werkzeug-1.0.1 zipp-3.4.1 zope.event-4.5.0 zope.interface-5.2.0
  113. (vcascade) [root@bogon cascade-server]#

        (5)setup Cascade

        直接运行python cascade.py --setup;一路回车取默认值就可以。这个地方需要保持合适的网络代理配置~~~~,否则可能会出错,而且不知怎的就直接把我的MongoDB搞崩溃。

        配置完成后,继续python cascade.py就可以把服务运行起来。

  1. (vcascade) [root@bogon cascade-server]# python cascade.py --setup
  2. Update configuration settings for CASCADE. Enter nothing to keep the default value
  3. config:
  4. allow_account_creation (True):
  5. password:
  6. enforce (False):
  7. regex (^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-\.]).{8,}$):
  8. database:
  9. mongo:
  10. host (127.0.0.1):
  11. port (27017):
  12. crypto:
  13. fernet (<autogenerate>):
  14. key (<autogenerate>):
  15. links:
  16. attack (https://attack-old.mitre.org):
  17. car (https://car.mitre.org):
  18. smtp ():
  19. proxies:
  20. http ():
  21. https ():
  22. server:
  23. hostname (bogon):
  24. https:
  25. certfile (misc/cascade.mitre.org.pem):
  26. enabled (False):
  27. keyfile (misc/cascade.mitre.org.key):
  28. interface (127.0.0.1):
  29. port (5000):
  30. Initializing database...
  31. Importing collection attack_technique
  32. Importing collection attack_tactic
  33. Importing collection analytic
  34. Importing collection session
  35. (vcascade) [root@bogon cascade-server]#
  36. (vcascade) [root@bogon cascade-server]#
  37. (vcascade) [root@bogon cascade-server]#
  38. (vcascade) [root@bogon cascade-server]# python cascade.py
  39. /root/cascade-server/app/async_wrapper.py:44: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['pymongo.ssl_context (/root/vcascade/lib64/python3.6/site-packages/pymongo/ssl_context.py)', 'urllib3.util.ssl_ (/root/vcascade/lib/python3.6/site-packages/urllib3/util/ssl_.py)', 'urllib3.util (/root/vcascade/lib/python3.6/site-packages/urllib3/util/__init__.py)'].
  40. gevent.monkey.patch_all()
  41. Running CASCADE via WSGIServer on http://bogon:5000

        此时打开 浏览器,从localhost就可以访问cascade了

        三、Docker上的Cascade

        Cascade提供了容器版本,并且包括了多服务容器的编排。这个从cascade-server目录下存在的Dockfile和docker-compose.yml文件就能看出来。然而,直接使用docker-compose build是会出错的:     

         好在我们完全立足手工自己搭建过,至少说明这个系统是能够搭建起来的,很可能是docker-compose.yml或者Dockerfile这两个配置文件中哪里出现了错误——我们可以尝试在docker的基础上再手撸一次来查找问题。

        PS:其实问题很简单,因为过程都已经给出了,是在安装requirements.txt的这一步出现了问题。因为这个requirements中的组件模块太多了,对python版本的要求也不同,出错概率太高。好在按照我们之前的成功搭建经验,在python 3.6.8的版本下是能够搭建成功的。所以只需要改一下这个地方就好。

        但,这完全不妨碍我们打算手撸一遍的兴趣。

        当然,在手撸之前,我们需要知道cascade的容器是如何配置的。

        1. Dockfile

  1. [root@pig cascade-server]# cat Dockerfile
  2. FROM python:3
  3. RUN mkdir -p /opt/cascade-server
  4. WORKDIR /opt/cascade-server
  5. COPY requirements.txt .
  6. RUN pip install -r requirements.txt
  7. COPY . .
  8. COPY docker_defaults.yml conf/defaults.yml
  9. CMD /bin/bash docker_start.sh

        FROM python:3,表示镜像从名为“python:3”的基础镜像开始构建。这个镜像在当前dockerhub中,实际对应的python版本号是3.11

        RUN mkdir -p /opt/cascade-server,在镜像中构建cascade-server文件夹,如果父文件夹/opt不存在,则同时构建(-p的作用)

        WORKDIR /opt/cascade-server,将刚建立的文件夹作为默认的工作文件夹

        COPY requirements.txt . ,将宿主机中requirements.txt文件拷贝到默认工作文件夹

        RUN pip install -r requirements.txt, 这其中 requirements.txt和上文是一致的。其作用就是安装cascade工作所需的预选项

        COPY . . ,将宿主机的整个cascade-server 目录下的文件拷贝到工作目录下

        COPY docker-defaults.yml conf/defaults.yml, 将docker_defaults.yml拷贝到镜像中的/opt/cascade-server/conf目录下,其中存储的配置,实际和上文在运行python cascade.py --setup时敲的一堆回车相同效果。

        CMD /bin/bash docker_start.sh,最后容器启动时默认执行的docker_start.sh,实际就是python cascade.py --setup和python cascade.py这2条命令。当然,--setup是在conf下没有默认的cascade.yml配置文件的情况下执行的。

  1. [root@pig cascade-server]# cat docker_start.sh
  2. #!/bin/bash
  3. if [ -f "conf/cascade.yml" ]; then
  4. echo "cascade.yml found. Using existing configuration."
  5. else
  6. echo "cascade.yml not found. Generating new config file from defaults"
  7. python cascade.py --setup_with_defaults
  8. fi
  9. python cascade.py -vv

        2. docker-compose.yml

  1. [root@pig cascade-server]# cat docker-compose.yml
  2. ---
  3. version: '2'
  4. volumes:
  5. mongo_data: {}
  6. cascade_conf: {}
  7. services:
  8. mongodb:
  9. image: mongo:4.0
  10. ports:
  11. - "127.0.0.1:27017:27017"
  12. volumes:
  13. - mongo_data:/data
  14. cascade_web:
  15. build:
  16. context: .
  17. args:
  18. - "http_proxy:${http_proxy}"
  19. - "https_proxy:${https_proxy}"
  20. - "no_proxy:${no_proxy}"
  21. image: "cascade:latest"
  22. volumes:
  23. - cascade_conf:/opt/cascade-server/conf
  24. ports:
  25. - "5000:5000"
  26. cascade_jobs:
  27. image: "cascade:latest"
  28. volumes:
  29. - cascade_conf:/opt/cascade-server/conf
  30. depends_on:
  31. - cascade_web
  32. - mongodb
  33. command: python cascade.py -vv --jobs

       docker-compose主要用于支持某种应用需要多服务支撑的场景。从前篇我们讨论docker的最佳用法是进程隔离来看。当需要多服务支撑的时候,显然是不适用于在一个容器里开多个服务的。标准的做法,应该是在每个docker中开一个服务,然后把这些容器组合成一个应用环境。这个成为容器的连接。

        docker-compose.yml的主要作用就是说明这种容器的连接方式。其主要的含义在于,一个项目(Project)可以由多个服务(Service)构成,我们用来实现客户功能的App也可以看作是一个服务(比如Cascade);对于每个服务,使用Image指定服务的镜像,使用Ports指定服务需要开放的端口,使用Volumes指定服务使用的映射于主机上的空间;使用depends_on来确定服务与服务之间的依赖关系;对于没有镜像可拉取的服务,可以使用Build来指定基于Dockerfile来创建。

        (1)存储映射别名

         这里是给主机上的存储空间起的别名,后面再每个服务里,可以将这个别名指代的主机空间映射到容器内的指定路径上。

        (2)服务Mongodb    

        image: 该服务使用的是官方的Mongo:4.0镜像      

        ports:并且将mongo的默认27017端口绑定到宿主机的127.0.0.1:27017上。

        volumes:将存储卷映射到容器的/data目录中

        (3)服务Cascade_web      

         这个服务就是我们之前装成功的提供WEB图形访问界面的那个python cascade.py

         build:表示该镜像需要从Dockerfile文件构建而来,Dockerfile文件的构建环境(默认目录)由context表示,此处为当前目录;构建参数(不携带到容器)由args指定,这里虽然有,但实际在构建过程中都取了空值(猜测应该是由conf/cascade.yml确定)。

        image:image和build同时使用,表示build构建除的镜像使用image指示的这个名字

        volumes:同样,将存储卷映射到conf子目录下

        ports:绑定5000端口到宿主机上

        (4)服务cascade_jobs

         根据官方给出的指南,在打开webserver后,为了对Splunk或者ES进行查询,还需要开启第二个终端,执行python cascade.py --jobs

         所以,这里以cascade_jobs这个服务来对应。该服务使用cascade_web服务中建立的镜像cascade:latest,然后在镜像载入后执行python cascade.py -vv --jobs,这个使用command来指示。因为jobs的启动依赖于web中镜像的构建,所以需要使用depends_on来指示这个依赖关系。

        4. 手撸docker cascade

        下面按照cascade配置文件的方式,手工走一遍docker的构建。

        (1)创建数据卷

        创建docker的存储卷,默认驱动为local,volume模式。这种模式下,存储卷的空间将会映射到宿主机docker空间/var/lib/docker/volumes下面。

  1. [root@pig cascade-server]# docker volume create mongo_data
  2. mongo_data
  3. [root@pig cascade-server]# docker volume create cascade_conf
  4. cascade_conf
  5. [root@pig cascade-server]# docker volume inspect mongo_data
  6. [
  7. {
  8. "CreatedAt": "2022-12-09T01:44:03-05:00",
  9. "Driver": "local",
  10. "Labels": {},
  11. "Mountpoint": "/var/lib/docker/volumes/mongo_data/_data",
  12. "Name": "mongo_data",
  13. "Options": {},
  14. "Scope": "local"
  15. }
  16. ]
  17. [root@pig cascade-server]#

        (2)构建Mongodb容器

        首先手工pull mongo:4.0的镜像        

  1. [root@pig cascade-server]# docker pull mongo:4.0
  2. 4.0: Pulling from library/mongo
  3. 58690f9b18fc: Pull complete
  4. b51569e7c507: Pull complete
  5. da8ef40b9eca: Pull complete
  6. fb15d46c38dc: Pull complete
  7. a0dc15b16822: Pull complete
  8. b7a3e92f19af: Pull complete
  9. ed4a7b863fa1: Pull complete
  10. a58b030ea8e4: Pull complete
  11. 6aa1ba699846: Pull complete
  12. ebc52c729dca: Pull complete
  13. 52e8c440d4d6: Pull complete
  14. 22b97876323d: Pull complete
  15. Digest: sha256:4ca81c89ad08f4cfa9906005126112bffe8fb363800466ef5e50f6238f6f6af1
  16. Status: Downloaded newer image for mongo:4.0
  17. docker.io/library/mongo:4.0

        然后启动mongdb服务。这里根据配置文件有几个需要关注的点:

        一是需要映射主机端口,应使用 -p 127.0.0.1:27017:27017

        二是需要映射存储卷,应使用 -v mongo_data:/data

        三是容器需要指定名称,方便后面连接,应使用--name mongodb        

  1. [root@pig cascade-server]# docker run -d -p 127.0.0.1:27017:27017 -v mongo_data:/data --name mongodb mongo:4.0
  2. a02c3ce1d8864ef6678bde3f9fde2d9d0b9098a9bd5ebf454639cb7c06d6463f
  3. [root@pig cascade-server]# docker ps
  4. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  5. a02c3ce1d886 mongo:4.0 "docker-entrypoint.s…" 14 seconds ago Up 13 seconds 127.0.0.1:27017->27017/tcp mongodb

        检查一下存储卷的映射:

         检查一下端口的映射,能够看到这一条就是成功的:

  1. [root@pig cascade-server]# curl localhost:27017
  2. It looks like you are trying to access MongoDB over HTTP on the native driver port.
  3. [root@pig cascade-server]#

         如果不行。虚拟机下需要使用ifconfig检查一下docker0的状态,在暂停后又重启的一些场合中,docker0的IP地址会丢失,这样就再连不上容器了。需要使用systemctl restart docker重启一下。

        (3)构建cascade:lastest

        话说,从配置文件看,这个cascade_web及jobs服务使用的镜像叫做cascade:latest,它是由build命令构建而来的。对于手工来说,只要Dockerfile文件存在就可以build:

        不过,这里如果直接使用下载的dockerfile进行build,python版本为3.11,过高,后面在pip install requirements.txt的时候会出错。实际测试3.6.8版本就够了。所以我们要将Dockerfile里面的基础镜像改为python:3.6.8在来测试:       

 使用官方的python:3.6.8镜像

 这样构建过程就稳的一批了。

  1. [root@pig cascade-server]# docker build -t cascade:latest .
  2. Sending build context to Docker daemon 20.24MB
  3. Step 1/8 : FROM python:3.6.8
  4. 3.6.8: Pulling from library/python
  5. 6f2f362378c5: Pull complete
  6. 494c27a8a6b8: Pull complete
  7. 7596bb83081b: Pull complete
  8. 372744b62d49: Pull complete
  9. 615db220d76c: Pull complete
  10. 1865698adfb0: Pull complete
  11. 7159b3304cc0: Pull complete
  12. ad0713808ef6: Pull complete
  13. 7ba593904573: Pull complete
  14. Digest: sha256:f20a9bfddd87c238c3d2316b4179222f219090cbb25d5b6975070d4dd4b75004
  15. Status: Downloaded newer image for python:3.6.8
  16. ---> 48c06762acf0
  17. Step 2/8 : RUN mkdir -p /opt/cascade-server
  18. ---> Running in 973c96c34640
  19. Removing intermediate container 973c96c34640
  20. ---> af05a324cf3e
  21. Step 3/8 : WORKDIR /opt/cascade-server
  22. ---> Running in 900cb1583677
  23. Removing intermediate container 900cb1583677
  24. ---> 6e32fa80e153
  25. Step 4/8 : COPY requirements.txt .
  26. ---> cafa46f17bc7
  27. Step 5/8 : RUN pip install -r requirements.txt
  28. ---> Running in 2d5b5bbd64ea
  29. Collecting antlr4-python3-runtime==4.9.1 (from -r requirements.txt (line 2))
  30. Downloading https://files.pythonhosted.org/packages/0a/89/d1926c443bbfdc28321b1435bf9b05019e6d1cc7a685e32bbfb751cf3a78/antlr4-python3-runtime-4.9.1.tar.gz (173kB)
  31. Collecting certifi==2020.12.5 (from -r requirements.txt (line 3))
  32. Downloading https://files.pythonhosted.org/packages/5e/a0/5f06e1e1d463903cf0c0eebeb751791119ed7a4b3737fdc9a77f1cdfb51f/certifi-2020.12.5-py2.py3-none-any.whl (147kB)
  33. Collecting cffi==1.14.5 (from -r requirements.txt (line 4))
  34. Downloading https://files.pythonhosted.org/packages/2b/cf/9a3b04e57191a970836aeaa8b2075574f02fbdb65d6368457a2f13213e7f/cffi-1.14.5-cp36-cp36m-manylinux1_x86_64.whl (401kB)
  35. Collecting chardet==4.0.0 (from -r requirements.txt (line 5))
  36. Downloading https://files.pythonhosted.org/packages/19/c7/fa589626997dd07bd87d9269342ccb74b1720384a4d739a1872bd84fbe68/chardet-4.0.0-py2.py3-none-any.whl (178kB)
  37. Collecting click==7.1.2 (from -r requirements.txt (line 6))
  38. Downloading https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB)
  39. Collecting cryptography==3.4.6 (from -r requirements.txt (line 7))
  40. Downloading https://files.pythonhosted.org/packages/2f/9f/ad80cfcf9fab90a32cf4e65048cee0936be8ac57cf2a3f63edb88a84eeaf/cryptography-3.4.6-cp36-abi3-manylinux2010_x86_64.whl (3.1MB)
  41. Collecting elasticsearch==7.11.0 (from -r requirements.txt (line 8))
  42. Downloading https://files.pythonhosted.org/packages/72/68/76c5d46cc6a48fddb759f585bc8728caa11bfc9b812ce6705fc5f99beab2/elasticsearch-7.11.0-py2.py3-none-any.whl (325kB)
  43. Collecting flask==1.1.2 (from -r requirements.txt (line 9))
  44. Downloading https://files.pythonhosted.org/packages/f2/28/2a03252dfb9ebf377f40fba6a7841b47083260bf8bd8e737b0c6952df83f/Flask-1.1.2-py2.py3-none-any.whl (94kB)
  45. Collecting gevent-websocket==0.10.1 (from -r requirements.txt (line 10))
  46. Downloading https://files.pythonhosted.org/packages/7b/84/2dc373eb6493e00c884cc11e6c059ec97abae2678d42f06bf780570b0193/gevent_websocket-0.10.1-py3-none-any.whl
  47. Collecting gevent==21.1.2 (from -r requirements.txt (line 11))
  48. Downloading https://files.pythonhosted.org/packages/f5/90/000736e587a720f8eef2bcd384456ce2add5ddfc3c63cf51a7ea13412cb6/gevent-21.1.2-cp36-cp36m-manylinux2010_x86_64.whl (5.5MB)
  49. Collecting greenlet==1.0.0 (from -r requirements.txt (line 12))
  50. Downloading https://files.pythonhosted.org/packages/22/e2/9fbb24cf1ee89813ded3761314562a83a2822ad2bf5682eef0d0c99e2a5d/greenlet-1.0.0-cp36-cp36m-manylinux2010_x86_64.whl (156kB)
  51. Collecting idna==2.10 (from -r requirements.txt (line 13))
  52. Downloading https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl (58kB)
  53. Collecting importlib-metadata==3.7.2 (from -r requirements.txt (line 14))
  54. Downloading https://files.pythonhosted.org/packages/34/7c/15499080be7cbb30579630238c6472c7c3529deca03bfab7bdead6419cd1/importlib_metadata-3.7.2-py3-none-any.whl
  55. Collecting itsdangerous==1.1.0 (from -r requirements.txt (line 15))
  56. Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
  57. Collecting jinja2==2.11.3 (from -r requirements.txt (line 16))
  58. Downloading https://files.pythonhosted.org/packages/7e/c2/1eece8c95ddbc9b1aeb64f5783a9e07a286de42191b7204d67b7496ddf35/Jinja2-2.11.3-py2.py3-none-any.whl (125kB)
  59. Collecting markdown==3.3.4 (from -r requirements.txt (line 17))
  60. Downloading https://files.pythonhosted.org/packages/6e/33/1ae0f71395e618d6140fbbc9587cc3156591f748226075e0f7d6f9176522/Markdown-3.3.4-py3-none-any.whl (97kB)
  61. Collecting markupsafe==1.1.1 (from -r requirements.txt (line 18))
  62. Downloading https://files.pythonhosted.org/packages/9d/d3/75cddfad6ca1d1bb3a017cece499a65e54ceb4583800f1256b8ad07bb57f/MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl
  63. Collecting mongoengine==0.23.0 (from -r requirements.txt (line 19))
  64. Downloading https://files.pythonhosted.org/packages/7e/6a/35699b1079aecebd88aae02ca3eb3a5a645cfd46a53c0df28b1e5c3e5768/mongoengine-0.23.0-py3-none-any.whl (107kB)
  65. Collecting passlib==1.7.4 (from -r requirements.txt (line 20))
  66. Downloading https://files.pythonhosted.org/packages/3b/a4/ab6b7589382ca3df236e03faa71deac88cae040af60c071a78d254a62172/passlib-1.7.4-py2.py3-none-any.whl (525kB)
  67. Collecting pycparser==2.20 (from -r requirements.txt (line 21))
  68. Downloading https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112kB)
  69. Collecting pymongo==3.11.3 (from -r requirements.txt (line 22))
  70. Downloading https://files.pythonhosted.org/packages/03/4b/2adf815a054b467e87de2b5c830dfc9bc75e9ae7f977b50e6bb8eca7c3ac/pymongo-3.11.3-cp36-cp36m-manylinux1_x86_64.whl (492kB)
  71. Collecting pyopenssl==20.0.1 (from -r requirements.txt (line 23))
  72. Downloading https://files.pythonhosted.org/packages/b2/5e/06351ede29fd4899782ad335c2e02f1f862a887c20a3541f17c3fa1a3525/pyOpenSSL-20.0.1-py2.py3-none-any.whl (54kB)
  73. Collecting python-dateutil==2.8.1 (from -r requirements.txt (line 24))
  74. Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
  75. Collecting pyyaml==5.4.1 (from -r requirements.txt (line 25))
  76. Downloading https://files.pythonhosted.org/packages/7a/5b/bc0b5ab38247bba158504a410112b6c03f153c652734ece1849749e5f518/PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (640kB)
  77. Collecting requests==2.25.1 (from -r requirements.txt (line 26))
  78. Downloading https://files.pythonhosted.org/packages/29/c1/24814557f1d22c56d50280771a17307e6bf87b70727d975fd6b2ce6b014a/requests-2.25.1-py2.py3-none-any.whl (61kB)
  79. Collecting six==1.15.0 (from -r requirements.txt (line 27))
  80. Downloading https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
  81. Collecting splunk-sdk==1.6.15 (from -r requirements.txt (line 28))
  82. Downloading https://files.pythonhosted.org/packages/9d/65/ca741361b7199b279cd83753ebbc9671e5364a850859864200a6caee6f63/splunk-sdk-1.6.15.tar.gz (105kB)
  83. Collecting typing-extensions==3.7.4.3 (from -r requirements.txt (line 29))
  84. Downloading https://files.pythonhosted.org/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl
  85. Collecting urllib3==1.26.3 (from -r requirements.txt (line 30))
  86. Downloading https://files.pythonhosted.org/packages/23/fc/8a49991f7905261f9ca9df5aa9b58363c3c821ce3e7f671895442b7100f2/urllib3-1.26.3-py2.py3-none-any.whl (137kB)
  87. Collecting werkzeug==1.0.1 (from -r requirements.txt (line 31))
  88. Downloading https://files.pythonhosted.org/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (298kB)
  89. Collecting zipp==3.4.1 (from -r requirements.txt (line 32))
  90. Downloading https://files.pythonhosted.org/packages/0f/8c/715c54e9e34c0c4820f616a913a7de3337d0cd79074dd1bed4dd840f16ae/zipp-3.4.1-py3-none-any.whl
  91. Collecting zope.event==4.5.0 (from -r requirements.txt (line 33))
  92. Downloading https://files.pythonhosted.org/packages/9e/85/b45408c64f3b888976f1d5b37eed8d746b8d5729a66a49ec846fda27d371/zope.event-4.5.0-py2.py3-none-any.whl
  93. Collecting zope.interface==5.2.0 (from -r requirements.txt (line 34))
  94. Downloading https://files.pythonhosted.org/packages/82/b0/da8afd9b3bd50c7665ecdac062f182982af1173c9081f9af7261091c5588/zope.interface-5.2.0-cp36-cp36m-manylinux2010_x86_64.whl (236kB)
  95. Requirement already satisfied: setuptools in /usr/local/lib/python3.6/site-packages (from gevent==21.1.2->-r requirements.txt (line 11)) (41.0.1)
  96. Building wheels for collected packages: antlr4-python3-runtime, splunk-sdk
  97. Building wheel for antlr4-python3-runtime (setup.py): started
  98. Building wheel for antlr4-python3-runtime (setup.py): finished with status 'done'
  99. Stored in directory: /root/.cache/pip/wheels/91/71/b3/107269b49ae650db5158b5645960dea7802e3765624e5a1e1c
  100. Building wheel for splunk-sdk (setup.py): started
  101. Building wheel for splunk-sdk (setup.py): finished with status 'done'
  102. Stored in directory: /root/.cache/pip/wheels/b6/d7/0f/0c62897973efc0b21e31712241396c099af237d0a866be8292
  103. Successfully built antlr4-python3-runtime splunk-sdk
  104. Installing collected packages: antlr4-python3-runtime, certifi, pycparser, cffi, chardet, click, cryptography, urllib3, elasticsearch, werkzeug, markupsafe, jinja2, itsdangerous, flask, greenlet, zope.interface, zope.event, gevent, gevent-websocket, idna, typing-extensions, zipp, importlib-metadata, markdown, pymongo, mongoengine, passlib, six, pyopenssl, python-dateutil, pyyaml, requests, splunk-sdk
  105. Successfully installed antlr4-python3-runtime-4.9.1 certifi-2020.12.5 cffi-1.14.5 chardet-4.0.0 click-7.1.2 cryptography-3.4.6 elasticsearch-7.11.0 flask-1.1.2 gevent-21.1.2 gevent-websocket-0.10.1 greenlet-1.0.0 idna-2.10 importlib-metadata-3.7.2 itsdangerous-1.1.0 jinja2-2.11.3 markdown-3.3.4 markupsafe-1.1.1 mongoengine-0.23.0 passlib-1.7.4 pycparser-2.20 pymongo-3.11.3 pyopenssl-20.0.1 python-dateutil-2.8.1 pyyaml-5.4.1 requests-2.25.1 six-1.15.0 splunk-sdk-1.6.15 typing-extensions-3.7.4.3 urllib3-1.26.3 werkzeug-1.0.1 zipp-3.4.1 zope.event-4.5.0 zope.interface-5.2.0
  106. WARNING: You are using pip version 19.1.1, however version 21.3.1 is available.
  107. You should consider upgrading via the 'pip install --upgrade pip' command.
  108. Removing intermediate container 2d5b5bbd64ea
  109. ---> f2fc4abc9d29
  110. Step 6/8 : COPY . .
  111. ---> f3c20447494f
  112. Step 7/8 : COPY docker_defaults.yml conf/defaults.yml
  113. ---> e316a7a9e83f
  114. Step 8/8 : CMD /bin/bash docker_start.sh
  115. ---> Running in c0072b683627
  116. Removing intermediate container c0072b683627
  117. ---> 32fde45d2e5a
  118. Successfully built 32fde45d2e5a
  119. Successfully tagged cascade:latest
  120. [root@pig cascade-server]#
  1. [root@pig cascade-server]# docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. cascade latest 32fde45d2e5a About a minute ago 1.02GB
  4. mongo 4.0 fb1435e8841c 3 months ago 430MB
  5. python 3.6.8 48c06762acf0 3 years ago 924MB
  6. [root@pig cascade-server]#

        (4)启动cascade_web

        cascade:latest构建完成后,就可以使用它来启动cascade_web服务了,这里同样要解决几个问题:

        一是映射存储卷,-v cascade_conf:/opt/cascade-server/conf

        二是映射服务端口,-p 5000:5000

        三是服务名称,--name cascade_web

        四是容器连接,应为该容器需要基于mongodb服务运作,所以需要使用 --link mongodb 连接

  1. [root@pig cascade-server]# docker run -d -p 5000:5000 -v cascade_conf:/opt/cascade-server/conf --name cascade_web --link mongodb cascade:latest
  2. ce61237d122891418ae8ad3e4212c82f9286d55c0c77dbeec6d2d3cf8dd35a9c
  3. [root@pig cascade-server]# docker ps
  4. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  5. ce61237d1228 cascade:latest "/bin/sh -c '/bin/ba…" 8 seconds ago Up 7 seconds 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp cascade_web
  6. a02c3ce1d886 mongo:4.0 "docker-entrypoint.s…" 27 minutes ago Up 18 minutes 127.0.0.1:27017->27017/tcp mongodb
  7. [root@pig cascade-server]#

        然后在宿主机浏览器中访问localhost:5000,就可以进入cascade的登陆页面了

 这里有个疑问,是不是一定要建立这个连接?mongodb不是也被绑到了宿主机的27017端口上?而且之前我们在倒腾网络时不是也试过,从容器向外访问是没有问题的。

然而实际情况是不行,必须连接,否则cascade_web无法使用mongodb的数据库,从而导致create

account页面失效,无法创建用户。

具体表现就是这个按钮无论怎么点,页面就是没反应,也不会报任何错误:

         至于cascade_jobs,我们就不在赘述了,反正一时半会也用不上。

        4.  使用docker-compose部署cascade

        经过手撸这一遍,我们对cascade的容器部署方式可以说是一步一步体验了一把,具体在直接使用docker-compose部署失败的时候怎么解决,就会比较容易的找到问题并进行解决:

        一是cascade:latest的构建,Dockfile中的python基础镜像,需要使用3.6.8的版本。

        二是docker-compose.yml中,按理说还是应该加上个依赖关系的。

         改动后,依序使用docker-compose build和docker-compose up来构建镜像并启动服务:        

  1. [root@pig cascade-server]# docker-compose build
  2. WARN[0000] The "http_proxy" variable is not set. Defaulting to a blank string.
  3. WARN[0000] The "https_proxy" variable is not set. Defaulting to a blank string.
  4. WARN[0000] The "no_proxy" variable is not set. Defaulting to a blank string.
  5. Sending build context to Docker daemon 13.55MB
  6. Step 1/8 : FROM python:3.6.8
  7. 3.6.8: Pulling from library/python
  8. 6f2f362378c5: Pull complete
  9. 494c27a8a6b8: Pull complete
  10. 7596bb83081b: Pull complete
  11. 372744b62d49: Pull complete
  12. 615db220d76c: Pull complete
  13. 1865698adfb0: Pull complete
  14. 7159b3304cc0: Pull complete
  15. ad0713808ef6: Pull complete
  16. 7ba593904573: Pull complete
  17. Digest: sha256:f20a9bfddd87c238c3d2316b4179222f219090cbb25d5b6975070d4dd4b75004
  18. Status: Downloaded newer image for python:3.6.8
  19. ---> 48c06762acf0
  20. Step 2/8 : RUN mkdir -p /opt/cascade-server
  21. ---> Running in 63773441106e
  22. ---> 4f45921fe585
  23. Step 3/8 : WORKDIR /opt/cascade-server
  24. ---> Running in 54501192c07d
  25. ---> 9e60ed4374a8
  26. Step 4/8 : COPY requirements.txt .
  27. ---> d8bba6608bd7
  28. Step 5/8 : RUN pip install -r requirements.txt
  29. ---> Running in 421de5fb3ca1
  30. Collecting antlr4-python3-runtime==4.9.1 (from -r requirements.txt (line 2))
  31. Downloading https://files.pythonhosted.org/packages/0a/89/d1926c443bbfdc28321b1435bf9b05019e6d1cc7a685e32bbfb751cf3a78/antlr4-python3-runtime-4.9.1.tar.gz (173kB)
  32. Collecting certifi==2020.12.5 (from -r requirements.txt (line 3))
  33. Downloading https://files.pythonhosted.org/packages/5e/a0/5f06e1e1d463903cf0c0eebeb751791119ed7a4b3737fdc9a77f1cdfb51f/certifi-2020.12.5-py2.py3-none-any.whl (147kB)
  34. Collecting cffi==1.14.5 (from -r requirements.txt (line 4))
  35. Downloading https://files.pythonhosted.org/packages/2b/cf/9a3b04e57191a970836aeaa8b2075574f02fbdb65d6368457a2f13213e7f/cffi-1.14.5-cp36-cp36m-manylinux1_x86_64.whl (401kB)
  36. Collecting chardet==4.0.0 (from -r requirements.txt (line 5))
  37. Downloading https://files.pythonhosted.org/packages/19/c7/fa589626997dd07bd87d9269342ccb74b1720384a4d739a1872bd84fbe68/chardet-4.0.0-py2.py3-none-any.whl (178kB)
  38. Collecting click==7.1.2 (from -r requirements.txt (line 6))
  39. Downloading https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB)
  40. Collecting cryptography==3.4.6 (from -r requirements.txt (line 7))
  41. Downloading https://files.pythonhosted.org/packages/2f/9f/ad80cfcf9fab90a32cf4e65048cee0936be8ac57cf2a3f63edb88a84eeaf/cryptography-3.4.6-cp36-abi3-manylinux2010_x86_64.whl (3.1MB)
  42. Collecting elasticsearch==7.11.0 (from -r requirements.txt (line 8))
  43. Downloading https://files.pythonhosted.org/packages/72/68/76c5d46cc6a48fddb759f585bc8728caa11bfc9b812ce6705fc5f99beab2/elasticsearch-7.11.0-py2.py3-none-any.whl (325kB)
  44. Collecting flask==1.1.2 (from -r requirements.txt (line 9))
  45. Downloading https://files.pythonhosted.org/packages/f2/28/2a03252dfb9ebf377f40fba6a7841b47083260bf8bd8e737b0c6952df83f/Flask-1.1.2-py2.py3-none-any.whl (94kB)
  46. Collecting gevent-websocket==0.10.1 (from -r requirements.txt (line 10))
  47. Downloading https://files.pythonhosted.org/packages/7b/84/2dc373eb6493e00c884cc11e6c059ec97abae2678d42f06bf780570b0193/gevent_websocket-0.10.1-py3-none-any.whl
  48. Collecting gevent==21.1.2 (from -r requirements.txt (line 11))
  49. Downloading https://files.pythonhosted.org/packages/f5/90/000736e587a720f8eef2bcd384456ce2add5ddfc3c63cf51a7ea13412cb6/gevent-21.1.2-cp36-cp36m-manylinux2010_x86_64.whl (5.5MB)
  50. Collecting greenlet==1.0.0 (from -r requirements.txt (line 12))
  51. Downloading https://files.pythonhosted.org/packages/22/e2/9fbb24cf1ee89813ded3761314562a83a2822ad2bf5682eef0d0c99e2a5d/greenlet-1.0.0-cp36-cp36m-manylinux2010_x86_64.whl (156kB)
  52. Collecting idna==2.10 (from -r requirements.txt (line 13))
  53. Downloading https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl (58kB)
  54. Collecting importlib-metadata==3.7.2 (from -r requirements.txt (line 14))
  55. Downloading https://files.pythonhosted.org/packages/34/7c/15499080be7cbb30579630238c6472c7c3529deca03bfab7bdead6419cd1/importlib_metadata-3.7.2-py3-none-any.whl
  56. Collecting itsdangerous==1.1.0 (from -r requirements.txt (line 15))
  57. Downloading https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
  58. Collecting jinja2==2.11.3 (from -r requirements.txt (line 16))
  59. Downloading https://files.pythonhosted.org/packages/7e/c2/1eece8c95ddbc9b1aeb64f5783a9e07a286de42191b7204d67b7496ddf35/Jinja2-2.11.3-py2.py3-none-any.whl (125kB)
  60. Collecting markdown==3.3.4 (from -r requirements.txt (line 17))
  61. Downloading https://files.pythonhosted.org/packages/6e/33/1ae0f71395e618d6140fbbc9587cc3156591f748226075e0f7d6f9176522/Markdown-3.3.4-py3-none-any.whl (97kB)
  62. Collecting markupsafe==1.1.1 (from -r requirements.txt (line 18))
  63. Downloading https://files.pythonhosted.org/packages/9d/d3/75cddfad6ca1d1bb3a017cece499a65e54ceb4583800f1256b8ad07bb57f/MarkupSafe-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl
  64. Collecting mongoengine==0.23.0 (from -r requirements.txt (line 19))
  65. Downloading https://files.pythonhosted.org/packages/7e/6a/35699b1079aecebd88aae02ca3eb3a5a645cfd46a53c0df28b1e5c3e5768/mongoengine-0.23.0-py3-none-any.whl (107kB)
  66. Collecting passlib==1.7.4 (from -r requirements.txt (line 20))
  67. Downloading https://files.pythonhosted.org/packages/3b/a4/ab6b7589382ca3df236e03faa71deac88cae040af60c071a78d254a62172/passlib-1.7.4-py2.py3-none-any.whl (525kB)
  68. Collecting pycparser==2.20 (from -r requirements.txt (line 21))
  69. Downloading https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112kB)
  70. Collecting pymongo==3.11.3 (from -r requirements.txt (line 22))
  71. Downloading https://files.pythonhosted.org/packages/03/4b/2adf815a054b467e87de2b5c830dfc9bc75e9ae7f977b50e6bb8eca7c3ac/pymongo-3.11.3-cp36-cp36m-manylinux1_x86_64.whl (492kB)
  72. Collecting pyopenssl==20.0.1 (from -r requirements.txt (line 23))
  73. Downloading https://files.pythonhosted.org/packages/b2/5e/06351ede29fd4899782ad335c2e02f1f862a887c20a3541f17c3fa1a3525/pyOpenSSL-20.0.1-py2.py3-none-any.whl (54kB)
  74. Collecting python-dateutil==2.8.1 (from -r requirements.txt (line 24))
  75. Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
  76. Collecting pyyaml==5.4.1 (from -r requirements.txt (line 25))
  77. Downloading https://files.pythonhosted.org/packages/7a/5b/bc0b5ab38247bba158504a410112b6c03f153c652734ece1849749e5f518/PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (640kB)
  78. Collecting requests==2.25.1 (from -r requirements.txt (line 26))
  79. Downloading https://files.pythonhosted.org/packages/29/c1/24814557f1d22c56d50280771a17307e6bf87b70727d975fd6b2ce6b014a/requests-2.25.1-py2.py3-none-any.whl (61kB)
  80. Collecting six==1.15.0 (from -r requirements.txt (line 27))
  81. Downloading https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
  82. Collecting splunk-sdk==1.6.15 (from -r requirements.txt (line 28))
  83. Downloading https://files.pythonhosted.org/packages/9d/65/ca741361b7199b279cd83753ebbc9671e5364a850859864200a6caee6f63/splunk-sdk-1.6.15.tar.gz (105kB)
  84. Collecting typing-extensions==3.7.4.3 (from -r requirements.txt (line 29))
  85. Downloading https://files.pythonhosted.org/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl
  86. Collecting urllib3==1.26.3 (from -r requirements.txt (line 30))
  87. Downloading https://files.pythonhosted.org/packages/23/fc/8a49991f7905261f9ca9df5aa9b58363c3c821ce3e7f671895442b7100f2/urllib3-1.26.3-py2.py3-none-any.whl (137kB)
  88. Collecting werkzeug==1.0.1 (from -r requirements.txt (line 31))
  89. Downloading https://files.pythonhosted.org/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl (298kB)
  90. Collecting zipp==3.4.1 (from -r requirements.txt (line 32))
  91. Downloading https://files.pythonhosted.org/packages/0f/8c/715c54e9e34c0c4820f616a913a7de3337d0cd79074dd1bed4dd840f16ae/zipp-3.4.1-py3-none-any.whl
  92. Collecting zope.event==4.5.0 (from -r requirements.txt (line 33))
  93. Downloading https://files.pythonhosted.org/packages/9e/85/b45408c64f3b888976f1d5b37eed8d746b8d5729a66a49ec846fda27d371/zope.event-4.5.0-py2.py3-none-any.whl
  94. Collecting zope.interface==5.2.0 (from -r requirements.txt (line 34))
  95. Downloading https://files.pythonhosted.org/packages/82/b0/da8afd9b3bd50c7665ecdac062f182982af1173c9081f9af7261091c5588/zope.interface-5.2.0-cp36-cp36m-manylinux2010_x86_64.whl (236kB)
  96. Requirement already satisfied: setuptools in /usr/local/lib/python3.6/site-packages (from gevent==21.1.2->-r requirements.txt (line 11)) (41.0.1)
  97. Building wheels for collected packages: antlr4-python3-runtime, splunk-sdk
  98. Building wheel for antlr4-python3-runtime (setup.py): started
  99. Building wheel for antlr4-python3-runtime (setup.py): finished with status 'done'
  100. Stored in directory: /root/.cache/pip/wheels/91/71/b3/107269b49ae650db5158b5645960dea7802e3765624e5a1e1c
  101. Building wheel for splunk-sdk (setup.py): started
  102. Building wheel for splunk-sdk (setup.py): finished with status 'done'
  103. Stored in directory: /root/.cache/pip/wheels/b6/d7/0f/0c62897973efc0b21e31712241396c099af237d0a866be8292
  104. Successfully built antlr4-python3-runtime splunk-sdk
  105. Installing collected packages: antlr4-python3-runtime, certifi, pycparser, cffi, chardet, click, cryptography, urllib3, elasticsearch, markupsafe, jinja2, itsdangerous, werkzeug, flask, zope.interface, greenlet, zope.event, gevent, gevent-websocket, idna, typing-extensions, zipp, importlib-metadata, markdown, pymongo, mongoengine, passlib, six, pyopenssl, python-dateutil, pyyaml, requests, splunk-sdk
  106. Successfully installed antlr4-python3-runtime-4.9.1 certifi-2020.12.5 cffi-1.14.5 chardet-4.0.0 click-7.1.2 cryptography-3.4.6 elasticsearch-7.11.0 flask-1.1.2 gevent-21.1.2 gevent-websocket-0.10.1 greenlet-1.0.0 idna-2.10 importlib-metadata-3.7.2 itsdangerous-1.1.0 jinja2-2.11.3 markdown-3.3.4 markupsafe-1.1.1 mongoengine-0.23.0 passlib-1.7.4 pycparser-2.20 pymongo-3.11.3 pyopenssl-20.0.1 python-dateutil-2.8.1 pyyaml-5.4.1 requests-2.25.1 six-1.15.0 splunk-sdk-1.6.15 typing-extensions-3.7.4.3 urllib3-1.26.3 werkzeug-1.0.1 zipp-3.4.1 zope.event-4.5.0 zope.interface-5.2.0
  107. WARNING: You are using pip version 19.1.1, however version 21.3.1 is available.
  108. You should consider upgrading via the 'pip install --upgrade pip' command.
  109. ---> 4800aff9357c
  110. Step 6/8 : COPY . .
  111. ---> a8f6e4a6d686
  112. Step 7/8 : COPY docker_defaults.yml conf/defaults.yml
  113. ---> d4641c2b07b2
  114. Step 8/8 : CMD /bin/bash docker_start.sh
  115. ---> Running in ce43e538eb5b
  116. ---> 95e91c0b9574
  117. Successfully built 95e91c0b9574
  118. Successfully tagged cascade:latest
  119. Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them

 启动

  1. [root@pig cascade-server]# docker-compose up
  2. WARN[0000] The "http_proxy" variable is not set. Defaulting to a blank string.
  3. WARN[0000] The "https_proxy" variable is not set. Defaulting to a blank string.
  4. WARN[0000] The "no_proxy" variable is not set. Defaulting to a blank string.
  5. [+] Running 13/13
  6. ⠿ mongodb Pulled 40.1s
  7. ⠿ 58690f9b18fc Pull complete 14.6s
  8. ⠿ b51569e7c507 Pull complete 14.7s
  9. ⠿ da8ef40b9eca Pull complete 14.7s
  10. ⠿ fb15d46c38dc Pull complete 14.8s
  11. ⠿ a0dc15b16822 Pull complete 14.9s
  12. ⠿ b7a3e92f19af Pull complete 15.1s
  13. ⠿ ed4a7b863fa1 Pull complete 15.2s
  14. ⠿ a58b030ea8e4 Pull complete 15.3s
  15. ⠿ 6aa1ba699846 Pull complete 15.3s
  16. ⠿ ebc52c729dca Pull complete 15.4s
  17. ⠿ 52e8c440d4d6 Pull complete 35.2s
  18. ⠿ 22b97876323d Pull complete 35.3s
  19. [+] Running 6/4
  20. ⠿ Network cascade-server_default Created 0.1s
  21. ⠿ Volume "cascade-server_cascade_conf" Created 0.0s
  22. ⠿ Volume "cascade-server_mongo_data" Created 0.0s
  23. ⠿ Container cascade-server-mongodb-1 Created 0.1s
  24. ⠿ Container cascade-server-cascade_web-1 Created 0.0s
  25. ⠿ Container cascade-server-cascade_jobs-1 Created 0.0s
  26. Attaching to cascade-server-cascade_jobs-1, cascade-server-cascade_web-1, cascade-server-mongodb-1
  27. cascade-server-mongodb-1 | 2022-12-09T08:21:27.506+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
  28. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=be82165789b2
  29. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] db version v4.0.28
  30. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] git version: af1a9dc12adcfa83cc19571cb3faba26eeddac92
  31. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
  32. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] allocator: tcmalloc
  33. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] modules: none
  34. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] build environment:
  35. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] distmod: ubuntu1604
  36. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] distarch: x86_64
  37. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] target_arch: x86_64
  38. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I CONTROL [initandlisten] options: { net: { bindIpAll: true } }
  39. cascade-server-mongodb-1 | 2022-12-09T08:21:27.508+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=380M,cache_overflow=(file_max=0M),session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
  40. cascade-server-mongodb-1 | 2022-12-09T08:21:27.639+0000 I STORAGE [initandlisten] WiredTiger message [1670574087:639595][1:0x7f11867b7a80], txn-recover: Set global recovery timestamp: 0
  41. cascade-server-mongodb-1 | 2022-12-09T08:21:27.644+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
  42. cascade-server-mongodb-1 | 2022-12-09T08:21:27.649+0000 I STORAGE [initandlisten] Starting to check the table logging settings for existing WiredTiger tables
  43. cascade-server-mongodb-1 | 2022-12-09T08:21:27.651+0000 I CONTROL [initandlisten]
  44. cascade-server-mongodb-1 | 2022-12-09T08:21:27.651+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
  45. cascade-server-mongodb-1 | 2022-12-09T08:21:27.651+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
  46. cascade-server-mongodb-1 | 2022-12-09T08:21:27.651+0000 I CONTROL [initandlisten]
  47. cascade-server-mongodb-1 | 2022-12-09T08:21:27.651+0000 I CONTROL [initandlisten]
  48. cascade-server-mongodb-1 | 2022-12-09T08:21:27.651+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
  49. cascade-server-mongodb-1 | 2022-12-09T08:21:27.651+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
  50. cascade-server-mongodb-1 | 2022-12-09T08:21:27.651+0000 I CONTROL [initandlisten]
  51. cascade-server-mongodb-1 | 2022-12-09T08:21:27.652+0000 I STORAGE [initandlisten] createCollection: admin.system.version with provided UUID: 3c8f1749-ef2c-49ee-9652-0c0b6df3490a
  52. cascade-server-mongodb-1 | 2022-12-09T08:21:27.667+0000 I COMMAND [initandlisten] setting featureCompatibilityVersion to 4.0
  53. cascade-server-mongodb-1 | 2022-12-09T08:21:27.667+0000 I STORAGE [initandlisten] Finished adjusting the table logging settings for existing WiredTiger tables
  54. cascade-server-mongodb-1 | 2022-12-09T08:21:27.667+0000 I STORAGE [initandlisten] createCollection: local.startup_log with generated UUID: 176160dd-867f-4c08-aa21-aa62e1aa0b43
  55. cascade-server-mongodb-1 | 2022-12-09T08:21:27.677+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
  56. cascade-server-mongodb-1 | 2022-12-09T08:21:27.681+0000 I STORAGE [LogicalSessionCacheRefresh] createCollection: config.system.sessions with generated UUID: 171b33f1-c619-43ac-88d4-e76f24cd5766
  57. cascade-server-mongodb-1 | 2022-12-09T08:21:27.682+0000 I NETWORK [initandlisten] waiting for connections on port 27017
  58. cascade-server-mongodb-1 | 2022-12-09T08:21:27.697+0000 I INDEX [LogicalSessionCacheRefresh] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 }
  59. cascade-server-mongodb-1 | 2022-12-09T08:21:27.697+0000 I INDEX [LogicalSessionCacheRefresh] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
  60. cascade-server-mongodb-1 | 2022-12-09T08:21:27.699+0000 I INDEX [LogicalSessionCacheRefresh] build index done. scanned 0 total records. 0 secs
  61. cascade-server-cascade_web-1 | cascade.yml not found. Generating new config file from defaults
  62. cascade-server-mongodb-1 | 2022-12-09T08:21:30.039+0000 I NETWORK [listener] connection accepted from 172.18.0.3:60212 #1 (1 connection now open)
  63. cascade-server-mongodb-1 | 2022-12-09T08:21:30.040+0000 I NETWORK [conn1] received client metadata from 172.18.0.3:60212 conn1: { driver: { name: "PyMongo", version: "3.11.3" }, os: { type: "Linux", name: "Linux", architecture: "x86_64", version: "4.18.0-373.el8.x86_64" }, platform: "CPython 3.6.8.final.0" }
  64. cascade-server-mongodb-1 | 2022-12-09T08:21:30.045+0000 I NETWORK [listener] connection accepted from 172.18.0.3:60214 #2 (2 connections now open)
  65. cascade-server-mongodb-1 | 2022-12-09T08:21:30.046+0000 I NETWORK [conn2] received client metadata from 172.18.0.3:60214 conn2: { driver: { name: "PyMongo", version: "3.11.3" }, os: { type: "Linux", name: "Linux", architecture: "x86_64", version: "4.18.0-373.el8.x86_64" }, platform: "CPython 3.6.8.final.0" }
  66. cascade-server-mongodb-1 | 2022-12-09T08:21:30.048+0000 I STORAGE [conn2] createCollection: cascade2.attack_technique with generated UUID: e220274c-af1e-4beb-a086-6b9df32bcf65
  67. cascade-server-mongodb-1 | 2022-12-09T08:21:30.082+0000 I STORAGE [conn2] createCollection: cascade2.attack_tactic with generated UUID: b2e0c2db-e9c8-43cb-9227-07446bb05fa0
  68. cascade-server-mongodb-1 | 2022-12-09T08:21:30.100+0000 I NETWORK [conn2] end connection 172.18.0.3:60214 (1 connection now open)
  69. cascade-server-mongodb-1 | 2022-12-09T08:21:30.103+0000 I NETWORK [conn1] end connection 172.18.0.3:60212 (0 connections now open)
  70. cascade-server-mongodb-1 | 2022-12-09T08:21:30.106+0000 I NETWORK [listener] connection accepted from 172.18.0.3:60216 #3 (1 connection now open)
  71. cascade-server-mongodb-1 | 2022-12-09T08:21:30.107+0000 I NETWORK [conn3] received client metadata from 172.18.0.3:60216 conn3: { driver: { name: "PyMongo", version: "3.11.3" }, os: { type: "Linux", name: "Linux", architecture: "x86_64", version: "4.18.0-373.el8.x86_64" }, platform: "CPython 3.6.8.final.0" }
  72. cascade-server-mongodb-1 | 2022-12-09T08:21:30.113+0000 I NETWORK [listener] connection accepted from 172.18.0.3:60218 #4 (2 connections now open)
  73. cascade-server-mongodb-1 | 2022-12-09T08:21:30.114+0000 I NETWORK [conn4] received client metadata from 172.18.0.3:60218 conn4: { driver: { name: "PyMongo", version: "3.11.3" }, os: { type: "Linux", name: "Linux", architecture: "x86_64", version: "4.18.0-373.el8.x86_64" }, platform: "CPython 3.6.8.final.0" }
  74. cascade-server-mongodb-1 | 2022-12-09T08:21:30.117+0000 I STORAGE [conn4] createCollection: cascade2.analytic with generated UUID: 34fee893-e4f0-450d-b090-69c3b92a002b
  75. cascade-server-mongodb-1 | 2022-12-09T08:21:30.136+0000 I NETWORK [conn4] end connection 172.18.0.3:60218 (1 connection now open)
  76. cascade-server-mongodb-1 | 2022-12-09T08:21:30.136+0000 I NETWORK [conn3] end connection 172.18.0.3:60216 (0 connections now open)
  77. cascade-server-mongodb-1 | 2022-12-09T08:21:30.141+0000 I NETWORK [listener] connection accepted from 172.18.0.3:60220 #5 (1 connection now open)
  78. cascade-server-mongodb-1 | 2022-12-09T08:21:30.141+0000 I NETWORK [conn5] received client metadata from 172.18.0.3:60220 conn5: { driver: { name: "PyMongo", version: "3.11.3" }, os: { type: "Linux", name: "Linux", architecture: "x86_64", version: "4.18.0-373.el8.x86_64" }, platform: "CPython 3.6.8.final.0" }
  79. cascade-server-mongodb-1 | 2022-12-09T08:21:30.148+0000 I NETWORK [listener] connection accepted from 172.18.0.3:60222 #6 (2 connections now open)
  80. cascade-server-mongodb-1 | 2022-12-09T08:21:30.148+0000 I NETWORK [conn6] received client metadata from 172.18.0.3:60222 conn6: { driver: { name: "PyMongo", version: "3.11.3" }, os: { type: "Linux", name: "Linux", architecture: "x86_64", version: "4.18.0-373.el8.x86_64" }, platform: "CPython 3.6.8.final.0" }
  81. cascade-server-mongodb-1 | 2022-12-09T08:21:30.149+0000 I STORAGE [conn6] createCollection: cascade2.session with generated UUID: 2ea3906d-d835-49ec-ac57-a0f659b17336
  82. cascade-server-cascade_web-1 | Automatically updated configuration settings for CASCADE based on defaults.yml
  83. cascade-server-cascade_web-1 |
  84. cascade-server-cascade_web-1 | Initializing database...
  85. cascade-server-cascade_web-1 | Importing collection attack_technique
  86. cascade-server-cascade_web-1 | Importing collection attack_tactic
  87. cascade-server-cascade_web-1 | Importing collection analytic
  88. cascade-server-cascade_web-1 | Importing collection session
  89. cascade-server-mongodb-1 | 2022-12-09T08:21:30.164+0000 I NETWORK [conn6] end connection 172.18.0.3:60222 (1 connection now open)
  90. cascade-server-mongodb-1 | 2022-12-09T08:21:30.165+0000 I NETWORK [conn5] end connection 172.18.0.3:60220 (0 connections now open)
  91. cascade-server-cascade_jobs-1 | /opt/cascade-server/app/async_wrapper.py:44: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['pymongo.ssl_context (/usr/local/lib/python3.6/site-packages/pymongo/ssl_context.py)', 'urllib3.util.ssl_ (/usr/local/lib/python3.6/site-packages/urllib3/util/ssl_.py)', 'urllib3.util (/usr/local/lib/python3.6/site-packages/urllib3/util/__init__.py)'].
  92. cascade-server-cascade_jobs-1 | gevent.monkey.patch_all()
  93. cascade-server-cascade_jobs-1 | 2022-12-09 08:21:30,934 | INFO | app.cascade.runner | Resetting all dispatched events
  94. cascade-server-mongodb-1 | 2022-12-09T08:21:30.945+0000 I NETWORK [listener] connection accepted from 172.18.0.4:39758 #7 (1 connection now open)
  95. cascade-server-mongodb-1 | 2022-12-09T08:21:30.947+0000 I NETWORK [conn7] received client metadata from 172.18.0.4:39758 conn7: { driver: { name: "PyMongo", version: "3.11.3" }, os: { type: "Linux", name: "Linux", architecture: "x86_64", version: "4.18.0-373.el8.x86_64" }, platform: "CPython 3.6.8.final.0" }
  96. cascade-server-mongodb-1 | 2022-12-09T08:21:30.952+0000 I NETWORK [listener] connection accepted from 172.18.0.4:39760 #8 (2 connections now open)
  97. cascade-server-mongodb-1 | 2022-12-09T08:21:30.954+0000 I NETWORK [conn8] received client metadata from 172.18.0.4:39760 conn8: { driver: { name: "PyMongo", version: "3.11.3" }, os: { type: "Linux", name: "Linux", architecture: "x86_64", version: "4.18.0-373.el8.x86_64" }, platform: "CPython 3.6.8.final.0" }
  98. cascade-server-mongodb-1 | 2022-12-09T08:21:30.956+0000 I STORAGE [conn8] createCollection: cascade2.job with generated UUID: ec9855be-f877-4cd8-8fa6-175d6b827c20
  99. cascade-server-mongodb-1 | 2022-12-09T08:21:31.011+0000 I INDEX [conn8] build index on: cascade2.job properties: { v: 2, unique: true, key: { uuid: 1 }, name: "uuid_1", ns: "cascade2.job", background: false }
  100. cascade-server-mongodb-1 | 2022-12-09T08:21:31.011+0000 I INDEX [conn8] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
  101. cascade-server-mongodb-1 | 2022-12-09T08:21:31.013+0000 I INDEX [conn8] build index done. scanned 0 total records. 0 secs
  102. cascade-server-mongodb-1 | 2022-12-09T08:21:31.017+0000 I INDEX [conn8] build index on: cascade2.job properties: { v: 2, key: { _cls: 1 }, name: "_cls_1", ns: "cascade2.job", background: false }
  103. cascade-server-mongodb-1 | 2022-12-09T08:21:31.017+0000 I INDEX [conn8] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
  104. cascade-server-cascade_jobs-1 | 2022-12-09 08:21:31,024 | INFO | app.cascade.runner | Waiting for worker events...
  105. cascade-server-mongodb-1 | 2022-12-09T08:21:31.019+0000 I INDEX [conn8] build index done. scanned 0 total records. 0 secs
  106. cascade-server-cascade_web-1 | 2022-12-09 08:21:31,204 | WARNING | app.plugins | Couldn't find plugin directory at ./plugins (will not load plugins)
  107. cascade-server-mongodb-1 | 2022-12-09T08:21:31.369+0000 I NETWORK [listener] connection accepted from 172.18.0.3:60228 #9 (3 connections now open)
  108. cascade-server-mongodb-1 | 2022-12-09T08:21:31.370+0000 I NETWORK [conn9] received client metadata from 172.18.0.3:60228 conn9: { driver: { name: "PyMongo", version: "3.11.3" }, os: { type: "Linux", name: "Linux", architecture: "x86_64", version: "4.18.0-373.el8.x86_64" }, platform: "CPython 3.6.8.final.0" }

        可以看到,现在这个安装部署就不是一般的简洁了。

        四、Cascade的使用

        创建好用户,登陆进去以后,在sessions菜单下,有个upload选项,可以供我们将mitre提供的示例数据载入进去体验一下:

 点击,在弹出对话框中选择“choose file”,选择在cascade-server/misc目录下的brawl-public-game-001.bson。

 

 打开后upload

 成功后数据就被载入了,关闭即可

        喝口茶等机器折腾会,然后刷新一下页面,再次看看sessions菜单,会发现这次多出来了刚才我们加入的数据(也就是被cascade-server成为session的一次数据分析任务)        

         选择以后,就可以看到载入的数据的统计信息了

         然后就可以开始愉快的玩耍了:

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/68499
推荐阅读
相关标签
  

闽ICP备14008679号