DPAPI in a Load Balanced Environment

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default DPAPI in a Load Balanced Environment

    Has anyone used the DPAPI to store database encryption keys and other
    data in a load balanced environment? Would multiple web servers be
    able to decrypt data if they were originally encrypted by another web
    server?

    My app works fine on a single box - but I am concerned about putting
    this into a load balanced production environment.

    What do I have to do to get this to work?
    Ron Ifferte Guest

  2. Similar Questions and Discussions

    1. Administering CF settings in load-balanced environment
      Hi, We run ColdFusion MX 6.1 on software load-balanced Windows 2003 servers. For some time we've had problems with basic administrations tasks...
    2. Session state IIS (Machine Key | Load Balanced Session)
      This is a classic ASP group. Try microsoft.public.dotnet.framework.aspnet "Fred" <me@me.com> wrote in message...
    3. Server Name Info for load balanced pool
      We are running a round-robin load balanced pool of 4 servers. I would like to be able to identify the server servrving the page in the html. What...
    4. Any free load generator for Solaris 9 in a Java environment?
      Does anyone know any free processor load generator for Solaris 9? I would like to stress Solaris 9 in a Java environment. Thanks. EKL
    5. load environment
      Hi to all, i have problem with a script perl. I need load any enviroment variables from a file. In a shell unix I can do . ./file.sh but in perl...
  3. #2

    Default Re: DPAPI in a Load Balanced Environment

    Each server will have its own machine key for encrypting/decrypting data
    using DPAPI. Data that is DPAPI-encrypted on one machine cannot be
    decrypted on another machine.

    From Improving Web Application Security: Threats and Countermeaures
    [url]http://msdn.microsoft.com/library/en-us/secmod/html/secmod92.asp[/url]

    Web Farm Considerations...
    DPAPI
    To encrypt data, developers sometimes use DPAPI. If you use DPAPI with the
    machine key to store secrets, the encrypted string is specific to a given
    computer and you cannot copy the encrypted data across computers in a Web
    farm or cluster.
    If you use DPAPI with a user key, you can decrypt the data on any computer
    with a roaming user profile. However, this is not recommended because the
    data can be decrypted by any machine on the network that can execute code
    using the account which encrypted the data.
    DPAPI is ideally suited to storing configuration secrets, for example,
    database connection strings, that live on the Web server. Other encryption
    techniques should be used when the encrypted data is stored on a remote
    server, for example, in a database. For more information about storing
    encrypted data in the database, see the module, "Building Secure Data
    Access."


    "Ron Ifferte" <rifferte@mac.com> wrote in message
    news:51d3cb7.0402261315.4f50b45c@posting.google.co m...
    > Has anyone used the DPAPI to store database encryption keys and other
    > data in a load balanced environment? Would multiple web servers be
    > able to decrypt data if they were originally encrypted by another web
    > server?
    >
    > My app works fine on a single box - but I am concerned about putting
    > this into a load balanced production environment.
    >
    > What do I have to do to get this to work?

    Aaron Margosis [MS] Guest

  4. #3

    Default Re: DPAPI in a Load Balanced Environment

    Ron,

    A reasonable (security-wise) approach for your situation would be to have a
    user-defined encryption key (either static or derived from passphrase,
    initialization vector (iv), etc) which should be used by all servers on your
    farm. What you need to do is at application installation (on each server)
    define this key and store it in secure form, so that only your application
    can retrieve it. If your application is a Windows service (or some Windows
    app which can run with loaded user profile), you can encrypt this key (and
    store in the registry or app.config file) using DPAPI with user store of the
    account under which the app will run. This, of course assumes that your app
    and the app used to encrypt key run under the same user account. There may
    be some logistical challenges here, but it is feasible. You will also have
    to store the key (or key characteristics, such as iv, etc) somewhere to make
    sure you can redefine it on another system or if your original server fails
    or if you decide to run the app under a different account.

    If your app is an ASP.NET app (or some app which cannot run with loaded user
    profile, such as Web service), you can only use DPAPI with machine key. You
    can use the same logic/process, but it is not secure, because anyone who
    gets access to the server will be able to decrypt data (in the previous
    case, the user would need to know the password of the user account, which is
    unlikely). While some may argue that their servers are unhackable, life
    proves that even most guarded systems can be broken into (due to viruses,
    app vulnerabilities, admin/user mistakes, etc). Anyway, if you feel this is
    acceptable risk (and it may be depending on the value of your data, support
    infrastructure, etc), go ahead and use it; otherwise, it will be a bit
    tricky. Check this article; it may offer you some ideas and relevant
    references: "Safeguard Database Connection Strings and Other Sensitive
    Settings in Your Code"
    ([url]http://msdn.microsoft.com/msdnmag/issues/03/11/ProtectYourData/default.aspx[/url]
    ).

    In any case, under no circumstances should you encrypt database data using
    DPAPI (with either user or machine store). If your server gets rebuilt (or
    user is changed), you will lose data and there is nothing you will be able
    to do to restore it since you will not know how to generate the same key.

    Alek

    "Ron Ifferte" <rifferte@mac.com> wrote in message
    news:51d3cb7.0402261315.4f50b45c@posting.google.co m...
    > Has anyone used the DPAPI to store database encryption keys and other
    > data in a load balanced environment? Would multiple web servers be
    > able to decrypt data if they were originally encrypted by another web
    > server?
    >
    > My app works fine on a single box - but I am concerned about putting
    > this into a load balanced production environment.
    >
    > What do I have to do to get this to work?

    Alek Davis Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139