general updates

This commit is contained in:
2025-12-06 12:07:05 -03:00
parent 4966611eec
commit dc7c446254
12 changed files with 336 additions and 57 deletions

View File

@@ -39,9 +39,20 @@ pyinstaller --onefile --name dnsblock-agent --clean main.py
echo "Organizando saída..."
mkdir -p dist/
# PyInstaller puts the binary in dist/ by default, but let's ensure structure
# We might want to copy config.json.example there too for distribution
# Copy config example
cp config.json.example dist/ 2>/dev/null || echo "Nota: config.json.example não encontrado para copiar."
# Copy distribution files
if [ -d "pkg" ]; then
cp pkg/install.sh dist/
cp pkg/dnsblock-agent.service dist/
cp pkg/README.md dist/
chmod +x dist/install.sh
echo "Arquivos de instalação copiados para dist/"
else
echo "Aviso: Diretório 'pkg' não encontrado. O instalador não será incluído."
fi
echo "Build concluído com sucesso!"
echo "O binário está disponível em: agent/dist/dnsblock-agent"
echo "Para distribuir, compacte a pasta 'dist'."
echo "O diretório 'dist' contém todos os arquivos necessários para distribuição."
echo "Para distribuir, compacte a pasta 'agent/dist'."

View File

@@ -148,13 +148,13 @@
('dis', '/usr/lib/python3.11/dis.py', 'PYMODULE'),
('opcode', '/usr/lib/python3.11/opcode.py', 'PYMODULE'),
('ast', '/usr/lib/python3.11/ast.py', 'PYMODULE'),
('stringprep', '/usr/lib/python3.11/stringprep.py', 'PYMODULE'),
('_py_abc', '/usr/lib/python3.11/_py_abc.py', 'PYMODULE'),
('tracemalloc', '/usr/lib/python3.11/tracemalloc.py', 'PYMODULE'),
('pickle', '/usr/lib/python3.11/pickle.py', 'PYMODULE'),
('pprint', '/usr/lib/python3.11/pprint.py', 'PYMODULE'),
('dataclasses', '/usr/lib/python3.11/dataclasses.py', 'PYMODULE'),
('_compat_pickle', '/usr/lib/python3.11/_compat_pickle.py', 'PYMODULE'),
('_py_abc', '/usr/lib/python3.11/_py_abc.py', 'PYMODULE'),
('stringprep', '/usr/lib/python3.11/stringprep.py', 'PYMODULE'),
('logging.handlers', '/usr/lib/python3.11/logging/handlers.py', 'PYMODULE'),
('http.client', '/usr/lib/python3.11/http/client.py', 'PYMODULE'),
('ssl', '/usr/lib/python3.11/ssl.py', 'PYMODULE'),
@@ -476,25 +476,33 @@
('base_library.zip',
'/home/halbebruno/Projetos/DNSBlock/agent/build/dnsblock-agent/base_library.zip',
'DATA')],
[('_collections_abc', '/usr/lib/python3.11/_collections_abc.py', 'PYMODULE'),
[('reprlib', '/usr/lib/python3.11/reprlib.py', 'PYMODULE'),
('operator', '/usr/lib/python3.11/operator.py', 'PYMODULE'),
('collections.abc', '/usr/lib/python3.11/collections/abc.py', 'PYMODULE'),
('collections', '/usr/lib/python3.11/collections/__init__.py', 'PYMODULE'),
('linecache', '/usr/lib/python3.11/linecache.py', 'PYMODULE'),
('stat', '/usr/lib/python3.11/stat.py', 'PYMODULE'),
('types', '/usr/lib/python3.11/types.py', 'PYMODULE'),
('warnings', '/usr/lib/python3.11/warnings.py', 'PYMODULE'),
('traceback', '/usr/lib/python3.11/traceback.py', 'PYMODULE'),
('heapq', '/usr/lib/python3.11/heapq.py', 'PYMODULE'),
('functools', '/usr/lib/python3.11/functools.py', 'PYMODULE'),
('sre_constants', '/usr/lib/python3.11/sre_constants.py', 'PYMODULE'),
('re._parser', '/usr/lib/python3.11/re/_parser.py', 'PYMODULE'),
('re._constants', '/usr/lib/python3.11/re/_constants.py', 'PYMODULE'),
('re._compiler', '/usr/lib/python3.11/re/_compiler.py', 'PYMODULE'),
('re._casefix', '/usr/lib/python3.11/re/_casefix.py', 'PYMODULE'),
('re', '/usr/lib/python3.11/re/__init__.py', 'PYMODULE'),
('codecs', '/usr/lib/python3.11/codecs.py', 'PYMODULE'),
('io', '/usr/lib/python3.11/io.py', 'PYMODULE'),
('keyword', '/usr/lib/python3.11/keyword.py', 'PYMODULE'),
('sre_compile', '/usr/lib/python3.11/sre_compile.py', 'PYMODULE'),
('weakref', '/usr/lib/python3.11/weakref.py', 'PYMODULE'),
('reprlib', '/usr/lib/python3.11/reprlib.py', 'PYMODULE'),
('sre_parse', '/usr/lib/python3.11/sre_parse.py', 'PYMODULE'),
('abc', '/usr/lib/python3.11/abc.py', 'PYMODULE'),
('ntpath', '/usr/lib/python3.11/ntpath.py', 'PYMODULE'),
('enum', '/usr/lib/python3.11/enum.py', 'PYMODULE'),
('heapq', '/usr/lib/python3.11/heapq.py', 'PYMODULE'),
('functools', '/usr/lib/python3.11/functools.py', 'PYMODULE'),
('io', '/usr/lib/python3.11/io.py', 'PYMODULE'),
('_collections_abc', '/usr/lib/python3.11/_collections_abc.py', 'PYMODULE'),
('keyword', '/usr/lib/python3.11/keyword.py', 'PYMODULE'),
('copyreg', '/usr/lib/python3.11/copyreg.py', 'PYMODULE'),
('weakref', '/usr/lib/python3.11/weakref.py', 'PYMODULE'),
('locale', '/usr/lib/python3.11/locale.py', 'PYMODULE'),
('genericpath', '/usr/lib/python3.11/genericpath.py', 'PYMODULE'),
('encodings.zlib_codec',
'/usr/lib/python3.11/encodings/zlib_codec.py',
'PYMODULE'),
@@ -725,17 +733,9 @@
('encodings.ascii', '/usr/lib/python3.11/encodings/ascii.py', 'PYMODULE'),
('encodings.aliases', '/usr/lib/python3.11/encodings/aliases.py', 'PYMODULE'),
('encodings', '/usr/lib/python3.11/encodings/__init__.py', 'PYMODULE'),
('_weakrefset', '/usr/lib/python3.11/_weakrefset.py', 'PYMODULE'),
('linecache', '/usr/lib/python3.11/linecache.py', 'PYMODULE'),
('abc', '/usr/lib/python3.11/abc.py', 'PYMODULE'),
('sre_parse', '/usr/lib/python3.11/sre_parse.py', 'PYMODULE'),
('traceback', '/usr/lib/python3.11/traceback.py', 'PYMODULE'),
('collections.abc', '/usr/lib/python3.11/collections/abc.py', 'PYMODULE'),
('collections', '/usr/lib/python3.11/collections/__init__.py', 'PYMODULE'),
('codecs', '/usr/lib/python3.11/codecs.py', 'PYMODULE'),
('posixpath', '/usr/lib/python3.11/posixpath.py', 'PYMODULE'),
('warnings', '/usr/lib/python3.11/warnings.py', 'PYMODULE'),
('types', '/usr/lib/python3.11/types.py', 'PYMODULE'),
('genericpath', '/usr/lib/python3.11/genericpath.py', 'PYMODULE'),
('stat', '/usr/lib/python3.11/stat.py', 'PYMODULE'),
('operator', '/usr/lib/python3.11/operator.py', 'PYMODULE'),
('enum', '/usr/lib/python3.11/enum.py', 'PYMODULE'),
('sre_compile', '/usr/lib/python3.11/sre_compile.py', 'PYMODULE'),
('_weakrefset', '/usr/lib/python3.11/_weakrefset.py', 'PYMODULE'),
('os', '/usr/lib/python3.11/os.py', 'PYMODULE')])

