Compare commits
2
Commits
4445aa08c7
...
v1.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8caf2bddbc
|
||
|
|
bcd0b10a2d
|
No files matched your search
@@ -9,6 +9,7 @@ A lightweight user management system for LDAP, implemented using Flask. This app
|
|||||||
- **User Unregistration**: Users can remove themselves from the LDAP system.
|
- **User Unregistration**: Users can remove themselves from the LDAP system.
|
||||||
- **Captcha Protection**: Uses a custom captcha mechanism to mitigate bot registrations.
|
- **Captcha Protection**: Uses a custom captcha mechanism to mitigate bot registrations.
|
||||||
- **LDAP Integration**: Directly interacts with LDAP for all credential and user management tasks.
|
- **LDAP Integration**: Directly interacts with LDAP for all credential and user management tasks.
|
||||||
|
- **Rate limiting** (new): Setting rate limiting for user registration.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
@@ -37,6 +38,8 @@ A lightweight user management system for LDAP, implemented using Flask. This app
|
|||||||
- `LDAPPASS`: Admin password for LDAP operations.
|
- `LDAPPASS`: Admin password for LDAP operations.
|
||||||
- `USERBASE`: The base DN for users.
|
- `USERBASE`: The base DN for users.
|
||||||
- `CAPTCHA_PATH`: Path where captcha images are stored.
|
- `CAPTCHA_PATH`: Path where captcha images are stored.
|
||||||
|
- `PERIOD`: Time period after which the rate limiting counter resets
|
||||||
|
- `LIMIT`: Number of allowed user registrations in the given time PERIOD
|
||||||
|
|
||||||
4. **Setup Captcha script**:
|
4. **Setup Captcha script**:
|
||||||
Ensure the `captcha.sh` script is available in `/usr/local/bin/` and is executable.
|
Ensure the `captcha.sh` script is available in `/usr/local/bin/` and is executable.
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
from flask import render_template, request, redirect
|
from flask import render_template, request, redirect
|
||||||
from luser import app
|
from luser import app
|
||||||
from luser.models import LUSER
|
from luser.models import LUSER
|
||||||
|
from luser.models import ratelimit
|
||||||
from passlib.hash import ldap_salted_sha1,sha512_crypt
|
from passlib.hash import ldap_salted_sha1,sha512_crypt
|
||||||
import subprocess
|
import subprocess
|
||||||
import random
|
import random
|
||||||
@@ -88,7 +89,7 @@ def unregister():
|
|||||||
@app.route('/account/register/', methods=['POST', 'GET'])
|
@app.route('/account/register/', methods=['POST', 'GET'])
|
||||||
def register():
|
def register():
|
||||||
rl = ratelimit(PERIOD, LIMIT, "/var/luser/luser/.ratelimit")
|
rl = ratelimit(PERIOD, LIMIT, "/var/luser/luser/.ratelimit")
|
||||||
if rl.check(1):
|
if rl.check(1) == False:
|
||||||
return 'Error: rate limit exceeded, please come again in ' + PERIOD
|
return 'Error: rate limit exceeded, please come again in ' + PERIOD
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
captcha_solution = str(random.randint(0,999999))
|
captcha_solution = str(random.randint(0,999999))
|
||||||
|
|||||||
Reference in new issue
Block a user