Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"We will bury you." -- Nikita Kruschev


devel / comp.lang.java.programmer / Alternative for properties like javax.net.ssl.trustStorePassword ...

SubjectAuthor
* Alternative for properties like javax.net.ssl.trustStorePassword ...Andreas Leitgeb
+* Re: Alternative for properties like javax.net.ssl.trustStorePassword ...e.d.pro...@gmail.com
|`* Re: Alternative for properties likeAndreas Leitgeb
| `- Re: Alternative for properties like javax.net.ssl.trustStorePassword ...e.d.pro...@gmail.com
+* Re: Alternative for properties like javax.net.ssl.trustStorePasswordArne Vajhøj
|`- Re: Alternative for properties likeAndreas Leitgeb
`- Re: Alternative for properties like javax.net.ssl.trustStorePasswordDaniele Futtorovic

1
Alternative for properties like javax.net.ssl.trustStorePassword ...

<slrntt5jd0.pa7s.avl@logic.at>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=202&group=comp.lang.java.programmer#202

  copy link   Newsgroups: comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: avl@logic.at (Andreas Leitgeb)
Newsgroups: comp.lang.java.programmer
Subject: Alternative for properties like javax.net.ssl.trustStorePassword ...
Date: Thu, 26 Jan 2023 18:59:44 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <slrntt5jd0.pa7s.avl@logic.at>
Reply-To: avl@logic.at
Injection-Date: Thu, 26 Jan 2023 18:59:44 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="9481629feea367234aa831c80c06dfc8";
logging-data="1386676"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+v1qa9bFvbU+hxMCDi+DIu"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:C58U/EvuiBYJ/pcXrDs8g+e/JpE=
 by: Andreas Leitgeb - Thu, 26 Jan 2023 18:59 UTC

If some java appliation is supposed to use a trustStore, then apparently
all hits on google for the obvious words will suggest to start the application
with an option "-Djavax.net.ssl.trustStorePassword=..." passed to the java
executable...

Assuming I do not want everyone on the machine to see the password in clear
text in the "ps -ef" output, what would be "safer" alternatives?

The most obvious one might be to set the property from my own code, (after
reading the pw from a file that not everyone on the machine has access to)
but my code comes too late: some beans already got initialized and didn't
see the property, before the program gets to set the properties. --
I'm not a master of beans... maybe I could just add another bean that
would do the "setProperty" as a sideeffect just in time before the other
bean needs the property... haven't thought this through, yet.

Maybe I'm still in the stone-age, and there is already some new property that
would allow me to just specify another file holding the relevant passwords,
or something else?

Any ideas? Is passing a password as argument to a process nothing to worry
about?

Re: Alternative for properties like javax.net.ssl.trustStorePassword ...

<98e07321-e56e-4546-b62b-9d614deedf79n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=203&group=comp.lang.java.programmer#203

  copy link   Newsgroups: comp.lang.java.programmer
X-Received: by 2002:a05:620a:13d0:b0:6ff:afd8:f08e with SMTP id g16-20020a05620a13d000b006ffafd8f08emr2308199qkl.337.1674766226201;
Thu, 26 Jan 2023 12:50:26 -0800 (PST)
X-Received: by 2002:a0c:9169:0:b0:537:7ad6:90f7 with SMTP id
q96-20020a0c9169000000b005377ad690f7mr382956qvq.16.1674766226000; Thu, 26 Jan
2023 12:50:26 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.java.programmer
Date: Thu, 26 Jan 2023 12:50:25 -0800 (PST)
In-Reply-To: <slrntt5jd0.pa7s.avl@logic.at>
Injection-Info: google-groups.googlegroups.com; posting-host=98.237.40.232; posting-account=2czF5goAAAD4GBMPIGV4KcD2K4PhoB_H
NNTP-Posting-Host: 98.237.40.232
References: <slrntt5jd0.pa7s.avl@logic.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <98e07321-e56e-4546-b62b-9d614deedf79n@googlegroups.com>
Subject: Re: Alternative for properties like javax.net.ssl.trustStorePassword ...
From: e.d.programmer@gmail.com (e.d.pro...@gmail.com)
Injection-Date: Thu, 26 Jan 2023 20:50:26 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1635
 by: e.d.pro...@gmail.com - Thu, 26 Jan 2023 20:50 UTC

