Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 30 Apr 2015 10:53:54 +0200
From: Frank Dittrich <frank.dittrich@...lbox.org>
To: john-dev@...ts.openwall.com
Subject: Re: [Johnny] Task 1.4.2 fork and OpenMP

On 04/30/2015 02:04 AM, Mathieu Laprise wrote:
> a) I could modify John (signal.c) to forward the sigterm signal to
> children. Cons: 1)is it a bug or the wished behaviour that sigterm on
> john main process doesn't kill the children on any sigterm/sigint ? 2)
> it'll only work for user with the latest version of john, which might be
> a big con.

IIRC, Shinnok asked you whether you use Windows, but you never mentioned
which OS you use.

Anyway, I tried sending certain signals to john processes started using
--fork.
For SIGINT, the expected behavior was that
$ kill -s INT <pid>
will cause the corressponding process to update the corresponding .rec
file (and I assume, .pot and .log) even if the "Crash recovery file
saving delay" specified in john.conf is not yet reached.
(BTW: I think SIGINT is not mentioned in the docs.)
This worked as expected.

But I must admit that kill -s TERM didn't work as I expected in
bleeding-jumbo, that's why I checked out master to see whether
bleeding-jumbo behaved differently than master or whether I was just
confused about the expected behavior.

After checking out master I built linux-x86-64-avx.
Then I started
(master)run $ ./john --fork=3 hashes.bcrypt
Loaded 14 password hashes with 6 different salts (bcrypt [Blowfish 32/64
X2])
Node numbers 1-3 of 3 (fork)
Press 'q' or Ctrl-C to abort, almost any other key for status
                 (?)
                 (?)


