stop passing passphrases via args, instead use prepared files

Any process can read the process table, and can therefore see the entire
command line of any other process.  That means its a bad idea to ever put
passwords as part of a command line.  Python is executing keytool and
jarsigner command lines here, so now instead of putting the password on the
command line, a file is passed instead with suitable file permissions.
This should reduce the exposure a lot.  But still, sensitive passwords
should not be written to any text file.

This change requires OpenJDK-7 since the :file option to -storepass and
-keypass was only added in Java 7's keytool and jarsigner.
This commit is contained in:
Hans-Christoph Steiner 2014-03-31 21:02:42 -04:00
parent caa88ec388
commit 525759b235
5 changed files with 39 additions and 13 deletions

View file

@ -642,7 +642,7 @@ def make_index(apps, apks, repodir, archive, categories):
p = FDroidPopen(['keytool', '-exportcert',
'-alias', config['repo_keyalias'],
'-keystore', config['keystore'],
'-storepass', config['keystorepass']])
'-storepass:file', config['keystorepassfile']])
if p.returncode != 0:
logging.critical("Failed to get repo pubkey")
sys.exit(1)
@ -796,7 +796,8 @@ def make_index(apps, apks, repodir, archive, categories):
# Sign the index...
p = FDroidPopen(['jarsigner', '-keystore', config['keystore'],
'-storepass', config['keystorepass'], '-keypass', config['keypass'],
'-storepass:file', config['keystorepassfile'],
'-keypass:file', config['keypassfile'],
'-digestalg', 'SHA1', '-sigalg', 'MD5withRSA',
os.path.join(repodir, 'index.jar') , config['repo_keyalias']])
if p.returncode != 0: