1
0
mirror of https://github.com/coreos/ignition.git synced 2026-02-06 18:47:54 +01:00
Commit Graph

48 Commits

Author SHA1 Message Date
Steven Presti
2203687ef7 config/*: extend special bit validation logic to 3.4.0 and 3.5.0
Extend the warning to trigger on 3.4.0 and 3.5.0 when special
file mode bits are set.
2025-05-05 13:21:22 -04:00
Madhu Pillai
d078c9fe79 Support LUKS encryption using IBM CEX secure keys on s390x
Extend the `luks` schema to support a new `cex` key. When enabled, the
volume key of the LUKS device uses a secure key generated using a CEX
card. The keyfile to unlock the volume is not considered confidential.

Closes: #1693

Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
2024-05-13 12:25:21 -04:00
Steven Presti
b772e19557 config/v3_4_exp: add Tang offline provisioning support
Expand schema for 3_4_exp with an advertisement field to allow for
Ignition to support Tang offline provisioning by passing the supplied
advertisement field during first boot's device bind. Fixes #1474
2023-02-18 13:07:09 -05:00
Michael Armijo
2f63faa15b config/types/config: prevent files/links/dirs from conflicting with systemd units and dropins 2022-11-08 08:58:02 -05:00
Steven Presti
a8d088f39e storage.go: add filesystems validation warnings
Fixes #1397, a common configuration error is to create a filesystem over
a whole-disk device rather than a partition. Add a warning for a
filesystem device matching the disk device.

Additionally, another configuration error was identified for a way to
recreate the filesystem on every provision, while the configuration to
do so is valid, it might be done unitionally. Add a warning when
wipeTable is true but wipeFilesystem is false.
2022-10-25 15:59:19 -04:00
Benjamin Gilbert
6f00407849 config/*: warn if user/group specified for hard link
We don't try to apply a user/group to a hard link, since it would affect
the target instead.
2022-08-10 12:24:28 -04:00
Sohan Kunkerkar
38be4f1e18 config/*: add systemd install section warning for Instantiable units
This allows to parse all units at once and helps to identify
instantiable units which don't have the install section.

Fixes https://github.com/coreos/ignition/issues/1344
2022-05-31 08:39:12 -04:00
Benjamin Gilbert
bd6aa78020 Merge pull request #1264 from lyft/aws-s3-access-points
internal/resource: support S3 access point URLs
2022-04-28 05:32:44 -04:00
Sohan Kunkerkar
b208aca11d config/*: add validation logic regarding permission bits for specs < 3.4.0
This adds logic to throw a warning if the special file mode bits are set
in an Ignition config with the spec version < 3.4.0
2022-04-10 14:34:57 -04:00
Zeleena Kearney
4daa32d59b internal/resource: support S3 access point URLs
Support S3 access point URLs in ARN format as a source.
This allows valid, opaque S3 URLs such as
`s3:arn:aws:s3:us-west-2:123456789012:accesspoint/test/object`
Being able to use this format will allow S3 URLs on different
partitions and lays the foundation to potentially support
multi-region access points in the future.

Fixes https://github.com/coreos/ignition/issues/1091
Signed-off-by: Zeleena Kearney <zeleenak@lyft.com>
2022-04-08 16:50:18 -07:00
Benjamin Gilbert
3612dfba04 config/v3_3_exp: pointerify ClevisCustom Config and Pin
They're not struct keys.
2021-06-18 14:31:17 -04:00
Benjamin Gilbert
3271218a2f config/v3_3_exp: pointerify Raid.Level
It's not a struct key.
2021-06-18 14:31:17 -04:00
Benjamin Gilbert
d16241cd1f config/v3_3_exp: pointerify LinkEmbedded1.Target
It's not a struct key.
2021-06-18 14:31:17 -04:00
Benjamin Gilbert
d2183b790e config/*: validate that storage.raid.devices is non-empty
Add the check to all config versions, since an empty device list doesn't
make sense.
2021-06-18 12:59:15 -04:00
Benjamin Gilbert
1817a6673e config/shared/errors: fix ErrSparesUnsupportedForLevel message
The sense of the message was inverted from the code.
2021-06-17 20:37:08 -04:00
Benjamin Gilbert
5954d261f5 config/*: require filesystems.format with wipeFilesystem or mountOptions
Filesystem creation and mounting both ignore filesystems with format
unset, but if the user specified wipeFilesystem or mountOptions that's
clearly not their intent.  Fail validation in this case.
2020-12-08 18:55:45 -05:00
Stephen Lowrie
5c65915211 config: add custom options for clevis devices
Adds new custom options that allow for the direct specification of the
clevis pin & configuration JSON that will be passed to `clevis luks
bind`.
2020-09-18 00:36:11 -05:00
Stephen Lowrie
23b34d7974 internal/config: allow Ignition generated key-files for all devices
Allows Ignition to generate the key-file in all cases (instead of just
for clevis based devices).
2020-07-29 22:49:23 -05:00
Stephen Lowrie
882a65a101 config: add LUKS to schema 2020-07-10 12:48:30 -05:00
Benjamin Gilbert
e2c0f664ab config/*: drop warning on unset file/dir mode
The warning was originally added in 424f37b755 because Ignition spec 2
defaulted to mode 0000, which was certainly not what the user wanted.
However, spec 3 defaults to 0755 for dirs and 0644 for files, and is
documented as such.  It's therefore reasonable for the user to omit those
fields, and by issuing the warnings we're encouraging the user to write
unnecessarily verbose Ignition configs (or FCCs).
2020-05-14 14:31:34 -04:00
Benjamin Gilbert
082b45478d spec: unify resource fetching type
Dedupe the "remote resource" type from the spec. This came up too during
review of the new HTTP headers. They all had more or less the same
fields in common ("source", "verification", "compression", and more
recently "httpHeaders").

One noticeable spec level change from this is that some places now
support compression where they didn't before. Might seem odd to support
compression for e.g. certificate authorities, though it does make the
spec more consistent throughout.

Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
2020-04-09 14:37:55 -04:00
Mike Fedosin
dbdf013a10 Allow to specify HTTP headers for fetching configs and files
This commit adds an ability to use HTTP headers for config-reference,
ca-reference and file-contents structures. This can be useful when a
remote server requires authentication and we have to provide a token
in the header.
2020-03-24 17:33:39 +01:00
Sohan Kunkerkar
842010c8a8 Fix enabling systemd instantiated services 2020-03-20 16:25:49 -04:00
Andrew Jeddeloh
480fc1049e config/v3_1_exp/types: validate http(s) proxies
Validate that the specified http(s) proxies are in fact valid http(s)
urls.
2019-10-23 10:56:29 -07:00
Andrew Jeddeloh
3048e395b7 config/validate: replace old validation with vcontext 2019-05-24 11:28:28 -07:00
Andrew Jeddeloh
2ea831d068 config/*/types/storage: fail on hardlinked dirs
Hardlinks to directories are disallowed, so fail to validate if we know
that we're going to. We could even take this a step further and
blacklist /usr, /etc, /tmp etc but those might be symlinks, which would
be ok, so lets not.
2019-04-23 15:16:31 -07:00
Andrew Jeddeloh
21096944fb config/v3_0/types/file: add more validation
Add validation that verification requires source.
2019-04-01 15:35:16 -07:00
Andrew Jeddeloh
02a960466d config/v3_0: disallow overwrite and nil source
Disallow setting storage.files.overwrite = true when
storage.files.contents.source is unspecified (nil). If a user wants to
force an file to be empty they should set source to empty string.
2019-04-01 12:11:02 -07:00
Andrew Jeddeloh
266bdd5738 config: validate fs entries dont use symlinks
Filesystem entries should not use symlinks that are defined in the
config. These will fail or give the wrong results anyway.

