From 7cee30276c6a552e357f48db12771346b1f74aef Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 18 Aug 2021 11:08:55 +0800 Subject: [PATCH 1/4] Modify the dockerfile file of the cve proxy service to support the installation and execution of python files --- cve-agency-manager/controllers/live.go | 17 ++--- cve-agency-manager/views/index.tpl | 95 ++++++++++++++++++++++++ cve-vulner-manager/conf/app.conf | 2 +- cve-vulner-manager/conf/product_app.conf | 2 +- 4 files changed, 105 insertions(+), 11 deletions(-) create mode 100644 cve-agency-manager/views/index.tpl diff --git a/cve-agency-manager/controllers/live.go b/cve-agency-manager/controllers/live.go index 7af428a..9bb773e 100644 --- a/cve-agency-manager/controllers/live.go +++ b/cve-agency-manager/controllers/live.go @@ -2,7 +2,6 @@ package controllers import ( "github.com/astaxie/beego" - "github.com/astaxie/beego/logs" ) type TriggerHeartbeatreadController struct { @@ -21,10 +20,10 @@ func (c *TriggerHeartbeatreadController) RetCveData(resp map[string]interface{}) // @Failure 403 body is empty // @router / [get] func (u *TriggerHeartbeatreadController) Get() { - req := u.Ctx.Request - addr := req.RemoteAddr - logs.Info("Method: ", req.Method, "Client request ip address: ", addr, - ", Header: ", req.Header, ", body: ", req.Body) + //req := u.Ctx.Request + //addr := req.RemoteAddr + //logs.Info("Method: ", req.Method, "Client request ip address: ", addr, + // ", Header: ", req.Header, ", body: ", req.Body) resp := make(map[string]interface{}) resp["code"] = "200" resp["errmsg"] = "success" @@ -48,10 +47,10 @@ func (c *TriggerHeartbeatLiveController) RetCveData(resp map[string]interface{}) // @Failure 403 :status is err // @router / [get] func (u *TriggerHeartbeatLiveController) Get() { - req := u.Ctx.Request - addr := req.RemoteAddr - logs.Info("Method: ", req.Method, "Client request ip address: ", addr, - ", Header: ", req.Header, ", body: ", req.Body) + //req := u.Ctx.Request + //addr := req.RemoteAddr + //logs.Info("Method: ", req.Method, "Client request ip address: ", addr, + // ", Header: ", req.Header, ", body: ", req.Body) resp := make(map[string]interface{}) resp["code"] = "200" resp["errmsg"] = "success" diff --git a/cve-agency-manager/views/index.tpl b/cve-agency-manager/views/index.tpl new file mode 100644 index 0000000..8d6fbec --- /dev/null +++ b/cve-agency-manager/views/index.tpl @@ -0,0 +1,95 @@ + + + + + Beego + + + + + + + +
+

Welcome to Beego

+
+ Beego is a simple & powerful Go web framework which is inspired by tornado and sinatra. +
+
+ +
+ + + + diff --git a/cve-vulner-manager/conf/app.conf b/cve-vulner-manager/conf/app.conf index a6d2578..84f0250 100644 --- a/cve-vulner-manager/conf/app.conf +++ b/cve-vulner-manager/conf/app.conf @@ -19,7 +19,7 @@ rejectCmd = "/reject" approveCmd = "/approve" closeCmd = "/close" errorCmd = "/error" -autoPrCmd = "/auto-pr" +autoPrCmd = "/auto-patch" labelFixed = "CVE/FIXED" labelUnFix = "CVE/UNFIXED" labeUnaffected = "CVE/UNAFFECTED" diff --git a/cve-vulner-manager/conf/product_app.conf b/cve-vulner-manager/conf/product_app.conf index 430579e..b5c0bf4 100644 --- a/cve-vulner-manager/conf/product_app.conf +++ b/cve-vulner-manager/conf/product_app.conf @@ -19,7 +19,7 @@ rejectCmd = "/reject" approveCmd = "/approve" closeCmd = "/close" errorCmd = "/error" -autoPrCmd = "/auto-pr" +autoPrCmd = "/auto-patch" labelFixed = "CVE/FIXED" labelUnFix = "CVE/UNFIXED" labeUnaffected = "CVE/UNAFFECTED" -- Gitee From 64af4ed9a6673bcd8084248a6b14de3841fc31c7 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 18 Aug 2021 11:09:29 +0800 Subject: [PATCH 2/4] Modify the dockerfile file of the cve proxy service to support the installation and execution of python files --- cve-agency-manager/views/index.tpl | 95 ------------------------------ 1 file changed, 95 deletions(-) delete mode 100644 cve-agency-manager/views/index.tpl diff --git a/cve-agency-manager/views/index.tpl b/cve-agency-manager/views/index.tpl deleted file mode 100644 index 8d6fbec..0000000 --- a/cve-agency-manager/views/index.tpl +++ /dev/null @@ -1,95 +0,0 @@ - - - - - Beego - - - - - - - -
-

Welcome to Beego

-
- Beego is a simple & powerful Go web framework which is inspired by tornado and sinatra. -
-
- -
- - - - -- Gitee From 8c50cd6f36a28f83489a1a7491a7eb34c54e9a2e Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 18 Aug 2021 11:16:34 +0800 Subject: [PATCH 3/4] Modify the dockerfile file of the cve proxy service to support the installation and execution of python files --- cve-agency-manager/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cve-agency-manager/Dockerfile b/cve-agency-manager/Dockerfile index a922a3e..67a4ee9 100644 --- a/cve-agency-manager/Dockerfile +++ b/cve-agency-manager/Dockerfile @@ -9,12 +9,14 @@ RUN cd /go/src/gitee.com/openeuler/cve-agency-manager && CGO_ENABLED=1 go build # copy binary config and utils FROM golang:latest +RUN apt-get update && apt-get install -y python3 && apt-get install -y python3-pip RUN mkdir -p /opt/app/ && mkdir -p /opt/app/conf/ COPY ./conf/product.conf /opt/app/conf/app.conf # overwrite config yaml COPY ./cve_tracking /opt/app/cve_tracking RUN chmod 755 -R /opt/app/cve_tracking +RUN pip install --no-cache-dir -r /opt/app/cve_tracking/requirements.txt COPY --from=BUILDER /go/src/gitee.com/openeuler/cve-agency-manager/cve-agency-manager /opt/app/cve-agency-manager WORKDIR /opt/app/ -ENTRYPOINT ["/opt/app/cve-agency-manager"] \ No newline at end of file +ENTRYPOINT ["/opt/app/cve-agency-manager"] -- Gitee From b2d0a2746a1245973072c38c1fa0713d3c2f0c54 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 18 Aug 2021 11:09:29 +0800 Subject: [PATCH 4/4] Modify the dockerfile file of the cve proxy service to support the installation and execution of python files --- cve-agency-manager/Dockerfile | 4 +- cve-agency-manager/controllers/track.go | 2 +- cve-agency-manager/views/index.tpl | 95 ------------------------- 3 files changed, 4 insertions(+), 97 deletions(-) delete mode 100644 cve-agency-manager/views/index.tpl diff --git a/cve-agency-manager/Dockerfile b/cve-agency-manager/Dockerfile index a922a3e..d73ef1d 100644 --- a/cve-agency-manager/Dockerfile +++ b/cve-agency-manager/Dockerfile @@ -9,12 +9,14 @@ RUN cd /go/src/gitee.com/openeuler/cve-agency-manager && CGO_ENABLED=1 go build # copy binary config and utils FROM golang:latest +RUN apt-get update && apt-get install -y python3 && apt-get install -y python3-pip RUN mkdir -p /opt/app/ && mkdir -p /opt/app/conf/ COPY ./conf/product.conf /opt/app/conf/app.conf # overwrite config yaml COPY ./cve_tracking /opt/app/cve_tracking RUN chmod 755 -R /opt/app/cve_tracking +RUN pip3 install --no-cache-dir -r /opt/app/cve_tracking/requirements.txt COPY --from=BUILDER /go/src/gitee.com/openeuler/cve-agency-manager/cve-agency-manager /opt/app/cve-agency-manager WORKDIR /opt/app/ -ENTRYPOINT ["/opt/app/cve-agency-manager"] \ No newline at end of file +ENTRYPOINT ["/opt/app/cve-agency-manager"] diff --git a/cve-agency-manager/controllers/track.go b/cve-agency-manager/controllers/track.go index ed41841..cf07348 100644 --- a/cve-agency-manager/controllers/track.go +++ b/cve-agency-manager/controllers/track.go @@ -47,7 +47,7 @@ func (c *TriggerTrackController) Post() { args := []string{pythonFile, "-cve", cvePram.CveNum, "-name", cvePram.PackName, "-v", cvePram.PackVersion, "-branch", cvePram.AffectBranch, "-cmd", "-issue", cvePram.IssueNumber} //args := []string{pythonFile} - out, err := exec.Command("python", args...).Output() + out, err := exec.Command("python3", args...).Output() if err != nil { logs.Error("cmd python3 ==> python ", args, ",err: ", err) resp["errno"] = common.RecodeCmdFailed diff --git a/cve-agency-manager/views/index.tpl b/cve-agency-manager/views/index.tpl deleted file mode 100644 index 8d6fbec..0000000 --- a/cve-agency-manager/views/index.tpl +++ /dev/null @@ -1,95 +0,0 @@ - - - - - Beego - - - - - - - -
-

Welcome to Beego

-
- Beego is a simple & powerful Go web framework which is inspired by tornado and sinatra. -
-
- -
- - - - -- Gitee