View | Details | Raw Unified | Return to bug 157245 | Differences between
and this patch

Collapse All | Expand All

(-)chapter.sgml (-2 / +322 lines)
Lines 3872-3877 Link Here
3872
    </sect2>
3872
    </sect2>
3873
3873
3874
    <sect2>
3874
    <sect2>
3875
      <title>DNSSEC</title>
3876
      <indexterm>
3877
        <primary>BIND</primary>
3878
        <secondary>DNS security extensions</secondary>
3879
      </indexterm>
3880
3881
      <para>Domain Name System Security Extensions, or <acronym>DNSSEC</acronym>
3882
	for short, is a suite of specifications to protect
3883
	<acronym>DNS</acronym> clients, i.e. Internet resolvers, from forged
3884
	<acronym>DNS</acronym> data, such as spoofed <acronym>DNS</acronym>
3885
	records.  By using digital signatures, a resolver can verify the
3886
	integrity and authenticity of the record.  Note that
3887
	<acronym>DNSSEC</acronym> only provides integrity, it does not
3888
	provide neither confidentiality nor protection against false
3889
	assumptions.  This meanins that it cannot protect against people going
3890
	to <hostid role="domainname">example.net</hostid> instead of
3891
	<hostid role="domainname">example.com</hostid>.  The only 
3892
	thing <acronym>DNSSEC</acronym> does is authenticate that the data is 
3893
	from the domain owner and that it has not been compromised in transit. 
3894
	The security of <acronym>DNS</acronym> is believed to be an important 
3895
	step in securing the Internet in general.  For a more in-depth 
3896
	details of how <acronym>DNSSEC</acronym> works, the relevant
3897
	<acronym>RFC</acronym>s are a good place to start.  See the list in
3898
	<xref linkened="dns-read">.
3899
3900
      <para>The next two sections will demonstrate how to enable
3901
	<acronym>DNSSEC</acronym> for an authoritative <acronym>DNS</acronym>
3902
	server and a recursive (or caching) <acronym>DNS</acronym> server
3903
	running <acronym>BIND</acronym>9.  While all versions of
3904
	<acronym>BIND</acronym>9 support <acronym>DNSSEC</acronym>, it is
3905
	necessary to have at least version 9.6.2 in order to be able to use the
3906
	signed root zone when validating <acronym>DNS</acronym> queries.  This is
3907
	because earlier versions lack the required algorithms to enable
3908
	validation using the root zone key.  It is strongly recommended to use
3909
	<acronym>BIND</acronym> 9.7 or later to take advantage of automatic
3910
	key updating for the root key, as well as other features to 
3911
	automatically keep zones signed and signatures up to date.  Where
3912
	configurations differ between 9.6.2 and 9.7 and later, differences
3913
	will be pointed out.</para>
3914
3915
      <sect3>
3916
	<title>Recursive <acronym>DNS</acronym> server configuration</title>
3917
3918
	<para>Enabling <acronym>DNSSEC</acronym> validation of queries done by
3919
	  a recursive <acronym>DNS</acronym> server reqires a few changes to
3920
	  <filename>named.conf</filename>.  Before making these changes
3921
	  the root zone key, or trust anchor, must be aquired.  Currently the
3922
	  root zone key is not available in a file format
3923
	  <acronym>BIND</acronym> understands, so it has to be manually
3924
	  converted into the proper format.  The key itself can be obtained by
3925
	  querying the root zone for it, using <application>dig</application>.
3926
	  By running <screen>&prompt.user; <userinput>dig +multi +noall
3927
	  +answer DNSKEY . &gt; root.dnskey</userinput></screen> the key will
3928
	  end up in <filename>root.dnskey</filename>. The contents should look
3929
	  something like this:<programlisting>
3930
. 93910 IN DNSKEY 257 3 8 (
3931
            AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQ
3932
            bSEW0O8gcCjFFVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh
3933
            /RStIoO8g0NfnfL2MTJRkxoXbfDaUeVPQuYEhg37NZWA
3934
            JQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaDX6RS6CXp
3935
            oY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3
3936
            LQpzW5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGO
3937
            Yl7OyQdXfZ57relSQageu+ipAdTTJ25AsRTAoub8ONGc
3938
            LmqrAmRLKBP1dfwhYB4N7knNnulqQxA+Uk1ihz0=
3939
            ) ; key id = 19036