> Any ideas? Is passing a password as argument to a process nothing to worry
> about?
first result https://docs.oracle.com/javadb/10.8.3.0/adminguide/cadminsslclient.html shows setting the password as system property right before making your first database connection.
How and when are you making your database connection?
I normally make database connections using datasource in the tomcat config files with the password in the config as an encrypted string and reference a decryption jar.

Re: Alternative for properties like javax.net.ssl.trustStorePassword ...

<tqusjt$1bq63$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=204&group=comp.lang.java.programmer#204

  copy link   Newsgroups: comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: arne@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.lang.java.programmer
Subject: Re: Alternative for properties like javax.net.ssl.trustStorePassword
...
Date: Thu, 26 Jan 2023 16:50:52 -0500
Organization: A noiseless patient Spider
Lines: 48
Message-ID: <tqusjt$1bq63$1@dont-email.me>
References: <slrntt5jd0.pa7s.avl@logic.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 26 Jan 2023 21:50:53 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="8aad2a058c5f4431eb30e0b47888fc1d";
logging-data="1435843"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zxhl2R4/k6rIz/7T7ut6Zdwns6zHnfr4="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.7.0
Cancel-Lock: sha1:lcithLzhe91ps18AKuMdWJKD4sI=
In-Reply-To: <slrntt5jd0.pa7s.avl@logic.at>
Content-Language: en-US
 by: Arne Vajhøj - Thu, 26 Jan 2023 21:50 UTC

On 1/26/2023 1:59 PM, Andreas Leitgeb wrote:
> If some java appliation is supposed to use a trustStore, then apparently
> all hits on google for the obvious words will suggest to start the application
> with an option "-Djavax.net.ssl.trustStorePassword=..." passed to the java
> executable...
>
> Assuming I do not want everyone on the machine to see the password in clear
> text in the "ps -ef" output, what would be "safer" alternatives?
>
> The most obvious one might be to set the property from my own code, (after
> reading the pw from a file that not everyone on the machine has access to)
> but my code comes too late: some beans already got initialized and didn't
> see the property, before the program gets to set the properties. --
> I'm not a master of beans... maybe I could just add another bean that
> would do the "setProperty" as a sideeffect just in time before the other
> bean needs the property... haven't thought this through, yet.
>
> Maybe I'm still in the stone-age, and there is already some new property that
> would allow me to just specify another file holding the relevant passwords,
> or something else?
>
> Any ideas? Is passing a password as argument to a process nothing to worry
> about?

A password in visible plain text is at least a potential problem.

But there are no miracles.

You have some code that are not yours that use this property.

Your regular code that runs later cannot change that property when needed.

You need to get some code to run before the code using this property.

Startup servlet may be too unreliable timing wise.

Some googling indicate that a ServletContextListener and doing
it in contextInitialized may be better.

If everything is using Spring you may be able to sneak some
code in via Spring early enough.

If they will allow you to use sledgehammer then a Java agent
will run before anything!

Arne

Re: Alternative for properties like javax.net.ssl.trustStorePassword ...

<slrnttj940.pa7s.avl@logic.at>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=209&group=comp.lang.java.programmer#209

  copy link   Newsgroups: comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: avl@logic.at (Andreas Leitgeb)
Newsgroups: comp.lang.java.programmer
Subject: Re: Alternative for properties like
javax.net.ssl.trustStorePassword ...
Date: Tue, 31 Jan 2023 23:30:08 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <slrnttj940.pa7s.avl@logic.at>
References: <slrntt5jd0.pa7s.avl@logic.at>
<98e07321-e56e-4546-b62b-9d614deedf79n@googlegroups.com>
Reply-To: avl@logic.at
Injection-Date: Tue, 31 Jan 2023 23:30:08 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="ce841eb8ff8643107f1a0f63faeeb8de";
logging-data="34098"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HN86yKKC7exQQiZcgk54V"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:oGWyF6LG6E3WpayeeXE0CvQdJgY=
 by: Andreas Leitgeb - Tue, 31 Jan 2023 23:30 UTC

