Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AA1EE200D5F for ; Mon, 18 Dec 2017 17:49:10 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id A8789160C05; Mon, 18 Dec 2017 16:49:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C6875160BFB for ; Mon, 18 Dec 2017 17:49:09 +0100 (CET) Received: (qmail 3235 invoked by uid 500); 18 Dec 2017 16:49:08 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 3222 invoked by uid 99); 18 Dec 2017 16:49:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Dec 2017 16:49:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 13422180622 for ; Mon, 18 Dec 2017 16:49:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.821 X-Spam-Level: X-Spam-Status: No, score=-0.821 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=objectstyle.org header.b=qiKTBQUc; dkim=pass (2048-bit key) header.d=messagingengine.com header.b=DqDmzCiU Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id u1tlH3QVEIeq for ; Mon, 18 Dec 2017 16:49:06 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 5C93F5F30C for ; Mon, 18 Dec 2017 16:49:06 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 1AFEA20D9D for ; Mon, 18 Dec 2017 11:49:06 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute3.internal (MEProxy); Mon, 18 Dec 2017 11:49:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=objectstyle.org; h=content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=5mvQ2gm3v3zNfd1ZoHPpIA1xoY YwTZD+WqLD3Jgjwp4=; b=qiKTBQUcDMudbjTxkEctpLMP2lxkTCd6g1WaTeShiw nB8NFQpy/39QCO/x59X+t5AkSI0TcZp//fq9j50+GKn9uXeVa7jTx4Rzq5pDnlzT 8UCDEwaMGNY9/kFLCkL8oN0fus9/uwYsc8qUzqMU4fpjS0cyeJaAfo9IIUrEet8a 8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=5mvQ2g m3v3zNfd1ZoHPpIA1xoYYwTZD+WqLD3Jgjwp4=; b=DqDmzCiUZ8MPmWQWOEutwy 6Zu/sF9Y88AFwAeCYEF9x7q80YQfHJCw4tTs/emvyyW02FJGNO7HFAJGgA4nJlVI veTVx7jvUYp81ZfFNUwe1bdTHnAPJUgke96ATFsJjFP4BnKIkSpuNZBWGgP/drCP m//NgdOAhm9nLs5yCFA2bmIVFZddBYVqzaw6X+b2AdxkPnxlLCxFXX1d1yUDqufj yGnqid6r6cpMRK2QPUTeQ4C1hRKwKlE99PvSNqKAjo2mkTT5GjKElAwVwM6eaQC1 4bjaeX+/AHjES3J7SfhbbZW5IoqyAcgsH08EelLEwzd/KlefovSigaS7BRI/2X1A == X-ME-Sender: Received: from [192.168.2.111] (unknown [31.24.95.217]) by mail.messagingengine.com (Postfix) with ESMTPA id 84EB2245F1 for ; Mon, 18 Dec 2017 11:49:05 -0500 (EST) From: Andrus Adamchik Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Subject: Re: Redacting db user name and password from XML Date: Mon, 18 Dec 2017 19:49:04 +0300 References: <6b2d9aa1-7efc-1b02-48a3-9ec40c5108cc@gmail.com> To: user@cayenne.apache.org In-Reply-To: <6b2d9aa1-7efc-1b02-48a3-9ec40c5108cc@gmail.com> Message-Id: <855C0FAF-8633-4A44-9B24-2438D4BF8D87@objectstyle.org> X-Mailer: Apple Mail (2.3445.5.20) archived-at: Mon, 18 Dec 2017 16:49:10 -0000 Hi Mark, We've done quite a bit of work in Cayenne to avoid complex things like = PasswordEncoding or custom DataSourceFactories. If all that is needed is = to change / define login credentials, the simplest way is via properties = [1]. [2] shows an example with a single DataNode. If you have more than = one, you will need to add the project name and the DataNode name to the = base property name. E.g.: export MY_USER=3Duser export MY_PASSWORD=3Dsecret java -Dcayenne.jdbc.username.project.mynode=3D$MY_USER \ -Dcayenne.jdbc.password.project.mynode=3D$MY_PASSWORD \ -jar myapp.jar=20 Hope this helps, Andrus [1] = http://cayenne.apache.org/docs/4.0/cayenne-guide/configuration-properties.= html [2] = https://stackoverflow.com/questions/45781378/best-practice-to-manage-apach= e-cayenne-project-xml-file > On Dec 17, 2017, at 4:23 AM, Mark Hull wrote: >=20 > I apologize if this question has been asked and answered before but: = What is the best-practices solution to redact the database user name and = password from an XML file created and used by Cayenne Modeler? The = ServerRuntime build statement is simply: >=20 > cayenneRuntime =3D ServerRuntime.builder() > .addConfig("com/hulles/a1icia/cayenne/cayenne-a1icia.xml") > .build(); >=20 > It works just fine as long as the db user name and password are in the = XML file, but I don't believe in leaving clear-text artifacts like that = laying around in the code, so I want to add the user and password data = at runtime from a Java method (not from an external file or an = 'executable', whatever that means in the content of PasswordEncoding). = Adding .user("xyz") and .password("zyx") to the build statement don't = work, presumably because the DataNode is not the default and those = statements just set their respective fields for the default DataNode. >=20 > If I have to, I can create either a Module to change those properties = somehow at runtime (though the documentation for doing so is, to be = kind, sparse), somehow implement the PasswordEncoding (even less = documentation, because I don't know where it's used), or just edit the = XML at runtime (horrible choice but looking like the best of a bad lot = at this point). >=20 > All this seems like a lot of effort when I imagine this need must crop = up fairly often among Cayenne users (it should, for security reasons = IMO). Is there a simple standard way to do what I want? Or at least a = standard way? I don't want to invent a new wheel here. I feel like I'm = missing something obvious that everyone else knows about and that I just = missed. Oh, by the way, whatever the solution is should still allow = Cayenne Modeler to function normally. >=20 > I promise I searched for the answer everywhere I could think of. = StackOverflow had a couple answers that used deprecated methods and = didn't work when I tried them. >=20 > Thanks in advance for any help. I hope there's a really simple answer = so I feel stupid but don't have to spend any more time on this than I = have already. :) >=20 > - Mark Hull >=20 > /People say nothing is impossible, but I do nothing every day. - A. A. = Milne/