You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Thomas <Th...@t-online.de> on 2013/05/09 12:02:18 UTC
Native authentication and password expiry date
Hi,
is there a way to find out when the password of the user logged in will
expire so an application can display a message like "Your password will
expire in x days. Do you want to change it now?"
Thanks
Re: Native authentication and password expiry date
Posted by Rick Hillegas <ri...@oracle.com>.
On 5/20/13 5:21 AM, Thomas wrote:
> Rick Hillegas<ri...@...> writes:
>
> I am running the 10.9.1.0 server using the basic security manager with the
> default security policy settings.
>
> Trying to inspect the system property settings from a stored procedure which
> includes using java.lang.System.getProperty() I am getting:
>
> Error: The exception 'java.security.AccessControlException: access denied
> ("java.util.PropertyPermission"
> "derby.authentication.native.passwordLifetimeMillis" "read")' was thrown
> while evaluating an expression.
> SQLState: 38000
> ErrorCode: -1
> Error: Java exception: 'access denied ("java.util.PropertyPermission"
> "derby.authentication.native.passwordLifetimeMillis" "read"):
> java.security.AccessControlException'.
> SQLState: XJ001
> ErrorCode: 99999
>
> I tried adding the line
> permission java.util.PropertyPermission "java.lang.System.getProperty",
> "read";
> to the security.policy file and restarted the server, but I am still getting
> the same error.
>
> Can someone please advise which addition/change to security.policy is
> exactely needed to prevent the error message? Would also be interested in
> getting a hint on security risk behind that I should consider prior to
> making that change? (if there would be none, I would suspect reading the
> system properties would be possible using the dafult configuration).
>
> Many thanks in advance.
>
>
Hi Thomas,
The grammar of permissions descriptors can be confusing. You may want to
take a look at the template policy file which ships with Derby and at
the section titled "Running Derby under a security manager" in the
Developer's Guide:
http://db.apache.org/derby/docs/10.10/devguide/index.html.
You will want to grant your application jars the following minimal
permission:
permission java.util.PropertyPermission
"derby.authentication.native.passwordLifetimeMillis", "read";
...and if you need to read other Derby properties, you may want to
broaden this permission to:
permission java.util.PropertyPermission "derby.*", "read";
I don't see much security risk in letting your application read the
Derby properties. Certainly not much risk in reading the password
timeout property. The only security-sensitive Derby properties are the
credentials properties used by the deprecated BUILTIN authentication scheme.
Hope this helps,
-Rick
Re: Native authentication and password expiry date
Posted by Thomas <th...@t-online.de>.
Rick Hillegas <ri...@...> writes:
I am running the 10.9.1.0 server using the basic security manager with the
default security policy settings.
Trying to inspect the system property settings from a stored procedure which
includes using java.lang.System.getProperty() I am getting:
Error: The exception 'java.security.AccessControlException: access denied
("java.util.PropertyPermission"
"derby.authentication.native.passwordLifetimeMillis" "read")' was thrown
while evaluating an expression.
SQLState: 38000
ErrorCode: -1
Error: Java exception: 'access denied ("java.util.PropertyPermission"
"derby.authentication.native.passwordLifetimeMillis" "read"):
java.security.AccessControlException'.
SQLState: XJ001
ErrorCode: 99999
I tried adding the line
permission java.util.PropertyPermission "java.lang.System.getProperty",
"read";
to the security.policy file and restarted the server, but I am still getting
the same error.
Can someone please advise which addition/change to security.policy is
exactely needed to prevent the error message? Would also be interested in
getting a hint on security risk behind that I should consider prior to
making that change? (if there would be none, I would suspect reading the
system properties would be possible using the dafult configuration).
Many thanks in advance.
Re: Native authentication and password expiry date
Posted by Rick Hillegas <ri...@oracle.com>.
On 5/9/13 6:47 AM, Thomas wrote:
> Hi Rick,
>
> thanks for pointing me to the lastmodified column on the sysusers table.
> I think your query tells me how many days ago the password has been changed.
> So would I need to compare this to the property
> derby.authentication.native.passwordLifetimeMillis
> to get to know the remaining days?
>
> In my installation I have not changed this property which by default I
> understand is a system-wide property set to 31 days.
>
> Is there a system function which allows me to retrieve the value of a
> system-wide property?
>
> as I think the approach needed might be to first check if the default of the
> property has been changed at database level by executing
> SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY
> ('derby.authentication.native.passwordLifetimeMillis');
> If this returns null (what it does in my installation) I know the property
> is set at system level. But how do I then retrieve the value of a system
> property? I have not found a system procedure for this.
Hi Thomas,
Derby properties can be specified as system properties, in
derby.properties, or in the database. The way that these three property
sets interact can be confusing. I have created a JIRA for providing a
way for users to see what Derby thinks a property has been set to:
https://issues.apache.org/jira/browse/DERBY-6220
Here's how you manually inspect these three property sets:
o system properties - Use java.lang.System.getProperty()
o derby.properties - Use java.util.Properties.load()
o database properties - Use syscs_util.syscs_get_database_property()
Hope this helps,
-Rick
> Thanks for looking into this again.
>
> Kind regards
> Thomas
>
>
>
>
>
Re: Native authentication and password expiry date
Posted by Thomas <Th...@t-online.de>.
Hi Rick,
thanks for pointing me to the lastmodified column on the sysusers table.
I think your query tells me how many days ago the password has been changed.
So would I need to compare this to the property
derby.authentication.native.passwordLifetimeMillis
to get to know the remaining days?
In my installation I have not changed this property which by default I
understand is a system-wide property set to 31 days.
Is there a system function which allows me to retrieve the value of a
system-wide property?
as I think the approach needed might be to first check if the default of the
property has been changed at database level by executing
SYSCS_UTIL.SYSCS_GET_DATABASE_PROPERTY
('derby.authentication.native.passwordLifetimeMillis');
If this returns null (what it does in my installation) I know the property
is set at system level. But how do I then retrieve the value of a system
property? I have not found a system procedure for this.
Thanks for looking into this again.
Kind regards
Thomas
Re: Native authentication and password expiry date
Posted by Rick Hillegas <ri...@oracle.com>.
On 5/9/13 3:02 AM, Thomas wrote:
> Hi,
>
> is there a way to find out when the password of the user logged in will
> expire so an application can display a message like "Your password will
> expire in x days. Do you want to change it now?"
>
> Thanks
>
>
Hi Thomas,
The following query shows how many days remain in the lifetimes of
NATIVE passwords:
select username, { fn timestampdiff( sql_tsi_day, current_timestamp,
lastmodified ) }
from sys.sysusers
order by username;
The JDBC escape syntax for timestamp arithmetic (the bracketed bits) is
documented in the Reference Guide in the section titled "JDBC escape
syntax for fn keyword".
Hope this helps,
-Rick