Code Monkey home page Code Monkey logo

paper-dragon.github.io's Issues

BackdoorSecureGuardian

项目名称BackdoorSecureGuardian
写一个Django服务器,
有一个post的接口,用于接收客户机传送来的数据 /slave-track

  • 在配置里新增私钥,公钥,客户机数据进行加密,服务器进行解密。解密失败则返回状态
  • 使用 pycryptodome进行加密解密
  • 接收数据并进行保存到sqlite中,如果成功则返回json数据,status是successful。
  • 数据结构是 uuid, hostname , lan ip, wan ip, time(同步时间)精确到毫秒, need link(默认是关掉)。
  • 如果有新的数据来,uuid一致,则更新这个记录。如果成功则返回json数据,status是successful。message是保存成功。
    有一个get接口,需要参数uuid,
  • 使用了私钥公钥保护
  • 接收数据校验并且根据uuid参数对数据库里的数据进行查询。
  • 返回json数据,包含need link字段。如果成功则返回json数据,status是successful。

有一个web界面,管理展示和删除数据。

AppArmor限制Linux内核权限,限制Pod权限

  • https://www.apparmor.net/
    AppArmor(Application Armor)是Linux内核的一个安全模块,AppAromor允许系统管理员将每个程序与一个安全配置文件关联,从而限制程序的功能。AppArmor是与SELinux类似的一个访问控制系统,通过它可以指定程序可以读、写或运行哪些文件,是否可以打开网络端口等。作为对传统Unix的自主访问控制模块的补充,AppAromor提供了强制访问控制机制。

AppArmor 可以配置为任何应用程序减少潜在的攻击面,并且提供更加深入的防御,AppArmor 可以通过限制允许容器执行的操作, 和通过系统日志提供更好的审计来帮助你运行更安全的部署

工作模式
Apparmor有两种工作模式:

enforcing(强制模式)

遵循配置文件的规则限制,阻止访问不允许访问的资源

complain(警告模式)

遵循配置文件的规则限制,对访问禁止的资源发出警告但不做限制
[root@node3 ~]# apparmor_parser -q <<EOF
#include <tunables/global>

profile k8s-apparmor-deny-write flags=(attach_disconnected) {
#include <abstractions/base>
file,
deny /** w,
}
EOF

查看是否加载

root@node3:~# cat /sys/kernel/security/apparmor/profiles | grep k8s-apparmor-deny-write
k8s-apparmor-deny-write (enforce)

[root@master1 ~]# cat busybox-test.yaml
apiVersion: v1
kind: Pod
metadata:
name: hello-apparmor
labels:
app: nginx
annotations:
container.apparmor.security.beta.kubernetes.io/test: localhost/k8s-apparmor-deny-write
# 表示对nginx容器应用本地的k8s-apparmor-deny-write策略
spec:
nodeName: node3.xiaowangc.local # 由于Pod的创建是通过调度器可能不会调度到Ubuntu节点,我就直接使用节点选择器测试
containers:

  • name: test
    image: busybox
    command: ["sh", "-c", "echo 'Hello xiaowangc!' && sleep 1h"]

runc创建service模式的container

[Unit]
Description=Start My Container

[Service]
Type=forking
ExecStart=/usr/local/sbin/runc run -d --pid-file /run/mycontainerid.pid mycontainerid
ExecStopPost=/usr/local/sbin/runc delete mycontainerid
WorkingDirectory=/mycontainer
PIDFile=/run/mycontainerid.pid

[Install]
WantedBy=multi-user.target

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.