3940
. 93910 IN DNSKEY 256 3 8 (
3941
            AwEAAcaGQEA+OJmOzfzVfoYN249JId7gx+OZMbxy69Hf
3942
            UyuGBbRN0+HuTOpBxxBCkNOL+EJB9qJxt+0FEY6ZUVjE
3943
            g58sRr4ZQ6Iu6b1xTBKgc193zUARk4mmQ/PPGxn7Cn5V
3944
            EGJ/1h6dNaiXuRHwR+7oWh7DnzkIJChcTqlFrXDW3tjt
3945
            ) ; key id = 34525
3946
          </programlisting>Do not be alarmed if the obtained keys differ from
3947
          this example, they might have changed since these instructions were
3948
          last updated.  This output actually contains two keys.  The first
3949
          key in the listing, with the value 257 behind the DNSKEY record
3950
          type, is the one needed. This value indicates that this is a 
3951
          Secure Entry Point (<acronym role="Secure Entry Point">SEP</acronym>,
3952
          more commonly known as a Key Signing Key
3953
          (<acronym role="Key Signing Key">KSK</acronym>). The second key,
3954
          with value 256, is a subordinate key, commonly called a Zone Signing
3955
          Key (<acronym role="Zone Signing Key">ZSK</acronym>).  More on the
3956
          different key types later in the section <xref
3957
          linkend="dns-dnssec-auth">.</para>
3958
3959
        <para>Now the key must be verified verified and formatted so that
3960
          <acronym>BIND</acronym> can use it.  To verify the key, generate a
3961
          <acronym role="Delegation signer">DS</acronym> 
3962
          <acronym role="Resource Record">RR</acronym> set.  Create a file
3963
          containing these <acronym role="Resource Record">RR</acronym>s with 
3964
          <screen>&prompt.user; <userinput>dnssec-dsfromkey -f root-dnskey .
3965
          &gt; root.ds</userinput></screen>.  These records use SHA-1 and
3966
          SHA-256 respectively, and should look similar to the following
3967
          example, where the longer is using SHA-256.<programlisting>
3968
. IN DS 19036 8 1 B256BD09DC8DD59F0E0F0D8541B8328DD986DF6E
3969
. IN DS 19036 8 2 49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5
3970
	  </programlisting>The SHA-256 <acronym>RR</acronym> can now be
3971
	  compared to the digest in <ulink
3972
	  url="https://data.iana.org/root-anchors/root-anchors.xml">
3973
	  https://data.iana.org/root-anchors/root-anchors.xml</ulink>.  To be
3974
	  absolutely sure that the key has not been tampered with, the data in
3975
	  the <acronym>XML</acronym> file can be verified using the
3976
	  <acronym>PGP</acronym> signature in <ulink
3977
	  url="https://data.iana.org/root-anchors/root-anchors.asc">
3978
	  https://data.iana.org/root-anchors/root-anchors.asc</ulink>.</para>
3979
	    
3980
	<para>Next, the key must be formatted properly.  This differs a
3981
	  little between <acronym>BIND</acronym> versions 9.6.2 and 9.7 and
3982
	  later.  Both use a <literal>managed-keys</literal> clause, but
3983
	  support for <literal>initial-key</literal> was added in 9.7.
3984
	  <literal>initial-key</literal> makes <acronym>BIND</acronym>
3985
	  automatically track changes to the key and update it as necesarry.
3986
	  Users of <acronym>BIND</acronym> 9.6.2 must do this manually.
3987
	  For <acronym>BIND</acronym> 9.6.2 the format should look like:
3988
	  <programlisting>
3989
managed-keys {
3990
	"." 257 3 8
3991
	"AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF
3992
	FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX
3993
	bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD
3994
	X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz
3995
	W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS
3996
	Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq
3997
	QxA+Uk1ihz0=";
3998
};
3999
	  </programlisting>For 9.7 the format will instead be:
4000
	  <programlisting>
4001
managed-keys {
4002
        "." initial-key 257 3 8
4003
	"AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF
4004
	FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX
4005
	bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD
4006
	X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz
4007
	W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS
4008
	Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq
4009
	QxA+Uk1ihz0=";
4010
};
4011
	  </programlisting>The <literal>managed-keys</literal> directive can
4012
	  now be added to <filename>named.conf</filename> either directly or
4013
	  by including a file containing the key.  After these steps, tell
4014
	  <acronym>BIND</acronym> to do <acronym>DNSSEC</acronym> validation
4015
	  on queries by editing <filename>named.conf</filename> and adding the
4016
	  following to the <literal>options</literal> directive:
4017
	  <programlisting>
4018
dnssec-enable yes;
4019
dnssec-validation yes;
4020
          </programlisting></para>
4021
4022
	<para>To verify that it is actually working, use
4023
	  <application>dig</application> to make a query for a signed zone
4024
	  using the resolver just configured.  A successful reply will contain
4025
	  the <literal><acronym role="Authenticated Data">AD</acronym>
4026
	  </literal> flag to indicate the data was authenticated.  Running a
4027
	  query such as <screen>&prompt.user; <userinput>dig
4028
	  @<replaceable>resolver</replaceable> +dnssec se ds
4029
	  </userinput><screen> should return the <acronym>DS</acronym>
4030
	  <acronym>RR</acronyms> for the .se zone.  In the
4031
	  <literal>flags:</literal> section the
4032
	  <literal><acronym>AD</acronym></literal> flag should be set, as seen
4033
	  in:<programlisting>
4034
...
4035
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
4036
...
4037
	  </programlisting>.  This means that the resolver is now capable of
4038
	  authenticating <acronym>DNS</acronym>queries.</para>
4039
      </sect3>
4040
4041
      <sect3 id="dns-dnssec-auth">
4042
        <title>Authoritative <acronym>DNS</acronym> server configuration</title>
4043
        <para>In order to get an authoritative nameserver to serve a
4044
          <acronym>DNSSEC</acronym> signed zone, a little more work is
4045
          required.  To sign a zone, two cryptographic keys for that zone must
4046
          be generated. These two keys are usually called the Key Signing Key
4047
          (<acronym role="Key Signing Key">KSK</acronym>) and Zone Signing Key
4048
          (<acronym role="Zone Signing Key">ZSK</acronym>) respectively.  The
4049
          <acronym role="Key Signing Key">KSK</acronym> is used to build a chain
4050
          of authority to the data in need of validation and as such is also
4051
          called a Secure Entry Point
4052
          (<acronym role="Secure Entry Point">SEP</acronym>) key.  This key
4053
          needs to be published in the parent zone as well, to establish the
4054
          trust chain.  How this is accomplished depends on the parent zone
4055
          owner. The <acronym role="Zone Signing Key">ZSK</acronym> is used
4056
          to sign the zone, and only needs to be published there.</para>
4057
4058
        <para>To enable <acronym>DNSSEC</acronym> for the <hostid
4059
          role="domainname">example.com</hostid> zone depicted in previous
4060
          examples, the first step is to use
4061
          <application>dnssec-keygen</application> to generate the
4062
          <acronym>KSK</acronym> and <acronym>ZSK</acronym> keypair.  This keypair
4063
          can utilize different cryptograhic algorithms.  Currently the mandatory
4064
          algorithm is <literal>RSA/SHA-1</literal>.  In the examples the key
4065
          length used is 2048 bits for the <acronym>KSK</acronym> and 1024 bits
4066
          for the <acronym>ZSK</acronym>.  To generate the
4067
          <acronym>KSK</acronym> for <hostid
4068
          role="domainname">example.com</hostid>, run <screen>&prompt.user;
4069
          <userinput>dnssec-keygen -f KSK -a RSASHA1 -b 2048 -n ZONE
4070
          example.com</userinput></screen> and to generate the
4071
          <acronym>ZSK</acronym>, run <screen>&prompt.user;
4072
          <userinput>dnssec-keygen -a RSASHA1 -b 1024 -n ZONE
4073
          example.com</userinput></screen>.
4074
          <application>dnssec-keygen</application> outputs two files, the public
4075
          and the private keys in files named similar to
4076
          <filename>Kexample.com.+005+nnnnn.key</filename> (public) and
4077
          <filename>Kexample.com.+005+nnnnn.private</filename> (private). The
4078
          <literal>nnnnn</literal> part of the file name is a five digit key ID.
4079
          Keep track of which key ID belongs to which key.  This is especially
4080
          important when having more than one key in a zone.  The public key
4081
          files can now be included in the zone file, using the
4082
          <literal>$include</literal> statement. It should look something like
4083
          this:<programlisting>
4084
$include Kexample.net.+005+nnnnn.key    ; ZSK
4085
$include Kexample.net.+005+nnnnn.key    ; KSK
4086
	  </programlisting></para>
4087
4088
	<para>Finally, sign the zone and tell <acronym>BIND</acronym> to use
4089
	  the signed zonefile.  To sign a zone
4090
	  <application>dnssec-signzone</application> is used.  The command to
4091
	  sign the zone <hostid role="domainname">example.com</hostid>, located in
4092
	  <filename>example.com.db</filename> would look similar to
4093
	  <screen>&prompt.user; <userinput>dnssec-signzone -o example.com -k
4094
	  Kexample.com+005+nnnnn example.com.db
4095
	  Kexample.com+005+nnnnn.key</userinput></screen>. The key supplied to
4096
	  the <literal>-k</literal> argument is the <acronym>KSK</acronym> and
4097
	  the other key file is the <acronym>ZSK</acronym> that should be used
4098
	  in the signing.  It is possible to supply more than one
4099
	  <acronym>KSK</acronym> and <acronym>ZSK</acronym>, which will result
4100
	  in the zone being signed with all supplied keys.  This can be needed
4101
	  to supply zone data signed using more than one algorithm.  The output
4102
	  of <application>dnssec-signzone</application> is a zone file with all
4103
	  <acronym>RR</acronym>s signed.  This output will end up in a file with
4104
	  the extension <literal>.signed</literal>, such as
4105
	  <filename>example.com.db.signed</filename>.  To use this signed zone
4106
	  just modify the zone directive in <filename>named.conf</filename> to
4107
	  use this file.  By default, the signatures are only valid 30 days,
4108
	  meaning that the zone needs to be resigned within this time.  It is
4109
	  possible to make a script and a cron job to do this.  See relevant
4110
	  manuals for details.</para>
4111
	<para>Some cautionary words at the end.  Be sure to keep private keys
4112
	  confidential, as with all cryptographic keys.  When changing a key it
4113
	  is best to include the new key into the zone, while still signing with
4114
	  the old key, and then move over to using the new key to sign.  After
4115
	  these steps are done the old key can be removed from the zone.
4116
	  Failiure to do this might render the <acronym>DNS</acronym> data
4117
	  unavailable for a time, until the new key has propagated through the
4118
	  <acronym>DNS</acronym> hierarchy.  For more information on key
4119
	  rollovers and other <acronym>DNSSEC</acronym> operational issues, see
4120
	  <ulink
4121
	  url="http://www.ietf.org/rfc/rfc4641.txt"><acronym>RFC</acronym> 4641:
4122
	  <acronym>DNSSEC</acronym> Operational practices</ulink>.</para>
4123
      </sect3>
4124
4125
      <sect3>
4126
        <title>Automation using <acronym>BIND</acronym>9.7 or later</title>
4127
        <para>Beginning with <acronym>BIND</acronym> version 9.7, a new feature
4128
          called <emphasis>Smart Signing</emphasis> was introduced.  This
4129
          feature aims to make the key management and signing process simpler by
4130
          automating parts of the task.  By putting the keys into a directory
4131
          called a <emphasis>key repository</emphasis>, and using the new option
4132
          <literal>auto-dnssec</literal>, it is possible to create a dynamic zone
4133
          which will be resigned as needed.  To update this zone use
4134
          <application>nsupdate</application> with the new option
4135
          <option>-l</option>. <application>rndc</application> has
4136
          also grown the ability to sign zones with keys in the key repository,
4137
          using the option <option>sign</option>.  To tell
4138
          <acronym>BIND</acronym> to use this automatic signing and zone
4139
          updating for <hostid role="domainname">exanple.com<hostid>, add the
4140
          following to <filename>named.conf</filename>:
4141
zone example.com {
4142
	type master;
4143
	key-directory "keys";
4144
	update-policy local;
4145
	auto-dnssec maintain;
4146
	file "dynamic/example.com.zone";
4147
};
4148
	  After making these changes, generate keys for the zone as explained in
4149
	  <xref linkened="dns-dnssec-auth">, put those keys in the key repository
4150
	  given as the argument to the <literal>key-directory</literal> in the
4151
	  zone configuration and sign the zone using
4152
	  <application>rndc</application>.  Updates to a zone configured this
4153
	  way must be done using <application>nsupdate</application>, which will
4154
	  take care of re-signing the zone with the new data added.  For further
4155
	  details, see <xref linkened="dns-read"> and the
4156
	  <acronym>BIND</acronym> documentation.</para>
4157
	</sect3>
4158
4159
    </sect2>
4160
4161
    <sect2>
3875
      <title>Security</title>
4162
      <title>Security</title>
3876
4163
3877
      <para>Although BIND is the most common implementation of DNS,
4164
      <para>Although BIND is the most common implementation of DNS,
Lines 3897-3907 Link Here
3897
      </tip>
4184
      </tip>
3898
    </sect2>
4185
    </sect2>
3899
4186
3900
    <sect2>
4187
    <sect2 id="dns-read">
3901
      <title>Further Reading</title>
4188
      <title>Further Reading</title>
3902
4189
3903
      <para>BIND/<application>named</application> manual pages:
4190
      <para>BIND/<application>named</application> manual pages:
3904
      &man.rndc.8; &man.named.8; &man.named.conf.5;</para>
4191
        &man.rndc.8; &man.named.8; &man.named.conf.5; &man.nsupdate.8;
4192
        &man.dnssec-signzone.8; &man.dnssec-keygen.8;</para>
3905
4193
3906
      <itemizedlist>
4194
      <itemizedlist>
3907
	<listitem>
4195
	<listitem>
Lines 3932-3937 Link Here
3932
	      url="http://tools.ietf.org/html/rfc1035">RFC1035
4220
	      url="http://tools.ietf.org/html/rfc1035">RFC1035
3933
	      - Domain Names - Implementation and Specification</ulink></para>
4221
	      - Domain Names - Implementation and Specification</ulink></para>
3934
	</listitem>
4222
	</listitem>
4223
4224
	<listitem>
4225
	  <para><ulink
4226
	      url="http://tools.ietf.org/html/rfc4033">RFC4033
4227
	      - DNS Security Introduction and Requirements</ulink></para>
4228
	</listitem>
4229
4230
	<listitem>
4231
	  <para><ulink
4232
	      url="http://tools.ietf.org/html/rfc4034">RFC4034
4233
	      - Recource Records for the DNS Security Extensions</ulink></para>
4234
	</listitem>
4235
4236
	<listitem>
4237
	  <para><ulink
4238
	      url="http://tools.ietf.org/html/rfc4035">RFC4035
4239
	      - Protocol Modifications for the DNS Security Extensions</ulink></para>
4240
	</listitem>
4241
4242
	<listitem>
4243
	  <para><ulink
4244
	      url="http://tools.ietf.org/html/rfc4641">RFC4641
4245
	      - DNSSEC Operational Practices</ulink></para>
4246
	</listitem>
4247
4248
	<listitem>
4249
	  <para><ulink
4250
	      url="http://tools.ietf.org/html/rfc5011">RFC 5011
4251
	      - Automated Updates of DNS Security (<acronym>DNSSEC</acronym>
4252
	      Trust Anchors</ulink></para>
4253
	</listitem>
4254
3935
      </itemizedlist>
4255
      </itemizedlist>
3936
    </sect2>
4256
    </sect2>
3937
  </sect1>
4257
  </sect1>

Return to bug 157245