From 6d79a2a2d4d8930c874a7e76c8ed1d95e0443c07 Mon Sep 17 00:00:00 2001 From: renkaige Date: Sat, 15 Dec 2018 11:21:25 +0600 Subject: [PATCH] =?UTF-8?q?1:=E8=A1=A5=E5=85=85=E5=90=91=E9=98=80=E9=97=A8?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E7=89=B9=E6=AE=8A=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E7=9A=84=E4=B8=9A=E5=8A=A1=202:=E4=BF=AE=E6=94=B9request?= =?UTF-8?q?=E8=8E=B7=E5=8F=96ip=E7=9A=84=E6=96=B9=E5=BC=8F(=E5=89=8D?= =?UTF-8?q?=E9=9D=A2=E6=8E=A5=E7=9A=84=E6=9C=89nginx=E7=9B=B4=E6=8E=A5requ?= =?UTF-8?q?est.getRemoteAddr=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=E5=88=B0)?= =?UTF-8?q?=E7=9C=9F=E5=AE=9Eip=203:=E4=BF=AE=E6=94=B9=E6=91=98=E8=A6=81?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B0=83=E7=94=A8=E7=9A=84readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/restful/NtcCollectRadiusLog.java | 27 +++++++++++++++++++ .../com/nis/web/service/AuditLogThread.java | 17 +++++++++++- .../applicationConfig-rule.properties | 4 +-- .../applicationConfig-parser.xml | 1 + src/main/webapp/maat-redis/readme.txt | 16 ++++++++++- 5 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/nis/domain/restful/NtcCollectRadiusLog.java b/src/main/java/com/nis/domain/restful/NtcCollectRadiusLog.java index 1c314f8..9496544 100644 --- a/src/main/java/com/nis/domain/restful/NtcCollectRadiusLog.java +++ b/src/main/java/com/nis/domain/restful/NtcCollectRadiusLog.java @@ -1,5 +1,6 @@ package com.nis.domain.restful; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.nis.domain.LogEntity; import com.wordnik.swagger.annotations.ApiModelProperty; @@ -22,6 +23,11 @@ public class NtcCollectRadiusLog extends LogEntity { protected String framedIp; @ApiModelProperty(value="用户名", required=true) protected String account; + + protected String searchNasIp;//ISN接入的IP + protected String searchFramedIp;//服务器下发的用户地址 + protected String searchAccount;//用户名 + public Integer getCode() { return code; } @@ -46,6 +52,27 @@ public class NtcCollectRadiusLog extends LogEntity { public void setAccount(String account) { this.account = account; } + @JsonIgnore + public String getSearchNasIp() { + return searchNasIp; + } + public void setSearchNasIp(String searchNasIp) { + this.searchNasIp = searchNasIp; + } + @JsonIgnore + public String getSearchFramedIp() { + return searchFramedIp; + } + public void setSearchFramedIp(String searchFramedIp) { + this.searchFramedIp = searchFramedIp; + } + @JsonIgnore + public String getSearchAccount() { + return searchAccount; + } + public void setSearchAccount(String searchAccount) { + this.searchAccount = searchAccount; + } } diff --git a/src/main/java/com/nis/web/service/AuditLogThread.java b/src/main/java/com/nis/web/service/AuditLogThread.java index b8db811..e6c5992 100644 --- a/src/main/java/com/nis/web/service/AuditLogThread.java +++ b/src/main/java/com/nis/web/service/AuditLogThread.java @@ -174,9 +174,24 @@ public class AuditLogThread implements Runnable { return sb.toString(); } + + public static String getIpAddr(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + } + return ip; + } + public static AuditLogThread getNewSaveRequestLogThread(HttpServletRequest request) { AuditLogThread thread = new AuditLogThread(); - thread.setRemoteAddr(request.getRemoteAddr()); + thread.setRemoteAddr(getIpAddr(request)); thread.setRequestURI(request.getRequestURI()); if (request.getMethod().toLowerCase().equals("get")) { thread.setQueryString(request.getQueryString()); diff --git a/src/main/resources/applicationConfig-rule.properties b/src/main/resources/applicationConfig-rule.properties index bfc8515..b885a52 100644 --- a/src/main/resources/applicationConfig-rule.properties +++ b/src/main/resources/applicationConfig-rule.properties @@ -333,7 +333,7 @@ unMaatService=3:32;4:96;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:16;266 #0x402 APP DOMAIN特征发现 1026:2,5; #0x404 APP IP特征 1028:2,5; ########## -serviceDBIndex=1:2,4,5;2:2,4,5;5:2,5;66:2,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;38:2;39:2;40:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;150:2;151:2;152:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;273:3;274:5;384:2;385:2;386:2;387:2;388:2;395:2;399:3;512:4,5;513:4,2,5;514:4,5;515:4,2,5;517:4,5;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;624:4;625:4;640:4;641:4;750:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2;1041:2;1042:2;1056:2;1152:2;3:5;4:5;25:5;28:5;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;268:3;269:3;270:3;389:3;390:3;391:3;392:3;393:3;394:3;396:3;397:3;398:3;834:6;835:6;836:6 +serviceDBIndex=1:2,4,5;2:2,4,5;5:2,5;66:2,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;38:2;39:2;40:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;150:2;151:2;152:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;273:3;274:5;384:2;385:2;386:2;387:2;388:2;395:2;399:3;512:4,5;513:4,2,5;514:4,5;515:4,2,5;517:4,5;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;624:4;625:4;640:4;641:4;750:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2,5;1041:2;1042:2;1056:2,5;1152:2;3:5;4:5;25:5;28:5;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;268:3;269:3;270:3;389:3;390:3;391:3;392:3;393:3;394:3;396:3;397:3;398:3;834:6;835:6;836:6 ##阀门配置在redisdb的序号 tapRedisDb=5 @@ -349,7 +349,7 @@ tapRedisDb=5 #0x205 基于PXY IP替换 517 #0x402 APP DOMAIN特征发现 1026 #0x404 APP IP特征 1028 -maat2Valve=33:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;512:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;514:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;517:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1028:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1040:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1056:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;5:ipRegion@COMPILE_ID&USER_REGION&EFFECTIVE_RANGE +maat2Valve=1:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;2:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;33:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;512:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;514:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;517:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1028:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1040:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1056:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;5:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE&COMPILE_ID ##记录哪些service可以被分组复用(只有maat类配置可以被分组复用) #业务ID:域类型1@表名,表名|域类型2@表名;业务ID:域类型1@表名,表名|域类型2@表名 diff --git a/src/main/resources/commonSources/applicationConfig-parser.xml b/src/main/resources/commonSources/applicationConfig-parser.xml index 9fa1bd0..0ee0931 100644 --- a/src/main/resources/commonSources/applicationConfig-parser.xml +++ b/src/main/resources/commonSources/applicationConfig-parser.xml @@ -52,6 +52,7 @@ +