SSHFP-Records (Thanks to Martin Gollowitzer)
bernd

bernd commited on 2011-06-21 15:08:34
Zeige 3 geänderte Dateien mit 27 Einfügungen und 3 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2014 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -36,9 +36,13 @@ foreach ($records AS $rec)
36 36
   {
37 37
     $data .= ' ('.$rec['spec'].')';
38 38
   }
39
+  if ($rec['type'] == 'sshfp')
40
+  {
41
+    $data = $rec['spec'] . ' 1 ' . $data;
42
+  }
39 43
   $ttl = ($rec['ttl'] ? $rec['ttl'] : 3600);
40 44
   $link = $rec['fqdn'];
41
-  if (in_array($rec['type'], array('a', 'aaaa', 'mx', 'cname', 'ns', 'txt', 'spf', 'ptr'))) {
45
+  if (in_array($rec['type'], array('a', 'aaaa', 'mx', 'cname', 'ns', 'txt', 'spf', 'ptr', 'sshfp'))) {
42 46
       $link = internal_link('dns_record_edit', $rec['fqdn'], "id={$rec['id']}");
43 47
   }
44 48
   output("<tr><td>{$link}</td><td>".strtoupper($rec['type'])."</td><td>$data</td><td>{$ttl} Sek.</td><td>".internal_link('dns_record_save', '<img src="'.$prefix.'images/delete.png" width="16" height="16" alt="löschen" title="Record löschen" />', "id={$rec['id']}&action=delete")."</td></tr>\n");
... ...
@@ -74,6 +78,7 @@ output('<h4>Neuen DNS-Record anlegen</h4>
74 78
 <li>'.internal_link('dns_record_edit', 'NS (Nameserver)', 'id=new&type=ns&domain='.$domain->id).'</li>
75 79
 <li>'.internal_link('dns_record_edit', 'SPF (sender policy framework)', 'id=new&type=spf&domain='.$domain->id).'</li>
76 80
 <li>'.internal_link('dns_record_edit', 'TXT', 'id=new&type=txt&domain='.$domain->id).'</li>
81
+<li>'.internal_link('dns_record_edit', 'SSHFP', 'id=new&type=sshfp&domain='.$domain->id).'</li>
77 82
 </ul>
78 83
 
79 84
 <h4>Automatische DNS-Records</h4>
... ...
@@ -98,6 +98,16 @@ if ($type == 'spf' || $type == 'txt')
98 98
 ';
99 99
 }
100 100
 
101
+if ($type == 'sshfp')
102
+{
103
+  $rsadefault = ($data['spec'] == 1) ? ' selected="selected"' : '';
104
+  $dsadefault = ($data['spec'] == 2) ? ' selected="selected"' : '';
105
+  $form .= '
106
+<tr><td><label for="spec">Algorithmus:</label></td><td><select name="spec" id="spec"><option value="1"'.$rsadefault.'>RSA (1)</option><option value="2"'.$dsadefault.'>DSS (2)</option></select></td></tr>
107
+<tr><td><label for="data">Fingerabdruck:</label></td><td><input type="text" name="data" id="data" value="'.$data['data'].'" /></td></tr>
108
+';
109
+}
110
+
101 111
 if ($dyndns)
102 112
 {
103 113
   $form .= '
... ...
@@ -102,7 +102,7 @@ function get_dyndns_records($id)
102 102
   return $data;
103 103
 }
104 104
 
105
-$valid_record_types = array('a', 'aaaa', 'mx', 'ns', 'spf', 'txt', 'cname', 'ptr', 'srv', 'raw');
105
+$valid_record_types = array('a', 'aaaa', 'mx', 'ns', 'spf', 'txt', 'cname', 'ptr', 'srv', 'raw', 'sshfp');
106 106
 
107 107
 
108 108
 function blank_dns_record($type)
... ...
@@ -171,7 +171,7 @@ function get_domain_auto_records($domainname)
171 171
 }
172 172
 
173 173
 
174
-$implemented_record_types = array('a', 'aaaa', 'mx', 'spf', 'txt', 'cname', 'ptr', 'srv', 'ns');
174
+$implemented_record_types = array('a', 'aaaa', 'mx', 'spf', 'txt', 'cname', 'ptr', 'srv', 'ns', 'sshfp');
175 175
 
176 176
 function save_dns_record($id, $record)
177 177
 {
... ...
@@ -240,6 +240,15 @@ function save_dns_record($id, $record)
240 240
         system_failure('text entry missing');
241 241
       break;
242 242
 
243
+    case 'sshfp':
244
+      $record['dyndns'] = '';
245
+      $record['spec'] = max( (int) $record['spec'], 1);
246
+      $record['ip'] = '';
247
+      if (! $record['data'] )
248
+        system_failure('text entry missing');
249
+      break;
250
+
251
+
243 252
     case 'srv':
244 253
       system_failure('not implemented yet');
245 254
     default:
246 255