View File

@@ -121,7 +121,7 @@
[],
False,
False,
1764875919,
1765033492,
[('run',
'/home/halbebruno/Projetos/DNSBlock/agent/build_venv/lib/python3.11/site-packages/PyInstaller/bootloader/Linux-64bit-intel/run',
'EXECUTABLE')],

View File

@@ -19,8 +19,8 @@ missing module named _frozen_importlib_external - imported by importlib._bootstr
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional)
missing module named winreg - imported by importlib._bootstrap_external (conditional), platform (delayed, optional), mimetypes (optional), urllib.request (delayed, conditional, optional), requests.utils (delayed, conditional, optional)
missing module named nt - imported by os (delayed, conditional, optional), ntpath (optional), shutil (conditional), importlib._bootstrap_external (conditional)
missing module named _winapi - imported by encodings (delayed, conditional, optional), ntpath (optional), subprocess (conditional), mimetypes (optional)
missing module named org - imported by pickle (optional)
missing module named _winapi - imported by encodings (delayed, conditional, optional), ntpath (optional), subprocess (conditional), mimetypes (optional)
missing module named _scproxy - imported by urllib.request (conditional)
missing module named msvcrt - imported by subprocess (optional), getpass (optional)
missing module named win32evtlog - imported by logging.handlers (delayed, optional)

