Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.github/
.venv/
tests/
.gitignore
app.log
CITATION.cff
CODE_OF_CONDUCT.md
CONTRIBUTING.md
docker-compose.yml
LICENSE
poetry.lock
pyproject.toml
README.md
SECURITY.md
nginx.conf
19 changes: 0 additions & 19 deletions .github/workflows/lint.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test

on: [ push, pull_request ]

jobs:
test:
name: Tests
runs-on: ubuntu-latest

env:
PYTHON_COLORS: 0

steps:
- name: Copy files from repo
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config virtualenvs.create false

- name: Install dependencies
run: poetry install

- name: Run Ruff
run: poetry run ruff check .; poetry run ruff check . --diff

- name: Run Radon
run: poetry run radon cc ./server -a -na

- name: Run Bandit
run: poetry run bandit -r ./server

- name: Run Tests
run: poetry run pytest -s -x --cov=server -vv; poetry run coverage html

- name: Store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: htmlcov
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.13-slim

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHON_COLORS=0

WORKDIR /code

COPY . /code/

RUN pip install --no-cache-dir --root-user-action ignore --upgrade pip \
&& pip install --no-cache-dir --root-user-action ignore -r requirements.txt

EXPOSE 8000

ENTRYPOINT ["uvicorn", "--reload", "--host", "0.0.0.0", "server.main:app", "--workers", "4"]
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,62 @@
)](/LICENSE)
[![Visitors](https://api.visitorbadge.io/api/visitors?path=confy-security%2Fserver&label=repository%20visits&countColor=%231182c3&style=flat)](https://github.com/confy-security/server)

</div>
</div>

---

Este é um servidor de comunicação em tempo real, desenvolvido com FastAPI e WebSockets,
projetado para possibilitar a troca de mensagens de ponta a ponta entre os clientes que se conetam ao servidor.
Ele atua como m intermediário seguro entre os clientes, gerenciando conexões e encaminhando mensagens
sem acesso ao conteúdo e sem armazenamento local, preservando a privacidade.
Os aplicativos clientes por sua vez enviam as mensagens criptografadas com AES,
e a descriptografia só é feita quando a mensagem no cliente de destino.
Mesmo que alguma comunicação seja interceptada na rede, ela é ilegível.

## Executando o servidor

### Via Docker (recomendado)

A maneira mais rápida e fácil de executar o servidor é com um container [Docker](https://www.docker.com/).

```shell
docker run -d --restart=always -p 8000:8000 --name confy-server henriquesebastiao/confy-server:latest
```

O servidor Confy agora está rodando em [http://0.0.0.0:8000](http://0.0.0.0:8000).

### Localmente

Caso queira executar o servidor sem Docker para fins de debug ou desenvolvimento siga as etapas abaixo.

1. Tenha instalado as seguintes dependências:

- [Git](https://git-scm.com/downloads)
- [Poetry](https://python-poetry.org/docs/#installation)
- [Python 3.13 ou superior](https://www.python.org/downloads/)

2. Clone este repositório e entre na pasta.

```shell
git clone https://github.com/confy-security/server.git && cd server
```

3. Instale as dependência do servidor com Poetry.

```shell
poetry install
```

4. Ative o ambiente virtual.

5. Execute o servidor.

```shell
task run
```

Pronto, agora o servidor Confy agora está rodando em [http://0.0.0.0:8000](http://0.0.0.0:8000).

## License

Este projeto está licenciado sob os termos da licença GNU GPL-3.0.
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
server:
container_name: confy-server
image: 'confy-server:${TAG-latest}'
restart: always
build: .
volumes:
- .:/code
web:
container_name: web-confy-server
image: nginx:stable-alpine
restart: always
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
ports:
- "9000:80"
environment:
- NGINX_PORT=80
depends_on:
- server
30 changes: 30 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
worker_processes 4;

events {
worker_connections 512;
}

http {
server {
listen 80;
listen [::]:80;

location / {
proxy_pass http://confy-server:8000;

# Necessário para WebSocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

# Encaminhar informações do cliente
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

# Evitar timeout prematuro
proxy_read_timeout 86400;
}
}
}
Loading