3

I am running kernel version as followings on an Arch Linux computer:

[root@router ~ ]$ uname -a
Linux router 4.2.5-1-ARCH #1 SMP PREEMPT Tue Oct 27 08:13:28 CET 2015 

and I noticed that every time I do a sysctl -a piped into a command say grep I received following message

[root@router ~ ]$ sysctl -a | grep no_meaning
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
...

Run cat on these files:

[root@router ~ ]$ cat /proc/sys/net/ipv6/conf/all/stable_secret 
cat: /proc/sys/net/ipv6/conf/all/stable_secret: Input/output error
[root@router ~ ]$ ls -hl /proc/sys/net/ipv6/conf/all/stable_secret 
-rw------- 1 root root 0 Dec 24 14:57 /proc/sys/net/ipv6/conf/all/stable_secret

So far I still haven't seen any ill effect of this, but I wonder if it is normal and in particular what is the function of these stable_secret key? Thanks in advance.

4

This is to support RFC 7217 addresses

The sysctl variable stable_secret contains the secret for the generation of stable interface identifiers (normally the lower 64 bit in IPv6 addresses) as defined in RFC 7217, "A Method for Generating Semantically Opaque Interface Identifiers with IPv6 Stateless Address Autoconfiguration (SLAAC)."

The RFC describes a method to define interface identifiers (IID) in IPv6 networks that do not contain the MAC address, as RFC 4862 SLAAC addresses do, but does not change in time like RFC 4941 privacy addresses either. This IID should be generated using a secret key and other information, including the network prefix. Thus, the IID will be stable in one subnet, but different in another subnet with another prefix (and probably another secret key and other ingredients). This should prevent tracking of the node when roaming different networks, improving privacy, but allow easier management of it in each one of them.

From the RFC:

      secret_key:
          A secret key that is not known by the attacker.  The secret
          key SHOULD be of at least 128 bits.  It MUST be initialized to
          a pseudo-random number (see [RFC4086] for randomness
          requirements for security) when the operating system is
          installed or when the IPv6 protocol stack is "bootstrapped"
          for the first time.  An implementation MAY provide the means
          for the system administrator to display and change the secret
          key.

The variable is explained in the kernel documentation:

stable_secret - IPv6 address
    This IPv6 address will be used as a secret to generate IPv6
    addresses for link-local addresses and autoconfigured
    ones. All addresses generated after setting this secret will
    be stable privacy ones by default. This can be changed via the
    addrgenmode ip-link. conf/default/stable_secret is used as the
    secret for the namespace, the interface specific ones can
    overwrite that. Writes to conf/all/stable_secret are refused.

    It is recommended to generate this secret during installation
    of a system and keep it stable after that.

    By default the stable secret is unset.

This posting to the Linux kernel mailing list and this git commit message show that RFC 7217 was implemented in the Linux kernel by Hannes Frederic Sowa in March 2015. Unfortunately, I could not determine the corresponding released kernel version.

An I/O error may occur when stable_secret is read, but not set

The commit text suggests that reading the stable_secret variable will return an I/O error until set:

The secret is formatted as an ipv6 address and will be stored per interface and per namespace. We track initialized flag and return EIO errors until the secret is set.

[emphasis mine]

  • Thank you so much for the detailed explanation. I set those keys with an arbitrarily-chosen ipv6 address, though I think those keys should be probably set during system installation. There is another question though, I could not set 'proc/sys/net/ipv6/conf/all/stable_secret' which according to the kernel doc should be expected. However trying to read it still throws an error. Is this a bug or so? – Peng Jan 18 '16 at 14:57
  • 2
    stable_secret is implemented since Linux v4.1. It was not working for new interfaces, but this was corrected in Linux v4.4. – Totor Oct 26 '16 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.