Displaying 14 results from an estimated 14 matches for "unixtimestamp".
2017 Feb 07
3
How to get password expiration?
figured out how to use ldapsearch also to get what I want.
Also found how to convert AD time to unix time
Another thing I wanted calculated was when an account expires.
ldapsearch -h ad.mydomain.tld -b dc=ad,dc=mydomain,dc=tld
"(sAMAccountName=$user)"
gives all the good information about a user.
here is how I used it to tell me all accounts expiring this next month.
h=ad.mydomain.tld
2017 Feb 08
4
Users list and the date the password will expire
...=`wbinfo -u`
basedn="OU=*,DC=*,DC=*,DC=*"
for user in $user_list; do
set_date=`ldbsearch -H /usr/local/samba/private/sam.ldb -s sub
-b $basedn cn=$user | grep pwdLastSet | tr -dc '0-9'`
if [ $set_date ] && [ $set_date -gt 1 ]; then
UNIXTimeStamp=$((($set_date/10000000)-11644473600))
then_sec=`date -d "1970-01-01 $UNIXTimeStamp sec GMT" +%s`
now_sec=`date +%s`
diff_days=$(( ( $now_sec - $then_sec )/60/60/24 ))
exp_days=$(( $max_pwAge - $diff_days ))...
2017 Feb 08
3
Users list and the date the password will expire
...; > for user in $user_list; do
> >
> > set_date=`ldbsearch -H /usr/local/samba/private/sam.ldb -s
> > sub -b $basedn cn=$user | grep pwdLastSet | tr -dc '0-9'`
> >
> > if [ $set_date ] && [ $set_date -gt 1 ]; then
> >
> > UNIXTimeStamp=$((($set_date/10000000)-11644473600))
> > then_sec=`date -d "1970-01-01 $UNIXTimeStamp sec
> > GMT" +%s`
> > now_sec=`date +%s`
> > diff_days=$(( ( $now_sec - $then_sec )/60/60/24 ))
> > exp_days...
2017 Feb 07
0
How to get password expiration?
...] && [ "$days" -gt 0 ];then
>> > echo $user expires in $days days
>> > fi
>> > fi
>> > done
>>
>> Hmm, accountExpires != msDS-UserPasswordExpiryTimeComputed
>>
>> And from my internet investigations:
>>
>> unixtimestamp=$((($WindowsTimeStamp/10000000)-11676009600))
>>
>> $WindowsTimeStamp/10000000
> is equal to
> ${WindowsTimeStamp::-7}
> I don't know what is a more expensive operation catting a string or
> division(I guessed division was a more expensive operation).
>
> 116760096...
2017 Feb 09
5
Users list and the date the password will expire
On Thu, 9 Feb 2017 12:49:12 +0100
Ole Traupe via samba <samba at lists.samba.org> wrote:
> Never mind. However, with your update I get the following error right
> on the first found "user":
>
> ./mailtest_rowland.sh: line 27: (""/10000000)-11644473600: syntax
> error: operand expected (error token is """/10000000)-11644473600")
>
2017 Feb 09
3
Users list and the date the password will expire
...uot;${LDBDB}" -b "${domainDN}" -s sub "(&(objectCategory=person)(objectClass=user)(sAMAccountName=$user))" msDS-UserPasswordExpiryTimeComputed | grep "msDS-UserPasswordExpiryTimeComputed: " | sed "s|msDS-UserPasswordExpiryTimeComputed: ||")
> UNIXTimeStamp=$((("${user_expire_date}"/10000000)-11644473600))
> date_now=$(date +%s)
> exp_days=$((("${UNIXTimeStamp}" - "${date_now}") / 3600 / 24))
> if [ "${exp_days}" -le "0" ]; then
> mail_string=$(ldbsearch --url="...
2017 Feb 08
0
Users list and the date the password will expire
...quot;OU=*,DC=*,DC=*,DC=*"
>
> for user in $user_list; do
>
> set_date=`ldbsearch -H /usr/local/samba/private/sam.ldb -s sub
> -b $basedn cn=$user | grep pwdLastSet | tr -dc '0-9'`
>
> if [ $set_date ] && [ $set_date -gt 1 ]; then
>
> UNIXTimeStamp=$((($set_date/10000000)-11644473600))
> then_sec=`date -d "1970-01-01 $UNIXTimeStamp sec GMT"
> +%s`
> now_sec=`date +%s`
> diff_days=$(( ( $now_sec - $then_sec )/60/60/24 ))
> exp_days=$(( $max_pwAge - $diff_...
2017 Feb 09
0
Users list and the date the password will expire
...r_list; do
>>>
>>> set_date=`ldbsearch -H /usr/local/samba/private/sam.ldb -s
>>> sub -b $basedn cn=$user | grep pwdLastSet | tr -dc '0-9'`
>>>
>>> if [ $set_date ] && [ $set_date -gt 1 ]; then
>>>
>>> UNIXTimeStamp=$((($set_date/10000000)-11644473600))
>>> then_sec=`date -d "1970-01-01 $UNIXTimeStamp sec
>>> GMT" +%s`
>>> now_sec=`date +%s`
>>> diff_days=$(( ( $now_sec - $then_sec )/60/60/24 ))
>>>...
2017 Feb 09
0
Users list and the date the password will expire
...url="${LDBDB}" -b "${domainDN}" -s sub "(&(objectCategory=person)(objectClass=user)(sAMAccountName=$user))" msDS-UserPasswordExpiryTimeComputed | grep "msDS-UserPasswordExpiryTimeComputed: " | sed "s|msDS-UserPasswordExpiryTimeComputed: ||")
UNIXTimeStamp=$((("${user_expire_date}"/10000000)-11644473600))
date_now=$(date +%s)
exp_days=$((("${UNIXTimeStamp}" - "${date_now}") / 3600 / 24))
if [ "${exp_days}" -le "0" ]; then
mail_string=$(ldbsearch --url="${LDBDB}" -b "...
2017 Feb 09
1
Users list and the date the password will expire
On 02/09/2017 11:25 AM, Ole Traupe via samba wrote:
> Exactly, and got reminded that I don't have to grep anything but can ask
> for specific parameters. Been a while that I used ldbsearch. ;)
>
So there will be an updated version of your script? :-)
Your script is something we could use as well, appreciated!
MJ
2017 Feb 09
0
Users list and the date the password will expire
...t;> -s sub
>> "(&(objectCategory=person)(objectClass=user)(sAMAccountName=$user))"
>> msDS-UserPasswordExpiryTimeComputed | grep
>> "msDS-UserPasswordExpiryTimeComputed: " | sed
>> "s|msDS-UserPasswordExpiryTimeComputed: ||")
>> UNIXTimeStamp=$((("${user_expire_date}"/10000000)-11644473600))
>> date_now=$(date +%s)
>> exp_days=$((("${UNIXTimeStamp}" - "${date_now}") / 3600 / 24))
>> if [ "${exp_days}" -le "0" ]; then
>> mail_string=$(ldbsea...
2017 Feb 09
0
Users list and the date the password will expire
...quot;${LDBDB}" -b "${domainDN}" -s
sub "(&(objectCategory=person)(objectClass=user)(sAMAccountName=$user))"
msDS-UserPasswordExpiryTimeComputed | grep
"msDS-UserPasswordExpiryTimeComputed: " | sed
"s|msDS-UserPasswordExpiryTimeComputed: ||")
UNIXTimeStamp=$(((${user_expire_date}/10000000)-11644473600))
date_now=$(date +%s)
exp_days=$(((${UNIXTimeStamp} - ${date_now}) / 3600 / 24))
With the 'awk' the user is empty. Querying $user before the awk shows
the correct user name without "DOMAIN\". This line seems not to be
nec...
2017 Feb 09
2
Users list and the date the password will expire
...{domainDN}" -s
> sub
> "(&(objectCategory=person)(objectClass=user)(sAMAccountName=$user))"
> msDS-UserPasswordExpiryTimeComputed | grep
> "msDS-UserPasswordExpiryTimeComputed: " | sed
> "s|msDS-UserPasswordExpiryTimeComputed: ||")
> UNIXTimeStamp=$(((${user_expire_date}/10000000)-11644473600))
> date_now=$(date +%s)
> exp_days=$(((${UNIXTimeStamp} - ${date_now}) / 3600 / 24))
>
> With the 'awk' the user is empty. Querying $user before the awk shows
> the correct user name without "DOMAIN\". This lin...
2007 Apr 02
0
automonitor and CDR(userfiled)
...,Set(DYNAMIC_FETAURES=automon)
exten => 100,n,Set(TOUCH_MONITOR_FORMAT=wav:monitor)
exten => 100,n,Set(TOUCH_MONITOR=${CALLERID}-${EXTEN})
exten => 100,n,Dial(SIP/100,,tw)
and in that case (of incoming calls) everything is great and my CDR
has userfiled set to something like
monitor/auto-{UNIXTIMESTAMP}-${TOUCH_MONITOR}.wav
Poblem is of outgoing calls:
I use SIP phones so I have set in sip.conf:
[101]
...
...
setvar=DYNAMIC_FEATURES=automon
...
...
and in dial plan:
[interenational]
exten => _9x.,1,Dial(Zap/g1/${EXTEN:1},,TWM(setautomon^${CALLERID}^${EXTEN:1})
Macro "setutomon"...