Add unit tests for this.

Remove tests that used to fail that now fail at validation time.
2019-03-29 15:21:42 -07:00
Andrew Jeddeloh
50d71e2f31 Merge pull request #778 from ajeddeloh/remove-size-start
Remove partition size and start
2019-03-29 14:47:41 -07:00
Andrew Jeddeloh
72cf8c3ec8 config/shared/errors: drop unused errors
Remove all errors that are not used anywhere.
2019-03-28 17:23:57 -07:00
Andrew Jeddeloh
d2c3fdc9e2 config: remove partition start and size
The fields are deprecated in favor of startMiB and sizeMiB
2019-03-28 13:23:49 -07:00
Andrew Jeddeloh
999b6c1709 config: rework schema for better merging
Rework the schema to have all leaf fields be pointer except keys and all
interior nodes not be pointers.

This allows child configs to distinguish between an unspecified field
and a field specified as the go zero value.

This includes making storage.files.contents a normal (non pointer)
struct but making all of its members pointers. Similarly,
storage.files.{user,group} are no longer pointers but
storage.files.{user,group}.name are now pointers.

Finally, convert validation logic to use report.AddOnError() and friends
where appropriate.
2019-03-21 11:00:01 -07:00
Andrew Jeddeloh
02cde65258 config: drop passwd.users.create
Drop a deprecated field.
2019-03-19 12:06:52 -07:00
Andrew Jeddeloh
1c763c7926 config/v3_0_exp: require partition label or number
Require either a partition number or a label. If no number is specified
use the label for duplication detection.
2019-03-19 11:54:28 -07:00
Andrew Jeddeloh
de4ba6e504 config: refactor
- config package should have a Parse() function that accepts any
 supported version of the config
 - each version package (i.e. config/v3_0_experimental) should only
 accept configs of that version
 - In the future translation code should be its own subpackage to each
 config version package (i.e. under config/vX_Y/translate)
 - In the future the config package should handle calling the
 translation code explicitly instead of each version package. This
 removes the need to vendor more than 1 version if that's all you need.
