installer v1 (A+B): install-code enrollment, panel code UI, EXE publish; DPAPI credential store

This commit is contained in:
gti
2026-09-23 16:38:19 -03:00
parent b058affa29
commit 91c4030b06
15 changed files with 1135 additions and 54 deletions
@@ -0,0 +1,34 @@
"""Installation code (install_code) for the Windows installer EXE flow.
agent_enrollments gains the install-code columns used by the universal EXE
installer: the code is typed by the operator into Setup.exe and resolves the
installation on the Hub. Only the SHA-256 of the normalized code is ever
stored (install_code_hash); install_code_expires_at bounds its life and
install_code_created_at records when it was generated (rotation rewrites
these). install_code_attempts counts failed enrollment tries to support the
per-installation rate limit. No plaintext code column exists.
Revision ID: 0023_install_codes
Revises: 0022_agent_releases_enrollment
"""
from alembic import op
import sqlalchemy as sa
revision = "0023_install_codes"
down_revision = "0022_agent_releases_enrollment"
branch_labels = None
depends_on = None
def upgrade():
op.add_column("agent_enrollments", sa.Column("install_code_hash", sa.String(64), nullable=True))
op.add_column("agent_enrollments", sa.Column("install_code_expires_at", sa.DateTime(timezone=True), nullable=True))
op.add_column("agent_enrollments", sa.Column("install_code_attempts", sa.Integer(), nullable=False, server_default="0"))
op.add_column("agent_enrollments", sa.Column("install_code_created_at", sa.DateTime(timezone=True), nullable=True))
def downgrade():
op.drop_column("agent_enrollments", "install_code_created_at")
op.drop_column("agent_enrollments", "install_code_attempts")
op.drop_column("agent_enrollments", "install_code_expires_at")
op.drop_column("agent_enrollments", "install_code_hash")