mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 22:22:26 +00:00
Exposition des sshfpr via api rest
This commit is contained in:
parent
fe50f23ea1
commit
86d80521c0
2 changed files with 20 additions and 2 deletions
|
@ -716,6 +716,21 @@ class CNAMERecordSerializer(serializers.ModelSerializer):
|
||||||
fields = ('alias', 'hostname', 'extension')
|
fields = ('alias', 'hostname', 'extension')
|
||||||
|
|
||||||
|
|
||||||
|
class SSHFPRRecordSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = machines.SshFingerprint
|
||||||
|
fields = ('algo_id', 'hash')
|
||||||
|
|
||||||
|
|
||||||
|
class SSHFPRInterfaceSerializer(serializers.ModelSerializer):
|
||||||
|
hostname = serializers.CharField(source='domain.name', read_only=True)
|
||||||
|
sshfpr = SSHFPRRecordSerializer(source='machine.sshfingerprint_set', many=True, read_only=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = machines.Interface
|
||||||
|
fields = ('hostname', 'sshfpr')
|
||||||
|
|
||||||
|
|
||||||
class DNSZonesSerializer(serializers.ModelSerializer):
|
class DNSZonesSerializer(serializers.ModelSerializer):
|
||||||
"""Serialize the data about DNS Zones.
|
"""Serialize the data about DNS Zones.
|
||||||
"""
|
"""
|
||||||
|
@ -729,12 +744,13 @@ class DNSZonesSerializer(serializers.ModelSerializer):
|
||||||
a_records = ARecordSerializer(many=True, source='get_associated_a_records')
|
a_records = ARecordSerializer(many=True, source='get_associated_a_records')
|
||||||
aaaa_records = AAAARecordSerializer(many=True, source='get_associated_aaaa_records')
|
aaaa_records = AAAARecordSerializer(many=True, source='get_associated_aaaa_records')
|
||||||
cname_records = CNAMERecordSerializer(many=True, source='get_associated_cname_records')
|
cname_records = CNAMERecordSerializer(many=True, source='get_associated_cname_records')
|
||||||
|
sshfpr_records = SSHFPRInterfaceSerializer(many=True, source='get_associated_sshfpr')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = machines.Extension
|
model = machines.Extension
|
||||||
fields = ('name', 'soa', 'ns_records', 'originv4', 'originv6',
|
fields = ('name', 'soa', 'ns_records', 'originv4', 'originv6',
|
||||||
'mx_records', 'txt_records', 'srv_records', 'a_records',
|
'mx_records', 'txt_records', 'srv_records', 'a_records',
|
||||||
'aaaa_records', 'cname_records')
|
'aaaa_records', 'cname_records', 'sshfpr_records')
|
||||||
|
|
||||||
|
|
||||||
# MAILING
|
# MAILING
|
||||||
|
|
|
@ -636,7 +636,9 @@ class Extension(RevMixin, AclMixin, models.Model):
|
||||||
from re2o.utils import all_active_assigned_interfaces
|
from re2o.utils import all_active_assigned_interfaces
|
||||||
return (all_active_assigned_interfaces()
|
return (all_active_assigned_interfaces()
|
||||||
.filter(type__ip_type__extension=self)
|
.filter(type__ip_type__extension=self)
|
||||||
.filter(machine))
|
.filter(
|
||||||
|
machine__id__in=SshFingerprint.objects.values('machine')
|
||||||
|
))
|
||||||
|
|
||||||
def get_associated_a_records(self):
|
def get_associated_a_records(self):
|
||||||
from re2o.utils import all_active_assigned_interfaces
|
from re2o.utils import all_active_assigned_interfaces
|
||||||
|
|
Loading…
Reference in a new issue