Commit Graph

29 Commits

Author SHA1 Message Date
Hans-Christoph Steiner b92e280eab fix code format for new black rule 2023-03-20 14:47:48 +01:00
Hans-Christoph Steiner 0c9f62a5fe signindex: add JSON check for entry.json
Ran this to generate/refresh the test index files:
`cd tests; ../fdroid update --nosign --pretty`

* converts config.py description to a single line, since the values are no
  longer stripped, so this give the same output.

closes #835
2023-02-17 14:34:53 +00:00
Jochen Sprickerhof 0549535bab
signindex: fix buster workaround
Don't try to remove arg if the old args where used.
2022-11-14 17:59:56 +01:00
Jochen Sprickerhof cf228d35a3 Work around old apksigner on f-droid.org publish server 2022-09-20 13:58:41 +00:00
Hans-Christoph Steiner 3182b77d18
use apksigner to sign index-v2 with modern, supported algorithms
The current signing method uses apksigner to sign the JAR so that it
will automatically select algorithms that are compatible with Android
SDK 23, which added the most recent algorithms:
https://developer.android.com/reference/java/security/Signature

This signing method uses then inherits the default signing algothim
settings, since Java and Android both maintain those.  That helps
avoid a repeat of being stuck on an old signing algorithm.  That means
specifically that this call to apksigner does not specify any of the
algorithms.

The old indexes must be signed by SHA1withRSA otherwise they will no
longer be compatible with old Androids.

apksigner 30.0.0+ is available in Debian/bullseye, Debian/buster-backports,
Ubuntu 21.10, and Ubuntu 20.04 from the fdroid PPA.  Here's a quick way to
test:

for f in `ls -1 /opt/android-sdk/build-tools/*/apksigner | sort ` /usr/bin/apksigner; do printf "$f : "; $f sign --v4-signing-enabled false; done

closes #1005
2022-06-07 16:56:23 +02:00
Jochen Sprickerhof d70e5c2cd9 Index v2 2022-05-23 10:39:17 +00:00
Hans-Christoph Steiner 73c31e6e63
signindex: do not remove index-v1.json after signing
With ~index-v2, the model is changing to offer the plain JSON file for easy
consumption.  Then gpgsign will also provide a detached PGP signature for
systems that would rather verify based on PGP signatures than JAR signatures.

!1080
closes #969
2022-05-17 15:38:06 +02:00
Jochen Sprickerhof d05bcafe14 Test index before signing 2022-04-25 22:26:59 +02:00
Hans-Christoph Steiner 307cf8958c
run black to reformat code that does not have WIP merge requests 2021-06-28 18:57:56 +02:00
Benedikt Brückmann 1e943a22df rewrite docstrings to match numpy style guide 2021-06-25 06:28:47 +02:00
Hans-Christoph Steiner 08cde5c2e6 code formatting: black --skip-string-normalization --line-length 100 2021-03-22 18:16:34 +01:00
Hans-Christoph Steiner fede58a710 use ArgumentParser's own "usage" line in help output 2020-10-01 23:01:55 +02:00
Marcus Hoffmann 004d13a48a make publish and update work with a smartcard HSM
Followup to fdroid/fdroidserver!779.

We need to add smartcardoptions to every call to keytool and jarsigner
as well as handle when keypass not being required and not allowed for
pkcs11 keystores.
2020-08-14 17:27:58 +02:00
Hans-Christoph Steiner 55935d9a41
signindex: write status JSON 2020-02-19 14:50:30 +01:00
Hans-Christoph Steiner 278d67d960 implement gettext localization
This allows all the text to be localized via Weblate.  This is a quick
overview of all the strings, but there are certainly some that were left
out.

closes #342
2017-09-15 11:39:00 +02:00
Torsten Grote 1fcd8e63a3
Replace sys.exit() in non-main functions by exceptions
Also move all exceptions into one module
2017-05-22 16:51:11 -03:00
Torsten Grote 4d25113fa0
Eliminate the need for password files
The passwords are now passed as private environment variables to the
processes that need them.
2017-04-11 16:34:49 -03:00
Torsten Grote 9f765ed6f7
Move index signing methods into signindex.py 2017-03-29 12:11:40 -03:00
Hans-Christoph Steiner 866528de5b signindex: support signing index-v1.jar
This is a bit different than index.jar: instead of their being index.xml
and index_unsigned.jar, the presense of index-v1.json means that there is
unsigned data.  That file is then stuck into a jar and signed by the
signing process.  index-v1.json is never published to the repo.  It is
included in the binary transparency log, if that is enabled.
2017-03-17 14:12:03 +01:00
Hans-Christoph Steiner fa657ce720 move update.signjar() to common so it can also be used in signindex 2017-03-17 13:55:40 +01:00
Daniel Martí 82b1d7ad14 all: make newer pycodestyle happy
Apparently the "two empty lines" rule is now stricter.
2016-11-15 20:55:06 +00:00
Daniel Martí 920ae4692f Port all imports to python3 2016-03-10 16:43:37 +00:00
Daniel Martí 99edd64372 Switch all headers to python3 2016-03-10 16:43:36 +00:00
Hans-Christoph Steiner 5780c14df2 fix PEP9 E713 test for membership should be 'not in' 2016-02-12 08:33:22 +01:00
Hans-Christoph Steiner 69c81c3817 use jarsigner and keytool from same JDK as is being set in JAVA7_HOME
Using the same JDK throughout should prevent weird bugs where a setup might
use Java8's jarsigner and Java7's keytool.  This also allows the user to
set java_paths and have jarsigner and keytool used from that specified JDK.

This incorporates almost all of the patch that is in the Debian package
that forces fdroidserver to use the default JDK on that Debian release.

closes #93 https://gitlab.com/fdroid/fdroidserver/issues/93
2016-02-11 21:17:23 +01:00
Daniel Martí d88914b466 Replace MD5withRSA with SHA1withRSA. Fixes #26.
Looks to me like we were using SHA1withRSA all along. Tested that everything
still works with a test repo.

As Hans reports, SHA1withRSA has been the default on Android tools for a long
time and it's supported on all Android versions.
2015-09-24 18:53:04 -07:00
Daniel Martí 576da1d048 all: deduplicate -v/-q setup 2015-09-11 23:42:50 -07:00
nero-tux d23ecf1b35 replace deprecated optparse with argparse
following guidelines from:
https://docs.python.org/2/library/argparse.html#upgrading-optparse-code
except, still using option = parse.parse_args() instead of args = ...

- using the following script in folder fdroidserver:
	for i in *.py; do
		sed -i -e 's/optparse/argparse/' \
			-e 's/OptionParser/ArgumentParser/' \
			-e 's/OptionError/ArgumentError/' \
			-e 's/add_option/add_argument/' \
			-e 's/(options, args) = parser/options = parser/' \
			-e 's/options, args = parser/options = parser/' \
			-e 's/Usage: %prog/%(prog)s/' $i;
	done
- use ArgumentParser argument to replace (option, args) = parser.parse()
  call
- use parser.error(msg) instead of raise ArgumentException as suggested
  in https://docs.python.org/2/library/argparse.html#exiting-methods
- in fdroid catch ArgumentError instead of OptionError
2015-09-06 10:34:50 +02:00
Ciaran Gultnieks ba177472da Add fdroid signindex to sign previously unsigned indexes 2015-01-11 08:20:14 +00:00