diff --git a/docker_challenges/__init__.py b/docker_challenges/__init__.py index 1f5b8f0..be2aeb7 100644 --- a/docker_challenges/__init__.py +++ b/docker_challenges/__init__.py @@ -53,24 +53,24 @@ class DockerConfig(db.Model): id = db.Column(db.Integer, primary_key=True) hostname = db.Column("hostname",db.String(64), index=True) tls_enabled = db.Column("tls_enabled",db.Boolean,default=False, index=True) - ca_cert = db.Column("ca_cert",db.Text, index=True) - client_cert = db.Column("client_cert",db.Text, index=True) - client_key = db.Column("client_key",db.Text, index=True) - repositories = db.Column("repositories",db.Text, index=True) + ca_cert = db.Column("ca_cert",db.String, index=True) + client_cert = db.Column("client_cert",db.String, index=True) + client_key = db.Column("client_key",db.String, index=True) + repositories = db.Column("repositories",db.String, index=True) class DockerChallengeTracker(db.Model): """ Docker Container Tracker. This model stores the users/teams active docker containers. """ id = db.Column(db.Integer, primary_key=True) - team_id = db.Column("team_id",db.String(64), index=True) - user_id = db.Column("user_id",db.String(64), index=True) - docker_image = db.Column("docker_image",db.String(128), index=True) + team_id = db.Column("team_id",db.String, index=True) + user_id = db.Column("user_id",db.String, index=True) + docker_image = db.Column("docker_image",db.String, index=True) timestamp = db.Column("timestamp",db.Integer, index=True) revert_time = db.Column("revert_time",db.Integer, index=True) - instance_id = db.Column("instance_id",db.String(64), index=True) - ports = db.Column('ports', db.String(64), index=True) - host = db.Column('host', db.String(64), index=True) + instance_id = db.Column("instance_id",db.String, index=True) + ports = db.Column('ports', db.String, index=True) + host = db.Column('host', db.String, index=True) class DockerConfigForm(BaseForm): @@ -232,6 +232,7 @@ def get_repositories(docker, tags=False, repos=False): def get_unavailable_ports(docker): tls = docker.tls_enabled + CERT = None if not tls: prefix = 'http' else: @@ -264,6 +265,7 @@ def get_unavailable_ports(docker): def get_required_ports(docker, image): tls = docker.tls_enabled + CERT = None if not tls: prefix = 'http' else: @@ -293,6 +295,7 @@ def get_required_ports(docker, image): def create_container(docker, image, team, portbl): tls = docker.tls_enabled + CERT = None if not tls: prefix = 'http' else: @@ -340,6 +343,7 @@ def create_container(docker, image, team, portbl): def delete_container(docker, instance_id): tls = docker.tls_enabled + CERT = None if not tls: prefix = 'http' else: @@ -544,7 +548,7 @@ def fail(user, team, challenge, request): class DockerChallenge(Challenges): __mapper_args__ = {'polymorphic_identity': 'docker'} id = db.Column(None, db.ForeignKey('challenges.id'), primary_key=True) - docker_image = db.Column(db.String(128), index=True) + docker_image = db.Column(db.String, index=True) # API container_namespace = Namespace("container", description='Endpoint to interact with containers')