| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
$public_key_pins = get_option ( 'hh_public_key_pins', 0 ); |
| 6 |
?> |
| 7 |
<tr valign="top"> |
| 8 |
<th scope="row">Public-Key-Pins |
| 9 |
<p class="description"><?php _e('HTTP Public Key Pinning (HPKP) is a security mechanism which allows HTTPS websites to resist impersonation by attackers using mis-issued or otherwise fraudulent certificates.', 'http-headers'); ?></p> |
| 10 |
|
| 11 |
<p> |
| 12 |
<label><input type="checkbox" class="http-header-value" |
| 13 |
name="hh_public_key_pins_report_only" value="1" |
| 14 |
<?php checked(get_option('hh_public_key_pins_report_only'), 1, true); ?> |
| 15 |
<?php echo $public_key_pins == 1 ? NULL : ' readonly'; ?> /> "Report-Only" (<?php _e('for reporting-only purposes', 'http-headers'); ?>)</label> |
| 16 |
</p> |
| 17 |
</th> |
| 18 |
<td> |
| 19 |
<fieldset> |
| 20 |
<legend class="screen-reader-text">Public-Key-Pins</legend> |
| 21 |
<?php |
| 22 |
foreach ( $bools as $k => $v ) { |
| 23 |
?><p> |
| 24 |
<label><input type="radio" class="http-header" name="hh_public_key_pins" value="<?php echo $k; ?>" <?php checked($public_key_pins, $k, true); ?> /> <?php echo $v; ?></label> |
| 25 |
</p><?php |
| 26 |
} |
| 27 |
?> |
| 28 |
</fieldset> |
| 29 |
</td> |
| 30 |
<td> |
| 31 |
<?php settings_fields( 'http-headers-pkp' ); ?> |
| 32 |
<?php do_settings_sections( 'http-headers-pkp' ); ?> |
| 33 |
<table> |
| 34 |
<tr> |
| 35 |
<td>pin-sha256:</td> |
| 36 |
<td><input type="text" class="http-header-value" |
| 37 |
name="hh_public_key_pins_sha256_1" |
| 38 |
value="<?php echo esc_attr(get_option('hh_public_key_pins_sha256_1')); ?>" |
| 39 |
placeholder="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM=" |
| 40 |
<?php echo $public_key_pins == 1 ? NULL : ' readonly'; ?> /></td> |
| 41 |
</tr> |
| 42 |
<tr> |
| 43 |
<td>pin-sha256:<br>(backup key) |
| 44 |
</td> |
| 45 |
<td><input type="text" class="http-header-value" |
| 46 |
name="hh_public_key_pins_sha256_2" |
| 47 |
value="<?php echo esc_attr(get_option('hh_public_key_pins_sha256_2')); ?>" |
| 48 |
placeholder="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=" |
| 49 |
<?php echo $public_key_pins == 1 ? NULL : ' readonly'; ?> /></td> |
| 50 |
</tr> |
| 51 |
<tr> |
| 52 |
<td>max-age:</td> |
| 53 |
<td><select class="http-header-value" |
| 54 |
name="hh_public_key_pins_max_age" |
| 55 |
<?php echo $public_key_pins == 1 ? NULL : ' readonly'; ?>> |
| 56 |
<?php |
| 57 |
$items = array ( |
| 58 |
'3600' => '1 hour', |
| 59 |
'86400' => '1 day', |
| 60 |
'604800' => '7 days', |
| 61 |
'2592000' => '30 days', |
| 62 |
'5184000' => '60 days', |
| 63 |
'7776000' => '90 days', |
| 64 |
'31536000' => '1 year', |
| 65 |
); |
| 66 |
$public_key_pins_max_age = get_option ( 'hh_public_key_pins_max_age' ); |
| 67 |
foreach ( $items as $key => $item ) { |
| 68 |
?><option value="<?php echo $key; ?>" |
| 69 |
<?php selected($public_key_pins_max_age, $key); ?>><?php echo $item; ?></option><?php |
| 70 |
} |
| 71 |
?> |
| 72 |
</select> |
| 73 |
</td> |
| 74 |
</tr> |
| 75 |
<tr> |
| 76 |
<td>includeSubDomains:</td> |
| 77 |
<td><input type="checkbox" class="http-header-value" |
| 78 |
name="hh_public_key_pins_sub_domains" value="1" |
| 79 |
<?php checked(get_option('hh_public_key_pins_sub_domains'), 1, true); ?> |
| 80 |
<?php echo $public_key_pins == 1 ? NULL : ' readonly'; ?> /></td> |
| 81 |
</tr> |
| 82 |
<tr> |
| 83 |
<td>report-uri:</td> |
| 84 |
<td><input type="text" class="http-header-value" |
| 85 |
name="hh_public_key_pins_report_uri" |
| 86 |
value="<?php echo esc_attr(get_option('hh_public_key_pins_report_uri')); ?>" |
| 87 |
placeholder="http://example.com/pkp-report" |
| 88 |
<?php echo $public_key_pins == 1 ? NULL : ' readonly'; ?> /></td> |
| 89 |
</tr> |
| 90 |
</table> |
| 91 |
</td> |
| 92 |
</tr> |