Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 2fa branch into dev #255

Merged
merged 80 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
f15bba0
Refs #253 Updated requirements for pyotp
doumdi Sep 5, 2024
8f95e7a
Refs #253, Added 2fa columns to t_users
doumdi Sep 5, 2024
a55e535
Refs #253, added new columns to ignored fields.
doumdi Sep 5, 2024
8764879
Refs #253, starting 2FA API.
doumdi Sep 9, 2024
cfddb38
Refs #253, starting 2FA API. logout user when 2fa fails.
doumdi Sep 10, 2024
7009500
Refs #253 Updated base implementation with exceptions.
doumdi Sep 16, 2024
73eb372
Refs #253 Updated base implementation with exceptions.
doumdi Sep 16, 2024
af1cb32
Refs #253 First tests with login views and 2fa.
doumdi Sep 16, 2024
c22049b
Refs #253 Working login flow with otp enabled.
doumdi Sep 17, 2024
b6c8ba5
Refs #253 Sending JSON output when logged in.
doumdi Sep 17, 2024
c0c9b6a
Refs #253, testing Qt app with webchannel.
doumdi Sep 19, 2024
17ae671
Refs #253, working Qt with webchannel.
doumdi Sep 19, 2024
5a3e837
Refs #253, implementing change password, work in progress
doumdi Sep 23, 2024
125084a
Refs #253, implementing change password, work in progress
doumdi Sep 23, 2024
1070e6c
Refs #253, updating requirements.
doumdi Sep 25, 2024
cdb084f
Refs #253, fixing tests for vscode.
doumdi Sep 25, 2024
21e2d8d
Refs #253. Updated login view visuals.
SBriere Sep 25, 2024
feafedc
Refs #253, cleaning up login procedure using API, now able to log if …
doumdi Sep 25, 2024
ef3d23a
Refs #253, merging changes
doumdi Sep 25, 2024
af97f4c
Refs #253. Conditional use of QWebChannel in login (don't use if not …
SBriere Sep 26, 2024
15feecc
Refs #253, Setting up setup 2FA api.
doumdi Sep 26, 2024
ff7c01d
Refs #253, Working Setup 2FA api.
doumdi Sep 26, 2024
bb35762
Refs #253. Login view UI adjustments
SBriere Sep 26, 2024
94a4e8a
Merge branch '2fa-dev' of https://github.com/introlab/opentera into 2…
SBriere Sep 26, 2024
8829f7e
Refs #253. Removed WWW-Authenticate from headers when using basic aut…
SBriere Sep 26, 2024
e78bd53
Refs #253. Updated translations
SBriere Sep 27, 2024
72afb43
Refs #253, Maximum 5 2FA attempts in an hour.
doumdi Sep 30, 2024
2dc69a5
Refs #253, Maximum 5 2FA attempts in an hour. Simplified and fixed lo…
doumdi Sep 30, 2024
3b93a56
Refs #253, Maximum 5 2FA attempts in an hour. Simplified and fixed lo…
doumdi Sep 30, 2024
b6be74b
Refs #253, Maximum 5 2FA attempts in an hour. Simplified and fixed lo…
doumdi Sep 30, 2024
93a0b6c
Refs #253. Added reason for redirect and work on UI to setup 2FA
SBriere Sep 30, 2024
949eec5
Merge branch '2fa-dev' of https://github.com/introlab/opentera into 2…
SBriere Sep 30, 2024
1cc9a05
Refs #253. Disabled 2fa in progress Qt signal
SBriere Sep 30, 2024
88b7ca6
Refs #253, add site_2fa_required column.
doumdi Sep 30, 2024
d9ce750
Refs #253. Revised 2FA setup screen and flow.
SBriere Sep 30, 2024
9eae718
Merge branch '2fa-dev' of https://github.com/introlab/opentera into 2…
SBriere Sep 30, 2024
f35a4bc
Refs #253, display 2FA for site.
doumdi Sep 30, 2024
863b861
Refs #253, Enable all users 2FA is a site has 2fa required.
doumdi Sep 30, 2024
4a6bbc6
Refs #253, enable 2FA for users in sites and related user groups.
doumdi Oct 1, 2024
d26c140
Refs #253, enable 2FA for users in sites and related user groups.
doumdi Oct 1, 2024
f433dae
Refs #253. Updated 2FA login screen, changed session length to 5 minu…
SBriere Oct 1, 2024
2862bd5
Merge branch '2fa-dev' of https://github.com/introlab/opentera into 2…
SBriere Oct 1, 2024
a629124
Refs #253. Updated translations.
SBriere Oct 1, 2024
2098597
Refs #253, Avoid users to remove otp_enabled if secret is set.
doumdi Oct 2, 2024
5dfa187
Refs #253. Updated user form
SBriere Oct 2, 2024
8fac52b
Refs #253. Protected endpoints from HTTP basic auth when 2FA enabled
SBriere Oct 3, 2024
ef27bcc
Refs #253. Prevented User API endpoint access if user must change its…
SBriere Oct 3, 2024
3b36b6d
Refs #253, More robust checks for 2fa update/insert on models.
doumdi Oct 3, 2024
b89a28f
Refs #253, Fix test_UserLogin2FA.
doumdi Oct 3, 2024
d5b3048
Refs #253. Updated API endpoints documentation
SBriere Oct 3, 2024
fa528a7
Refs #253, Added tests for UserLoginSetup2FA API.
doumdi Oct 3, 2024
f725cf1
Merge branch '2fa-dev' of github.com:introlab/opentera into 2fa-dev
doumdi Oct 3, 2024
b6d4d61
Refs #253, Added tests for 2FA configuration on login.
doumdi Oct 4, 2024
b4f4faf
Refs #253. Completed password change view. Added password strength re…
SBriere Oct 4, 2024
f8c9a3f
Merge branch '2fa-dev' of https://github.com/introlab/opentera into 2…
SBriere Oct 4, 2024
317d66c
Refs #253, Reimplementation if after_update, after_insert events not …
doumdi Oct 4, 2024
b7a8f8d
Refs #253, Reimplementation if after_update, after_insert events not …
doumdi Oct 4, 2024
3ec3a63
Merge branch '2fa-dev' of https://github.com/introlab/opentera into 2…
SBriere Oct 7, 2024
a97650f
Refs #253, cleanup DBManager, fix tests.
doumdi Oct 7, 2024
27defa9
Refs #253, force reset password for admin on first login.
doumdi Oct 7, 2024
f851261
Refs #253, fix tests.
doumdi Oct 7, 2024
c531739
Refs #253. Updated login 2fa API paths in views. Work started on logi…
SBriere Oct 7, 2024
269d478
Merge branch '2fa-dev' of https://github.com/introlab/opentera into 2…
SBriere Oct 7, 2024
a64e99a
Refs #253, cleanup test.
doumdi Oct 7, 2024
802d4c3
Merge branch '2fa-dev' of github.com:introlab/opentera into 2fa-dev
doumdi Oct 7, 2024
3c46086
Refs #253, added site tests and user tests with 2fa enabled.
doumdi Oct 7, 2024
a1840a1
Refs #253. Added tests for User Login Change Password
SBriere Oct 7, 2024
aea6eb5
Merge branch '2fa-dev' of https://github.com/introlab/opentera into 2…
SBriere Oct 7, 2024
9dbde4a
Refs #253, Fix typos.
doumdi Oct 7, 2024
168f631
Merge branch '2fa-dev' of https://github.com/introlab/opentera into 2…
SBriere Oct 7, 2024
a08f314
Refs #253, Add verification for superadmins.
doumdi Oct 7, 2024
5b90d8a
Merge branch '2fa-dev' of github.com:introlab/opentera into 2fa-dev
doumdi Oct 7, 2024
398a7a6
Refs #253. Fixed backwards forms compatibility for OpenTeraPlus <= 1.2.x
SBriere Oct 7, 2024
a07f2d1
Refs #253, Add tests for 2fa with superadmins.
doumdi Oct 7, 2024
7bde014
Refs #253, Code cleanup.
doumdi Oct 7, 2024
a42bb28
Refs #253, Code cleanup.
doumdi Oct 7, 2024
5881536
Refs #253. Updated translations
SBriere Oct 7, 2024
b64580f
Update FlaskUtils.py
doumdi Oct 10, 2024
add82fb
Update LoginModule.py
doumdi Oct 10, 2024
d641348
Update login_change_password.html
doumdi Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions teraserver/python/.env.vscode
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PYTHONPATH=${workspaceFolder}
33 changes: 33 additions & 0 deletions teraserver/python/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
// Pointez pour afficher la description des attributs existants.
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: OpenTera Server TeraServer.py",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/TeraServer.py",
"console": "integratedTerminal",
"env": {
"PYTHONPATH": "${workspaceFolder}"
}
},
{
"name": "Python Debugger: Attach",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5688
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}", // Maps C:\Users\user1\project1
"remoteRoot": "/root/opentera/teraserver/python" // To current working directory ~/project1
}
]
}
]
}
13 changes: 13 additions & 0 deletions teraserver/python/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

