feat(qualys/agents): bloque troubleshooting pour Windows (route + bouton 'Non gere' dans table)
This commit is contained in:
parent
eecb61c720
commit
767b33095a
@ -1356,13 +1356,28 @@ async def qualys_asset_delete(request: Request, asset_id: int, db=Depends(get_db
|
||||
@router.get("/qualys/agents/{hostname}/audit-qualys", response_class=HTMLResponse)
|
||||
def qualys_agent_audit_page(hostname: str, request: Request, db=Depends(get_db),
|
||||
refresh: int = 0):
|
||||
"""Audit cible Qualys Agent (async). Background thread + page auto-refresh."""
|
||||
"""Audit cible Qualys Agent (async). Background thread + page auto-refresh.
|
||||
Bloque l'audit pour Windows (commandes shell Linux uniquement)."""
|
||||
user = get_current_user(request)
|
||||
if not user:
|
||||
return RedirectResponse(url="/login")
|
||||
perms = get_user_perms(db, user)
|
||||
if not can_view(perms, "qualys"):
|
||||
return RedirectResponse(url="/dashboard")
|
||||
|
||||
# Garde-fou : audit non disponible pour Windows
|
||||
asset_os = db.execute(text(
|
||||
"SELECT os FROM qualys_assets WHERE LOWER(hostname)=LOWER(:h) LIMIT 1"
|
||||
), {"h": hostname}).scalar()
|
||||
if asset_os and "windows" in asset_os.lower():
|
||||
ctx = base_context(request, db, user)
|
||||
ctx.update({
|
||||
"hostname": hostname, "asset_os": asset_os,
|
||||
"audit_status": "unsupported", "audit": None,
|
||||
"audit_error": None, "audit_started_at": None, "audit_finished_at": None,
|
||||
})
|
||||
return templates.TemplateResponse("qualys_agent_audit.html", ctx)
|
||||
|
||||
from app.services.realtime_audit_service import (
|
||||
start_qualys_audit_async, get_qualys_audit_state
|
||||
)
|
||||
|
||||
@ -6,6 +6,17 @@
|
||||
<meta http-equiv="refresh" content="3">
|
||||
{% endif %}
|
||||
|
||||
{% if audit_status == 'unsupported' %}
|
||||
<div class="card p-6 mb-4 text-center" style="border:1px solid #6b7280;background:rgba(107,114,128,0.08)">
|
||||
<div class="text-cyber-yellow font-bold text-sm mb-2">⚠ Audit non géré</div>
|
||||
<p class="text-xs text-gray-400">
|
||||
L'audit SSH ciblé n'est disponible que pour les serveurs <strong>Linux</strong>.<br>
|
||||
Ce serveur est détecté comme <strong>Windows</strong> ({{ asset_os or '?' }}).
|
||||
</p>
|
||||
<a href="/qualys/agents#inactive-list" class="btn-sm bg-cyber-border text-gray-300 px-3 py-2 text-xs mt-3 inline-block">← Retour</a>
|
||||
</div>
|
||||
{% else %}
|
||||
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<div>
|
||||
<h2 class="text-xl font-bold text-cyber-accent">Audit Qualys Agent</h2>
|
||||
@ -181,4 +192,6 @@
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@ -300,7 +300,13 @@ function refreshAgents(mode) {
|
||||
<td class="p-2 text-center font-mono">{{ a.agent_version or '-' }}</td>
|
||||
<td class="p-2 text-center text-cyber-yellow">{% if a.last_checkin %}{{ (a.last_checkin|string)[:10] }}{% else %}-{% endif %}</td>
|
||||
<td class="p-2 text-center">{{ a.etat or '-' }}</td>
|
||||
<td class="p-2 text-center"><a href="/qualys/agents/{{ a.hostname }}/audit-qualys" class="btn-sm bg-cyber-border text-cyber-accent px-2 py-1 text-xs hover:bg-cyber-hover" title="Audit SSH ciblé : status agent, version, disque, connectivité, logs">Troubleshooting</a></td>
|
||||
<td class="p-2 text-center">
|
||||
{% if 'Windows' in (a.os or '') %}
|
||||
<span class="text-gray-500 text-xs italic" title="Audit SSH non disponible pour Windows">Non géré</span>
|
||||
{% else %}
|
||||
<a href="/qualys/agents/{{ a.hostname }}/audit-qualys" class="btn-sm bg-cyber-border text-cyber-accent px-2 py-1 text-xs hover:bg-cyber-hover" title="Audit SSH ciblé : status agent, version, disque, connectivité, logs">Troubleshooting</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user