38 Commits

Author SHA1 Message Date
bapt
7a94803fa4 MFC: r287580
Remove extra debug that crept in
2015-09-15 05:56:16 +00:00
bapt
07bd68bf9d MFC: r287579
Implement pubkey support for the bootstrap

Note that to not interfer with finger print it expects a signature on pkg itself
which is named pkg.txz.pubkeysign

To genrate it:
echo -n "$(sha256 -q pkg.txz)" | openssl dgst -sha256 -sign /thekey \
    -binary -out ./pkg.txz.pubkeysig

Note the "echo -n" which prevent signing the '\n' one would get otherwise

PR:		202622
2015-09-15 05:46:55 +00:00
delphij
99883f69b1 Instant-MFC r286933:
Issue warning and refuse to proceed further if the configured
repository signature_type is unsupported by bootstrap pkg(7).

Previously, when signature_type specified an unsupported method,
the bootstrap pkg(7) would proceed like when signature_type is
"none".  MITM attackers may be able to use this vulnerability and
bypass validation and install their own versions of pkg(8).

At this time, only fingerprint and none are supported by the
bootstrap pkg(7).

FreeBSD's official pkg(8) repository uses the fingerprint method
and is therefore unaffected.

Errata candidate.
2015-08-19 18:32:36 +00:00
bapt
0479e26254 MFC: r281039
Allow fetching pkg(8) even if servers/proxies are not passing Content-length
2015-05-30 21:49:18 +00:00
bapt
051d0fa6db MFC: r259773, r259774, r259775
Do not print a question in non-interractive mode but explain why boostrapping
has failed and how to allow it to happen

Reported by:	jmmv
2015-05-30 21:32:02 +00:00
bapt
b5d16437e1 MFC: r258226
argc is now used
2015-05-30 21:28:55 +00:00
bapt
0f4e3f90c5 MFC: r258020 (by bdrewery)
Remove useless checks for NULL pointer before free(3)

Reported by:		eadler
Approved by:		eadler
2015-05-30 21:25:32 +00:00
bapt
644eb326fc MFC: r257701 (by bdrewery)
Remove condition which can never be true as the previous loop
is never exited while remote == NULL.
2015-05-30 21:23:41 +00:00
bapt
a0d89550fe MFC: r278173
Test the return of fetchParseURL(3)

CID:		1125811
2015-02-11 08:20:07 +00:00
bapt
1e06417cb0 MFC: r278172
Plug resources leak

  CID:          1125813
  CID:          1125807
  CID:          1125808
2015-02-11 08:07:32 +00:00
gavin
9a525ec03f Merge r268728 from head:
When we fail to extract the pkg binaries (for example, / is read-only),
  give a more helpful error message.
2014-08-13 12:44:44 +00:00
bapt
6f718e3669 MFC: r263648, r264789, r266636
This brings:
- schema validation
- xpath-like interface for ucl objects

Adapt pkg(7) to the new libucl API
2014-07-19 23:44:57 +00:00
bapt
cc2de0e857 r262400,r262401,r262418
Sync pkg(7) with head
2014-03-11 13:16:03 +00:00
gjb
b7e8f6268b MFC r258550:
Do not create pkg.conf, as it is not necessary anymore
  and packagesite is deprecated

Approved by:	re (glebius)
Sponsored by:	The FreeBSD Foundation
2013-11-30 17:33:49 +00:00
glebius
0daddca6bd Merge r257945 from head:
Do not use just freed memory.

Approved by:	re (kib)
2013-11-14 09:26:52 +00:00
bdrewery
8ca6127d10 MFC r257505:
Add -f support to 'pkg bootstrap' and 'pkg add' to force installation
  of pkg(8) even if already installed.

  This is useful if you somehow messup pkg(8) and need to reinstall from
  remote with it already being registered in the pkg(8) /var/db/pkg database.

  Also add some sanity checks to 'pkg add'.

Approved by:	bapt
Approved by:	re (glebius)
2013-11-04 13:01:29 +00:00
bdrewery
eb6fbdd1a6 MFC r257377:
Add a 'pkg bootstrap' command which will bootstrap pkg(8) without
  forwarding any command to it after installation.

Approved by:	bapt
Approved by:	re (gjb)
2013-11-03 12:58:14 +00:00
bdrewery
7046958142 MFC: r256770,r257142,r257145,r257146,r257147,r257148,
r257149,r257150,r257158,r257159,r257164,r257168,
     r257193

  - Support checking signature for pkg bootstrap from remote
    and for 'pkg add ./pkg.txz'

  - Be verbose on where pkg is being bootstrapped from.

  - Add support for reading configuration files from /etc/pkg.
    For now only /etc/pkg/FreeBSD.conf is supported.

  - Add test package signing key fingerprint into /etc/keys/pkg/trusted.

  - Disable fingerprint checking by default for now as the official
    packages are not yet signed.

Approved by:	bapt
Approved by:	re (glebius)
2013-10-29 18:36:44 +00:00
bdrewery
b8f1640fa0 MFC r257051:
Add support for using "pkg+http://" for the PACKAGESITE.

  pkg 1.2 is adding this support as well. This should help
  lessen the confusion on why the default SRV PACKAGESITE
  does not load in a browser.

