File: trackalert_api.7.yml

package info (click to toggle)
weakforced 3.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,196 kB
  • sloc: cpp: 20,397; python: 2,002; sh: 700; makefile: 432
file content (284 lines) | stat: -rw-r--r-- 7,044 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
openapi: 3.0.1

info:
  title: OX Abuse Shield (Trackalert)
  description: An API to the trackalert daemon to prevent brute-force and abuse of
    mail systems
  contact:
    name: Open-Xchange
  license:
    name: GPL3
    url: http://github.com/PowerDNS/weakforced/blob/master/LICENSE
  version: "3.0.0"

servers:
  - url: http://doesnotexist.open-xchange.com/
  - url: https://doesnotexist.open-xchange.com/

paths:
  /command/report:
    post:
      description: Creates a new report about a login (successful or unsuccessful)
      operationId: report
      requestBody:
        description: Login Tuple for report command
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginTupleReport'
        required: true
      responses:
        "200":
          description: report response
          content:
            application/json:
              schema:
                required:
                  - status
                type: object
                properties:
                  status:
                    type: string
                example:
                  status: ok
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      x-codegen-request-body-name: LoginTupleReport
  /command/stats:
    get:
      description: Get server stats
      operationId: stats
      responses:
        "200":
          description: stats response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/statsResponse'
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /metrics:
    get:
      description: Retrieve prometheus metrics
      operationId: metrics
      responses:
        "200":
          description: Prometheus metrics in the format described at https://prometheus.io/docs/instrumenting/exposition_formats/
          content:
            text/plain:
              schema:
                type: string
        default:
          description: unexpected error
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/Error'
  /readyz:
    get:
      security: [] # No auth needed
      description: Determine if trackalert is ready to accept queries
      operationId: readyz
      responses:
        "200":
          description: trackalert is ready to accept queries
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /livez:
    get:
      security: [] # No auth needed
      description: Determine if trackalert is up
      operationId: livez
      responses:
        "200":
          description: trackalert is up
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

components:
  schemas:
    LoginTupleReport:
      required:
        - login
        - pwhash
        - remote
        - success
      type: object
      properties:
        login:
          type: string
        remote:
          type: string
        pwhash:
          type: string
        success:
          type: boolean
        policy_reject:
          type: boolean
        fail_type:
          type: string
          enum:
            - internal
            - credentials
            - account
            - expired
            - disabled
            - policy
        protocol:
          type: string
          enum:
            - http
            - imap
            - pop3
            - smtp
            - mobileapi
        tls:
          type: boolean
        device_id:
          type: string
        device_attrs:
          $ref: '#/components/schemas/LTAttrs'
        attrs:
          $ref: '#/components/schemas/LTAttrs'
      example:
        login: joe.bloggs
        remote: 192.168.1.2
        pwhash: cc04
        success: true
        fail_type: credentials
    LTAttrs:
      type: object
      properties:
        attr_name_single_value:
          type: string
        attr_name multi_value:
          type: array
          items:
            type: string
      example:
        attr1: value1
        attr2: value2
        attr3:
          - value3
          - value4
    Error:
      required:
        - reason
        - status
      type: object
      properties:
        status:
          type: string
        reason:
          type: string
      example:
        status: failure
        reason: Unauthorized
    statsResponse:
      type: object
      properties:
        reports:
          type: integer
        sys-msec:
          type: integer
        user-msec:
          type: integer
        perfstats:
          type: object
          properties:
            WTW_0_1:
              type: integer
            WTW_1_10:
              type: integer
            WTW_10_100:
              type: integer
            WTW_100_1000:
              type: integer
            WTW_Slow:
              type: integer
            WTR_0_1:
              type: integer
            WTR_1_10:
              type: integer
            WTR_10_100:
              type: integer
            WTR_100_1000:
              type: integer
            WTR_Slow:
              type: integer
          description: Latency buckets for worker thread wait (WTW) and run (WTR)
        commandstats:
          type: object
          properties:
            addBLEntry:
              type: integer
            delBLEntry:
              type: integer
            getBL:
              type: integer
            getDBStats:
              type: integer
            stats:
              type: integer
            allow:
              type: integer
            report:
              type: integer
            reset:
              type: integer
            ping:
              type: integer
          description: Count of REST API commands run in last 5 minutes
        customstats:
          type: object
          properties:
            custom_stat:
              type: integer
          description: Count of custom statistics in last 5 minutes
      example:
        reports: 28291
        sys-msec: 97211221
        user-msec: 292910108
        perfstats:
          WTR_0_1: 0
          WTR_100_1000: 0
          WTR_10_100: 0
          WTR_1_10: 0
          WTR_Slow: 0
          WTW_0_1: 1
          WTW_100_1000: 0
          WTW_10_100: 0
          WTW_1_10: 0
          WTW_Slow: 0
        commandstats:
          addBLEntry: 0
          allow: 0
          delBLEntry: 0
          getBL: 0
          getDBStats: 0
          ping: 0
          report: 0
          reset: 0
          stats: 0
        customstats:
          custom1: 0
          custom2: 0

security:
  - BasicAuth: []