e.d.pro...@gmail.com <e.d.programmer@gmail.com> wrote:
>> Any ideas? Is passing a password as argument to a process nothing to worry
>> about?
> first result https://docs.oracle.com/javadb/10.8.3.0/adminguide/cadminsslclient.html
> shows setting the password as system property right before making
> your first database connection. How and when are you making your
> database connection?

It is a web-application running in tomcat, and tomcat itself is
currently configured in "bin/setenv.sh" to start with those "-D..."
options, setting key- & truststore file and their password.

> I normally make database connections using datasource in the tomcat
> config files with the password in the config as an encrypted string
> and reference a decryption jar.

That sounds like a promising solution...
Could I set them e.g. in the server.xml ?

The tomcat-config is already readable only by the user running it,
which would be a huge advantage to current state where the password
shows up in process list visible even for other users.

Re: Alternative for properties like javax.net.ssl.trustStorePassword ...

<slrnttjabt.pa7s.avl@logic.at>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=210&group=comp.lang.java.programmer#210

  copy link   Newsgroups: comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: avl@logic.at (Andreas Leitgeb)
Newsgroups: comp.lang.java.programmer
Subject: Re: Alternative for properties like
javax.net.ssl.trustStorePassword ...
Date: Tue, 31 Jan 2023 23:51:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <slrnttjabt.pa7s.avl@logic.at>
References: <slrntt5jd0.pa7s.avl@logic.at> <tqusjt$1bq63$1@dont-email.me>
Reply-To: avl@logic.at
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 31 Jan 2023 23:51:25 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="ce841eb8ff8643107f1a0f63faeeb8de";
logging-data="34098"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XTWNYsQGmtlGh6e4+Uw8w"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:iWautrc+w22NQWapHlvcPq9ySwM=
 by: Andreas Leitgeb - Tue, 31 Jan 2023 23:51 UTC

Arne Vajhøj <arne@vajhoej.dk> wrote:
> On 1/26/2023 1:59 PM, Andreas Leitgeb wrote:
>> Any ideas? Is passing a password as argument to a process nothing to worry
>> about?
> A password in visible plain text is at least a potential problem.
>
> You have some code that are not yours that use this property.
> Your regular code that runs later cannot change that property when needed.
> You need to get some code to run before the code using this property.
> Startup servlet may be too unreliable timing wise.
> Some googling indicate that a ServletContextListener and doing
> it in contextInitialized may be better.

Actually, my hope was, that I wouldn't really need any own code for
that at all.

Alternatives could in principle be:
- newer properties with an extra level of indirection for the sensible
data, ideally understood by the same (java crypto internal) code
that currently reads these "indiscrete" properties...
I didn't find any from googling, but that doesn't necessarily mean
that there couldn't be any.
- Given that my app runs in tomcat, maybe tomcat already has a way to
specify properties in its configuration (outside setenv.sh)...
(I didn't think of that until e.d.programmer mentioned tomcat config
in his followup. I'm not sure if he meant it that way: as defining
properties somewhere inside e.g. the xmls or some property-files that
would be read by tomcat after startup)
- maybe others...

Re: Alternative for properties like javax.net.ssl.trustStorePassword ...

<dd2dc8fe-e04a-43aa-953a-ad0a6949e15an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=211&group=comp.lang.java.programmer#211

  copy link   Newsgroups: comp.lang.java.programmer