Approved by:	bapt
Approved by:	re (glebius)
2013-10-29 12:25:22 +00:00
bapt
22acce6ad4 MFC: r256968, r256971, r256978
Improve SRV records support for the pkg(8) bootstrap:
- order srv records by priorities
- for all entries of the same priority, order randomly respect the weight
- select the port where to fetch from respect the port provided in the SRV
record

Allow to bootstrap by doing pkg add ./a/path/to/a/pkg_package.txz

Approved by:	re (glebius)
2013-10-29 07:33:53 +00:00
bapt
6438218c14 Fix bootstrapping pkgng by not appending "/latest/" to PACKAGESITE.
Reporter by :	Alexander Yerenkow (via irc)
2013-03-08 10:43:03 +00:00
bapt
94bcfee7d0 Add the ability to correctly read pkg.conf is exists.
Only look for boostrap useful options:
 - PACKAGESITE
 - ABI
 - MIRROR_TYPE
 - ASSUME_ALWAYS_YES

While here makes PACKAGESITE expand the ${ABI} variable.
Allow to deactivate any SRV record look up (MIRROR_TYPE=none)
Use the same mechanism as for pkgng itself: first get configuration out of
environment variable and fallback on pkg.conf if exists.

Reviewed by:	bdrewery
2013-03-05 13:31:06 +00:00
bapt
f4e406048b Do not use deprecated functions from libarchive 2013-02-20 22:51:42 +00:00
bapt
efbce5fcea In case of failure of the pkg boostrap advice the user to either change the
PACKAGESITE they use or install from ports directly indicating where the port
is localted in the port collection

Submitted by:	kientzle
2013-02-14 12:42:09 +00:00
matthew
7653472013 Remove extraneous space and new-line.
Submitted by:	pjd, gcooper
Approved by:	bapt
MFC after:	2 weeks
2012-12-23 20:39:03 +00:00
matthew
2fa689448c Third time's the charm. pkg -N output needs to go to stderr.
Approved by:	bapt
MFC after:	2 weeks
2012-12-23 11:22:18 +00:00
matthew
45679ebc7b Switch from 'pkg -n' to 'pkg -N' as the test for pkgn activation
status. '-n' is already used extensively elsewhere in pkgng (to mean
'dry-run') and this reduces the potential confusion

Submitted by:	eadler
Approved by:	bapt
MFC after:	2 weeks
2012-12-22 15:13:16 +00:00
matthew
0a2c07efd7 In preparation for making 'pkg -n' the one true method of determining
whether a system has been configured to use pkgng, cause /usr/sbin/pkg
recognise a -n option and exit with a failure code when the pkg port
is not installed.

Approved by:	bapt
MFC after:	2 weeks
2012-12-21 20:01:13 +00:00
bapt
aa139cc58e if PACKAGESITE url scheme is not 'file://', always try to revolv SRV records and
use them if any. It allows the bootstrap to use directly pkg.FreeBSD.org instead
of pkgbeta.FreeBSD.org

MFC after:	1 month
2012-12-05 11:35:50 +00:00
bapt
160bf30663 Fix confirmation logic when detecting a tty
Reported by:	mjg
2012-08-24 21:45:52 +00:00
bapt
c01de85820 - change ALWAYS_ASSUME_YES to ASSUME_ALWAYS_YES for consistency with pkg(8)
- if not on a tty prompt about the missing pkg(8) but default on 'no' except if
  ASSUME_ALWAYS_YES is set

MFC after:	2 days
2012-08-24 21:08:56 +00:00
kan
ee2618962b Make pkg bootstrap program ask for confirmation before proceeding.
The previous behaviour was to silently download and install the pkg
package, without ever telling user about what it was doing and why.

Discussed with:	bapt
Reviewed by: kib
2012-07-15 04:15:27 +00:00
bapt
f165b50eeb Add missing \n when generating pkg.conf
Reported by:	beat
Approved by:	des (mentor)
MFC after:	1 day
2012-05-21 15:45:18 +00:00
bapt
8f1960d6cc - close the open file after fetching
- create a default /usr/local/etc/pkg.conf

Approved by:	des (mentor)
2012-05-01 10:16:12 +00:00
bapt
10552859c1 - Use _PATH_TMP instead of hardcoded /tmp
- more style(9) fixes
- some refactoring
- better error detection
- Add the DPADD to Makefile

Submitted by:	Garrett Cooper <yanegomi@gmail.com>
Approved by:	des (mentor)
2012-04-16 20:41:25 +00:00
bapt
c8f7bbe987 - Fix style(9) bugs + inconsistencies
Submitted by:	marius
Approved by:	des (mentor)
2012-04-15 18:32:14 +00:00
bapt
008e190698 Do not do double initialisation
style(9) says for (;;) not while (1)

Reported by:	culot
Approved by:	des
2012-04-15 16:00:32 +00:00
bapt
d1d7ab95bb add usr.sbin/pkg which is a bootstrap tool for pkgng.
it respects PACKAGESITE, PACKAGEROOT, and a new environment variable ABI (if a user want to use a different API from the base one for its packages)
it has no man page on purpose to avoid hidding the pkg(8) man page from the pkgng package.
for now uses pkgbeta.FreeBSD.org as default mirror to find its package
it respects MK_PKGTOOLS

Approved by:	des (mentor)
2012-04-15 15:13:36 +00:00