├── .dockerignore ├── .gitignore ├── .travis.yml ├── CREDITS.md ├── Dockerfile ├── LICENSE ├── Makefile ├── Pipfile ├── Pipfile.lock ├── README.md ├── beesly ├── __init__.py ├── _logging.py ├── config.py ├── swagger-ui │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── index.html │ ├── swagger-ui-bundle.js │ ├── swagger-ui-bundle.js.map │ ├── swagger-ui-standalone-preset.js │ ├── swagger-ui-standalone-preset.js.map │ ├── swagger-ui.css │ ├── swagger-ui.css.map │ ├── swagger-ui.js │ ├── swagger-ui.js.map │ └── swagger.yaml ├── tests │ ├── __init__.py │ ├── test_auth_endpoint.py │ ├── test_config.py │ ├── test_renew_endpoint.py │ ├── test_service_endpoints.py │ └── test_verify_endpoint.py ├── utils.py ├── version.py └── views.py ├── examples ├── beesly.pam ├── beesly.service ├── healthcheck.py ├── logstash.conf ├── pam_duo.conf └── telegraf.conf ├── gconfig.py ├── requirements.txt ├── serve.py └── swagger.yaml /.dockerignore: -------------------------------------------------------------------------------- 1 | .git/ 2 | *.pyc 3 | .dockerignore 4 | .vagrant/ 5 | .coverage 6 | htmlcov/ 7 | Vagrantfile 8 | Makefile 9 | Pipfile 10 | Pipfile.lock 11 | README.md 12 | CREDITS.md 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .vagrant 3 | .env 4 | .coverage 5 | htmlcov/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: python 3 | python: "3.6" 4 | notifications: 5 | email: false 6 | addons: 7 | srcclr: true 8 | 9 | install: 10 | # install Python packages 11 | - sudo pip install flake8 coveralls 12 | - sudo pip install -r requirements.txt 13 | 14 | script: 15 | # create test user for unit tests 16 | - sudo useradd -p '$6$EeIWuA0rKjGSdc.f$.yZbGhuzpycWdK2PU.oA9cnJhrC5C68nel5TmSqMD7h9Nat1V.hRF/DIghIkUe8ryZMVqn6yLG9VvgxPNPTVy0' -M vagrant 17 | 18 | # run unit tests 19 | - export TEST_USERNAME=vagrant 20 | - export TEST_PASSWORD=vagrant 21 | - sudo make test 22 | 23 | # run unit tests with coverage for coveralls.io 24 | - sudo make coverage 25 | 26 | # run lint test 27 | - make lint 28 | 29 | after_success: 30 | coveralls 31 | -------------------------------------------------------------------------------- /CREDITS.md: -------------------------------------------------------------------------------- 1 | # CREDITS 2 | 3 | beesly could not exist without the following excellent open source software: 4 | 5 | * [Flask](http://flask.pocoo.org/) 6 | * [Flask-Limiter](http://flask-limiter.readthedocs.io/en/stable/) 7 | * [Gunicorn](http://docs.gunicorn.org/en/stable/) 8 | * [psutil](http://pythonhosted.org/psutil/) 9 | * [pymemcache](https://pymemcache.readthedocs.io/en/latest/) 10 | * [pynacl](https://pynacl.readthedocs.io/en/latest/) 11 | * [python-jose](https://python-jose.readthedocs.io/en/latest/) 12 | * [python-pam](https://github.com/FirefighterBlu3/python-pam) 13 | * [python](https://www.python.org/) 14 | * [redis-py](https://github.com/andymccurdy/redis-py) 15 | * [requests](http://docs.python-requests.org/en/master/) 16 | * [swagger-ui](https://github.com/swagger-api/swagger-ui) 17 | * [statsd](https://statsd.readthedocs.io/en/v3.2.1/) 18 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # builds a Docker container image 2 | # https://docs.docker.com/engine/reference/builder/ 3 | # 4 | # docker build -t beesly:latest . 5 | 6 | FROM python:3.6-slim 7 | 8 | LABEL APP="beesly" 9 | LABEL MAINTAINER="@bincyber" 10 | LABEL URL="http://github.com/bincyber/beesly" 11 | 12 | COPY ./requirements.txt /tmp/requirements.txt 13 | 14 | RUN set -ex && apt-get update -qq \ 15 | && apt-get -y --no-install-recommends install build-essential libffi-dev \ 16 | && pip install -r /tmp/requirements.txt --no-cache-dir --disable-pip-version-check \ 17 | && apt-get purge -y --auto-remove build-essential libffi-dev \ 18 | && apt-get -y autoremove \ 19 | && rm -rf /var/lib/apt/lists/* \ 20 | && rm -f /var/log/dpkg.log \ 21 | && rm -rf /usr/share/doc \ 22 | && rm -rf /usr/src/python ~/.cache \ 23 | && find /usr/local -depth -type f -a -name '*.pyc' -exec rm -rf '{}' \; 24 | 25 | ADD . /opt/app 26 | 27 | WORKDIR /opt/app 28 | 29 | USER nobody 30 | 31 | EXPOSE 8000 32 | 33 | ENTRYPOINT ["/usr/local/bin/gunicorn", "-c", "gconfig.py", "--preload", "-w", "4", "-b", "0.0.0.0:8000", "serve:app"] 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | VERSION=$(shell grep version beesly/version.py | cut -f2 -d '=' | xargs | tr -d '"') 2 | WORKERS=4 3 | PORT=8000 4 | 5 | install: 6 | pipenv --python 3.6; \ 7 | pipenv install --dev; \ 8 | pipenv lock -r > requirements.txt; \ 9 | 10 | test: 11 | nose2 -v -s beesly/ -C --coverage-report html 12 | 13 | coverage: 14 | coverage run --source=beesly -m unittest discover -s beesly/tests 15 | 16 | lint: 17 | flake8 --statistics --ignore E221,E501,E722 beesly/ 18 | 19 | build: 20 | docker build -t beesly:$(VERSION) . 21 | 22 | clean: 23 | find . -name "*pyc" -exec rm -f "{}" \; 24 | coverage erase && rm -rf htmlcov 25 | 26 | run: 27 | pipenv run gunicorn -c gconfig.py --preload -w $(WORKERS) -b '0.0.0.0:$(PORT)' serve:app 28 | 29 | run-container: 30 | docker run -d -p $(PORT):$(PORT) beesly:$(VERSION) 31 | -------------------------------------------------------------------------------- /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | 3 | url = "https://pypi.python.org/simple" 4 | verify_ssl = true 5 | name = "pypi" 6 | 7 | 8 | [packages] 9 | 10 | Flask = "*" 11 | Flask-Limiter = "*" 12 | gunicorn = "*" 13 | psutil = "*" 14 | pymemcache = "*" 15 | PyNaCl = "*" 16 | python-jose = "*" 17 | python-pam = "*" 18 | redis = "*" 19 | requests = "*" 20 | statsd = "*" 21 | 22 | 23 | [dev-packages] 24 | 25 | bandit = "*" 26 | coveralls = "*" 27 | docker-compose = "*" 28 | "flake8" = "*" 29 | ipython = "*" 30 | logging_tree = "*" 31 | "nose2" = "*" 32 | "nose2-cov" = "*" 33 | 34 | 35 | [requires] 36 | 37 | python_version = "3.6" 38 | -------------------------------------------------------------------------------- /Pipfile.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "hash": { 4 | "sha256": "4c8f810cf45743c8cc421541bda4cba16c8d2378b8bb82a6b4ce0b1438b9d016" 5 | }, 6 | "host-environment-markers": { 7 | "implementation_name": "cpython", 8 | "implementation_version": "3.6.4", 9 | "os_name": "posix", 10 | "platform_machine": "x86_64", 11 | "platform_python_implementation": "CPython", 12 | "platform_release": "3.10.0-693.17.1.el7.x86_64", 13 | "platform_system": "Linux", 14 | "platform_version": "#1 SMP Thu Jan 25 20:13:58 UTC 2018", 15 | "python_full_version": "3.6.4", 16 | "python_version": "3.6", 17 | "sys_platform": "linux" 18 | }, 19 | "pipfile-spec": 6, 20 | "requires": { 21 | "python_version": "3.6" 22 | }, 23 | "sources": [ 24 | { 25 | "name": "pypi", 26 | "url": "https://pypi.python.org/simple", 27 | "verify_ssl": true 28 | } 29 | ] 30 | }, 31 | "default": { 32 | "certifi": { 33 | "hashes": [ 34 | "sha256:14131608ad2fd56836d33a71ee60fa1c82bc9d2c8d98b7bdbc631fe1b3cd1296", 35 | "sha256:edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d" 36 | ], 37 | "version": "==2018.1.18" 38 | }, 39 | "cffi": { 40 | "hashes": [ 41 | "sha256:5d0d7023b72794ea847725680e2156d1d01bc698a9007fccce46d03c904fe093", 42 | "sha256:86903c0afab4a3390170aca61f753f5adad8ffff947030719ee44dedc5b68403", 43 | "sha256:7d35678a54da0d3f1bc30e3a58a232043753d57c691875b5a75e4e062793bc9a", 44 | "sha256:824cac33906be5c8e976f0d950924d88ec058989ef9cd2f77f5cd53cec417635", 45 | "sha256:6ca52651f6bd4b8647cb7dee15c82619de3e13490f8e0bc0620830a2245b51d1", 46 | "sha256:a183959a4b1e01d6172aeed356e2523ec8682596075aa6cf0003fe08da959a49", 47 | "sha256:9532c5bc0108bd0fe43c0eb3faa2ef98a2db60fc0d4019f106b88d46803dd663", 48 | "sha256:96652215ef328262b5f1d5647632bd342ac6b31dfbc495b21f1ab27cb06d621d", 49 | "sha256:6c99d19225e3135f6190a3bfce2a614cae8eaa5dcaf9e0705d4ccb79a3959a3f", 50 | "sha256:12cbf4c04c1ad07124bfc9e928c01e282feac9ec7dd72a18042d4fc56456289a", 51 | "sha256:69c37089ccf10692361c8d14dbf4138b00b46741ffe9628755054499f06ed548", 52 | "sha256:b8d1454ef627098dc76ccfd6211a08065e6f84efe3754d8d112049fec3768e71", 53 | "sha256:cd13f347235410c592f6e36395ee1c136a64b66534f10173bfa4df1dc88f47d0", 54 | "sha256:0640f12f04f257c4467075a804a4920a5d07ef91e11c525fc65d715c08231c81", 55 | "sha256:89a8d05b96bdeca8fdc89c5fa9469a357d30f6c066262e92c0c8d2e4d3c53cae", 56 | "sha256:a67c430a9bde73ae85b0c885fcf41b556760e42ea74c16dc70431a349989b448", 57 | "sha256:7a831170b621e98f45ed1d5758325be19619a593924127a0a47af9a72a117319", 58 | "sha256:796d0379102e6da5215acfcd20e8e69cca9d97309215b4ce088fe175b1c2f586", 59 | "sha256:0fe3b3d571543a4065059d1d3d6d39f4ca6da0f2207ad13547094522e32ead46", 60 | "sha256:678135090c311780382b1dd3f828f715583ea8a69687ed053c047d3cec6625d6", 61 | "sha256:f4992cd7b4c867f453d44c213ee29e8fd484cf81cfece4b6e836d0982b6fa1cf", 62 | "sha256:6d191fb20138fe1948727b20e7b96582b7b7e676135eabf72d910e10bf7bfa65", 63 | "sha256:ec208ca16e57904dd7f4c7568665f80b1f7eb7e3214be014560c28def219060d", 64 | "sha256:b3653644d6411bf4bd64c1f2ca3cb1b093f98c68439ade5cef328609bbfabf8c", 65 | "sha256:f4719d0bafc5f0a67b2ec432086d40f653840698d41fa6e9afa679403dea9d78", 66 | "sha256:87f837459c3c78d75cb4f5aadf08a7104db15e8c7618a5c732e60f252279c7a6", 67 | "sha256:df9083a992b17a28cd4251a3f5c879e0198bb26c9e808c4647e0a18739f1d11d" 68 | ], 69 | "version": "==1.11.4" 70 | }, 71 | "chardet": { 72 | "hashes": [ 73 | "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691", 74 | "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae" 75 | ], 76 | "version": "==3.0.4" 77 | }, 78 | "click": { 79 | "hashes": [ 80 | "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d", 81 | "sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b" 82 | ], 83 | "version": "==6.7" 84 | }, 85 | "ecdsa": { 86 | "hashes": [ 87 | "sha256:40d002cf360d0e035cf2cb985e1308d41aaa087cbfc135b2dc2d844296ea546c", 88 | "sha256:64cf1ee26d1cde3c73c6d7d107f835fed7c6a2904aef9eac223d57ad800c43fa" 89 | ], 90 | "version": "==0.13" 91 | }, 92 | "flask": { 93 | "hashes": [ 94 | "sha256:0749df235e3ff61ac108f69ac178c9770caeaccad2509cb762ce1f65570a8856", 95 | "sha256:49f44461237b69ecd901cc7ce66feea0319b9158743dd27a2899962ab214dac1" 96 | ], 97 | "version": "==0.12.2" 98 | }, 99 | "flask-limiter": { 100 | "hashes": [ 101 | "sha256:473aa5bc97310406aa8c12ab3dc080697bcfa8cd21a6d0aba30916911bbc673c", 102 | "sha256:8cce98dcf25bf2ddbb824c2b503b4fc8e1a139154240fd2c60d9306bad8a0db8" 103 | ], 104 | "version": "==1.0.1" 105 | }, 106 | "future": { 107 | "hashes": [ 108 | "sha256:e39ced1ab767b5936646cedba8bcce582398233d6a627067d4c6a454c90cfedb" 109 | ], 110 | "version": "==0.16.0" 111 | }, 112 | "gunicorn": { 113 | "hashes": [ 114 | "sha256:75af03c99389535f218cc596c7de74df4763803f7b63eb09d77e92b3956b36c6", 115 | "sha256:eee1169f0ca667be05db3351a0960765620dad53f53434262ff8901b68a1b622" 116 | ], 117 | "version": "==19.7.1" 118 | }, 119 | "idna": { 120 | "hashes": [ 121 | "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4", 122 | "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f" 123 | ], 124 | "version": "==2.6" 125 | }, 126 | "itsdangerous": { 127 | "hashes": [ 128 | "sha256:cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519" 129 | ], 130 | "version": "==0.24" 131 | }, 132 | "jinja2": { 133 | "hashes": [ 134 | "sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd", 135 | "sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4" 136 | ], 137 | "version": "==2.10" 138 | }, 139 | "limits": { 140 | "hashes": [ 141 | "sha256:9df578f4161017d79f5188609f1d65f6b639f8aad2914c3960c9252e56a0ff95", 142 | "sha256:a017b8d9e9da6761f4574642149c337f8f540d4edfe573fb91ad2c4001a2bc76" 143 | ], 144 | "version": "==1.3" 145 | }, 146 | "markupsafe": { 147 | "hashes": [ 148 | "sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665" 149 | ], 150 | "version": "==1.0" 151 | }, 152 | "psutil": { 153 | "hashes": [ 154 | "sha256:82a06785db8eeb637b349006cc28a92e40cd190fefae9875246d18d0de7ccac8", 155 | "sha256:4152ae231709e3e8b80e26b6da20dc965a1a589959c48af1ed024eca6473f60d", 156 | "sha256:230eeb3aeb077814f3a2cd036ddb6e0f571960d327298cc914c02385c3e02a63", 157 | "sha256:a3286556d4d2f341108db65d8e20d0cd3fcb9a91741cb5eb496832d7daf2a97c", 158 | "sha256:94d4e63189f2593960e73acaaf96be235dd8a455fe2bcb37d8ad6f0e87f61556", 159 | "sha256:c91eee73eea00df5e62c741b380b7e5b6fdd553891bee5669817a3a38d036f13", 160 | "sha256:779ec7e7621758ca11a8d99a1064996454b3570154277cc21342a01148a49c28", 161 | "sha256:8a15d773203a1277e57b1d11a7ccdf70804744ef4a9518a87ab8436995c31a4b", 162 | "sha256:e2467e9312c2fa191687b89ff4bc2ad8843be4af6fb4dc95a7cc5f7d7a327b18" 163 | ], 164 | "version": "==5.4.3" 165 | }, 166 | "pycparser": { 167 | "hashes": [ 168 | "sha256:99a8ca03e29851d96616ad0404b4aad7d9ee16f25c9f9708a11faf2810f7b226" 169 | ], 170 | "version": "==2.18" 171 | }, 172 | "pycryptodome": { 173 | "hashes": [ 174 | "sha256:444053c24b336daa7f84bf872df7a6b9950697559926aea5775f5aa757b67a3e", 175 | "sha256:29d3a581cfcc68ca66f7c5d4830944556ddca9e2747e214bde8028972bb1901f", 176 | "sha256:7bda0f395fd8ef6b1fa7cded00d5cca72005ff158fc30703e1337fe32fbf2102", 177 | "sha256:bdd8581dae617b9fbe6e8dbdd96590c02fc33eebc411b0273fd62b4d468d0bb7", 178 | "sha256:89a0a233ed3a216ae117323d8fb0da38f1ca344dc1021559e38416cce23592a0", 179 | "sha256:5d390f8c6562173b913f0359cd87d5bc2e3245cc88ec4edf59d8c52107f24d29", 180 | "sha256:44ad06faf5ee589c1127a18610695a65815ed5db724b58687294ee907ec546ba", 181 | "sha256:c8922f187fcac3b2afa6d200ef00cd4e69719799b54b4f2f2741b2e4c96ccd61", 182 | "sha256:2aeded7095564b8a068402531c7407517cd714a0fe9872f76c69bd4400b07613", 183 | "sha256:c88e9a04d3ed89689bc76ce0a90b018cdd4edb94ab99ce31264f2e15bad9d752", 184 | "sha256:64a0cccf590546e7de602378f21482cb06cd1a1995cdfb121b123394c48b05c3", 185 | "sha256:21fd74571b3579cbf36792916ad76a4ecf91581a112bb78ec48e20389dcdb912", 186 | "sha256:11ca73effcc15596b62d601a6b3c48ea607fb5219546d406312520d63c446bf5", 187 | "sha256:ce3110812d8823c3182fc7f841031387ee6fda27d8696da8949a99b026048e7e", 188 | "sha256:29e8d3770bc0a0366093eb693ca40c5be56ed5a7ca214af5156a0b2e23053549", 189 | "sha256:d9ae42a88c716a7ca9a53966562968921883211b6390eeab22e5b735dbc49f49", 190 | "sha256:d3136fe71a37882ca457bea5917f1db5431f18f1bd91b0f7c4cec57ac4d57016", 191 | "sha256:0ebbcdbd21b5d8569c5b44137e2071d28c14a7460afdd8b1f6398a1548c4773a", 192 | "sha256:5ce44a755be8aef369d1057a38bff01501db0b89ba38c3292578f42ed401f355", 193 | "sha256:1d3065b741ec8d269327e4487eacd187e0bf909e7a73d0a959da1a0918b16fa9", 194 | "sha256:cb81302f3295a14722f6c26c44ab4023d66f8394db4c316ccf5658dbada2ac91", 195 | "sha256:4fd2584719895ff041cf48766014ef6b5a170f5caf0e2dc735837b182e78d081", 196 | "sha256:c5dd29e9f1b733e74311bf95d0e544e91bd1d14bc0366e8f443562d8d9920b7d" 197 | ], 198 | "version": "==3.4.11" 199 | }, 200 | "pymemcache": { 201 | "hashes": [ 202 | "sha256:c92e591e148dece0df4e4264628c5fc629a1efab45347df0e1f7424f61b10101", 203 | "sha256:822464a69449cb4a0a0025a5ed093c0848b445e2dacd7f57879d57805119a35e" 204 | ], 205 | "version": "==1.4.4" 206 | }, 207 | "pynacl": { 208 | "hashes": [ 209 | "sha256:0bfa0d94d2be6874e40f896e0a67e290749151e7de767c5aefbad1121cad7512", 210 | "sha256:1d33e775fab3f383167afb20b9927aaf4961b953d76eeb271a5703a6d756b65b", 211 | "sha256:eb2acabbd487a46b38540a819ef67e477a674481f84a82a7ba2234b9ba46f752", 212 | "sha256:14339dc233e7a9dda80a3800e64e7ff89d0878ba23360eea24f1af1b13772cac", 213 | "sha256:cf6877124ae6a0698404e169b3ba534542cfbc43f939d46b927d956daf0a373a", 214 | "sha256:eeee629828d0eb4f6d98ac41e9a3a6461d114d1d0aa111a8931c049359298da0", 215 | "sha256:d0eb5b2795b7ee2cbcfcadacbe95a13afbda048a262bd369da9904fecb568975", 216 | "sha256:11aa4e141b2456ce5cecc19c130e970793fa3a2c2e6fbb8ad65b28f35aa9e6b6", 217 | "sha256:8ac1167195b32a8755de06efd5b2d2fe76fc864517dab66aaf65662cc59e1988", 218 | "sha256:d795f506bcc9463efb5ebb0f65ed77921dcc9e0a50499dedd89f208445de9ecb", 219 | "sha256:be71cd5fce04061e1f3d39597f93619c80cdd3558a6c9ba99a546f144a8d8101", 220 | "sha256:2a42b2399d0428619e58dac7734838102d35f6dcdee149e0088823629bf99fbb", 221 | "sha256:73a5a96fb5fbf2215beee2353a128d382dbca83f5341f0d3c750877a236569ef", 222 | "sha256:d8aaf7e5d6b0e0ef7d6dbf7abeb75085713d0100b4eb1a4e4e857de76d77ac45", 223 | "sha256:2dce05ac8b3c37b9e2f65eab56c544885607394753e9613fd159d5e2045c2d98", 224 | "sha256:f5ce9e26d25eb0b2d96f3ef0ad70e1d3ae89b5d60255c462252a3e456a48c053", 225 | "sha256:6453b0dae593163ffc6db6f9c9c1597d35c650598e2c39c0590d1757207a1ac2", 226 | "sha256:fabf73d5d0286f9e078774f3435601d2735c94ce9e514ac4fb945701edead7e4", 227 | "sha256:13bdc1fe084ff9ac7653ae5a924cae03bf4bb07c6667c9eb5b6eb3c570220776", 228 | "sha256:8f505f42f659012794414fa57c498404e64db78f1d98dfd40e318c569f3c783b", 229 | "sha256:04e30e5bdeeb2d5b34107f28cd2f5bbfdc6c616f3be88fc6f53582ff1669eeca", 230 | "sha256:8abb4ef79161a5f58848b30ab6fb98d8c466da21fdd65558ce1d7afc02c70b5f", 231 | "sha256:e0d38fa0a75f65f556fb912f2c6790d1fa29b7dd27a1d9cc5591b281321eaaa9" 232 | ], 233 | "version": "==1.2.1" 234 | }, 235 | "python-jose": { 236 | "hashes": [ 237 | "sha256:3b35cdb0e55a88581ff6d3f12de753aa459e940b50fe7ca5aa25149bc94cb37b", 238 | "sha256:391f860dbe274223d73dd87de25e4117bf09e8fe5f93a417663b1f2d7b591165" 239 | ], 240 | "version": "==2.0.2" 241 | }, 242 | "python-pam": { 243 | "hashes": [ 244 | "sha256:26efe4e79b869b10f97cd8c4a6bbb04a4e54d41186364e975b4108c9c071812c" 245 | ], 246 | "version": "==1.8.2" 247 | }, 248 | "redis": { 249 | "hashes": [ 250 | "sha256:8a1900a9f2a0a44ecf6e8b5eb3e967a9909dfed219ad66df094f27f7d6f330fb", 251 | "sha256:a22ca993cea2962dbb588f9f30d0015ac4afcc45bee27d3978c0dbe9e97c6c0f" 252 | ], 253 | "version": "==2.10.6" 254 | }, 255 | "requests": { 256 | "hashes": [ 257 | "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b", 258 | "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" 259 | ], 260 | "version": "==2.18.4" 261 | }, 262 | "six": { 263 | "hashes": [ 264 | "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb", 265 | "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" 266 | ], 267 | "version": "==1.11.0" 268 | }, 269 | "statsd": { 270 | "hashes": [ 271 | "sha256:50e0e7b34e5c01e78e270f17ccbd6bcc334f1a81ac5cb0b19050f7dd24d72c3e", 272 | "sha256:84f2427ef7b8ffab28cdb717933f6889d248d710eee32b5eb79e3fdac0e374dd" 273 | ], 274 | "version": "==3.2.2" 275 | }, 276 | "urllib3": { 277 | "hashes": [ 278 | "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b", 279 | "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" 280 | ], 281 | "version": "==1.22" 282 | }, 283 | "werkzeug": { 284 | "hashes": [ 285 | "sha256:d5da73735293558eb1651ee2fddc4d0dedcfa06538b8813a2e20011583c9e49b", 286 | "sha256:c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c" 287 | ], 288 | "version": "==0.14.1" 289 | } 290 | }, 291 | "develop": { 292 | "bandit": { 293 | "hashes": [ 294 | "sha256:de4cc19d6ba32d6f542c6a1ddadb4404571347d83ef1ed1e7afb7d0b38e0c25b", 295 | "sha256:cb977045497f83ec3a02616973ab845c829cdab8144ce2e757fe031104a9abd4" 296 | ], 297 | "version": "==1.4.0" 298 | }, 299 | "cached-property": { 300 | "hashes": [ 301 | "sha256:fe045921fe75c873064028e9fbbe06121114ccf613227f4ba284fa7d4c9ff27f", 302 | "sha256:6562f0be134957547421dda11640e8cadfa7c23238fc4e0821ab69efdb1095f3" 303 | ], 304 | "version": "==1.3.1" 305 | }, 306 | "certifi": { 307 | "hashes": [ 308 | "sha256:14131608ad2fd56836d33a71ee60fa1c82bc9d2c8d98b7bdbc631fe1b3cd1296", 309 | "sha256:edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d" 310 | ], 311 | "version": "==2018.1.18" 312 | }, 313 | "chardet": { 314 | "hashes": [ 315 | "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691", 316 | "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae" 317 | ], 318 | "version": "==3.0.4" 319 | }, 320 | "cov-core": { 321 | "hashes": [ 322 | "sha256:4a14c67d520fda9d42b0da6134638578caae1d374b9bb462d8de00587dba764c" 323 | ], 324 | "version": "==1.15.0" 325 | }, 326 | "coverage": { 327 | "hashes": [ 328 | "sha256:464d85d6959497cc4adfa9f0d36fca809e2ca7ec5f4625f548317892cac6ed7c", 329 | "sha256:e958ab5b6a7f3b88289a25c95d031f2b62bc73219141c09d261fd97f244c124c", 330 | "sha256:67288f8834a0a64c1af66286b22fd325b5524ceaa153a51c3e2e30f7e8b3f826", 331 | "sha256:cfb6b7035c6605e2a87abe7d84ea35a107e6c432014a3f1ca243ab57a558fbcd", 332 | "sha256:c86a12b3dc004bcbe97a3849354bd1f93eb6fb69b0e4eb58831fd7adba7740ec", 333 | "sha256:8ddcf308f894d01a1a0ae01283d19b613751815b7190113266a0b7f9d076e86d", 334 | "sha256:adab01e4c63a01bdf036f57f0114497994aa2195d8659d12a3d69673c3f27939", 335 | "sha256:54d73fe68a7ac9c847af69a234a7461bbaf3cad95f258317d4584d14dd53f679", 336 | "sha256:a0d98c71d026c1757c7393a99d24c6e42091ff41e20e68238b17e145252c2d0a", 337 | "sha256:464e0eda175c7fe2dc730d9d02acde5b8a8518d9417413dee6ca187d1f65ef89", 338 | "sha256:2890cb40464686c0c1dccc1223664bbc34d85af053bc5dbcd71ea13959e264f2", 339 | "sha256:0f2315c793b1360f80a9119fff76efb7b4e5ab5062651dff515e681719f29689", 340 | "sha256:85c028e959312285225040cdac5ad3db6189e958a234f09ae6b4ba5f539c842d", 341 | "sha256:da6585339fc8a25086003a2b2c0167438b8ab0cd0ccae468d22ed603e414bba1", 342 | "sha256:e837865a7b20c01a8a2f904c05fba36e8406b146649ff9174cbddf32e217b777", 343 | "sha256:b718efb33097c7651a60a03b4b38b14776f92194bc0e9e598ce05ddaef7c70e7", 344 | "sha256:7413f078fbba267de44814584593a729f88fc37f2d938263844b7f4daf1e36ec", 345 | "sha256:47ad00a0c025f87a7528cc13d013c54e4691ae8730430e49ec9c7ace7e0e1fba", 346 | "sha256:95f9f5072afeb2204401401cbd0ab978a9f86ef1ebc5cd267ba431cfa581cc4d", 347 | "sha256:ca8827a5dad1176a8da6bf5396fd07e66549d1bc842047b76cdf69e196597a80", 348 | "sha256:c68164c4f49cfc2e66ca1ded62e4a1092a6bd4b2c65222059b867700ad19151c", 349 | "sha256:61e0bcf15aa0385e15d1fe4a86022a6b813d08c785855e3fab56ba6d7ac3dd21", 350 | "sha256:981a64063242a2c6c88dda33ccafe3583026847961fe56636b6a00c47674e258", 351 | "sha256:21e47d2ff9c75e25880dd12b316db11379e9afc98b39e9516149d189c15c564b", 352 | "sha256:f6b822c68f68f48d480d23fcfcd1d4df7d42ff03cf5d7b574d09e662c0b95b43", 353 | "sha256:53fa7aa7643a22eeadcf8b781b97a51f37d43ba1d897a05238aa7e4d11bc0667", 354 | "sha256:95ce1a70323d47c0f6b8d6cfd3c14c38cb30d51fd1ab4f6414734fa33a78b17e", 355 | "sha256:b7a06a523dfeaf417da630d46ad4f4e11ca1bae6202c9312c4cb987dde5792fc", 356 | "sha256:585e8db44b8f3af2a4152b00dd8a7a36bc1d2aba7de5e50fc17a54178428f0d6", 357 | "sha256:102933e14b726bd4fdfafb541e122ad36c150732aee36db409d8c8766e11537e", 358 | "sha256:15f92238487d93f7f34a3ba03be3bd4615c69cffc88388b4dd1ea99af74fc1bf", 359 | "sha256:319190dd7fa08c23332215782b563a9ef12b76fb15e4a325915592b825eca9ed", 360 | "sha256:af14e9628c0a3152b6a1fbba4471e6a3e5f5567ecae614f84b84ff3441c58692", 361 | "sha256:72bc3f91a25a87fd87eb57983c8cefbb8aa5bacd50d73516ade398271d652d77", 362 | "sha256:c3905f10786dcf386f3f6cebe0ae4a36f47e5e256471161fb944ca537e97e928", 363 | "sha256:3344079d73a4849341aaaecd9b391141824b8c9a96732fbd6ef95ba9566895d3" 364 | ], 365 | "version": "==4.5" 366 | }, 367 | "coveralls": { 368 | "hashes": [ 369 | "sha256:84dd8c88c5754e8db70a682f537e2781366064aa3cdd6b24c2dcecbd3181187c", 370 | "sha256:510682001517bcca1def9f6252df6ce730fcb9831c62d9fff7c7d55b6fdabdf3" 371 | ], 372 | "version": "==1.2.0" 373 | }, 374 | "decorator": { 375 | "hashes": [ 376 | "sha256:94d1d8905f5010d74bbbd86c30471255661a14187c45f8d7f3e5aa8540fdb2e5", 377 | "sha256:7d46dd9f3ea1cf5f06ee0e4e1277ae618cf48dfb10ada7c8427cd46c42702a0e" 378 | ], 379 | "version": "==4.2.1" 380 | }, 381 | "docker": { 382 | "hashes": [ 383 | "sha256:c1d4e37b1ea03b2b6efdd0379640f6ea372fefe56efa65d4d17c34c6b9d54558", 384 | "sha256:144248308e8ea31c4863c6d74e1b55daf97cc190b61d0fe7b7313ab920d6a76c" 385 | ], 386 | "version": "==2.7.0" 387 | }, 388 | "docker-compose": { 389 | "hashes": [ 390 | "sha256:4abb290b3ebb91314942532f1333d7f729c66254bde4b0756718291b7df42a7a", 391 | "sha256:2930cbfe2685018fbb75377600ab6288861d9955717b3f14212f63950351d379" 392 | ], 393 | "version": "==1.18.0" 394 | }, 395 | "docker-pycreds": { 396 | "hashes": [ 397 | "sha256:58d2688f92de5d6f1a6ac4fe25da461232f0e0a4c1212b93b256b046b2d714a9", 398 | "sha256:93833a2cf280b7d8abbe1b8121530413250c6cd4ffed2c1cf085f335262f7348" 399 | ], 400 | "version": "==0.2.1" 401 | }, 402 | "dockerpty": { 403 | "hashes": [ 404 | "sha256:69a9d69d573a0daa31bcd1c0774eeed5c15c295fe719c61aca550ed1393156ce" 405 | ], 406 | "version": "==0.4.1" 407 | }, 408 | "docopt": { 409 | "hashes": [ 410 | "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491" 411 | ], 412 | "version": "==0.6.2" 413 | }, 414 | "flake8": { 415 | "hashes": [ 416 | "sha256:c7841163e2b576d435799169b78703ad6ac1bbb0f199994fc05f700b2a90ea37", 417 | "sha256:7253265f7abd8b313e3892944044a365e3f4ac3fcdcfb4298f55ee9ddf188ba0" 418 | ], 419 | "version": "==3.5.0" 420 | }, 421 | "gitdb2": { 422 | "hashes": [ 423 | "sha256:cf9a4b68e8c4da8d42e48728c944ff7af2d8c9db303ac1ab32eac37aa4194b0e", 424 | "sha256:b60e29d4533e5e25bb50b7678bbc187c8f6bcff1344b4f293b2ba55c85795f09" 425 | ], 426 | "version": "==2.0.3" 427 | }, 428 | "gitpython": { 429 | "hashes": [ 430 | "sha256:b8367c432de995dc330b5b146c5bfdc0926b8496e100fda6692134e00c0dcdc5", 431 | "sha256:ad61bc25deadb535b047684d06f3654c001d9415e1971e51c9c20f5b510076e9" 432 | ], 433 | "version": "==2.1.8" 434 | }, 435 | "idna": { 436 | "hashes": [ 437 | "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4", 438 | "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f" 439 | ], 440 | "version": "==2.6" 441 | }, 442 | "ipython": { 443 | "hashes": [ 444 | "sha256:fcc6d46f08c3c4de7b15ae1c426e15be1b7932bcda9d83ce1a4304e8c1129df3", 445 | "sha256:51c158a6c8b899898d1c91c6b51a34110196815cc905f9be0fa5878e19355608" 446 | ], 447 | "version": "==6.2.1" 448 | }, 449 | "ipython-genutils": { 450 | "hashes": [ 451 | "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8", 452 | "sha256:eb2e116e75ecef9d4d228fdc66af54269afa26ab4463042e33785b887c628ba8" 453 | ], 454 | "version": "==0.2.0" 455 | }, 456 | "jedi": { 457 | "hashes": [ 458 | "sha256:d795f2c2e659f5ea39a839e5230d70a0b045d0daee7ca2403568d8f348d0ad89", 459 | "sha256:d6e799d04d1ade9459ed0f20de47c32f2285438956a677d083d3c98def59fa97" 460 | ], 461 | "version": "==0.11.1" 462 | }, 463 | "jsonschema": { 464 | "hashes": [ 465 | "sha256:000e68abd33c972a5248544925a0cae7d1125f9bf6c58280d37546b946769a08", 466 | "sha256:6ff5f3180870836cae40f06fa10419f557208175f13ad7bc26caa77beb1f6e02" 467 | ], 468 | "version": "==2.6.0" 469 | }, 470 | "logging-tree": { 471 | "hashes": [ 472 | "sha256:3df68a170f30386e58bbea330d27c6a6ce88681919b35080deac8ec69458973e" 473 | ], 474 | "version": "==1.7" 475 | }, 476 | "mccabe": { 477 | "hashes": [ 478 | "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", 479 | "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" 480 | ], 481 | "version": "==0.6.1" 482 | }, 483 | "nose2": { 484 | "hashes": [ 485 | "sha256:5c79a2e46ad76999ca1ec7a83080424ed134eafaaf90b6e7554ebdf85aea6f23" 486 | ], 487 | "version": "==0.7.3" 488 | }, 489 | "nose2-cov": { 490 | "hashes": [ 491 | "sha256:4b707ebc4caff3292bf2a21ad6c1833b137a798a9045640adeec7965706b0f8f" 492 | ], 493 | "version": "==1.0a4" 494 | }, 495 | "parso": { 496 | "hashes": [ 497 | "sha256:a7bb86fe0844304869d1c08e8bd0e52be931228483025c422917411ab82d628a", 498 | "sha256:5815f3fe254e5665f3c5d6f54f086c2502035cb631a91341591b5a564203cffb" 499 | ], 500 | "version": "==0.1.1" 501 | }, 502 | "pbr": { 503 | "hashes": [ 504 | "sha256:60c25b7dfd054ef9bb0ae327af949dd4676aa09ac3a9471cdc871d8a9213f9ac", 505 | "sha256:05f61c71aaefc02d8e37c0a3eeb9815ff526ea28b3b76324769e6158d7f95be1" 506 | ], 507 | "version": "==3.1.1" 508 | }, 509 | "pexpect": { 510 | "hashes": [ 511 | "sha256:144939a072a46d32f6e5ecc866509e1d613276781f7182148a08df52eaa7b022", 512 | "sha256:8e287b171dbaf249d0b06b5f2e88cb7e694651d2d0b8c15bccb83170d3c55575" 513 | ], 514 | "markers": "sys_platform != 'win32'", 515 | "version": "==4.3.1" 516 | }, 517 | "pickleshare": { 518 | "hashes": [ 519 | "sha256:c9a2541f25aeabc070f12f452e1f2a8eae2abd51e1cd19e8430402bdf4c1d8b5", 520 | "sha256:84a9257227dfdd6fe1b4be1319096c20eb85ff1e82c7932f36efccfe1b09737b" 521 | ], 522 | "version": "==0.7.4" 523 | }, 524 | "prompt-toolkit": { 525 | "hashes": [ 526 | "sha256:3f473ae040ddaa52b52f97f6b4a493cfa9f5920c255a12dc56a7d34397a398a4", 527 | "sha256:1df952620eccb399c53ebb359cc7d9a8d3a9538cb34c5a1344bdbeb29fbcc381", 528 | "sha256:858588f1983ca497f1cf4ffde01d978a3ea02b01c8a26a8bbc5cd2e66d816917" 529 | ], 530 | "version": "==1.0.15" 531 | }, 532 | "ptyprocess": { 533 | "hashes": [ 534 | "sha256:e8c43b5eee76b2083a9badde89fd1bbce6c8942d1045146e100b7b5e014f4f1a", 535 | "sha256:e64193f0047ad603b71f202332ab5527c5e52aa7c8b609704fc28c0dc20c4365" 536 | ], 537 | "version": "==0.5.2" 538 | }, 539 | "pycodestyle": { 540 | "hashes": [ 541 | "sha256:6c4245ade1edfad79c3446fadfc96b0de2759662dc29d07d80a6f27ad1ca6ba9", 542 | "sha256:682256a5b318149ca0d2a9185d365d8864a768a28db66a84a2ea946bcc426766" 543 | ], 544 | "version": "==2.3.1" 545 | }, 546 | "pyflakes": { 547 | "hashes": [ 548 | "sha256:08bd6a50edf8cffa9fa09a463063c425ecaaf10d1eb0335a7e8b1401aef89e6f", 549 | "sha256:8d616a382f243dbf19b54743f280b80198be0bca3a5396f1d2e1fca6223e8805" 550 | ], 551 | "version": "==1.6.0" 552 | }, 553 | "pygments": { 554 | "hashes": [ 555 | "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", 556 | "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" 557 | ], 558 | "version": "==2.2.0" 559 | }, 560 | "pyyaml": { 561 | "hashes": [ 562 | "sha256:3262c96a1ca437e7e4763e2843746588a965426550f3797a79fca9c6199c431f", 563 | "sha256:16b20e970597e051997d90dc2cddc713a2876c47e3d92d59ee198700c5427736", 564 | "sha256:e863072cdf4c72eebf179342c94e6989c67185842d9997960b3e69290b2fa269", 565 | "sha256:bc6bced57f826ca7cb5125a10b23fd0f2fff3b7c4701d64c439a300ce665fff8", 566 | "sha256:c01b880ec30b5a6e6aa67b09a2fe3fb30473008c85cd6a67359a1b15ed6d83a4", 567 | "sha256:827dc04b8fa7d07c44de11fabbc888e627fa8293b695e0f99cb544fdfa1bf0d1", 568 | "sha256:592766c6303207a20efc445587778322d7f73b161bd994f227adaa341ba212ab", 569 | "sha256:5f84523c076ad14ff5e6c037fe1c89a7f73a3e04cf0377cb4d017014976433f3", 570 | "sha256:0c507b7f74b3d2dd4d1322ec8a94794927305ab4cebbe89cc47fe5e81541e6e8", 571 | "sha256:b4c423ab23291d3945ac61346feeb9a0dc4184999ede5e7c43e1ffb975130ae6", 572 | "sha256:ca233c64c6e40eaa6c66ef97058cdc80e8d0157a443655baa1b2966e812807ca", 573 | "sha256:4474f8ea030b5127225b8894d626bb66c01cda098d47a2b0d3429b6700af9fd8", 574 | "sha256:326420cbb492172dec84b0f65c80942de6cedb5233c413dd824483989c000608", 575 | "sha256:5ac82e411044fb129bae5cfbeb3ba626acb2af31a8d17d175004b70862a741a7" 576 | ], 577 | "version": "==3.12" 578 | }, 579 | "requests": { 580 | "hashes": [ 581 | "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b", 582 | "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" 583 | ], 584 | "version": "==2.18.4" 585 | }, 586 | "simplegeneric": { 587 | "hashes": [ 588 | "sha256:dc972e06094b9af5b855b3df4a646395e43d1c9d0d39ed345b7393560d0b9173" 589 | ], 590 | "version": "==0.8.1" 591 | }, 592 | "six": { 593 | "hashes": [ 594 | "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb", 595 | "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" 596 | ], 597 | "version": "==1.11.0" 598 | }, 599 | "smmap2": { 600 | "hashes": [ 601 | "sha256:b78ee0f1f5772d69ff50b1cbdb01b8c6647a8354f02f23b488cf4b2cfc923956", 602 | "sha256:c7530db63f15f09f8251094b22091298e82bf6c699a6b8344aaaef3f2e1276c3" 603 | ], 604 | "version": "==2.0.3" 605 | }, 606 | "stevedore": { 607 | "hashes": [ 608 | "sha256:e3d96b2c4e882ec0c1ff95eaebf7b575a779fd0ccb4c741b9832bed410d58b3d", 609 | "sha256:f1c7518e7b160336040fee272174f1f7b29a46febb3632502a8f2055f973d60b" 610 | ], 611 | "version": "==1.28.0" 612 | }, 613 | "texttable": { 614 | "hashes": [ 615 | "sha256:119041773ff03596b56392532f9315cb3a3116e404fd6f36e76a7dc088d95c79" 616 | ], 617 | "version": "==0.9.1" 618 | }, 619 | "traitlets": { 620 | "hashes": [ 621 | "sha256:c6cb5e6f57c5a9bdaa40fa71ce7b4af30298fbab9ece9815b5d995ab6217c7d9", 622 | "sha256:9c4bd2d267b7153df9152698efb1050a5d84982d3384a37b2c1f7723ba3e7835" 623 | ], 624 | "version": "==4.3.2" 625 | }, 626 | "urllib3": { 627 | "hashes": [ 628 | "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b", 629 | "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" 630 | ], 631 | "version": "==1.22" 632 | }, 633 | "wcwidth": { 634 | "hashes": [ 635 | "sha256:f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c", 636 | "sha256:3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e" 637 | ], 638 | "version": "==0.1.7" 639 | }, 640 | "websocket-client": { 641 | "hashes": [ 642 | "sha256:7a40abbd2534c91e667ca6507ccbb30d96816361840ef424dff49b24956fcdae", 643 | "sha256:933f6bbf08b381f2adbca9e93d7e7958ba212b42c73acb310b18f0fbe74f3738" 644 | ], 645 | "version": "==0.46.0" 646 | } 647 | } 648 | } 649 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # beesly 2 | 3 | [![Python](https://img.shields.io/badge/Python-3.6-yellow.svg)](#) 4 | [![GPLv3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl.html) 5 | [![Version](https://img.shields.io/badge/version-0.2.0-green.svg)](#) 6 | [![Build Status](https://travis-ci.org/bincyber/beesly.svg?branch=master)](https://travis-ci.org/bincyber/beesly) 7 | [![Coverage Status](https://coveralls.io/repos/github/bincyber/beesly/badge.svg?branch=master)](https://coveralls.io/github/bincyber/beesly?branch=master) 8 | 9 | 10 | beesly is a microservice for authenticating users with PAM. 11 | 12 | It provides an alternative method for authenticating and authorizing users' access to internal applications and services. Support for custom PAM services facilitates the reuse of existing integrations (SSSD) with directory servers (Active Directory, IdM, FreeIPA, OpenLDAP, etc.) and third party services (Duo Security). Group membership is returned for authenticated users allowing the addition of Role-Based Access Control for custom applications and services without the need to learn the intricacies of LDAP or Kerberos. 13 | 14 | beesly was developed in Python 3.6 using the Flask microframework. 15 | 16 | 17 | ### Features 18 | 19 | * Authenticate users with custom PAM services 20 | * Role-Based Access Control (RBAC) 21 | * Integration with Duo Security for 2-Factor Authentication (2FA) 22 | * short-lived JSON Web Tokens (JWT) 23 | * Rate limits to prevent abuse 24 | 25 | 26 | ## Prerequisites 27 | 28 | [Pipenv](https://docs.pipenv.org/) is used to manage dependencies. 29 | 30 | beesly requires superuser privileges to authenticate users when running in its default configuration because it uses the PAM login service which uses the `pam_unix.so` PAM module. This module adds a 2 second delay for failed authentications which can be disabled by using the nodelay option. It's encouraged to use a custom PAM service that does not use this module. 31 | 32 | If using a custom PAM service, the configuration file should be placed in `/etc/pam.d` with `0644` permissions. See `examples/beesly.pam` for an example of a custom PAM service that uses SSSD and does not require superuser privileges. 33 | 34 | [Flask-Limiter](https://flask-limiter.readthedocs.io/en/stable/) is used to implement rate limits. It can use in-memory, Redis, or Memcached as a storage backend. 35 | 36 | ## Usage 37 | 38 | Run beesly using gunicorn: 39 | 40 | $ gunicorn -c gconfig.py --preload -b '127.0.0.1:8000' -w 4 serve:app 41 | 42 | For production deployment, run gunicorn behind nginx and use TLS. 43 | 44 | ### Examples 45 | 46 | Authenticating a user: 47 | 48 | $ curl -X POST http://127.0.0.1:8000/auth -d '{"username":"dwight.schrute@dundermifflin.com", "password":"BearsBeetsBattlestarGalactica"}' 49 | 50 | { 51 | "auth": true, 52 | "groups": [ 53 | "Sales", 54 | "Assistant_Regional_Manager", 55 | "Assistant_to_the_Regional_Manager" 56 | ], 57 | "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiZWVz...", 58 | "message": "Authentication successful" 59 | } 60 | 61 | A successful authentication will return the groups that the user is a member of facilitating RBAC. 62 | 63 | If Duo Security 2FA is configured, the user will have to acknowledge a push notification for the authentication to succeed. 64 | 65 | The payload of the generated JWT contains the following claims: 66 | 67 | { 68 | 'exp': 1489344336.296496, 69 | 'groups': [ 70 | "Sales", 71 | "Assistant_Regional_Manager", 72 | "Assistant_to_the_Regional_Manager" 73 | ], 74 | 'iat': 1489343436.296496, 75 | 'iss': 'beesly', 76 | 'sub': 'dwight.schrute@dundermifflin.com', 77 | 'x': '2soDlgCPC0RFuxR0' 78 | } 79 | 80 | Note: a JWT is returned only when `JWT_MASTER_KEY` is configured. 81 | 82 | 83 | Renewing an existing JWT that has not expired: 84 | 85 | $ curl -X POST http://127.0.0.1:8000/renew -d '{"username":"dwight.schrute@dundermifflin.com","jwt":"2NzUuMjEyMzAyLCJncm91cHMiOm51bGwsInN1Yi..."}' 86 | 87 | { 88 | "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJiZWvR...", 89 | "message": "JWT successfully renewed" 90 | } 91 | 92 | 93 | Verifying the validity of a JWT: 94 | 95 | $ curl -X POST http://127.0.0.1:8000/verify -d '{"jwt":"2NzUuMjEyMzAyLCJncm91cHMiOm51bGwsInN1Yi..."}' 96 | 97 | { 98 | "message": "JWT successfully verified", 99 | "valid": true 100 | } 101 | 102 | Note: `/renew` and `/verify` endpoints are only available if `JWT_MASTER_KEY` is configured. 103 | 104 | 105 | Retrieving information about the running application: 106 | 107 | $ curl http://127.0.0.1:8000/service 108 | 109 | { 110 | "app": { 111 | "name": "beesly", 112 | "uptime": 9, 113 | "version": "0.1.0" 114 | }, 115 | "aws": { 116 | "availability_zone": "us-west-2b", 117 | "image_id": "ami-d2c924b2", 118 | "instance_id": "i-0ef224f23818bd413", 119 | "instance_type": "t2.micro", 120 | "region": "us-west-2" 121 | }, 122 | "system": { 123 | "hostname": "ip-172-31-36-157", 124 | "memory": "991 MB", 125 | "processors": 1, 126 | "uptime": 10647 127 | } 128 | } 129 | 130 | Note: EC2 metadata is returned only when running on AWS EC2. 131 | 132 | 133 | Monitoring the health of the application: 134 | 135 | $ curl http://127.0.0.1:8000/service/health 136 | 137 | { 138 | "beesly": "OK" 139 | } 140 | 141 | 142 | ### API Documentation 143 | 144 | [Swagger UI](http://swagger.io/swagger-ui/) is integrated into beesly and available at `/service/docs/index.html` when running in `DEV` mode. 145 | 146 | 147 | ### Configuration 148 | 149 | The following environment variables are used to modify the running configuration of this app: 150 | 151 | | Variable | Type | Required | Default Value | Explanation 152 | | -------- | -------- | -------- | -------- | -------- 153 | | DEV | Boolean | No | False | Set to True to enable debug logging and Swagger UI. 154 | | PAM_SERVICE | String | No | login | The name of the PAM service to authenticate users with. 155 | | JWT_MASTER_KEY | String | No | | The master key to use when generating JSON Web Tokens.
Must be between 10 - 64 characters in length. 156 | | JWT_ALGORITHM | String | No | HS256 | The HMAC algorithm to use when generating JWTs.
One of:
* `HS256`
* `HS384`
* `HS512` 157 | | JWT_VALIDITY_PERIOD | Interger | No | 900 | The validity period in seconds for generated JWTs. 158 | | STATSD_HOST | String | No | localhost | The hostname or IP address of the statsd collector. 159 | | STATSD_PORT | Integer | No | 8125 | The UDP port of the statsd collector. 160 | | RATELIMIT_ENABLED | Boolean | No | True | Set to False to disable rate limiting. 161 | | RATELIMIT_STRATEGY | String | No | fixed-window | The rate limiting strategy to use.
One of:
* `fixed-window`
* `fixed-window-elastic-expiry`
* `moving-window` 162 | | RATELIMIT_STORAGE_URL | String | No | memory:// | The URL for the storage backend used for rate limiting.
Refer to [limits](http://limits.readthedocs.io/en/latest/storage.html#storage-scheme) documentation for correct syntax. 163 | 164 | 165 | Note: The `moving-window` rate limiting strategy can only be used with `in-memory` or `Redis` storage. 166 | 167 | 168 | ### Integrating with Duo Security 169 | 170 | beesly can integrate with [Duo Security](https://duo.com/docs/duounix) to provide 2-factor authentication 171 | using the `pam_duo.so` PAM module. 172 | 173 | Create a custom PAM service: 174 | 175 | $ sudo vim /etc/pam.d/beesly 176 | 177 | auth required pam_env.so 178 | auth requisite pam_duo.so 179 | auth sufficient pam_unix.so nodelay 180 | auth required pam_deny.so 181 | 182 | Configure `duo_unix` to send push notifications to the user's phone: 183 | 184 | $ sudo vim /etc/duo/pam_duo.conf 185 | 186 | ; Duo Unix config 187 | ; https://duo.com/docs/duounix 188 | [duo] 189 | ikey= 190 | skey= 191 | host= 192 | failmode=secure 193 | autopush=yes 194 | prompts=1 195 | https_timeout=2 196 | 197 | Users will have to acknowledge the push notification for authentication to succeed. 198 | 199 | 200 | ### JSON Web Tokens 201 | 202 | beesly can optionally return short-lived JSON Web Tokens upon successful user authentication. To add JWT support, a secret master key must be set via the `JWT_MASTER_KEY` environment variable. It must be between 10 - 64 characters in length. 203 | 204 | blake2b key derivation function from [pynacl](https://pynacl.readthedocs.io/en/latest/hashing/#key-derivation) is used to create a unique signing key for each generated token: 205 | 206 | master_key = app.config["JWT_MASTER_KEY"] 207 | unique_salt = nacl.encoding.URLSafeBase64Encoder.encode(nacl.utils.random(12)) 208 | 209 | signing_key = blake2b(b'', key=master_key, salt=unique_salt, person=username) 210 | 211 | By default, each JWT is valid for 15 minutes. JWTs can be renewed by sending a POST request to `/renew` with the payload containing the username and their valid token. JWTs can be verified by sending a POST request to `/verify` with the payload containing the token. 212 | 213 | 214 | ### Metrics 215 | 216 | The Python [statsd](https://github.com/jsocol/pystatsd) client is used to export application metrics with the prefix `beesly`. 217 | 218 | The following metrics are exported: 219 | 220 | | Name | Type | Explanation 221 | | -------- | -------- | -------- 222 | | pam_auth | Meter | Time taken by PAM to authenticate a user 223 | | auth_success | Counter | User authentication succeeded 224 | | auth_failed | Counter | User authentication failed 225 | | jwt_generated | Counter | a JWT was successfully generated 226 | | jwt_renewed | Counter | a JWT was successfully renewed 227 | | jwt_verified | Counter | a JWT was successfully verified 228 | 229 | See `examples/telegraf.conf` for how to configure [telegraf](https://github.com/influxdata/telegraf) as a [statsd](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/statsd) collector sending metrics to [influxdb](https://github.com/influxdata/influxdb). 230 | 231 | 232 | ### Testing 233 | 234 | [nose2](http://nose2.readthedocs.io/en/latest/) is used for testing. Tests are located in `beesly/tests`. 235 | 236 | The tests require valid credentials to a local user to execute correctly. Credentials for this user can be set using environment variables: 237 | 238 | $ export TEST_USERNAME=example 239 | $ export TEST_PASSWORD=helloworld 240 | 241 | To run the test suite: 242 | 243 | $ sudo make test 244 | -------------------------------------------------------------------------------- /beesly/__init__.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os.path 3 | 4 | from beesly._logging import structured_log 5 | from beesly.config import ConfigError, initialize_config 6 | from beesly.views import app, rlimiter 7 | 8 | 9 | def create_app(): 10 | """ 11 | Initializes the Flask application. 12 | """ 13 | 14 | structured_log(level='info', msg="Starting beesly...") 15 | 16 | try: 17 | settings = initialize_config() 18 | except ConfigError: 19 | structured_log(level='critical', msg="Failed to load configuration. Exiting...") 20 | sys.exit(4) 21 | 22 | # enable Swagger UI if running in DEV mode 23 | if settings["DEV"]: 24 | app.static_folder = os.path.dirname(os.path.realpath(__file__)) + "/swagger-ui" 25 | app.add_url_rule("/service/docs/", endpoint="/service/docs", view_func=app.send_static_file) 26 | 27 | app.config.update(settings) 28 | structured_log(level='info', msg="Successfully loaded configuration") 29 | 30 | rlimiter.init_app(app) 31 | 32 | return app 33 | -------------------------------------------------------------------------------- /beesly/_logging.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from beesly.version import __app__ 4 | 5 | 6 | class CustomLogFilter(logging.Filter): 7 | """ 8 | Custom logging filter that adds the name of the application to each log. 9 | """ 10 | APP = __app__ 11 | 12 | def filter(self, record): 13 | record.app = CustomLogFilter.APP 14 | 15 | return True 16 | 17 | 18 | def structured_log(level, msg, **kwargs): 19 | """ 20 | Outputs structured, key-value log messages. 21 | 22 | Arguments 23 | ---------- 24 | level : string 25 | the log level for the log, eg. info, warning, error, critical 26 | 27 | msg : string 28 | the message field in the log 29 | """ 30 | level = level.upper() 31 | log_body = msg 32 | if kwargs: 33 | kv_pairs = ','.join([f'{k}={v}' for (k, v) in sorted(kwargs.items())]).rstrip('"') # trailing double quote is removed 34 | log_body += f'",{kv_pairs}' # double quote here closes the msg field 35 | 36 | app_logger_name = f'{__app__}.logger' 37 | app_logger_func = logging.getLogger(app_logger_name) 38 | 39 | app_logger = { 40 | 'INFO': app_logger_func.info, 41 | 'WARNING': app_logger_func.warning, 42 | 'ERROR': app_logger_func.error, 43 | 'CRITICAL': app_logger_func.critical 44 | } 45 | 46 | app_logger[level](log_body) 47 | -------------------------------------------------------------------------------- /beesly/config.py: -------------------------------------------------------------------------------- 1 | from distutils.spawn import find_executable 2 | from distutils.util import strtobool 3 | from urllib.parse import urlparse 4 | import os 5 | import os.path 6 | import socket 7 | 8 | from statsd import StatsClient 9 | 10 | from beesly._logging import structured_log 11 | from beesly.version import __app__, __version__ 12 | 13 | 14 | class ConfigError(Exception): 15 | """ 16 | Exception raised when there is a configuration error. 17 | """ 18 | 19 | 20 | class StatsdConfig(object): 21 | """ 22 | Manages statsd settings for exporting metrics. 23 | 24 | Attributes 25 | ---------- 26 | prefix : string 27 | the prefix for metrics 28 | 29 | host : string 30 | the host of the statsd collector 31 | 32 | port : integer 33 | the UDP port of the statsd collector 34 | 35 | client : StatsClient object 36 | the initialized statsd client 37 | """ 38 | def __init__(self): 39 | self.prefix = __app__.lower() 40 | self.host = os.environ.get("STATSD_HOST", "localhost") 41 | 42 | try: 43 | self.port = int(os.environ.get('STATSD_PORT', 8125)) 44 | except ValueError: 45 | self.port = 8125 46 | 47 | # check that STATSD_HOST is a valid hostname or IPv4 address 48 | if self.host != "localhost": 49 | try: 50 | socket.gethostbyname(self.host) 51 | except: 52 | try: 53 | socket.inet_aton(self.host) 54 | except: 55 | structured_log(level='error', msg="Invalid value provided for STATSD_HOST. Defaulting to localhost") 56 | self.host = "localhost" 57 | 58 | self.client = StatsClient(host=self.host, port=self.port, prefix=self.prefix) 59 | 60 | structured_log(level='info', msg=f"Statsd client configured to export metrics to {self.host}:{self.port}") 61 | 62 | 63 | def initialize_config(): 64 | """ 65 | Initializes the application's configuration by reading settings from 66 | environment variables and validating them. Returns a dictionary containing 67 | application configuration if validation passes, otherwise ConfigError exception is raised. 68 | """ 69 | settings = {} 70 | 71 | # ensure that all dependencies used exist 72 | dependencies = ['id'] 73 | for binary in dependencies: 74 | if find_executable(binary) is None: 75 | structured_log(level='critical', msg="Failed to locate required dependency", dependency=binary) 76 | raise ConfigError() 77 | 78 | settings['APP_NAME'] = __app__ 79 | settings['APP_VERSION'] = __version__ 80 | settings['DEV'] = strtobool(os.environ.get("DEV", 'False')) 81 | 82 | settings["RATELIMIT_ENABLED"] = strtobool(os.environ.get("RATELIMIT_ENABLED", 'True')) 83 | settings["RATELIMIT_STRATEGY"] = os.environ.get("RATELIMIT_STRATEGY", 'fixed-window') 84 | settings["RATELIMIT_STORAGE_URL"] = os.environ.get("RATELIMIT_STORAGE_URL", 'memory://') 85 | 86 | if not settings["RATELIMIT_ENABLED"]: 87 | structured_log(level='info', msg="Rate limiting disabled") 88 | 89 | if settings["RATELIMIT_ENABLED"]: 90 | 91 | rate_limit_strategies = ['fixed-window', 'fixed-window-elastic-expiry', 'moving-window'] 92 | rate_limit_storage_schemes = ['memory', 'memcached', 'redis', 'rediss', 'redis+sentinel', 'redis_cluster'] 93 | 94 | storage_scheme = urlparse(settings["RATELIMIT_STORAGE_URL"]).scheme 95 | 96 | if settings["RATELIMIT_STRATEGY"] not in rate_limit_strategies: 97 | structured_log(level='error', msg="Invalid value provided for RATELIMIT_STRATEGY") 98 | raise ConfigError() 99 | 100 | if storage_scheme not in rate_limit_storage_schemes: 101 | structured_log(level='error', msg="Invalid value provided for RATELIMIT_STORAGE_URL") 102 | raise ConfigError() 103 | 104 | if settings["RATELIMIT_STRATEGY"] == 'moving-window' and storage_scheme == 'memcached': 105 | structured_log(level='error', msg="Invalid value provided for RATELIMIT_STORAGE_URL. moving-window can't be used with memcached") 106 | raise ConfigError() 107 | 108 | # python-pam module allows specfiying which PAM service by name to authenticate against 109 | settings['PAM_SERVICE'] = os.environ.get("PAM_SERVICE", 'login') 110 | 111 | pam_file = f"/etc/pam.d/{settings['PAM_SERVICE']}" 112 | if not os.path.exists(pam_file): 113 | structured_log(level='error', msg=f"Invalid value provided for PAM_SERVICE. The pam configuration file '{pam_file}' does not exist") 114 | raise ConfigError() 115 | 116 | # configure JWT, by default it's disabled 117 | settings["JWT"] = False 118 | 119 | settings["JWT_MASTER_KEY"] = os.environ.get('JWT_MASTER_KEY', None) 120 | settings["JWT_ALGORITHM"] = os.environ.get('JWT_ALGORITHM', 'HS256') 121 | 122 | try: 123 | settings["JWT_VALIDITY_PERIOD"] = int(os.environ.get('JWT_VALIDITY_PERIOD', 900)) 124 | except ValueError: 125 | settings["JWT_VALIDITY_PERIOD"] = 900 126 | 127 | if settings["JWT_MASTER_KEY"] is not None: 128 | if len(settings["JWT_MASTER_KEY"]) < 10 or len(settings["JWT_MASTER_KEY"]) > 64: 129 | structured_log(level='error', msg="Invalid value provided for JWT_MASTER_KEY. Must be between 10 - 64 characters") 130 | raise ConfigError() 131 | 132 | if settings["JWT_ALGORITHM"] not in ['HS256', 'HS384', 'HS512']: 133 | structured_log(level='error', msg="Invalid value provided for JWT_ALGORITHM. Defaulting to HS256") 134 | settings["JWT_ALGORITHM"] = 'HS256' 135 | 136 | settings["JWT"] = True 137 | settings["JWT_MASTER_KEY"] = bytes(settings["JWT_MASTER_KEY"], encoding='utf-8') 138 | 139 | return settings 140 | -------------------------------------------------------------------------------- /beesly/swagger-ui/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bincyber/beesly/82899f06efbd02ce30d9103df07bef12aaa1df2b/beesly/swagger-ui/favicon-16x16.png -------------------------------------------------------------------------------- /beesly/swagger-ui/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bincyber/beesly/82899f06efbd02ce30d9103df07bef12aaa1df2b/beesly/swagger-ui/favicon-32x32.png -------------------------------------------------------------------------------- /beesly/swagger-ui/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Swagger UI 7 | 8 | 9 | 10 | 11 | 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 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /beesly/swagger-ui/swagger-ui-bundle.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0dA;;;;;;AAoIA;AAk7FA;AAmtCA;;;;;AA0uIA;AA66IA;AA27FA;AAuwGA;AAilFA;AAikFA;AAs9CA;AA8jDA;AA2qCA;AA4tEA;AAgkIA;;;;;;;;;;;;;;AAw4GA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AAyxDA;AAw6BA;;;;;;AA8vEA;AA+zFA;;;;;AA23CA;AA2qFA;AAq2CA;AA0kCA;AAs/CA;AA0wEA;AA49FA;;;;;;;;;AA20BA;AA2zIA;AAi4DA;AA6tDA","sourceRoot":""} -------------------------------------------------------------------------------- /beesly/swagger-ui/swagger-ui-standalone-preset.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA2SA;AAyiGA","sourceRoot":""} -------------------------------------------------------------------------------- /beesly/swagger-ui/swagger-ui.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8";.swagger-ui html{box-sizing:border-box}.swagger-ui *,.swagger-ui :after,.swagger-ui :before{box-sizing:inherit}.swagger-ui body{margin:0;background:#fafafa}.swagger-ui .wrapper{width:100%;max-width:1460px;margin:0 auto;padding:0 20px}.swagger-ui .opblock-tag-section{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.swagger-ui .opblock-tag{display:-webkit-box;display:-ms-flexbox;display:flex;padding:10px 20px 10px 10px;cursor:pointer;-webkit-transition:all .2s;transition:all .2s;border-bottom:1px solid rgba(59,65,81,.3);-webkit-box-align:center;-ms-flex-align:center;align-items:center}.swagger-ui .opblock-tag:hover{background:rgba(0,0,0,.02)}.swagger-ui .opblock-tag{font-size:24px;margin:0 0 5px;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .opblock-tag.no-desc span{-webkit-box-flex:1;-ms-flex:1;flex:1}.swagger-ui .opblock-tag svg{-webkit-transition:all .4s;transition:all .4s}.swagger-ui .opblock-tag small{font-size:14px;font-weight:400;padding:0 10px;-webkit-box-flex:1;-ms-flex:1;flex:1;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .parаmeter__type{font-size:12px;padding:5px 0;font-family:Source Code Pro,monospace;font-weight:600;color:#3b4151}.swagger-ui .view-line-link{position:relative;top:3px;width:20px;margin:0 5px;cursor:pointer;-webkit-transition:all .5s;transition:all .5s}.swagger-ui .opblock{margin:0 0 15px;border:1px solid #000;border-radius:4px;box-shadow:0 0 3px rgba(0,0,0,.19)}.swagger-ui .opblock.is-open .opblock-summary{border-bottom:1px solid #000}.swagger-ui .opblock .opblock-section-header{padding:8px 20px;background:hsla(0,0%,100%,.8);box-shadow:0 1px 2px rgba(0,0,0,.1)}.swagger-ui .opblock .opblock-section-header,.swagger-ui .opblock .opblock-section-header label{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.swagger-ui .opblock .opblock-section-header label{font-size:12px;font-weight:700;margin:0;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .opblock .opblock-section-header label span{padding:0 10px 0 0}.swagger-ui .opblock .opblock-section-header h4{font-size:14px;margin:0;-webkit-box-flex:1;-ms-flex:1;flex:1;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .opblock .opblock-summary-method{font-size:14px;font-weight:700;min-width:80px;padding:6px 15px;text-align:center;border-radius:3px;background:#000;text-shadow:0 1px 0 rgba(0,0,0,.1);font-family:Titillium Web,sans-serif;color:#fff}.swagger-ui .opblock .opblock-summary-path,.swagger-ui .opblock .opblock-summary-path__deprecated{font-size:16px;display:-webkit-box;display:-ms-flexbox;display:flex;padding:0 10px;font-family:Source Code Pro,monospace;font-weight:600;color:#3b4151;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.swagger-ui .opblock .opblock-summary-path .view-line-link,.swagger-ui .opblock .opblock-summary-path__deprecated .view-line-link{position:relative;top:2px;width:0;margin:0;cursor:pointer;-webkit-transition:all .5s;transition:all .5s}.swagger-ui .opblock .opblock-summary-path:hover .view-line-link,.swagger-ui .opblock .opblock-summary-path__deprecated:hover .view-line-link{width:18px;margin:0 5px}.swagger-ui .opblock .opblock-summary-path__deprecated{text-decoration:line-through}.swagger-ui .opblock .opblock-summary-description{font-size:13px;-webkit-box-flex:1;-ms-flex:1;flex:1;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .opblock .opblock-summary{display:-webkit-box;display:-ms-flexbox;display:flex;padding:5px;cursor:pointer;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.swagger-ui .opblock.opblock-post{border-color:#49cc90;background:rgba(73,204,144,.1)}.swagger-ui .opblock.opblock-post .opblock-summary-method{background:#49cc90}.swagger-ui .opblock.opblock-post .opblock-summary{border-color:#49cc90}.swagger-ui .opblock.opblock-put{border-color:#fca130;background:rgba(252,161,48,.1)}.swagger-ui .opblock.opblock-put .opblock-summary-method{background:#fca130}.swagger-ui .opblock.opblock-put .opblock-summary{border-color:#fca130}.swagger-ui .opblock.opblock-delete{border-color:#f93e3e;background:rgba(249,62,62,.1)}.swagger-ui .opblock.opblock-delete .opblock-summary-method{background:#f93e3e}.swagger-ui .opblock.opblock-delete .opblock-summary{border-color:#f93e3e}.swagger-ui .opblock.opblock-get{border-color:#61affe;background:rgba(97,175,254,.1)}.swagger-ui .opblock.opblock-get .opblock-summary-method{background:#61affe}.swagger-ui .opblock.opblock-get .opblock-summary{border-color:#61affe}.swagger-ui .opblock.opblock-patch{border-color:#50e3c2;background:rgba(80,227,194,.1)}.swagger-ui .opblock.opblock-patch .opblock-summary-method{background:#50e3c2}.swagger-ui .opblock.opblock-patch .opblock-summary{border-color:#50e3c2}.swagger-ui .opblock.opblock-head{border-color:#9012fe;background:rgba(144,18,254,.1)}.swagger-ui .opblock.opblock-head .opblock-summary-method{background:#9012fe}.swagger-ui .opblock.opblock-head .opblock-summary{border-color:#9012fe}.swagger-ui .opblock.opblock-options{border-color:#0d5aa7;background:rgba(13,90,167,.1)}.swagger-ui .opblock.opblock-options .opblock-summary-method{background:#0d5aa7}.swagger-ui .opblock.opblock-options .opblock-summary{border-color:#0d5aa7}.swagger-ui .opblock.opblock-deprecated{opacity:.6;border-color:#ebebeb;background:hsla(0,0%,92%,.1)}.swagger-ui .opblock.opblock-deprecated .opblock-summary-method{background:#ebebeb}.swagger-ui .opblock.opblock-deprecated .opblock-summary{border-color:#ebebeb}.swagger-ui .opblock .opblock-schemes{padding:8px 20px}.swagger-ui .opblock .opblock-schemes .schemes-title{padding:0 10px 0 0}.swagger-ui .tab{display:-webkit-box;display:-ms-flexbox;display:flex;margin:20px 0 10px;padding:0;list-style:none}.swagger-ui .tab li{font-size:12px;min-width:100px;min-width:90px;padding:0;cursor:pointer;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .tab li:first-of-type{position:relative;padding-left:0}.swagger-ui .tab li:first-of-type:after{position:absolute;top:0;right:6px;width:1px;height:100%;content:"";background:rgba(0,0,0,.2)}.swagger-ui .tab li.active{font-weight:700}.swagger-ui .opblock-description-wrapper,.swagger-ui .opblock-title_normal{padding:15px 20px}.swagger-ui .opblock-description-wrapper,.swagger-ui .opblock-description-wrapper h4,.swagger-ui .opblock-title_normal,.swagger-ui .opblock-title_normal h4{font-size:12px;margin:0 0 5px;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .opblock-description-wrapper p,.swagger-ui .opblock-title_normal p{font-size:14px;margin:0;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .execute-wrapper{padding:20px;text-align:right}.swagger-ui .execute-wrapper .btn{width:100%;padding:8px 40px}.swagger-ui .body-param-options{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.swagger-ui .body-param-options .body-param-edit{padding:10px 0}.swagger-ui .body-param-options label{padding:8px 0}.swagger-ui .body-param-options label select{margin:3px 0 0}.swagger-ui .responses-inner{padding:20px}.swagger-ui .responses-inner h4,.swagger-ui .responses-inner h5{font-size:12px;margin:10px 0 5px;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .response-col_status{font-size:14px;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .response-col_status .response-undocumented{font-size:11px;font-family:Source Code Pro,monospace;font-weight:600;color:#999}.swagger-ui .response-col_description__inner span{font-size:12px;font-style:italic;display:block;margin:10px 0;padding:10px;border-radius:4px;background:#41444e;font-family:Source Code Pro,monospace;font-weight:600;color:#fff}.swagger-ui .response-col_description__inner span p{margin:0}.swagger-ui .opblock-body pre{font-size:12px;margin:0;padding:10px;white-space:pre-wrap;border-radius:4px;background:#41444e;font-family:Source Code Pro,monospace;font-weight:600;color:#fff}.swagger-ui .opblock-body pre span{color:#fff!important}.swagger-ui .scheme-container{margin:0 0 20px;padding:30px 0;background:#fff;box-shadow:0 1px 2px 0 rgba(0,0,0,.15)}.swagger-ui .scheme-container .schemes{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.swagger-ui .scheme-container .schemes>label{font-size:12px;font-weight:700;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;margin:-20px 15px 0 0;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .scheme-container .schemes>label select{min-width:130px;text-transform:uppercase}.swagger-ui .loading-container{padding:40px 0 60px}.swagger-ui .loading-container .loading{position:relative}.swagger-ui .loading-container .loading:after{font-size:10px;font-weight:700;position:absolute;top:50%;left:50%;content:"loading";-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);text-transform:uppercase;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .loading-container .loading:before{position:absolute;top:50%;left:50%;display:block;width:60px;height:60px;margin:-30px;content:"";-webkit-animation:rotation 1s infinite linear,opacity .5s;animation:rotation 1s infinite linear,opacity .5s;opacity:1;border:2px solid rgba(85,85,85,.1);border-top-color:rgba(0,0,0,.6);border-radius:100%;-webkit-backface-visibility:hidden;backface-visibility:hidden}@-webkit-keyframes rotation{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes rotation{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes blinker{50%{opacity:0}}@keyframes blinker{50%{opacity:0}}.swagger-ui .btn{font-size:14px;font-weight:700;padding:5px 23px;-webkit-transition:all .3s;transition:all .3s;border:2px solid #888;border-radius:4px;background:transparent;box-shadow:0 1px 2px rgba(0,0,0,.1);font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .btn[disabled]{cursor:not-allowed;opacity:.3}.swagger-ui .btn:hover{box-shadow:0 0 5px rgba(0,0,0,.3)}.swagger-ui .btn.cancel{border-color:#ff6060;font-family:Titillium Web,sans-serif;color:#ff6060}.swagger-ui .btn.authorize{line-height:1;display:inline;color:#49cc90;border-color:#49cc90}.swagger-ui .btn.authorize span{float:left;padding:4px 20px 0 0}.swagger-ui .btn.authorize svg{fill:#49cc90}.swagger-ui .btn.execute{-webkit-animation:pulse 2s infinite;animation:pulse 2s infinite;color:#fff;border-color:#4990e2}@-webkit-keyframes pulse{0%{color:#fff;background:#4990e2;box-shadow:0 0 0 0 rgba(73,144,226,.8)}70%{box-shadow:0 0 0 5px rgba(73,144,226,0)}to{color:#fff;background:#4990e2;box-shadow:0 0 0 0 rgba(73,144,226,0)}}@keyframes pulse{0%{color:#fff;background:#4990e2;box-shadow:0 0 0 0 rgba(73,144,226,.8)}70%{box-shadow:0 0 0 5px rgba(73,144,226,0)}to{color:#fff;background:#4990e2;box-shadow:0 0 0 0 rgba(73,144,226,0)}}.swagger-ui .btn-group{display:-webkit-box;display:-ms-flexbox;display:flex;padding:30px}.swagger-ui .btn-group .btn{-webkit-box-flex:1;-ms-flex:1;flex:1}.swagger-ui .btn-group .btn:first-child{border-radius:4px 0 0 4px}.swagger-ui .btn-group .btn:last-child{border-radius:0 4px 4px 0}.swagger-ui .authorization__btn{padding:0 10px;border:none;background:none}.swagger-ui .authorization__btn.locked{opacity:1}.swagger-ui .authorization__btn.unlocked{opacity:.4}.swagger-ui .expand-methods,.swagger-ui .expand-operation{border:none;background:none}.swagger-ui .expand-methods svg,.swagger-ui .expand-operation svg{width:20px;height:20px}.swagger-ui .expand-methods{padding:0 10px}.swagger-ui .expand-methods:hover svg{fill:#444}.swagger-ui .expand-methods svg{-webkit-transition:all .3s;transition:all .3s;fill:#777}.swagger-ui button{cursor:pointer;outline:none}.swagger-ui select{font-size:14px;font-weight:700;padding:5px 40px 5px 10px;border:2px solid #41444e;border-radius:4px;background:#f7f7f7 url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCI+ICAgIDxwYXRoIGQ9Ik0xMy40MTggNy44NTljLjI3MS0uMjY4LjcwOS0uMjY4Ljk3OCAwIC4yNy4yNjguMjcyLjcwMSAwIC45NjlsLTMuOTA4IDMuODNjLS4yNy4yNjgtLjcwNy4yNjgtLjk3OSAwbC0zLjkwOC0zLjgzYy0uMjctLjI2Ny0uMjctLjcwMSAwLS45NjkuMjcxLS4yNjguNzA5LS4yNjguOTc4IDBMMTAgMTFsMy40MTgtMy4xNDF6Ii8+PC9zdmc+) right 10px center no-repeat;background-size:20px;box-shadow:0 1px 2px 0 rgba(0,0,0,.25);font-family:Titillium Web,sans-serif;color:#3b4151;-webkit-appearance:none;-moz-appearance:none;appearance:none}.swagger-ui select[multiple]{margin:5px 0;padding:5px;background:#f7f7f7}.swagger-ui .opblock-body select{min-width:230px}.swagger-ui label{font-size:12px;font-weight:700;margin:0 0 5px;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui input[type=email],.swagger-ui input[type=password],.swagger-ui input[type=search],.swagger-ui input[type=text]{min-width:100px;margin:5px 0;padding:8px 10px;border:1px solid #d9d9d9;border-radius:4px;background:#fff}.swagger-ui input[type=email].invalid,.swagger-ui input[type=password].invalid,.swagger-ui input[type=search].invalid,.swagger-ui input[type=text].invalid{-webkit-animation:shake .4s 1;animation:shake .4s 1;border-color:#f93e3e;background:#feebeb}@-webkit-keyframes shake{10%,90%{-webkit-transform:translate3d(-1px,0,0);transform:translate3d(-1px,0,0)}20%,80%{-webkit-transform:translate3d(2px,0,0);transform:translate3d(2px,0,0)}30%,50%,70%{-webkit-transform:translate3d(-4px,0,0);transform:translate3d(-4px,0,0)}40%,60%{-webkit-transform:translate3d(4px,0,0);transform:translate3d(4px,0,0)}}@keyframes shake{10%,90%{-webkit-transform:translate3d(-1px,0,0);transform:translate3d(-1px,0,0)}20%,80%{-webkit-transform:translate3d(2px,0,0);transform:translate3d(2px,0,0)}30%,50%,70%{-webkit-transform:translate3d(-4px,0,0);transform:translate3d(-4px,0,0)}40%,60%{-webkit-transform:translate3d(4px,0,0);transform:translate3d(4px,0,0)}}.swagger-ui textarea{font-size:12px;width:100%;min-height:280px;padding:10px;border:none;border-radius:4px;outline:none;background:hsla(0,0%,100%,.8);font-family:Source Code Pro,monospace;font-weight:600;color:#3b4151}.swagger-ui textarea:focus{border:2px solid #61affe}.swagger-ui textarea.curl{font-size:12px;min-height:100px;margin:0;padding:10px;resize:none;border-radius:4px;background:#41444e;font-family:Source Code Pro,monospace;font-weight:600;color:#fff}.swagger-ui .checkbox{padding:5px 0 10px;-webkit-transition:opacity .5s;transition:opacity .5s;color:#333}.swagger-ui .checkbox label{display:-webkit-box;display:-ms-flexbox;display:flex}.swagger-ui .checkbox p{font-weight:400!important;font-style:italic;margin:0!important;font-family:Source Code Pro,monospace;font-weight:600;color:#3b4151}.swagger-ui .checkbox input[type=checkbox]{display:none}.swagger-ui .checkbox input[type=checkbox]+label>.item{position:relative;top:3px;display:inline-block;width:16px;height:16px;margin:0 8px 0 0;padding:5px;cursor:pointer;border-radius:1px;background:#e8e8e8;box-shadow:0 0 0 2px #e8e8e8;-webkit-box-flex:0;-ms-flex:none;flex:none}.swagger-ui .checkbox input[type=checkbox]+label>.item:active{-webkit-transform:scale(.9);transform:scale(.9)}.swagger-ui .checkbox input[type=checkbox]:checked+label>.item{background:#e8e8e8 url("data:image/svg+xml;charset=utf-8,%3Csvg width='10' height='8' viewBox='3 7 10 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%2341474E' fill-rule='evenodd' d='M6.333 15L3 11.667l1.333-1.334 2 2L11.667 7 13 8.333z'/%3E%3C/svg%3E") 50% no-repeat}.swagger-ui .dialog-ux{position:fixed;z-index:9999;top:0;right:0;bottom:0;left:0}.swagger-ui .dialog-ux .backdrop-ux{position:fixed;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,.8)}.swagger-ui .dialog-ux .modal-ux{position:absolute;z-index:9999;top:50%;left:50%;width:100%;min-width:300px;max-width:650px;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);border:1px solid #ebebeb;border-radius:4px;background:#fff;box-shadow:0 10px 30px 0 rgba(0,0,0,.2)}.swagger-ui .dialog-ux .modal-ux-content{overflow-y:auto;max-height:540px;padding:20px}.swagger-ui .dialog-ux .modal-ux-content p{font-size:12px;margin:0 0 5px;color:#41444e;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .dialog-ux .modal-ux-content h4{font-size:18px;font-weight:600;margin:15px 0 0;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .dialog-ux .modal-ux-header{display:-webkit-box;display:-ms-flexbox;display:flex;padding:12px 0;border-bottom:1px solid #ebebeb;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.swagger-ui .dialog-ux .modal-ux-header .close-modal{padding:0 10px;border:none;background:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.swagger-ui .dialog-ux .modal-ux-header h3{font-size:20px;font-weight:600;margin:0;padding:0 20px;-webkit-box-flex:1;-ms-flex:1;flex:1;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .model{font-size:12px;font-weight:300;font-family:Source Code Pro,monospace;font-weight:600;color:#3b4151}.swagger-ui .model-toggle{font-size:10px;position:relative;top:6px;display:inline-block;margin:auto .3em;cursor:pointer;-webkit-transition:-webkit-transform .15s ease-in;transition:-webkit-transform .15s ease-in;transition:transform .15s ease-in;transition:transform .15s ease-in,-webkit-transform .15s ease-in;-webkit-transform:rotate(90deg);transform:rotate(90deg);-webkit-transform-origin:50% 50%;transform-origin:50% 50%}.swagger-ui .model-toggle.collapsed{-webkit-transform:rotate(0deg);transform:rotate(0deg)}.swagger-ui .model-toggle:after{display:block;width:20px;height:20px;content:"";background:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z'/%3E%3C/svg%3E") 50% no-repeat;background-size:100%}.swagger-ui .model-jump-to-path{position:relative;cursor:pointer}.swagger-ui .model-jump-to-path .view-line-link{position:absolute;top:-.4em;cursor:pointer}.swagger-ui .model-title{position:relative}.swagger-ui .model-title:hover .model-hint{visibility:visible}.swagger-ui .model-hint{position:absolute;top:-1.8em;visibility:hidden;padding:.1em .5em;white-space:nowrap;color:#ebebeb;border-radius:4px;background:rgba(0,0,0,.7)}.swagger-ui section.models{margin:30px 0;border:1px solid rgba(59,65,81,.3);border-radius:4px}.swagger-ui section.models.is-open{padding:0 0 20px}.swagger-ui section.models.is-open h4{margin:0 0 5px;border-bottom:1px solid rgba(59,65,81,.3)}.swagger-ui section.models.is-open h4 svg{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.swagger-ui section.models h4{font-size:16px;display:-webkit-box;display:-ms-flexbox;display:flex;margin:0;padding:10px 20px 10px 10px;cursor:pointer;-webkit-transition:all .2s;transition:all .2s;font-family:Titillium Web,sans-serif;color:#777;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.swagger-ui section.models h4 svg{-webkit-transition:all .4s;transition:all .4s}.swagger-ui section.models h4 span{-webkit-box-flex:1;-ms-flex:1;flex:1}.swagger-ui section.models h4:hover{background:rgba(0,0,0,.02)}.swagger-ui section.models h5{font-size:16px;margin:0 0 10px;font-family:Titillium Web,sans-serif;color:#777}.swagger-ui section.models .model-jump-to-path{position:relative;top:5px}.swagger-ui section.models .model-container{margin:0 20px 15px;-webkit-transition:all .5s;transition:all .5s;border-radius:4px;background:rgba(0,0,0,.05)}.swagger-ui section.models .model-container:hover{background:rgba(0,0,0,.07)}.swagger-ui section.models .model-container:first-of-type{margin:20px}.swagger-ui section.models .model-container:last-of-type{margin:0 20px}.swagger-ui section.models .model-box{background:none}.swagger-ui .model-box{padding:10px;border-radius:4px;background:rgba(0,0,0,.1)}.swagger-ui .model-box .model-jump-to-path{position:relative;top:4px}.swagger-ui .model-title{font-size:16px;font-family:Titillium Web,sans-serif;color:#555}.swagger-ui span>span.model,.swagger-ui span>span.model .brace-close{padding:0 0 0 10px}.swagger-ui .prop-type{color:#55a}.swagger-ui .prop-enum{display:block}.swagger-ui .prop-format{color:#999}.swagger-ui table{width:100%;padding:0 10px;border-collapse:collapse}.swagger-ui table.model tbody tr td{padding:0;vertical-align:top}.swagger-ui table.model tbody tr td:first-of-type{width:100px;padding:0}.swagger-ui table.headers td{font-size:12px;font-weight:300;vertical-align:middle;font-family:Source Code Pro,monospace;font-weight:600;color:#3b4151}.swagger-ui table tbody tr td{padding:10px 0 0;vertical-align:top}.swagger-ui table tbody tr td:first-of-type{width:20%;padding:10px 0}.swagger-ui table thead tr td,.swagger-ui table thead tr th{font-size:12px;font-weight:700;padding:12px 0;text-align:left;border-bottom:1px solid rgba(59,65,81,.2);font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .parameters-col_description p{font-size:14px;margin:0;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .parameters-col_description input[type=text]{width:100%;max-width:340px}.swagger-ui .parameter__name{font-size:16px;font-weight:400;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .parameter__name.required{font-weight:700}.swagger-ui .parameter__name.required:after{font-size:10px;position:relative;top:-6px;padding:5px;content:"required";color:rgba(255,0,0,.6)}.swagger-ui .parameter__in{font-size:12px;font-style:italic;font-family:Source Code Pro,monospace;font-weight:600;color:#888}.swagger-ui .table-container{padding:20px}.swagger-ui .topbar{padding:8px 30px;background-color:#89bf04}.swagger-ui .topbar .topbar-wrapper{-ms-flex-align:center}.swagger-ui .topbar .topbar-wrapper,.swagger-ui .topbar a{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;align-items:center}.swagger-ui .topbar a{font-size:1.5em;font-weight:700;text-decoration:none;-webkit-box-flex:1;-ms-flex:1;flex:1;-ms-flex-align:center;font-family:Titillium Web,sans-serif;color:#fff}.swagger-ui .topbar a span{margin:0;padding:0 10px}.swagger-ui .topbar .download-url-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex}.swagger-ui .topbar .download-url-wrapper input[type=text]{min-width:350px;margin:0;border:2px solid #547f00;border-radius:4px 0 0 4px;outline:none}.swagger-ui .topbar .download-url-wrapper .download-url-button{font-size:16px;font-weight:700;padding:4px 40px;border:none;border-radius:0 4px 4px 0;background:#547f00;font-family:Titillium Web,sans-serif;color:#fff}.swagger-ui .info{margin:50px 0}.swagger-ui .info hgroup.main{margin:0 0 20px}.swagger-ui .info hgroup.main a{font-size:12px}.swagger-ui .info p{font-size:14px;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .info code{padding:3px 5px;border-radius:4px;background:rgba(0,0,0,.05);font-family:Source Code Pro,monospace;font-weight:600;color:#9012fe}.swagger-ui .info a{font-size:14px;-webkit-transition:all .4s;transition:all .4s;font-family:Open Sans,sans-serif;color:#4990e2}.swagger-ui .info a:hover{color:#1f69c0}.swagger-ui .info>div{margin:0 0 5px}.swagger-ui .info .base-url{font-size:12px;font-weight:300!important;margin:0;font-family:Source Code Pro,monospace;font-weight:600;color:#3b4151}.swagger-ui .info .title{font-size:36px;margin:0;font-family:Open Sans,sans-serif;color:#3b4151}.swagger-ui .info .title small{font-size:10px;position:relative;top:-5px;display:inline-block;margin:0 0 0 5px;padding:2px 4px;vertical-align:super;border-radius:57px;background:#7d8492}.swagger-ui .info .title small pre{margin:0;font-family:Titillium Web,sans-serif;color:#fff}.swagger-ui .auth-btn-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;padding:10px 0;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.swagger-ui .auth-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex:1;flex:1;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.swagger-ui .auth-wrapper .authorize{padding-right:20px}.swagger-ui .auth-container{margin:0 0 10px;padding:10px 20px;border-bottom:1px solid #ebebeb}.swagger-ui .auth-container:last-of-type{margin:0;padding:10px 20px;border:0}.swagger-ui .auth-container h4{margin:5px 0 15px!important}.swagger-ui .auth-container .wrapper{margin:0;padding:0}.swagger-ui .auth-container input[type=password],.swagger-ui .auth-container input[type=text]{min-width:230px}.swagger-ui .auth-container .errors{font-size:12px;padding:10px;border-radius:4px;font-family:Source Code Pro,monospace;font-weight:600;color:#3b4151}.swagger-ui .scopes h2{font-size:14px;font-family:Titillium Web,sans-serif;color:#3b4151}.swagger-ui .scope-def{padding:0 0 20px}.swagger-ui .errors-wrapper{margin:20px;padding:10px 20px;-webkit-animation:scaleUp .5s;animation:scaleUp .5s;border:2px solid #f93e3e;border-radius:4px;background:rgba(249,62,62,.1)}.swagger-ui .errors-wrapper .error-wrapper{margin:0 0 10px}.swagger-ui .errors-wrapper .errors h4{font-size:14px;margin:0;font-family:Source Code Pro,monospace;font-weight:600;color:#3b4151}.swagger-ui .errors-wrapper .errors small{color:#666}.swagger-ui .errors-wrapper hgroup{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.swagger-ui .errors-wrapper hgroup h4{font-size:20px;margin:0;-webkit-box-flex:1;-ms-flex:1;flex:1;font-family:Titillium Web,sans-serif;color:#3b4151}@-webkit-keyframes scaleUp{0%{-webkit-transform:scale(.8);transform:scale(.8);opacity:0}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes scaleUp{0%{-webkit-transform:scale(.8);transform:scale(.8);opacity:0}to{-webkit-transform:scale(1);transform:scale(1);opacity:1}}.swagger-ui .Resizer.vertical.disabled{display:none} 2 | /*# sourceMappingURL=swagger-ui.css.map*/ -------------------------------------------------------------------------------- /beesly/swagger-ui/swagger-ui.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"swagger-ui.css","sources":[],"mappings":"","sourceRoot":""} -------------------------------------------------------------------------------- /beesly/swagger-ui/swagger-ui.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;;;;;;AAuwCA;AAoyHA;AA2wHA;AA07FA;AA+nCA;AAohCA;AAghCA;AAk4BA","sourceRoot":""} -------------------------------------------------------------------------------- /beesly/swagger-ui/swagger.yaml: -------------------------------------------------------------------------------- 1 | ../../swagger.yaml -------------------------------------------------------------------------------- /beesly/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bincyber/beesly/82899f06efbd02ce30d9103df07bef12aaa1df2b/beesly/tests/__init__.py -------------------------------------------------------------------------------- /beesly/tests/test_auth_endpoint.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import json 3 | import os 4 | 5 | from beesly.views import app 6 | from beesly.version import __app__ 7 | 8 | 9 | class AuthEndpointTests(unittest.TestCase): 10 | 11 | def setUp(self): 12 | app.config["APP_NAME"] = __app__ 13 | app.config["DEV"] = False 14 | app.config["PAM_SERVICE"] = "login" 15 | app.config["JWT"] = True 16 | app.config["JWT_MASTER_KEY"] = "passwordpassword" 17 | app.config["JWT_VALIDITY_PERIOD"] = 5 18 | app.config["JWT_ALGORITHM"] = "HS256" 19 | 20 | self.app = app.test_client() 21 | 22 | self.username = os.environ.get("TEST_USERNAME", "vagrant") 23 | self.password = os.environ.get("TEST_PASSWORD", "vagrant") 24 | 25 | def tearDown(self): 26 | pass 27 | 28 | def test_auth_endpoint_success(self): 29 | req_body = json.dumps(dict(username=self.username, password=self.password)) 30 | resp = self.app.post('/auth', data=req_body, content_type='application/json') 31 | self.assertEqual(resp.status_code, 200) 32 | 33 | resp_body = json.loads(resp.data) 34 | self.assertEqual(resp_body["message"], 'Authentication successful') 35 | 36 | def test_auth_endpoint_failure(self): 37 | req_body = json.dumps(dict(username=self.username, password=self.password + "nc8awdaw")) 38 | resp = self.app.post('/auth', data=req_body, content_type='application/json') 39 | self.assertEqual(resp.status_code, 401) 40 | 41 | resp_body = json.loads(resp.data) 42 | self.assertEqual(resp_body["message"], 'Authentication failed') 43 | 44 | def test_auth_endpoint_invalid_username(self): 45 | req_body = json.dumps(dict(username=self.username + " d@.-0z", password=self.password)) 46 | resp = self.app.post('/auth', data=req_body, content_type='application/json') 47 | self.assertEqual(resp.status_code, 400) 48 | 49 | resp_body = json.loads(resp.data) 50 | self.assertEqual(resp_body["message"], 'Invalid username provided') 51 | 52 | def test_auth_endpoint_missing_parameters(self): 53 | req_body = json.dumps(dict(username=self.username)) 54 | resp = self.app.post('/auth', data=req_body, content_type='application/json') 55 | self.assertEqual(resp.status_code, 400) 56 | 57 | resp_body = json.loads(resp.data) 58 | self.assertEqual(resp_body["message"], 'No username or password provided') 59 | -------------------------------------------------------------------------------- /beesly/tests/test_config.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import os 3 | 4 | from beesly import create_app 5 | from beesly.config import initialize_config, ConfigError, StatsdConfig 6 | 7 | 8 | class ConfigTests(unittest.TestCase): 9 | 10 | def setUp(self): 11 | env_vars = [ 12 | "DEV" 13 | "JWT_ALGORITHM", 14 | "JWT_MASTER_KEY", 15 | "JWT_VALIDITY_PERIOD", 16 | "PAM_SERVICE", 17 | "RATELIMIT_ENABLED", 18 | "RATELIMIT_STORAGE_URL", 19 | "RATELIMIT_STRATEGY", 20 | "STATSD_HOST", 21 | "STATSD_PORT", 22 | ] 23 | 24 | for i in env_vars: 25 | try: 26 | del os.environ[i] 27 | except: 28 | pass 29 | 30 | def tearDown(self): 31 | pass 32 | 33 | def test_swagger_ui_enabled(self): 34 | os.environ["DEV"] = "True" 35 | 36 | app = create_app().test_client() 37 | 38 | resp = app.get('/service/docs/index.html') 39 | self.assertEqual(resp.status_code, 200) 40 | del app 41 | 42 | def test_swagger_ui_disabled(self): 43 | app = create_app().test_client() 44 | 45 | resp = app.get('/service/docs/index.html') 46 | self.assertEqual(resp.status_code, 404) 47 | 48 | def test_invalid_pam_service(self): 49 | os.environ["PAM_SERVICE"] = "blah" 50 | 51 | with self.assertRaises(ConfigError): 52 | initialize_config() 53 | 54 | def test_invalid_rate_limit_strategy(self): 55 | os.environ["RATELIMIT_STRATEGY"] = "blah" 56 | 57 | with self.assertRaises(ConfigError): 58 | initialize_config() 59 | 60 | def test_invalid_rate_limit_storage_backend(self): 61 | os.environ["RATELIMIT_STORAGE_URL"] = "blah" 62 | 63 | with self.assertRaises(ConfigError): 64 | initialize_config() 65 | 66 | def test_invalid_rate_limit_strategy_storage_memcached(self): 67 | os.environ["RATELIMIT_STRATEGY"] = "moving-window" 68 | os.environ["RATELIMIT_STORAGE_URL"] = "memcached://localhost:11211" 69 | 70 | with self.assertRaises(ConfigError): 71 | initialize_config() 72 | 73 | def test_invalid_jwt_master_key(self): 74 | os.environ["JWT_MASTER_KEY"] = "blah" 75 | 76 | with self.assertRaises(ConfigError): 77 | initialize_config() 78 | 79 | del os.environ["JWT_MASTER_KEY"] 80 | 81 | def test_invalid_jwt_validity_period(self): 82 | os.environ["JWT_VALIDITY_PERIOD"] = "blah" 83 | 84 | settings = initialize_config() 85 | 86 | self.assertEqual(settings["JWT_VALIDITY_PERIOD"], 900) 87 | 88 | def test_invalid_jwt_algorithm(self): 89 | os.environ["JWT_ALGORITHM"] = "blah" 90 | os.environ["JWT_MASTER_KEY"] = "passwordpassword" 91 | 92 | settings = initialize_config() 93 | 94 | self.assertEqual(settings["JWT_ALGORITHM"], "HS256") 95 | 96 | def test_statsd_config(self): 97 | os.environ["STATSD_HOST"] = "A B C D" 98 | os.environ["STATSD_PORT"] = "abcd" 99 | 100 | statsd = StatsdConfig() 101 | 102 | self.assertTrue(statsd.client) 103 | self.assertEqual(statsd.host, "localhost") 104 | self.assertEqual(statsd.port, 8125) 105 | self.assertEqual(statsd.prefix, "beesly") 106 | 107 | 108 | class CreateAppTest(unittest.TestCase): 109 | 110 | def setUp(self): 111 | os.environ["RATELIMIT_ENABLED"] = "False" 112 | 113 | def tearDown(self): 114 | del os.environ["RATELIMIT_ENABLED"] 115 | 116 | def test_create_app(self): 117 | self.assertIsNotNone(create_app()) 118 | -------------------------------------------------------------------------------- /beesly/tests/test_renew_endpoint.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import json 3 | import os 4 | 5 | from jose import jwt 6 | 7 | from beesly.views import app 8 | from beesly.version import __app__ 9 | 10 | 11 | class RenewEndpointTests(unittest.TestCase): 12 | 13 | def setUp(self): 14 | app.config["APP_NAME"] = __app__ 15 | app.config["DEV"] = False 16 | app.config["PAM_SERVICE"] = "login" 17 | app.config["JWT"] = True 18 | app.config["JWT_MASTER_KEY"] = "passwordpassword" 19 | app.config["JWT_VALIDITY_PERIOD"] = 10 20 | app.config["JWT_ALGORITHM"] = "HS256" 21 | 22 | self.app = app.test_client() 23 | 24 | self.username = os.environ.get("TEST_USERNAME", "vagrant") 25 | self.password = os.environ.get("TEST_PASSWORD", "vagrant") 26 | 27 | req_body = json.dumps(dict(username=self.username, password=self.password)) 28 | resp = self.app.post('/auth', data=req_body, content_type='application/json') 29 | 30 | self.token = json.loads(resp.data)["jwt"] 31 | 32 | def tearDown(self): 33 | pass 34 | 35 | def test_renew_endpoint_disabled(self): 36 | app.config["JWT"] = False 37 | 38 | resp = self.app.post('/renew') 39 | self.assertEqual(resp.status_code, 501) 40 | 41 | resp_body = json.loads(resp.data) 42 | self.assertEqual(resp_body["message"], 'JWT renewal is not enabled') 43 | 44 | def test_renew_endpoint_success(self): 45 | req_body = json.dumps(dict(jwt=self.token, username=self.username)) 46 | resp = self.app.post('/renew', data=req_body, content_type='application/json') 47 | self.assertEqual(resp.status_code, 200) 48 | 49 | resp_body = json.loads(resp.data) 50 | self.assertEqual(resp_body["message"], 'JWT successfully renewed') 51 | 52 | def test_renew_endpoint_failure(self): 53 | 54 | claims = jwt.get_unverified_claims(self.token) 55 | new_token = jwt.encode(claims=claims, key='notthepassword', algorithm=app.config["JWT_ALGORITHM"]) 56 | 57 | req_body = json.dumps(dict(jwt=new_token, username=self.username)) 58 | resp = self.app.post('/renew', data=req_body, content_type='application/json') 59 | self.assertEqual(resp.status_code, 401) 60 | 61 | resp_body = json.loads(resp.data) 62 | self.assertEqual(resp_body["message"], 'Failed to renew invalid JWT') 63 | 64 | def test_renew_endpoint_invalid_subject(self): 65 | req_body = json.dumps(dict(jwt=self.token, username="INVALID")) 66 | resp = self.app.post('/renew', data=req_body, content_type='application/json') 67 | self.assertEqual(resp.status_code, 400) 68 | 69 | resp_body = json.loads(resp.data) 70 | self.assertEqual(resp_body["message"], 'Invalid subject in JWT claim') 71 | 72 | def test_renew_endpoint_invalid_username(self): 73 | req_body = json.dumps(dict(jwt=self.token, username=self.username + " dak298n")) 74 | resp = self.app.post('/renew', data=req_body, content_type='application/json') 75 | self.assertEqual(resp.status_code, 400) 76 | 77 | resp_body = json.loads(resp.data) 78 | self.assertEqual(resp_body["message"], 'Invalid username provided') 79 | 80 | def test_renew_endpoint_invalid_token(self): 81 | req_body = json.dumps(dict(jwt="INVALID", username=self.username)) 82 | resp = self.app.post('/renew', data=req_body, content_type='application/json') 83 | self.assertEqual(resp.status_code, 400) 84 | 85 | resp_body = json.loads(resp.data) 86 | self.assertEqual(resp_body["message"], 'Invalid JWT') 87 | 88 | def test_renew_endpoint_invalid_claims(self): 89 | 90 | claims = jwt.get_unverified_claims(self.token) 91 | del claims["sub"] 92 | new_token = jwt.encode(claims=claims, key='notthepassword', algorithm=app.config["JWT_ALGORITHM"]) 93 | 94 | req_body = json.dumps(dict(jwt=new_token, username=self.username)) 95 | resp = self.app.post('/renew', data=req_body, content_type='application/json') 96 | self.assertEqual(resp.status_code, 401) 97 | 98 | resp_body = json.loads(resp.data) 99 | self.assertEqual(resp_body["message"], 'Invalid claims in JWT') 100 | 101 | def test_renew_endpoint_missing_token(self): 102 | req_body = json.dumps(dict(username=self.username)) 103 | resp = self.app.post('/renew', data=req_body, content_type='application/json') 104 | self.assertEqual(resp.status_code, 400) 105 | 106 | resp_body = json.loads(resp.data) 107 | self.assertEqual(resp_body["message"], 'No JWT or username provided') 108 | -------------------------------------------------------------------------------- /beesly/tests/test_service_endpoints.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import json 3 | 4 | from beesly.views import app 5 | from beesly.version import __app__, __version__ 6 | 7 | 8 | class ServiceEndpointsTests(unittest.TestCase): 9 | 10 | def setUp(self): 11 | app.config["DEV"] = False 12 | app.config["APP_NAME"] = __app__ 13 | app.config["APP_VERSION"] = __version__ 14 | 15 | self.app = app.test_client() 16 | 17 | def tearDown(self): 18 | pass 19 | 20 | def test_root_endpoint(self): 21 | resp = self.app.get('/') 22 | self.assertEqual(resp.status_code, 200) 23 | 24 | def test_service_endpoint(self): 25 | resp = self.app.get('/service') 26 | self.assertEqual(resp.status_code, 200) 27 | 28 | def test_version_endpoint(self): 29 | resp = self.app.get('/service/version') 30 | self.assertEqual(resp.status_code, 200) 31 | 32 | resp_body = json.loads(resp.data) 33 | self.assertEqual(resp_body["version"], __version__) 34 | 35 | def test_health_endpoint(self): 36 | resp = self.app.get('/service/health') 37 | self.assertEqual(resp.status_code, 200) 38 | 39 | resp_body = json.loads(resp.data) 40 | self.assertEqual(resp_body["beesly"], 'OK') 41 | 42 | def test_nonexistant_endpoint(self): 43 | resp = self.app.get('/service/bar') 44 | self.assertEqual(resp.status_code, 404) 45 | -------------------------------------------------------------------------------- /beesly/tests/test_verify_endpoint.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import json 3 | import os 4 | 5 | from jose import jwt 6 | 7 | from beesly.views import app 8 | from beesly.version import __app__ 9 | 10 | 11 | class VerifyEndpointTests(unittest.TestCase): 12 | 13 | def setUp(self): 14 | app.config["APP_NAME"] = __app__ 15 | app.config["DEV"] = False 16 | app.config["PAM_SERVICE"] = "login" 17 | app.config["JWT"] = True 18 | app.config["JWT_MASTER_KEY"] = "passwordpassword" 19 | app.config["JWT_VALIDITY_PERIOD"] = 10 20 | app.config["JWT_ALGORITHM"] = "HS256" 21 | 22 | self.app = app.test_client() 23 | self.username = os.environ.get("TEST_USERNAME", "vagrant") 24 | self.password = os.environ.get("TEST_PASSWORD", "vagrant") 25 | 26 | req_body = json.dumps(dict(username=self.username, password=self.password)) 27 | resp = self.app.post('/auth', data=req_body, content_type='application/json') 28 | 29 | self.token = json.loads(resp.data)["jwt"] 30 | 31 | def tearDown(self): 32 | pass 33 | 34 | def test_verify_endpoint_disabled(self): 35 | app.config["JWT"] = False 36 | 37 | resp = self.app.post('/verify') 38 | self.assertEqual(resp.status_code, 501) 39 | 40 | resp_body = json.loads(resp.data) 41 | self.assertEqual(resp_body["message"], 'JWT verification is not enabled') 42 | 43 | def test_verify_endpoint_success(self): 44 | req_body = json.dumps(dict(jwt=self.token, username=self.username)) 45 | resp = self.app.post('/verify', data=req_body, content_type='application/json') 46 | self.assertEqual(resp.status_code, 200) 47 | 48 | resp_body = json.loads(resp.data) 49 | self.assertEqual(resp_body["message"], 'JWT successfully verified') 50 | 51 | def test_verify_endpoint_failure(self): 52 | 53 | claims = jwt.get_unverified_claims(self.token) 54 | new_token = jwt.encode(claims=claims, key='notthepassword', algorithm=app.config["JWT_ALGORITHM"]) 55 | 56 | req_body = json.dumps(dict(jwt=new_token, username=self.username)) 57 | resp = self.app.post('/verify', data=req_body, content_type='application/json') 58 | self.assertEqual(resp.status_code, 401) 59 | 60 | resp_body = json.loads(resp.data) 61 | self.assertEqual(resp_body["message"], 'Failed to verify JWT') 62 | 63 | def test_verify_endpoint_invalid_token(self): 64 | req_body = json.dumps(dict(jwt="INVALID", username=self.username)) 65 | resp = self.app.post('/verify', data=req_body, content_type='application/json') 66 | self.assertEqual(resp.status_code, 400) 67 | 68 | resp_body = json.loads(resp.data) 69 | self.assertEqual(resp_body["message"], 'Invalid JWT') 70 | 71 | def test_verify_endpoint_invalid_claims(self): 72 | 73 | claims = jwt.get_unverified_claims(self.token) 74 | del claims["sub"] 75 | new_token = jwt.encode(claims=claims, key='notthepassword', algorithm=app.config["JWT_ALGORITHM"]) 76 | 77 | req_body = json.dumps(dict(jwt=new_token, username=self.username)) 78 | resp = self.app.post('/verify', data=req_body, content_type='application/json') 79 | self.assertEqual(resp.status_code, 401) 80 | 81 | resp_body = json.loads(resp.data) 82 | self.assertEqual(resp_body["message"], 'Invalid claims in JWT') 83 | 84 | def test_verify_endpoint_missing_token(self): 85 | req_body = json.dumps(dict(username=self.username)) 86 | resp = self.app.post('/verify', data=req_body, content_type='application/json') 87 | self.assertEqual(resp.status_code, 400) 88 | 89 | resp_body = json.loads(resp.data) 90 | self.assertEqual(resp_body["message"], 'No JWT provided') 91 | -------------------------------------------------------------------------------- /beesly/utils.py: -------------------------------------------------------------------------------- 1 | from hashlib import sha256 2 | from distutils.spawn import find_executable 3 | import re 4 | import subprocess 5 | 6 | from flask import request 7 | import requests 8 | 9 | 10 | def get_ec2_metadata(): 11 | """ 12 | Returns the following AWS EC2 metadata as a dictionary: 13 | * region 14 | * availability zone 15 | * image id 16 | * instance type 17 | * instance id 18 | """ 19 | metadata_url = 'http://169.254.169.254/latest/dynamic/instance-identity/document/' 20 | 21 | resp = requests.get(metadata_url, timeout=0.250) 22 | 23 | json_body = resp.json() 24 | 25 | metadata = { 26 | 'image_id': json_body.get('imageId'), 27 | 'instance_type': json_body.get('instanceType'), 28 | 'instance_id': json_body.get('instanceId'), 29 | 'availability_zone': json_body.get('availabilityZone'), 30 | 'region': json_body.get('region') 31 | } 32 | 33 | return metadata 34 | 35 | 36 | def get_real_source_ip(): 37 | """ 38 | Returns the real source IP address of the HTTP request. 39 | """ 40 | if 'X-Forwarded-For' in request.headers: 41 | return request.headers.getlist("X-Forwarded-For")[0].rpartition(' ')[-1] 42 | else: 43 | return request.environ['REMOTE_ADDR'] 44 | 45 | 46 | def get_request_ip_username(): 47 | """ 48 | Returns a unique key for rate limiting by extracting the username from the 49 | JSON request body, combining it with the remote address of the HTTP request 50 | and hashing it using SHA256. 51 | """ 52 | request_json = request.get_json(force=True) 53 | 54 | rlimiting_key = get_real_source_ip() 55 | 56 | if request_json is not None: 57 | rlimiting_key += request_json.get('username', 'None') 58 | 59 | return sha256(rlimiting_key.encode('utf-8')).hexdigest() 60 | 61 | 62 | def validate_username(username): 63 | """ 64 | Checks if the username is valid and does not contain prohibited characters. 65 | Returns True if the username is valid, otherwise False. 66 | 67 | Arguments 68 | ---------- 69 | username : string 70 | the username to check 71 | """ 72 | regex = '^[a-zA-Z][-_.@a-z0-9]{1,32}$' 73 | if not re.match(regex, username): 74 | return False 75 | else: 76 | return True 77 | 78 | 79 | def get_group_membership(username): 80 | """ 81 | Returns a list of groups the user is a member of to support Role-Based Access Control. 82 | The `id` command is used because it reports all (POSIX) groups that the user 83 | is a member of including external groups from Identity Management systems (AD, IdM, FreeIPA). 84 | 85 | Arguments 86 | ---------- 87 | username : string 88 | the username to get group membership for 89 | """ 90 | exe = find_executable('id') 91 | process = subprocess.run([exe, '-Gn', username], stdout=subprocess.PIPE) 92 | groups = [group.decode('utf-8') for group in process.stdout.split()] 93 | groups.remove(username) 94 | return groups 95 | -------------------------------------------------------------------------------- /beesly/version.py: -------------------------------------------------------------------------------- 1 | __app__ = 'beesly' 2 | __version__ = "0.2.1" 3 | __license__ = "GPLv3" 4 | -------------------------------------------------------------------------------- /beesly/views.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import time 3 | import traceback 4 | 5 | from flask import Flask, request, jsonify, escape 6 | from flask_limiter import Limiter 7 | from flask_limiter.util import get_remote_address 8 | from pam import pam 9 | from jose import jwt, JWTError 10 | from nacl.encoding import URLSafeBase64Encoder 11 | from nacl.hash import blake2b 12 | import nacl.utils 13 | import psutil 14 | 15 | from beesly._logging import structured_log 16 | from beesly.config import StatsdConfig 17 | from beesly.utils import get_ec2_metadata, get_request_ip_username, get_real_source_ip 18 | from beesly.utils import validate_username, get_group_membership 19 | 20 | 21 | app = Flask(__name__, static_folder=None, static_url_path=None) 22 | 23 | rlimiter = Limiter(key_func=get_remote_address, headers_enabled=True) 24 | 25 | statsd = StatsdConfig() 26 | 27 | 28 | @app.route("/", methods=["GET"]) 29 | @rlimiter.limit("10/second") 30 | def index(): 31 | """ 32 | Returns information about this microservice such as name, version, 33 | what endpoints are available and which HTTP methods they support. 34 | """ 35 | response_body = { 36 | "hostname": socket.gethostname(), 37 | "app": app.config['APP_NAME'], 38 | "version": app.config['APP_VERSION'], 39 | "routes": [] 40 | } 41 | 42 | for rule in app.url_map.iter_rules(): 43 | response_body['routes'].append({ 44 | 'endpoint': rule.rule, 45 | 'methods': sorted(rule.methods) 46 | }) 47 | 48 | return jsonify(response_body), 200 49 | 50 | 51 | @app.route("/service", methods=["GET"]) 52 | @rlimiter.limit("10/second") 53 | def service_info(): 54 | """ 55 | Returns information about this microservice such as name, version, 56 | and metadata about the server it is running on. 57 | """ 58 | 59 | total_memory_mb = "{} MB".format(psutil.virtual_memory().total / (1024 * 1024)) 60 | system_uptime = round((time.time() - psutil.boot_time()), 3) 61 | app_uptime = round((time.time() - psutil.Process().create_time()), 3) 62 | 63 | response_body = { 64 | 'app': { 65 | 'name': app.config['APP_NAME'], 66 | 'version': app.config['APP_VERSION'], 67 | 'uptime': app_uptime 68 | }, 69 | 'system': { 70 | "hostname": socket.gethostname(), 71 | 'processors': psutil.cpu_count(), 72 | 'memory': total_memory_mb, 73 | 'uptime': system_uptime, 74 | } 75 | } 76 | 77 | try: 78 | response_body["aws"] = get_ec2_metadata() 79 | except Exception: 80 | pass 81 | 82 | return jsonify(response_body), 200 83 | 84 | 85 | @app.route("/service/version", methods=["GET"]) 86 | @rlimiter.limit("10/second") 87 | def service_version(): 88 | """ 89 | Returns the name and version of this microservice. 90 | """ 91 | response_body = { 92 | 'app': app.config['APP_NAME'], 93 | 'version': app.config['APP_VERSION'], 94 | } 95 | 96 | return jsonify(response_body), 200 97 | 98 | 99 | @app.route("/service/health", methods=["GET"]) 100 | @rlimiter.limit("10/second") 101 | def service_health(): 102 | """ 103 | Health check endpoint for load balancers and monitoring systems. 104 | """ 105 | app_name = app.config['APP_NAME'] 106 | 107 | response_body = { 108 | app_name: "OK" 109 | } 110 | 111 | return jsonify(response_body), 200 112 | 113 | 114 | @app.route("/auth", methods=["POST"]) 115 | @rlimiter.limit("10/second", methods=["POST"], key_func=get_request_ip_username) 116 | def auth_endpoint(): 117 | """ 118 | Authenticates users using PAM. 119 | If authentication is successful, returns a list of groups the user is a member of. 120 | Returns a short-lived JSON Web Token if JWT_MASTER_KEY is set. 121 | """ 122 | if request.method == 'POST': 123 | request_json = request.get_json(force=True, cache=False) 124 | 125 | username = request_json.get('username', None) 126 | password = request_json.get('password', None) 127 | 128 | if username is None or password is None: 129 | return jsonify(message="No username or password provided"), 400 130 | 131 | sanitized_username = str(escape(username)) 132 | 133 | if not validate_username(sanitized_username): 134 | structured_log(level='warning', msg="Invalid username provided", user=f"'{sanitized_username}'") 135 | return jsonify(message="Invalid username provided"), 400 136 | 137 | pam_service = app.config['PAM_SERVICE'] 138 | 139 | with statsd.client.timer("pam_auth"): 140 | if pam().authenticate(sanitized_username, password, service=pam_service): 141 | authenticated = True 142 | auth_message = "Authentication successful" 143 | statsd.client.incr("auth_success") 144 | else: 145 | authenticated = False 146 | auth_message = "Authentication failed" 147 | statsd.client.incr("auth_failed") 148 | 149 | structured_log(level='info', msg=auth_message, user=f"'{sanitized_username}'") 150 | 151 | if authenticated: 152 | groups = get_group_membership(sanitized_username) 153 | 154 | token = None 155 | 156 | if app.config["JWT"]: 157 | issuer = app.config['APP_NAME'] 158 | issue_time = time.time() 159 | expiry_time = issue_time + app.config['JWT_VALIDITY_PERIOD'] 160 | subject = sanitized_username.encode('utf-8') 161 | 162 | # generate a unique salt for each JWT, needs to be encoded to include as a claim 163 | salt = URLSafeBase64Encoder.encode(nacl.utils.random(12)) 164 | 165 | claims = { 166 | "iss": issuer, 167 | "iat": issue_time, 168 | "exp": expiry_time, 169 | "sub": sanitized_username, 170 | "groups": groups, 171 | "x": salt.decode('utf-8') 172 | } 173 | 174 | master_key = app.config["JWT_MASTER_KEY"] 175 | algorithm = app.config["JWT_ALGORITHM"] 176 | 177 | # generate a unique secret key for each JWT 178 | secret_key = blake2b(b'', key=master_key, salt=salt, person=subject).decode('utf-8') 179 | 180 | token = jwt.encode(claims=claims, key=secret_key, algorithm=algorithm) 181 | statsd.client.incr("jwt_generated") 182 | 183 | return jsonify(message=f"{auth_message}", auth=True, groups=groups, jwt=token), 200 184 | else: 185 | return jsonify(message=f"{auth_message}", auth=False), 401 186 | 187 | 188 | @app.route("/renew", methods=["POST"]) 189 | @rlimiter.limit("1/second", methods=["POST"], key_func=get_request_ip_username) 190 | def renew_endpoint(): 191 | """ 192 | Renews a JWT that has not expired. 193 | """ 194 | if request.method == 'POST': 195 | 196 | if not app.config["JWT"]: 197 | return jsonify(message="JWT renewal is not enabled"), 501 198 | 199 | request_json = request.get_json(force=True, cache=False) 200 | 201 | token = request_json.get('jwt', None) 202 | username = request_json.get('username', None) 203 | 204 | if token is None or username is None: 205 | return jsonify(message="No JWT or username provided"), 400 206 | 207 | sanitized_username = str(escape(username)) 208 | 209 | if not validate_username(sanitized_username): 210 | structured_log(level='warning', msg="Invalid username provided", user=f"'{sanitized_username}'") 211 | return jsonify(message="Invalid username provided"), 400 212 | 213 | try: 214 | claims = jwt.get_unverified_claims(token) 215 | except JWTError: 216 | return jsonify(message="Invalid JWT"), 400 217 | 218 | try: 219 | subject = claims["sub"].encode('utf-8') 220 | salt = claims["x"].encode('utf-8') 221 | except KeyError: 222 | return jsonify(message="Invalid claims in JWT"), 401 223 | 224 | if sanitized_username != claims["sub"]: 225 | return jsonify(message="Invalid subject in JWT claim"), 400 226 | 227 | master_key = app.config["JWT_MASTER_KEY"] 228 | algorithm = app.config["JWT_ALGORITHM"] 229 | issuer = app.config['APP_NAME'] 230 | 231 | # jwt.decode() requires secret_key to be a str, so it must be decoded 232 | secret_key = blake2b(b'', key=master_key, salt=salt, person=subject).decode('utf-8') 233 | 234 | # exception is raised if token has expired, signature verification fails, etc. 235 | try: 236 | payload = jwt.decode(token=token, key=secret_key, algorithms=algorithm, issuer=issuer) 237 | except Exception as err: 238 | structured_log(level='info', msg="Failed to renew JWT", error=err) 239 | return jsonify(message="Failed to renew invalid JWT"), 401 240 | 241 | issue_time = time.time() 242 | expiry_time = issue_time + app.config['JWT_VALIDITY_PERIOD'] 243 | 244 | salt = URLSafeBase64Encoder.encode(nacl.utils.random(12)) 245 | 246 | payload['iat'] = issue_time 247 | payload['exp'] = expiry_time 248 | payload['x'] = salt.decode('utf-8') 249 | 250 | # compute a new secret key for the regenerated JWT 251 | new_secret_key = blake2b(b'', key=master_key, salt=salt, person=subject).decode('utf-8') 252 | new_token = jwt.encode(claims=payload, key=new_secret_key, algorithm=algorithm) 253 | 254 | statsd.client.incr("jwt_renewed") 255 | structured_log(level='info', msg="JWT successfully renewed", user="'{}'".format(sanitized_username)) 256 | return jsonify(message="JWT successfully renewed", jwt=new_token), 200 257 | 258 | 259 | @app.route("/verify", methods=["POST"]) 260 | @rlimiter.limit("500/second") 261 | def verify_endpoint(): 262 | """ 263 | Verifies if a JWT is valid. 264 | """ 265 | if request.method == 'POST': 266 | 267 | if not app.config["JWT"]: 268 | return jsonify(message="JWT verification is not enabled"), 501 269 | 270 | request_json = request.get_json(force=True, cache=False) 271 | 272 | token = request_json.get('jwt', None) 273 | 274 | if token is None: 275 | return jsonify(message="No JWT provided"), 400 276 | 277 | try: 278 | claims = jwt.get_unverified_claims(token) 279 | except: 280 | return jsonify(message="Invalid JWT"), 400 281 | 282 | master_key = app.config["JWT_MASTER_KEY"] 283 | algorithm = app.config["JWT_ALGORITHM"] 284 | issuer = app.config['APP_NAME'] 285 | 286 | try: 287 | subject = claims["sub"].encode('utf-8') 288 | salt = claims["x"].encode('utf-8') 289 | except KeyError: 290 | return jsonify(message="Invalid claims in JWT", valid=False), 401 291 | 292 | # jwt.decode() requires secret_key to be a str, so it must be decoded 293 | secret_key = blake2b(b'', key=master_key, salt=salt, person=subject).decode('utf-8') 294 | 295 | # exception is raised if token has expired, signature verification fails, etc. 296 | try: 297 | jwt.decode(token=token, key=secret_key, algorithms=algorithm, issuer=issuer) 298 | except Exception as err: 299 | structured_log(level='info', msg="Failed to verify JWT", error=err) 300 | return jsonify(message="Failed to verify JWT", valid=False), 401 301 | 302 | statsd.client.incr("jwt_verified") 303 | structured_log(level='info', msg="JWT successfully verified", user=f"'{subject}'") 304 | return jsonify(message="JWT successfully verified", valid=True), 200 305 | 306 | 307 | @app.after_request 308 | def after_request(resp): 309 | """ 310 | Adds HTTP Headers to the response 311 | 312 | Arguments 313 | ---------- 314 | resp : flask.Response object 315 | the Flask response object 316 | """ 317 | resp.headers['Cache-Control'] = 'no-cache' 318 | 319 | if app.config['DEV']: 320 | resp.headers['Access-Control-Allow-Origin'] = '*' 321 | resp.headers['Access-Control-Allow-Methods'] = 'GET, POST' 322 | resp.headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept' 323 | 324 | source_ip = get_real_source_ip() 325 | 326 | structured_log( 327 | level='info', 328 | msg="HTTP Request", 329 | method=request.method, 330 | uri=request.path, 331 | status=resp.status_code, 332 | src_ip=source_ip, 333 | protocol=request.environ['SERVER_PROTOCOL'], 334 | user_agent=request.environ.get('HTTP_USER_AGENT', '-') 335 | ) 336 | 337 | return resp 338 | 339 | 340 | @app.errorhandler(404) 341 | def http_404_handler(err): 342 | """ 343 | Catches any 404 errors and responds with a custom error message. 344 | """ 345 | return jsonify(error="The requested endpoint does not exist"), 404 346 | 347 | 348 | @app.errorhandler(429) 349 | def rate_limit_handler(err): 350 | """ 351 | Custom error message returned when rate limits are exceeded. 352 | """ 353 | return jsonify(error=f"Rate limit exceeded {err.description}"), 429 354 | 355 | 356 | @app.errorhandler(Exception) 357 | def exception_handler(err): 358 | """ 359 | Catches any exceptions raised by this microservice and responds with 360 | HTTP 500 and a custom error message. 361 | """ 362 | tb = traceback.format_exc() 363 | formatted_traceback = ' '.join(tb.splitlines()[1:]).strip() 364 | 365 | structured_log(level='error', msg="Encountered an exception", traceback=formatted_traceback) 366 | return jsonify(error="The application failed to handle the request"), 500 367 | -------------------------------------------------------------------------------- /examples/beesly.pam: -------------------------------------------------------------------------------- 1 | # custom PAM service for beesly 2 | # this will only authenticate directory users via SSSD and does not require superuser privileges 3 | 4 | auth required pam_env.so 5 | auth requisite pam_succeed_if.so uid > 1000 quiet 6 | auth sufficient pam_sss.so quiet 7 | auth required pam_deny.so 8 | -------------------------------------------------------------------------------- /examples/beesly.service: -------------------------------------------------------------------------------- 1 | # example systemd unit file for beesly 2 | 3 | [Unit] 4 | Description=beesly 5 | Documentation=https://github.com/bincyber/beesly 6 | After=network.target 7 | 8 | [Service] 9 | User=daemon 10 | Group=daemon 11 | WorkingDirectory=/opt/beesly 12 | PIDFile=/var/run/gunicorn/gunicorn.pid 13 | EnvironmentFile=-/etc/sysconfig/beesly 14 | ExecStart=/usr/bin/gunicorn -c gconfig.py -w 4 -b '0.0.0.0:8000' serve:app 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /examples/healthcheck.py: -------------------------------------------------------------------------------- 1 | # healthcheck script for Docker 2 | 3 | import requests 4 | import sys 5 | 6 | url = 'http://127.0.0.1:8000/service/health' 7 | 8 | try: 9 | resp = requests.get(url, timeout=1.0) 10 | except: 11 | sys.exit(1) 12 | 13 | if resp.status_code != 200: 14 | sys.exit(1) 15 | -------------------------------------------------------------------------------- /examples/logstash.conf: -------------------------------------------------------------------------------- 1 | # logstash.conf 2 | # sample config for parsing beesly logs 3 | 4 | input { 5 | stdin { } 6 | } 7 | 8 | filter { 9 | 10 | mutate { 11 | strip => "message" 12 | } 13 | 14 | kv { 15 | field_split => "," 16 | value_split => "=" 17 | trimkey => "\s" 18 | } 19 | 20 | date { 21 | match => ["timestamp", "yyyy-MM-dd HH:mm:ss.SSS"] 22 | target => "@timestamp" 23 | remove_field => ["timestamp", "message"] 24 | } 25 | } 26 | 27 | output { 28 | stdout { 29 | codec => rubydebug 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /examples/pam_duo.conf: -------------------------------------------------------------------------------- 1 | ; Duo Unix config 2 | ; https://duo.com/docs/duounix 3 | [duo] 4 | ikey= 5 | skey= 6 | host= 7 | failmode=secure 8 | autopush=yes 9 | prompts=1 10 | https_timeout=3 -------------------------------------------------------------------------------- /examples/telegraf.conf: -------------------------------------------------------------------------------- 1 | # configure telegraf as a statsd collector sending to influxdb 2 | 3 | [[inputs.statsd]] 4 | service_address = "127.0.0.1:8125" 5 | delete_gauges = true 6 | delete_counters = true 7 | delete_sets = true 8 | delete_timings = true 9 | percentiles = [90] 10 | metric_separator = "_" 11 | 12 | parse_data_dog_tags = false 13 | 14 | allowed_pending_messages = 10000 15 | 16 | percentile_limit = 1000 17 | 18 | 19 | [[outputs.influxdb]] 20 | urls = ["http://localhost:8086"] 21 | database = "telegraf" 22 | retention_policy = "" 23 | write_consistency = "any" 24 | timeout = "5s" 25 | -------------------------------------------------------------------------------- /gconfig.py: -------------------------------------------------------------------------------- 1 | # gunicorn config file 2 | 3 | import logging 4 | import logging.config 5 | import os 6 | import os.path 7 | import sys 8 | 9 | app_path = os.path.dirname(os.path.abspath(__file__)) 10 | sys.path.insert(0, app_path) 11 | 12 | from beesly.version import __app__ 13 | 14 | app_logger = f'{__app__}.logger' 15 | 16 | LOGGING = { 17 | 'version': 1, 18 | 'disable_existing_loggers': True, 19 | 'formatters': { 20 | 'key_value_format': { 21 | 'format': '{"timestamp":"%(asctime)s.%(msecs).03d","loglevel":"%(levelname)s","app":"%(app)s","pid":"%(process)d","message":"%(message)s"}', 22 | 'datefmt': '%Y-%m-%d %H:%M:%S' 23 | }, 24 | }, 25 | 'filters': { 26 | 'customFilter': { 27 | '()': 'beesly._logging.CustomLogFilter' 28 | } 29 | }, 30 | 'handlers': { 31 | 'console': { 32 | 'level': 'INFO', 33 | 'class': 'logging.StreamHandler', 34 | 'formatter': 'key_value_format', 35 | 'stream': 'ext://sys.stdout' 36 | }, 37 | 'null': { 38 | 'class': 'logging.NullHandler' 39 | } 40 | }, 41 | 'loggers': { 42 | '': { 43 | 'handlers': ['null'] 44 | }, 45 | app_logger: { 46 | 'handlers': ['console'], 47 | 'level': 'INFO', 48 | 'propagate': False, 49 | 'filters': ['customFilter'] 50 | }, 51 | 'gunicorn.error': { 52 | 'handlers': ['console'], 53 | 'level': 'INFO', 54 | 'propagate': False, 55 | 'filters': ['customFilter'] 56 | }, 57 | }, 58 | } 59 | 60 | logging.config.dictConfig(LOGGING) 61 | 62 | def on_starting(server): 63 | 64 | # remove gunicorn's stream handler to prevent duplicate logs 65 | gunicornLogger = logging.getLogger('gunicorn.error') 66 | gunicornLogger.handlers.pop(1) 67 | return 68 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2018.1.18 --hash=sha256:14131608ad2fd56836d33a71ee60fa1c82bc9d2c8d98b7bdbc631fe1b3cd1296 --hash=sha256:edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d 2 | cffi==1.11.4 --hash=sha256:5d0d7023b72794ea847725680e2156d1d01bc698a9007fccce46d03c904fe093 --hash=sha256:86903c0afab4a3390170aca61f753f5adad8ffff947030719ee44dedc5b68403 --hash=sha256:7d35678a54da0d3f1bc30e3a58a232043753d57c691875b5a75e4e062793bc9a --hash=sha256:824cac33906be5c8e976f0d950924d88ec058989ef9cd2f77f5cd53cec417635 --hash=sha256:6ca52651f6bd4b8647cb7dee15c82619de3e13490f8e0bc0620830a2245b51d1 --hash=sha256:a183959a4b1e01d6172aeed356e2523ec8682596075aa6cf0003fe08da959a49 --hash=sha256:9532c5bc0108bd0fe43c0eb3faa2ef98a2db60fc0d4019f106b88d46803dd663 --hash=sha256:96652215ef328262b5f1d5647632bd342ac6b31dfbc495b21f1ab27cb06d621d --hash=sha256:6c99d19225e3135f6190a3bfce2a614cae8eaa5dcaf9e0705d4ccb79a3959a3f --hash=sha256:12cbf4c04c1ad07124bfc9e928c01e282feac9ec7dd72a18042d4fc56456289a --hash=sha256:69c37089ccf10692361c8d14dbf4138b00b46741ffe9628755054499f06ed548 --hash=sha256:b8d1454ef627098dc76ccfd6211a08065e6f84efe3754d8d112049fec3768e71 --hash=sha256:cd13f347235410c592f6e36395ee1c136a64b66534f10173bfa4df1dc88f47d0 --hash=sha256:0640f12f04f257c4467075a804a4920a5d07ef91e11c525fc65d715c08231c81 --hash=sha256:89a8d05b96bdeca8fdc89c5fa9469a357d30f6c066262e92c0c8d2e4d3c53cae --hash=sha256:a67c430a9bde73ae85b0c885fcf41b556760e42ea74c16dc70431a349989b448 --hash=sha256:7a831170b621e98f45ed1d5758325be19619a593924127a0a47af9a72a117319 --hash=sha256:796d0379102e6da5215acfcd20e8e69cca9d97309215b4ce088fe175b1c2f586 --hash=sha256:0fe3b3d571543a4065059d1d3d6d39f4ca6da0f2207ad13547094522e32ead46 --hash=sha256:678135090c311780382b1dd3f828f715583ea8a69687ed053c047d3cec6625d6 --hash=sha256:f4992cd7b4c867f453d44c213ee29e8fd484cf81cfece4b6e836d0982b6fa1cf --hash=sha256:6d191fb20138fe1948727b20e7b96582b7b7e676135eabf72d910e10bf7bfa65 --hash=sha256:ec208ca16e57904dd7f4c7568665f80b1f7eb7e3214be014560c28def219060d --hash=sha256:b3653644d6411bf4bd64c1f2ca3cb1b093f98c68439ade5cef328609bbfabf8c --hash=sha256:f4719d0bafc5f0a67b2ec432086d40f653840698d41fa6e9afa679403dea9d78 --hash=sha256:87f837459c3c78d75cb4f5aadf08a7104db15e8c7618a5c732e60f252279c7a6 --hash=sha256:df9083a992b17a28cd4251a3f5c879e0198bb26c9e808c4647e0a18739f1d11d 3 | chardet==3.0.4 --hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691 --hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae 4 | click==6.7 --hash=sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d --hash=sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b 5 | ecdsa==0.13 --hash=sha256:40d002cf360d0e035cf2cb985e1308d41aaa087cbfc135b2dc2d844296ea546c --hash=sha256:64cf1ee26d1cde3c73c6d7d107f835fed7c6a2904aef9eac223d57ad800c43fa 6 | flask==0.12.2 --hash=sha256:0749df235e3ff61ac108f69ac178c9770caeaccad2509cb762ce1f65570a8856 --hash=sha256:49f44461237b69ecd901cc7ce66feea0319b9158743dd27a2899962ab214dac1 7 | flask-limiter==1.0.1 --hash=sha256:473aa5bc97310406aa8c12ab3dc080697bcfa8cd21a6d0aba30916911bbc673c --hash=sha256:8cce98dcf25bf2ddbb824c2b503b4fc8e1a139154240fd2c60d9306bad8a0db8 8 | future==0.16.0 --hash=sha256:e39ced1ab767b5936646cedba8bcce582398233d6a627067d4c6a454c90cfedb 9 | gunicorn==19.7.1 --hash=sha256:75af03c99389535f218cc596c7de74df4763803f7b63eb09d77e92b3956b36c6 --hash=sha256:eee1169f0ca667be05db3351a0960765620dad53f53434262ff8901b68a1b622 10 | idna==2.6 --hash=sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4 --hash=sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f 11 | itsdangerous==0.24 --hash=sha256:cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519 12 | jinja2==2.10 --hash=sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd --hash=sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4 13 | limits==1.3 --hash=sha256:9df578f4161017d79f5188609f1d65f6b639f8aad2914c3960c9252e56a0ff95 --hash=sha256:a017b8d9e9da6761f4574642149c337f8f540d4edfe573fb91ad2c4001a2bc76 14 | markupsafe==1.0 --hash=sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665 15 | psutil==5.4.3 --hash=sha256:82a06785db8eeb637b349006cc28a92e40cd190fefae9875246d18d0de7ccac8 --hash=sha256:4152ae231709e3e8b80e26b6da20dc965a1a589959c48af1ed024eca6473f60d --hash=sha256:230eeb3aeb077814f3a2cd036ddb6e0f571960d327298cc914c02385c3e02a63 --hash=sha256:a3286556d4d2f341108db65d8e20d0cd3fcb9a91741cb5eb496832d7daf2a97c --hash=sha256:94d4e63189f2593960e73acaaf96be235dd8a455fe2bcb37d8ad6f0e87f61556 --hash=sha256:c91eee73eea00df5e62c741b380b7e5b6fdd553891bee5669817a3a38d036f13 --hash=sha256:779ec7e7621758ca11a8d99a1064996454b3570154277cc21342a01148a49c28 --hash=sha256:8a15d773203a1277e57b1d11a7ccdf70804744ef4a9518a87ab8436995c31a4b --hash=sha256:e2467e9312c2fa191687b89ff4bc2ad8843be4af6fb4dc95a7cc5f7d7a327b18 16 | pycparser==2.18 --hash=sha256:99a8ca03e29851d96616ad0404b4aad7d9ee16f25c9f9708a11faf2810f7b226 17 | pycryptodome==3.4.11 --hash=sha256:444053c24b336daa7f84bf872df7a6b9950697559926aea5775f5aa757b67a3e --hash=sha256:29d3a581cfcc68ca66f7c5d4830944556ddca9e2747e214bde8028972bb1901f --hash=sha256:7bda0f395fd8ef6b1fa7cded00d5cca72005ff158fc30703e1337fe32fbf2102 --hash=sha256:bdd8581dae617b9fbe6e8dbdd96590c02fc33eebc411b0273fd62b4d468d0bb7 --hash=sha256:89a0a233ed3a216ae117323d8fb0da38f1ca344dc1021559e38416cce23592a0 --hash=sha256:5d390f8c6562173b913f0359cd87d5bc2e3245cc88ec4edf59d8c52107f24d29 --hash=sha256:44ad06faf5ee589c1127a18610695a65815ed5db724b58687294ee907ec546ba --hash=sha256:c8922f187fcac3b2afa6d200ef00cd4e69719799b54b4f2f2741b2e4c96ccd61 --hash=sha256:2aeded7095564b8a068402531c7407517cd714a0fe9872f76c69bd4400b07613 --hash=sha256:c88e9a04d3ed89689bc76ce0a90b018cdd4edb94ab99ce31264f2e15bad9d752 --hash=sha256:64a0cccf590546e7de602378f21482cb06cd1a1995cdfb121b123394c48b05c3 --hash=sha256:21fd74571b3579cbf36792916ad76a4ecf91581a112bb78ec48e20389dcdb912 --hash=sha256:11ca73effcc15596b62d601a6b3c48ea607fb5219546d406312520d63c446bf5 --hash=sha256:ce3110812d8823c3182fc7f841031387ee6fda27d8696da8949a99b026048e7e --hash=sha256:29e8d3770bc0a0366093eb693ca40c5be56ed5a7ca214af5156a0b2e23053549 --hash=sha256:d9ae42a88c716a7ca9a53966562968921883211b6390eeab22e5b735dbc49f49 --hash=sha256:d3136fe71a37882ca457bea5917f1db5431f18f1bd91b0f7c4cec57ac4d57016 --hash=sha256:0ebbcdbd21b5d8569c5b44137e2071d28c14a7460afdd8b1f6398a1548c4773a --hash=sha256:5ce44a755be8aef369d1057a38bff01501db0b89ba38c3292578f42ed401f355 --hash=sha256:1d3065b741ec8d269327e4487eacd187e0bf909e7a73d0a959da1a0918b16fa9 --hash=sha256:cb81302f3295a14722f6c26c44ab4023d66f8394db4c316ccf5658dbada2ac91 --hash=sha256:4fd2584719895ff041cf48766014ef6b5a170f5caf0e2dc735837b182e78d081 --hash=sha256:c5dd29e9f1b733e74311bf95d0e544e91bd1d14bc0366e8f443562d8d9920b7d 18 | pymemcache==1.4.4 --hash=sha256:c92e591e148dece0df4e4264628c5fc629a1efab45347df0e1f7424f61b10101 --hash=sha256:822464a69449cb4a0a0025a5ed093c0848b445e2dacd7f57879d57805119a35e 19 | pynacl==1.2.1 --hash=sha256:0bfa0d94d2be6874e40f896e0a67e290749151e7de767c5aefbad1121cad7512 --hash=sha256:1d33e775fab3f383167afb20b9927aaf4961b953d76eeb271a5703a6d756b65b --hash=sha256:eb2acabbd487a46b38540a819ef67e477a674481f84a82a7ba2234b9ba46f752 --hash=sha256:14339dc233e7a9dda80a3800e64e7ff89d0878ba23360eea24f1af1b13772cac --hash=sha256:cf6877124ae6a0698404e169b3ba534542cfbc43f939d46b927d956daf0a373a --hash=sha256:eeee629828d0eb4f6d98ac41e9a3a6461d114d1d0aa111a8931c049359298da0 --hash=sha256:d0eb5b2795b7ee2cbcfcadacbe95a13afbda048a262bd369da9904fecb568975 --hash=sha256:11aa4e141b2456ce5cecc19c130e970793fa3a2c2e6fbb8ad65b28f35aa9e6b6 --hash=sha256:8ac1167195b32a8755de06efd5b2d2fe76fc864517dab66aaf65662cc59e1988 --hash=sha256:d795f506bcc9463efb5ebb0f65ed77921dcc9e0a50499dedd89f208445de9ecb --hash=sha256:be71cd5fce04061e1f3d39597f93619c80cdd3558a6c9ba99a546f144a8d8101 --hash=sha256:2a42b2399d0428619e58dac7734838102d35f6dcdee149e0088823629bf99fbb --hash=sha256:73a5a96fb5fbf2215beee2353a128d382dbca83f5341f0d3c750877a236569ef --hash=sha256:d8aaf7e5d6b0e0ef7d6dbf7abeb75085713d0100b4eb1a4e4e857de76d77ac45 --hash=sha256:2dce05ac8b3c37b9e2f65eab56c544885607394753e9613fd159d5e2045c2d98 --hash=sha256:f5ce9e26d25eb0b2d96f3ef0ad70e1d3ae89b5d60255c462252a3e456a48c053 --hash=sha256:6453b0dae593163ffc6db6f9c9c1597d35c650598e2c39c0590d1757207a1ac2 --hash=sha256:fabf73d5d0286f9e078774f3435601d2735c94ce9e514ac4fb945701edead7e4 --hash=sha256:13bdc1fe084ff9ac7653ae5a924cae03bf4bb07c6667c9eb5b6eb3c570220776 --hash=sha256:8f505f42f659012794414fa57c498404e64db78f1d98dfd40e318c569f3c783b --hash=sha256:04e30e5bdeeb2d5b34107f28cd2f5bbfdc6c616f3be88fc6f53582ff1669eeca --hash=sha256:8abb4ef79161a5f58848b30ab6fb98d8c466da21fdd65558ce1d7afc02c70b5f --hash=sha256:e0d38fa0a75f65f556fb912f2c6790d1fa29b7dd27a1d9cc5591b281321eaaa9 20 | python-jose==2.0.2 --hash=sha256:3b35cdb0e55a88581ff6d3f12de753aa459e940b50fe7ca5aa25149bc94cb37b --hash=sha256:391f860dbe274223d73dd87de25e4117bf09e8fe5f93a417663b1f2d7b591165 21 | python-pam==1.8.2 --hash=sha256:26efe4e79b869b10f97cd8c4a6bbb04a4e54d41186364e975b4108c9c071812c 22 | redis==2.10.6 --hash=sha256:8a1900a9f2a0a44ecf6e8b5eb3e967a9909dfed219ad66df094f27f7d6f330fb --hash=sha256:a22ca993cea2962dbb588f9f30d0015ac4afcc45bee27d3978c0dbe9e97c6c0f 23 | requests==2.18.4 --hash=sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b --hash=sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e 24 | six==1.11.0 --hash=sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb --hash=sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9 25 | statsd==3.2.2 --hash=sha256:50e0e7b34e5c01e78e270f17ccbd6bcc334f1a81ac5cb0b19050f7dd24d72c3e --hash=sha256:84f2427ef7b8ffab28cdb717933f6889d248d710eee32b5eb79e3fdac0e374dd 26 | urllib3==1.22 --hash=sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b --hash=sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f 27 | werkzeug==0.14.1 --hash=sha256:d5da73735293558eb1651ee2fddc4d0dedcfa06538b8813a2e20011583c9e49b --hash=sha256:c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c 28 | -------------------------------------------------------------------------------- /serve.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | 3 | from beesly import create_app 4 | 5 | app = create_app() 6 | 7 | if __name__ == '__main__': 8 | app.run(host='0.0.0.0', port=8000, debug=False, threaded=True) 9 | -------------------------------------------------------------------------------- /swagger.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | swagger: '2.0' 3 | info: 4 | title: beesly 5 | description: a PAM authentication microservice 6 | version: "0.2.0" 7 | license: 8 | name: GPLv3 9 | url: "https://www.gnu.org/licenses/gpl.html" 10 | externalDocs: 11 | description: "Github - beesly" 12 | url: "https://github.com/bincyber/beesly" 13 | host: "localhost:8000" 14 | schemes: 15 | - http 16 | - https 17 | produces: 18 | - application/json 19 | tags: 20 | - name: Service 21 | description: "service endpoints" 22 | - name: Auth 23 | description: "authentication endpoint" 24 | - name: JWT 25 | description: "endpoints for JSON Web Token operations" 26 | paths: 27 | /: 28 | get: 29 | description: | 30 | Returns info about this microservice such as name, version, what endpoints are available 31 | and which HTTP methods they support. 32 | tags: 33 | - Service 34 | responses: 35 | 200: 36 | description: successful operation 37 | 429: 38 | description: Rate limit of 10/second exceeded 39 | schema: 40 | $ref: '#/definitions/ErrorResponse' 41 | /service: 42 | get: 43 | description: | 44 | Returns info about this microservice such as name, version, and metadata about the system it is running on. 45 | tags: 46 | - Service 47 | responses: 48 | 200: 49 | description: successful operation 50 | 429: 51 | description: Rate limit of 10/second exceeded 52 | schema: 53 | $ref: '#/definitions/ErrorResponse' 54 | /service/version: 55 | get: 56 | description: "Returns the name and version of this microservice." 57 | tags: 58 | - Service 59 | responses: 60 | 200: 61 | description: successful operation 62 | schema: 63 | $ref: '#/definitions/VersionResponse' 64 | 429: 65 | description: Rate limit of 10/second exceeded 66 | schema: 67 | $ref: '#/definitions/ErrorResponse' 68 | /service/health: 69 | get: 70 | description: "Health check endpoint for load balancers and monitoring systems." 71 | tags: 72 | - Service 73 | responses: 74 | 200: 75 | description: service is healthy 76 | schema: 77 | $ref: '#/definitions/HealthResponse' 78 | 429: 79 | description: Rate limit of 10/second exceeded 80 | schema: 81 | $ref: '#/definitions/ErrorResponse' 82 | /auth: 83 | post: 84 | description: "Authenticates a user using PAM." 85 | consumes: 86 | - application/json 87 | tags: 88 | - Auth 89 | - JWT 90 | parameters: 91 | - in: body 92 | name: body 93 | description: the credentials for the user being authenticated 94 | required: true 95 | schema: 96 | $ref: '#/definitions/Credentials' 97 | responses: 98 | 200: 99 | description: user authentication successful 100 | schema: 101 | $ref: '#/definitions/AuthResponse' 102 | 400: 103 | description: | 104 | One of the following: 105 | - No username or password provided 106 | - Invalid username provided 107 | schema: 108 | $ref: '#/definitions/MessageResponse' 109 | 401: 110 | description: user authentication failed 111 | schema: 112 | $ref: '#/definitions/MessageResponse' 113 | 429: 114 | description: Rate limit of 10/second exceeded 115 | schema: 116 | $ref: '#/definitions/ErrorResponse' 117 | /renew: 118 | post: 119 | description: "Renews a JWT that has not expired." 120 | consumes: 121 | - application/json 122 | tags: 123 | - JWT 124 | parameters: 125 | - in: body 126 | name: body 127 | description: the valid token and the username it was issued for 128 | required: true 129 | schema: 130 | $ref: '#/definitions/Renewal' 131 | responses: 132 | 200: 133 | description: JWT successfully renewed 134 | schema: 135 | $ref: '#/definitions/RenewResponse' 136 | 400: 137 | description: | 138 | One of the following: 139 | 140 | * No JWT or username provided 141 | * Invalid username provided 142 | * Invalid JWT 143 | * Invalid subject in JWT claim 144 | schema: 145 | $ref: '#/definitions/MessageResponse' 146 | 401: 147 | description: | 148 | One of the following: 149 | 150 | * Invalid claims in the JWT 151 | * Failed to renew invalid JWT 152 | schema: 153 | $ref: '#/definitions/MessageResponse' 154 | 429: 155 | description: Rate limit of 1/second exceeded 156 | schema: 157 | $ref: '#/definitions/ErrorResponse' 158 | 501: 159 | description: JWT renewal is not enabled 160 | schema: 161 | $ref: '#/definitions/MessageResponse' 162 | /verify: 163 | post: 164 | description: "Verifies if a JWT is valid." 165 | consumes: 166 | - application/json 167 | tags: 168 | - JWT 169 | parameters: 170 | - in: body 171 | name: body 172 | description: the token to be verified 173 | required: true 174 | schema: 175 | $ref: '#/definitions/Verification' 176 | responses: 177 | 200: 178 | description: JWT successfully verified 179 | schema: 180 | $ref: '#/definitions/VerifyResponse' 181 | 400: 182 | description: | 183 | One of the following: 184 | 185 | * No JWT provided 186 | * Invalid JWT 187 | schema: 188 | $ref: '#/definitions/MessageResponse' 189 | 401: 190 | description: | 191 | One of the following: 192 | 193 | * Invalid claims in the JWT 194 | * Failed to verify JWT 195 | schema: 196 | $ref: '#/definitions/MessageResponse' 197 | 429: 198 | description: Rate limit of 500/second exceeded 199 | schema: 200 | $ref: '#/definitions/ErrorResponse' 201 | 501: 202 | description: JWT verification is not enabled 203 | schema: 204 | $ref: '#/definitions/MessageResponse' 205 | definitions: 206 | Credentials: 207 | type: object 208 | properties: 209 | username: 210 | type: string 211 | password: 212 | type: string 213 | Renewal: 214 | type: object 215 | properties: 216 | username: 217 | type: string 218 | jwt: 219 | type: string 220 | Verification: 221 | type: object 222 | properties: 223 | jwt: 224 | type: string 225 | MessageResponse: 226 | type: object 227 | properties: 228 | message: 229 | type: string 230 | ErrorResponse: 231 | type: object 232 | properties: 233 | error: 234 | type: string 235 | AuthResponse: 236 | type: object 237 | properties: 238 | message: 239 | type: string 240 | auth: 241 | type: boolean 242 | description: "True if successful authentication, otherwise False" 243 | groups: 244 | type: array 245 | items: 246 | type: string 247 | description: "a list of groups the user is a member of" 248 | jwt: 249 | type: string 250 | description: "the JWT generated for the user, only returned if JWT_MASTER_KEY is set" 251 | RenewResponse: 252 | type: object 253 | properties: 254 | message: 255 | type: string 256 | jwt: 257 | type: string 258 | description: "the JWT regenerated for the user" 259 | VerifyResponse: 260 | type: object 261 | properties: 262 | message: 263 | type: string 264 | valid: 265 | type: boolean 266 | description: "True if the JWT is valid, otherwise False" 267 | VersionResponse: 268 | type: object 269 | properties: 270 | app: 271 | type: string 272 | version: 273 | type: string 274 | example: 275 | app: "beesly" 276 | version: "0.1.0" 277 | HealthResponse: 278 | type: object 279 | properties: 280 | beesly: 281 | type: string 282 | example: 283 | beesly: "OK" 284 | --------------------------------------------------------------------------------