GithubHelp home page GithubHelp logo

file-monitor's Introduction

Hi there 👋

Intro

Welcome to my github page.

🌱 I’m a Security Engineer of ChinaUnicom .

I Worked at

  1. Chaitin Tech
  2. Xiaomi Inc

😘 And this is my BABY who is learning at University of Chinese Academy of Sciences.
This is my blog and this is its mirror, have a look!

GPG

pub  4096R/964DE07E 2020-08-25            
	 Fingerprint=BF27 2F57 55DE 6084 2550  EA50 B925 23CA 964D E07E 

file-monitor's People

Contributors

dependabot[bot] avatar mashiro01 avatar yueqsun avatar zyazhb avatar

Watchers

 avatar  avatar

file-monitor's Issues

panic: runtime error: invalid memory address or nil pointer dereference

引起原因未知 似乎是rpc传参的时候出现空指针的情况
之后应该做一下错误处理 排除掉一些没有意义的数据

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x5e26dd]

goroutine 3969 [running]:
net/rpc.(*Client).send(0x0, 0xc0014ac050)
        /usr/lib/go-1.15/src/net/rpc/client.go:72 +0x3d
net/rpc.(*Client).Go(0x0, 0x6541a5, 0x19, 0x62f460, 0xc00079c180, 0x5ff5a0, 0xc000d504c0, 0xc00194c000, 0x0)
        /usr/lib/go-1.15/src/net/rpc/client.go:316 +0xd0
net/rpc.(*Client).Call(...)
        /usr/lib/go-1.15/src/net/rpc/client.go:322
main/notify.rpcreportfan(0xc001841950, 0x8c, 0x64f41a, 0xa, 0x0, 0x0, 0x7ffdb5cb91ef, 0xe)
        /mnt/d/root/ZYA/File-monitor/agent/notify/rpcconnect.go:69 +0x1dc
created by main/notify.RunFanotify
        /mnt/d/root/ZYA/File-monitor/agent/notify/notifyfan.go:40 +0x4de
exit status 2

agent日志

  • 改进event 显示更多信息
  • 尝试使用rpc接口上报 一定要处理错误 比如服务端没有启动或端口无法连接 要有回显 本地依旧工作
  • 增加daemon模式
  • 预留inotify fanotify mix模式参数 默认为mix模式

数据库设计

设计用户表

  • 数据库初始化
  • 增查改删

用户角色分为admin和user admin可以控制用户
用户要有对应的日志id以便之后功能合并
其他用户信息可以自由发挥

在测试fanotify时出现panic: unable to open database file: too many open files

server log:
2021/01/27 10:04:35 /root/ZYA/File-monitor/server/model/RpcDbControl.go:57
[error] failed to initialize database, got error unable to open database file: too many open files
panic: unable to open database file: too many open files

agent log:
2021/01/27 10:04:35 ReDial RPC Server Error: dial tcp 127.0.0.1:8083: connect: connection refused

猜测原因为每个用户最多可以创建的fanotify 达到数量上限

前端网页

  • 主页 就一个登录框就可以
  • 登录之后进入的页面是日志查看 可以有一个总览
  • 侧边栏设计 可以跳转到用户管理和用户信息设置
  • 登录失败页面
  • 错误页面如404

暂时可以没后端功能 但是前端要能通 跳转也可以先不做 但是是否数据绑定要看好
目录结构
/static/ 静态文件目录
如果需要用到模板就/static/template
/log/ 日志目录

RPC信息上报

  • 为Fanotify与inotfy的rpc上报设计数据结构
  • 重连设计 #16
  • 数据库设计
  • 是直接传输msg字符串还是event 如果处理字符串应该只需要agent先处理好就可以 如果是event server那边需要重新处理才能输出

  • 安全性
  • 性能

无限重连

会无限redial
还有个问题 redial成功之后 如果服务器再断开连接就再也连不回去了

inotify_watch

兄弟们我这周先熟悉一下,看看怎么调用交互

RPC demo

  • 实现日志实时上报
  • 日志的内容尽量详细一些 看看inotify那边的event是不是需要改良 显示信息不是很全
  • 错误处理 例如断线重连

把rpc.go独立出来 留接口给两边用 可以写个说明文档 方便他们双方接入
关键是预留接口 不是xiaog
大概的效果就是 一个agent的日志可以很清晰的显示在server端 可以采用json传值

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.