View File

@@ -1,6 +1,6 @@
{
"serial_key": "YOUR_SERIAL_KEY_HERE",
"api_url": "https://dnsblock.app",
"api_url": "https://app.dnsblock.com.br",
"rpz_file": "/etc/unbound/rpz.zones/rpz.dnsblock.zone",
"reload_command": "systemctl reload unbound"
}

47
agent/pkg/README.md Normal file
View File

@@ -0,0 +1,47 @@
# DNSBlock Agent
Este é o pacote de distribuição binária do DNSBlock Agent para Linux.
## Instalação
1. Acesse o diretório descompactado:
```bash
cd dnsblock-agent
```
2. Execute o script de instalação como root:
```bash
sudo ./install.sh
```
Isso instalará o agente em `/opt/dnsblock`, configurará o serviço systemd e criará o arquivo de configuração inicial.
## Configuração
1. Edite o arquivo de configuração gerado:
```bash
sudo nano /opt/dnsblock/config.json
```
2. Insira sua **Serial Key** e verifique a **API URL**.
## Execução
Inicie o serviço do agente:
```bash
sudo systemctl start dnsblock-agent
```
Verifique o status:
```bash
sudo systemctl status dnsblock-agent
```
## Logs
Para visualizar os logs do agente:
```bash
sudo journalctl -u dnsblock-agent -f
```

View File

@@ -0,0 +1,14 @@
[Unit]
Description=DNSBlock Agent Service
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/dnsblock
ExecStart=/opt/dnsblock/dnsblock-agent
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target

58
agent/pkg/install.sh Normal file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
# DNSBlock Agent Installer (Binary Distribution)
INSTALL_DIR="/opt/dnsblock"
SOURCE_DIR=$(pwd)
# Check root
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root"
exit 1
fi
echo "Installing DNSBlock Agent..."
# Create Directory
mkdir -p "$INSTALL_DIR"
# Copy Binary
if [ -f "$SOURCE_DIR/dnsblock-agent" ]; then
cp "$SOURCE_DIR/dnsblock-agent" "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/dnsblock-agent"
else
echo "Error: dnsblock-agent binary not found in current directory."
exit 1
fi
# Create Config if not exists
if [ ! -f "$INSTALL_DIR/config.json" ]; then
echo "Creating default config..."
if [ -f "$SOURCE_DIR/config.json.example" ]; then
cp "$SOURCE_DIR/config.json.example" "$INSTALL_DIR/config.json"
else
cat <<EOF > "$INSTALL_DIR/config.json"
{
"serial_key": "YOUR_SERIAL_KEY_HERE",
"api_url": "https://seu-painel.com",
"rpz_file": "/opt/dnsblock/rpz.dnsblock.zone"
}
EOF
fi
echo "Config file created at $INSTALL_DIR/config.json. Please edit it with your Serial Key and API URL."
fi
# Setup Systemd Service
echo "Setting up systemd service..."
if [ -f "$SOURCE_DIR/dnsblock-agent.service" ]; then
cp "$SOURCE_DIR/dnsblock-agent.service" /etc/systemd/system/
systemctl daemon-reload
systemctl enable dnsblock-agent
echo "Installation Complete!"
echo "1. Edit /opt/dnsblock/config.json"
echo "2. Start service: systemctl start dnsblock-agent"
else
echo "Error: dnsblock-agent.service not found."
exit 1
fi