X-Received: by 2002:a05:622a:44c:b0:3b9:b3c2:a675 with SMTP id o12-20020a05622a044c00b003b9b3c2a675mr207051qtx.248.1675254350322;
Wed, 01 Feb 2023 04:25:50 -0800 (PST)
X-Received: by 2002:a05:622a:105:b0:3b6:a28b:53da with SMTP id
u5-20020a05622a010500b003b6a28b53damr319808qtw.331.1675254350043; Wed, 01 Feb
2023 04:25:50 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.java.programmer
Date: Wed, 1 Feb 2023 04:25:49 -0800 (PST)
In-Reply-To: <slrnttj940.pa7s.avl@logic.at>
Injection-Info: google-groups.googlegroups.com; posting-host=98.237.40.232; posting-account=2czF5goAAAD4GBMPIGV4KcD2K4PhoB_H
NNTP-Posting-Host: 98.237.40.232
References: <slrntt5jd0.pa7s.avl@logic.at> <98e07321-e56e-4546-b62b-9d614deedf79n@googlegroups.com>
<slrnttj940.pa7s.avl@logic.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dd2dc8fe-e04a-43aa-953a-ad0a6949e15an@googlegroups.com>
Subject: Re: Alternative for properties like javax.net.ssl.trustStorePassword ...
From: e.d.programmer@gmail.com (e.d.pro...@gmail.com)
Injection-Date: Wed, 01 Feb 2023 12:25:50 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: e.d.pro...@gmail.com - Wed, 1 Feb 2023 12:25 UTC

> That sounds like a promising solution...
> Could I set them e.g. in the server.xml ?
>
I'm not an expert on what server.xml can do but database config that I've seen is normally in context.xml. Just paste the encrypted string in a resource tag, use a factory to reference the decryption method, and drop your jdbc jar and decryption jar in the tomcat lib folder.
https://stackoverflow.com/a/48179892

Re: Alternative for properties like javax.net.ssl.trustStorePassword ...

<ts0c35$74ft$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=222&group=comp.lang.java.programmer#222

  copy link   Newsgroups: comp.lang.java.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: da.futt.news@laposte-dot-net.invalid (Daniele Futtorovic)
Newsgroups: comp.lang.java.programmer
Subject: Re: Alternative for properties like javax.net.ssl.trustStorePassword
...
Date: Wed, 8 Feb 2023 15:37:25 +0100
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <ts0c35$74ft$1@dont-email.me>
References: <slrntt5jd0.pa7s.avl@logic.at>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 8 Feb 2023 14:37:25 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="297522a9eec62b418f5e6ca34118f825";
logging-data="233981"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18YSInCziuHlRKexJ01PSN9"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:mI7eX/qx9N7NK+RXWSMFen0zSRg=
Content-Language: en-US
In-Reply-To: <slrntt5jd0.pa7s.avl@logic.at>
 by: Daniele Futtorovic - Wed, 8 Feb 2023 14:37 UTC

On 26/01/2023 19:59, Andreas Leitgeb wrote:
> If some java appliation is supposed to use a trustStore, then apparently
> all hits on google for the obvious words will suggest to start the application
> with an option "-Djavax.net.ssl.trustStorePassword=..." passed to the java
> executable...
>
> Assuming I do not want everyone on the machine to see the password in clear
> text in the "ps -ef" output, what would be "safer" alternatives?
>
> The most obvious one might be to set the property from my own code, (after
> reading the pw from a file that not everyone on the machine has access to)
> but my code comes too late: some beans already got initialized and didn't
> see the property, before the program gets to set the properties. --
> I'm not a master of beans... maybe I could just add another bean that
> would do the "setProperty" as a sideeffect just in time before the other
> bean needs the property... haven't thought this through, yet.
>
> Maybe I'm still in the stone-age, and there is already some new property that
> would allow me to just specify another file holding the relevant passwords,
> or something else?
>
> Any ideas? Is passing a password as argument to a process nothing to worry
> about?
>

A password in the clear, stored somewhere on disk, is always something
to worry about.

But I think the only way to solve the conundrum is to leverage the OS
and, more precisely, its user management.

Make the truststore file readable to the Tomcat user (and su) only. Then
you could perhaps even dispense with a password on the TS (although it'd
probably better not to).

Or leverage some kind of secure storage that's freely accessible to the
user, but to the user only, to retrieve the password (be it a mere file
or a cryptographically-secured safe).

I don't know of any other way. There might be some. I somewhat doubt it.
Security is easy once you're in it. Bootstrapping it, is a can of worms.

> The tomcat-config is already readable only by the user running it,
> which would be a huge advantage to current state where the password
> shows up in process list visible even for other users.

Well, there you go.

This
<https://www.cyberciti.biz/faq/linux-hide-processes-from-other-users/>
seems possibly relevant, too.

--
DF.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor