general updates
This commit is contained in:
47
agent/pkg/README.md
Normal file
47
agent/pkg/README.md
Normal 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
|
||||
```
|
||||
14
agent/pkg/dnsblock-agent.service
Normal file
14
agent/pkg/dnsblock-agent.service
Normal 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
58
agent/pkg/install.sh
Normal 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
|
||||
Reference in New Issue
Block a user