2019-03-15 14:24:16 -07:00
Robert Fairley
3afba38c3d internal/exec: use nonzero default file permissions
Creates files and directories with default permissions 0644 and 0755
respectively, when "mode" is not specified in the Ignition config for
the file/directory. This also updates the warning message printed when
the default permissions are applied.

Closes: #582
2019-02-25 15:34:20 -05:00
Andrew Jeddeloh
5fd51005bf exec/*: rework files and filesystems
- Remove filesystem names, make path be the mount path to use in the
 initramfs
 - Simplify symlink handling now that everything is under /sysroot
 - Update unit tests
2019-02-22 10:39:22 -08:00
Stephen Lowrie
e7e7aa2172 *: drop networkd section
Drop the networkd section from spec 3.0. networkd is not as widespread
as systemd and everything done in this section can be accomplished in
the files section.

Fixes #638
2019-01-11 14:03:00 -06:00
Andrew Jeddeloh
795d547bae config/*: drop cloudinit support
Ignition should no longer support cloudinit. This is a niche enough use
case where if distros want to support both they can either patch
Ignition to add it back or implement the logic as a seperate piece of
the initramfs.
2019-01-08 11:41:39 -08:00
Rodrigo Chacon
0cc84a74c9 resource: add support for ?versionId on s3:// URL download
This change adds support for specifying an S3 Object version ID through
the `?versionId` query parameter, such as:

    s3://my-bucket/some/path/my-key?versionId=v3rs10n
2018-10-18 22:36:49 -03:00
Andrew Jeddeloh
297d3544a0 config/types/partition*: deprecate size/start
Add validation functions to deprecrate the size and start fields.
Add tests to verify they generate deprecation notices.
2018-09-06 14:16:32 -07:00
Derek Gonyeo
68554b5509 internal: updates for size-mb and start-mb
Update disks stage to handle the new *-mb fields.
Add validation code to ensure they are not mixed.
2018-09-06 14:12:37 -07:00
bubblemelon
ce93f0a86b stages: Change Run() to return error
Run() returns an error instead of a bool.
2018-07-31 20:30:01 -07:00
Andrew Jeddeloh
9cfea99987 config/v2_3_exp: update partitioning validation
Handle start, size, and label being nil-able.
2018-05-31 13:34:14 -07:00
Benjamin Gilbert
3739a83a07 config/shared/errors: drop unused ErrVersion 2018-04-06 21:24:21 -04:00
Derek Gonyeo
f9c36841ad config: add common errors from types packages to config/shared/errors
Following commits will alter config/v*/types packages to use these error
values.
2018-03-20 10:14:09 -07:00
Euan Kemp
2699886b1b config/errors: move under 'shared'
Since more than just errors are shared between multiple config versions,
let's collect all the things under 'shared'
2018-03-20 00:02:56 -07:00