hashes.bcrypt contains all the bcrypt test hashes of bleeding-jumbo,
just the bare hashes, no user names, so there's nothing for single mode
to work with (as you'll see in john.log).

top showed my john processes:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+
COMMAND

 4401 fd        39  19   11864   2072   1788 R  93.1  0.0   0:06.38 john


 4402 fd        39  19   11864   1928   1644 R  93.1  0.0   0:06.37 john


 4403 fd        39  19   11864   1928   1644 R  93.1  0.0   0:06.37 john


This command
$ kill -s USR1 4401
caused the main process of the 3 john processes to print a status line:
1 2g 0:00:00:18 0% 2/3 0.1104g/s 100.5p/s 603.7c/s 1210C/s sunset..super

Similarly,
$ kill -s USR1 4403
$ kill -s USR1 4402
caused the other two processes to print status lines:
3 0g 0:00:00:21 4% 2/3 0g/s 105.6p/s 634.0c/s 1479C/s Bubbles1..Beatriz
2 0g 0:00:00:25 8% 2/3 0g/s 92.52p/s 555.1c/s 1295C/s sparkle1..kristina1

Finally, I tried
$ kill 4401
(or kill -s TERM 4401)


This caused the output of another status line and of the "Waiting for
..." line:
1 2g 0:00:00:29 1% 2/3 0.06738g/s 95.01p/s 570.4c/s 1142C/s abbott..acura
Waiting for 2 children to terminate

I would have expected that the main process would cause the other forked
processes to terminate, but that did never happen.
Instead, it is really just waiting, similar to what would be expected if
the main process finished all its work.

Some time later, the other 2 processes ran into

fopen: ./ascii.chr: No such file or directory
fopen: ./ascii.chr: No such file or directory
Use the "--show" option to display all of the cracked passwords reliably
Session aborted

This means, the other 2 processes advanced into incremental mode.
But checking out master had removed the .chr files, that's why the other
2 processes terminated.


john.log:

1 0:00:00:00 Starting a new session
1 0:00:00:00 Loaded a total of 14 password hashes with 6 different salts
1 0:00:00:00 - Node numbers 1-3 of 3 (fork)
1 0:00:00:00 - Hash type: bcrypt (lengths up to 72)
1 0:00:00:00 - Algorithm: Blowfish 32/64 X2
1 0:00:00:00 - Candidate passwords will be buffered and tried in chunks of 8
1 0:00:00:00 - Configured to use otherwise idle processor cycles only
1 0:00:00:00 Proceeding with "single crack" mode
1 0:00:00:00 - 1081 preprocessed word mangling rules
1 0:00:00:00 - Allocated 6 buffers of 8 candidate passwords each
1 0:00:00:00 Starting a new session
1 0:00:00:00 Loaded a total of 14 password hashes with 6 different salts
1 0:00:00:00 - Node numbers 1-3 of 3 (fork)
2 0:00:00:00 - Hash type: bcrypt (lengths up to 72)
2 0:00:00:00 - Algorithm: Blowfish 32/64 X2
2 0:00:00:00 - Candidate passwords will be buffered and tried in chunks of 8
2 0:00:00:00 - Configured to use otherwise idle processor cycles only
2 0:00:00:00 Proceeding with "single crack" mode
2 0:00:00:00 - 1081 preprocessed word mangling rules
2 0:00:00:00 - Allocated 6 buffers of 8 candidate passwords each
1 0:00:00:00 Starting a new session
1 0:00:00:00 Loaded a total of 14 password hashes with 6 different salts
1 0:00:00:00 - Node numbers 1-3 of 3 (fork)
3 0:00:00:00 - Hash type: bcrypt (lengths up to 72)
3 0:00:00:00 - Algorithm: Blowfish 32/64 X2
3 0:00:00:00 - Candidate passwords will be buffered and tried in chunks of 8
3 0:00:00:00 - Configured to use otherwise idle processor cycles only
3 0:00:00:00 Proceeding with "single crack" mode
3 0:00:00:00 - 1081 preprocessed word mangling rules
3 0:00:00:00 - Allocated 6 buffers of 8 candidate passwords each
2 0:00:00:00 - Rule #2: '-s x**' rejected
2 0:00:00:00 - Rule #5: '-s-c x** /?u l' rejected
2 0:00:00:00 - Rule #8: '-c >6 '6 /?u l' accepted as '>6'6/?ul'
2 0:00:00:00 - No information to base further candidate passwords on
2 0:00:00:00 - Processing the remaining buffered candidate passwords, if any
1 0:00:00:00 - Rule #1: ':' accepted as ''
1 0:00:00:00 - No information to base candidate passwords on
1 0:00:00:00 - Processing the remaining buffered candidate passwords, if any
3 0:00:00:00 - Rule #3: '-c (?a c Q' accepted as '(?acQ'
3 0:00:00:00 - No information to base further candidate passwords on
3 0:00:00:00 - Processing the remaining buffered candidate passwords, if any
2 0:00:00:00 Proceeding with wordlist mode
2 0:00:00:00 - Wordlist file: ./password.lst
2 0:00:00:00 - 57 preprocessed word mangling rules
3 0:00:00:00 Proceeding with wordlist mode
3 0:00:00:00 - Wordlist file: ./password.lst
3 0:00:00:00 - 57 preprocessed word mangling rules
1 0:00:00:00 Proceeding with wordlist mode
1 0:00:00:00 - Wordlist file: ./password.lst
1 0:00:00:00 - 57 preprocessed word mangling rules
1 0:00:00:00 - Will distribute rules across nodes
1 0:00:00:00 - Rule #1: ':' accepted as ''
1 0:00:00:00 + Cracked ?
1 0:00:00:00 + Cracked ?
2 0:00:00:00 - Will distribute rules across nodes
2 0:00:00:00 - Rule #2: '-c >3 !?X l Q' accepted as '>3!?XlQ'
2 0:00:00:01 - Rule #5: '<* >2 !?A l $1' accepted as '<*>2!?Al$1'
2 0:00:00:33 - Rule #8: '>3 !?A l M r Q' accepted as '>3!?AlMrQ'
2 0:00:00:59 - Rule #11: '<* >2 !?A l $2' accepted as '<*>2!?Al$2'
2 0:00:01:27 - Rule #14: '<* >2 !?A l $7' accepted as '<*>2!?Al$7'
2 0:00:01:54 - Rule #17: '<* >2 !?A l $4' accepted as '<*>2!?Al$4'
2 0:00:02:21 - Rule #20: '<* >2 !?A l $0' accepted as '<*>2!?Al$0'
2 0:00:02:48 - Rule #23: '/?p @?p >3 l' accepted as '/?p@...3l'
2 0:00:02:48 - Rule #26: '-c <7 >1 !?A c d' accepted as '<7>1!?Acd'
2 0:00:03:05 - Rule #29: '<7 >1 !?A l d M 'l f Q' accepted as
'<7>1!?AldM'lfQ'
2 0:00:03:22 - Rule #32: '>2 !?A l ^4' accepted as '>2!?Al^4'
2 0:00:03:50 - Rule #35: '-c <* >2 !?A c $3' accepted as '<*>2!?Ac$3'
2 0:00:04:17 - Rule #38: '-c <* >2 !?A c $7' accepted as '<*>2!?Ac$7'
2 0:00:04:44 - Rule #41: '-c <* >2 !?A c $8' accepted as '<*>2!?Ac$8'
2 0:00:05:11 - Rule #44: '-c <* >2 !?A c $0' accepted as '<*>2!?Ac$0'
2 0:00:05:38 - Rule #47: '>2 !?A l ^9' accepted as '>2!?Al^9'
2 0:00:06:06 - Rule #50: '>2 !?A l ^8' accepted as '>2!?Al^8'
2 0:00:06:33 - Rule #53: '-: <* >2 !?A l M I Q' accepted as '<*>2!?AlMIQ'
2 0:00:07:00 - Rule #56: '-s x**' rejected
2 0:00:07:00 Proceeding with "incremental" mode: ASCII
2 0:00:07:00 Terminating on error
3 0:00:00:00 - Will distribute rules across nodes
3 0:00:00:00 - Rule #3: '-c (?a >2 !?X c Q' accepted as '(?a>2!?XcQ'
3 0:00:00:30 - Rule #6: '-c <* >2 !?A c $1' accepted as '<*>2!?Ac$1'
3 0:00:00:57 - Rule #9: '>2 !?A l ^1' accepted as '>2!?Al^1'
3 0:00:01:24 - Rule #12: '<* >2 !?A l $!' accepted as '<*>2!?Al$!'
3 0:00:01:51 - Rule #15: '<* >2 !?A l $9' accepted as '<*>2!?Al$9'
3 0:00:02:18 - Rule #18: '<* >2 !?A l $8' accepted as '<*>2!?Al$8'
3 0:00:02:46 - Rule #21: '<* >2 !?A l $.' accepted as '<*>2!?Al$.'
3 0:00:03:13 - Rule #24: '/?v @?v >3 l' accepted as '/?v@...3l'
3 0:00:03:32 - Rule #27: '-c <+ >2 !?A c r' accepted as '<+>2!?Acr'
3 0:00:04:00 - Rule #30: '-c <+ >2 !?A l M r Q c r' accepted as
'<+>2!?AlMrQcr'
3 0:00:04:26 - Rule #33: '-c <* >2 !?A c $2' accepted as '<*>2!?Ac$2'
3 0:00:04:54 - Rule #36: '-c <* >2 !?A c $9' accepted as '<*>2!?Ac$9'
3 0:00:04:26 - Rule #33: '-c <* >2 !?A c $2' accepted as '<*>2!?Ac$2'
3 0:00:04:54 - Rule #36: '-c <* >2 !?A c $9' accepted as '<*>2!?Ac$9'
3 0:00:05:21 - Rule #39: '-c <* >2 !?A c $4' accepted as '<*>2!?Ac$4'
3 0:00:05:48 - Rule #42: '-c <* >2 !?A c $.' accepted as '<*>2!?Ac$.'
3 0:00:06:15 - Rule #45: '>2 !?A l ^3' accepted as '>2!?Al^3'
3 0:00:06:43 - Rule #48: '>2 !?A l ^5' accepted as '>2!?Al^5'
3 0:00:07:09 - Rule #51: '-c <* >2 !?A c p' accepted as '<*>2!?Acp'
3 0:00:07:33 - Rule #54: '-c <* >2 !?A c M P Q' accepted as '<*>2!?AcMPQ'
3 0:00:07:56 - Rule #57: '-s-c x** M l Q' rejected
3 0:00:07:56 Proceeding with "incremental" mode: ASCII
3 0:00:07:56 Terminating on error
1 0:00:00:29 Waiting for 2 children to terminate
1 0:00:07:56 Session aborted

Maybe we should add a log_flush() after writing the "Waiting for ..."
message to the log file.
As you see, it occurred more than 7 minutes earlier than those last
messages from the 3rd process.

When I resume john, the fist process continues with wordlist mode, the
other two immediately run into the missing .chr file:

$ ./john --restore
Loaded 13 password hashes with 6 different salts (bcrypt [Blowfish 32/64
X2])
Remaining 12 password hashes with 6 different salts
Node numbers 1-3 of 3 (fork)
Press 'q' or Ctrl-C to abort, almost any other key for status
fopen: ./ascii.chr: No such file or directory
fopen: ./ascii.chr: No such file or directory
1 2g 0:00:00:42 5% 2/3 0.04761g/s 108.0p/s 648.9c/s 1298C/s stuarts..sugars
1 2g 0:00:00:43 5% 2/3 0.04651g/s 108.6p/s 652.2c/s 1305C/s
bensons..bernardos
1 2g 0:00:00:44 5% 2/3 0.04545g/s 109.0p/s 654.8c/s 1310C/s
dutchesses..dwights
1 2g 0:00:00:54 6% 2/3 0.03703g/s 111.2p/s 667.8c/s 1336C/s
russells..sammies


Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