Compare commits

..

2 Commits

Author SHA1 Message Date
78bee32535 Update AvWeb and add Licenses 2026-02-09 14:55:41 -06:00
7732952e9c BBS Server Structure 2026-02-09 14:36:55 -06:00
7 changed files with 87 additions and 4 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
*.key
__pycache__/

24
srv/avalon.py Normal file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env python3
# avalon-bbs avalon.py
# Copyright (C) 2026 The Avalon Team <avalon@icolotl.com>
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from avdefs import AccountType
class AvalonConnection:
def __init__(self):
self.acuser: str = "anon"
self.actype: AccountType = AccountType.ANON

24
srv/avdefs.py Normal file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env python3
# avalon-bbs avdefs.py
# Copyright (C) 2026 The Avalon Team <avalon@icolotl.com>
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
from enum import Enum, auto
class AccountType(Enum):
ANON = auto()
LDAP = auto()
AKEY = auto()

View File

@@ -25,7 +25,7 @@ SEARCH_DN = "cn=Search,dc=icolotl,dc=com"
with open("search.key", encoding="utf-8") as file:
SEARCH_KEY = file.read().strip()
def authenticate(username, password):
def authenticate(username: str, password: str):
"""Attempt to authenticate against the Avalon LDAP Database."""
server = Server("127.0.0.1")
try:
@@ -33,8 +33,11 @@ def authenticate(username, password):
conn.search("ou=People,dc=icolotl,dc=com", f"(&(objectclass=person)(uid={escape_filter_chars(username)}))")
if len(conn.entries) != 1:
return False
USER_DN = conn.entries[0].entry_dn
USER_DN: str = conn.entries[0].entry_dn
with Connection(server, user=USER_DN, password=password, raise_exceptions=True):
return True
except (LDAPBindError, LDAPPasswordIsMandatoryError, LDAPInvalidCredentialsResult):
return False
if __name__ == "__main__":
print(authenticate(input("Avalon Username: "), getpass("Avalon Password: ")))

11
web/index.html Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Avalon BBS</title>
<link rel="stylesheet" href="style.css">
<script src="script.js" defer></script>
</head>
<body>
<h1>Avalon BBS</h1>
</body>
</html>

16
web/script.js Normal file
View File

@@ -0,0 +1,16 @@
/*
* avalon-bbs script.js
* Copyright (C) 2026 The Avalon Team <avalon@icolotl.com>
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

4
web/style.css Normal file
View File

@@ -0,0 +1,4 @@
html {
background-color: #222;
color: #f0a;
}