{
"python.testing.unittestArgs": [
"-v",
"-s",
"${workspaceFolder}",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true,
"python.envFile": "${workspaceFolder}/.env.vscode"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

def upgrade():
# Change t_assets column asset_type to string - integers values should be converted directly in Postgresql
op.alter_column(table_name='t_assets', column_name='asset_type', type_=sa.String)
op.alter_column(table_name='t_assets', column_name='asset_type', type=sa.String)

# Change all current values to "application/octet-stream" since that is what we have right now
op.execute("UPDATE t_assets SET asset_type=\'application/octet-stream\'")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

def upgrade():
# Remove site_name unique constraint on t_sites
op.drop_constraint(constraint_name='t_sites_site_name_key', table_name='t_sites', type_='unique')
op.drop_constraint(constraint_name='t_sites_site_name_key', table_name='t_sites', type='unique')

# TeraSessionParticipants.id_session add ondelete='cascade'
op.drop_constraint(constraint_name='t_sessions_participants_id_session_fkey', table_name='t_sessions_participants',
Expand Down
50 changes: 50 additions & 0 deletions teraserver/python/alembic/versions/89343f5c95b9_allow_2fa_login.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"""allow 2fa login

Revision ID: 89343f5c95b9
Revises: 09764faa2d57
Create Date: 2024-09-05 14:49:04.781595

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '89343f5c95b9'
down_revision = '09764faa2d57'
branch_labels = None
depends_on = None


def upgrade():
# Add 2fa_enabled column to t_users table
op.add_column(table_name='t_users', column=sa.Column('user_2fa_enabled',
sa.Boolean, nullable=False, server_default=str(False)))

# Add 2fa_otp_enabled column to t_users table
op.add_column(table_name='t_users', column=sa.Column('user_2fa_otp_enabled',
sa.Boolean, nullable=False, server_default=str(False)))

# Add 2fa_email_enabled_column to t_users table
# Will user user_email as 2fa email
op.add_column(table_name='t_users', column=sa.Column('user_2fa_email_enabled',
sa.Boolean, nullable=False, server_default=str(False)))

# Add 2fa_otp_secret column to t_users table
# Secrets will be generated with pytop.random_base32()
op.add_column(table_name='t_users', column=sa.Column('user_2fa_otp_secret',
sa.String(32), nullable=True))

# Add a force_password_change column to t_users table
op.add_column(table_name='t_users', column=sa.Column('user_force_password_change',
sa.Boolean, nullable=False, server_default=str(False)))


def downgrade():
# Remove columns
op.drop_column('t_users', 'user_2fa_enabled')
op.drop_column('t_users', 'user_2fa_otp_enabled')
op.drop_column('t_users', 'user_2fa_email_enabled')
op.drop_column('t_users', 'user_2fa_otp_secret')
op.drop_column('t_users', 'user_force_password_change')

10 changes: 10 additions & 0 deletions teraserver/python/alembic/versions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
alembic revision -m "create account table"
```

## Changes for next version (Sept 5 2024)

### TeraServer
**Modified t_users table**
* Add column user_2fa_enabled (Boolean, default=False)
* Add column user_2fa_otp_enabled (Boolean, default=False)
* Add column user_2fa_email_enabled (Boolean, default=False)
* Add column user_2fa_otp_secret (String(32), nullable=True)
* Add column user_force_password_change (Boolean, default=False)

## Changes for next version (Feb 6 2023)

### TeraServer
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""add_site_2fa_required_column_to_tera_site

Revision ID: c58727df3ac2
Revises: 89343f5c95b9
Create Date: 2024-09-30 13:58:38.839824

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'c58727df3ac2'
down_revision = '89343f5c95b9'
branch_labels = None
depends_on = None


def upgrade():
# Add site_2fa_required column to t_sites table
op.add_column(table_name='t_sites', column=sa.Column('site_2fa_required',
sa.Boolean, nullable=False, server_default=str(False)))

def downgrade():
# Remove columns
op.drop_column('t_sites', 'site_2fa_required')
44 changes: 23 additions & 21 deletions teraserver/python/env/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
pypiwin32==223; sys_platform == 'win32'
Twisted==24.3.0
treq==23.11.0
cryptography==42.0.5
autobahn==23.6.2
SQLAlchemy==2.0.28
Twisted==24.7.0
treq==24.9.1
cryptography==43.0.1
autobahn==24.4.2
SQLAlchemy==2.0.35
sqlalchemy-schemadisplay==2.0
pydot==2.0.0
pydot==3.0.1
psycopg2-binary==2.9.9
Flask==3.0.2
Flask==3.0.3
Flask-SQLAlchemy==3.1.1
Flask-Login==0.6.3
Flask-Login-Multi==0.1.2
Flask-HTTPAuth==4.8.0
Flask-SocketIO==5.3.6
Flask-Session==0.6.0
Flask-SocketIO==5.3.7
Flask-Session==0.8.0
flask-restx==1.3.0
Flask-Security==3.0.0
Flask-Security==5.5.2
Flask-Babel==4.0.0
Flask-BabelEx==0.9.4
Flask-Migrate==4.0.5
Flask-Migrate==4.0.7
flask-swagger-ui==4.11.1
Flask-Limiter==3.5.1
Flask-Mail==0.9.1
Flask-Limiter==3.8.0
Flask-Mail==0.10.0
Flask-Principal==0.4.0
redis==5.0.2
redis==5.0.8
txredisapi==1.4.10
passlib==1.7.4
bcrypt==4.1.2
bcrypt==4.2.0
WTForms==3.1.2
pyOpenSSL==24.0.0
pyOpenSSL==24.2.1
service-identity==24.1.0
PyJWT==2.8.0
PyJWT==2.9.0
pylzma==0.5.0
bz2file==0.98
python-slugify==8.0.4
websocket-client==1.7.0
pytest==8.0.2
Jinja2==3.1.3
websocket-client==1.8.0
pytest==8.3.3
Jinja2==3.1.4
ua-parser==0.18.0

pyotp==2.9.0
pyqrcode==1.2.1
pypng==0.20220715.0
Loading
Loading