Commit graph

48 commits

Author SHA1 Message Date
Stéphane Lesimple
9b2aa996b3 enh: better use of account creation metadata
Store account creation information in a JSON.
Display this information in `accountInfo` for auditors.
2021-07-23 09:50:18 +02:00
Stéphane Lesimple
a2626e6970 chore: tests: add json_document() func 2021-07-23 09:50:18 +02:00
Stéphane Lesimple
f483b1540a enh: max account length is now 28 chars up from 18 2021-07-02 17:41:12 +02:00
thibault.dewailly
5415ed2793 Feat: Add admin and super owner accounts list in info plugin
For auditing purposes, get admin and super owner list in info plugin
Available for auditor role only
Closes #206
2021-06-28 11:13:30 +02:00
Stéphane Lesimple
c201f44d83 enh: tests: refactor the framework for more maintainability
The chain of executions is as is:
- `docker_build_and_run_tests_all.sh`
  - launches several instances of `docker_build_and_run_tests.sh`
    - builds docker images with the `target_role.sh` and `tester_role.sh` entrypoints
      - inside the tester docker, `tester_role.sh` launches `launch_tests_on_instance.sh`
      - the target docker gets tested after setting up accounts, SSH etc.

Previously, these scripts passed options to each other either by a mix of environment
variables and command-line arguments, with some inconsistencies here and there.

Now, `launch_tests_on_instance.sh` supports a lot of command-line options, which can
be specified directly if testing a remote server, or can be passed-through by the calling
script in case of docker tests. `docker_build_and_run_tests.sh` and
`docker_build_and_run_tests_all.sh` also support to passthrough these options down.
2021-06-25 16:02:38 +02:00
Stéphane Lesimple
b364706f37 feat: httpproxy: add functional tests 2021-06-03 16:16:29 +02:00
Stéphane Lesimple
3925e67d43 feat: add groupDestroy command for owners
This command deletes a group, as `groupDelete` does, but works
for owners so that they can delete their own group.
`groupDelete` remains as a restricted command, able to delete any group.

Closes #40.
2021-06-02 15:32:40 +02:00
Stéphane Lesimple
8cc990ad57 feat: add filtering options to several cmds,nicify print_acls()
The commands selfListAccesses, accountListAccesses,
groupList, groupListServers, groupListGuestAccesses and
accountList now have options to filter their output through
pattern matching, with --include and --exclude.

The output from the commands using print_acls() is also more
human-friendly, with auto-adjusting column length, and empty
columns omitted.

Closes #60.
2021-05-25 09:42:28 +02:00
Stéphane Lesimple
344865884b fix: groupCreate: deny groups starting with 'key'
Mitigates #178
2021-05-21 14:13:22 +02:00
Jonathan Marsaud
b7b2533604 accountModify - Add a new accept-new POLICY in egress-strict-host-key-checking parameter 2021-05-19 16:34:35 +02:00
Stéphane Lesimple
5ec805f26b fix: groupGenerateEgressKey: --help wasn't working properly 2021-04-08 09:41:03 +02:00
Stéphane Lesimple
1d9018ef7f fix: strict check failure was no longer detected to print a help message
Fixes #155
2021-03-24 17:41:14 +01:00
Stéphane Lesimple
5920b09aed chore: mkdir -p doesn't fail if dir already exists 2021-03-24 10:47:11 +01:00
Stéphane Lesimple
255f0684cc fix: scp: abort early if host is not found to avoid a warn()
The following warn would happen if the scp wrapper was called with an invalid hostname:

Use of uninitialized value  in bitwise and (&) at /usr/share/perl5/Net/Netmask.pm line 699.
 at /opt/bastion/bin/plugin/open/../../../lib/perl/OVH/Bastion.pm line 41.
 OVH::Bastion::__ANON__("Use of uninitialized value \ in bitwise and (&) at /usr/shar"...) called at /usr/share/perl5/Net/Netmask.pm line 697
 Net::Netmask::match(Net::Netmask=HASH(0x55b1d5f11860), undef) called at /opt/bastion/lib/perl/OVH/Bastion/allowdeny.inc line 214
 OVH::Bastion::is_access_way_granted("port", 22, "exactUserMatch", 1, "ipfrom", "X.X.X.X", "ip", undef, ...) called at /opt/bastion/lib/perl/OVH/Bastion/allowdeny.inc line 688
 OVH::Bastion::is_access_granted(\"account\", \"johndoe\", \"user\", \"!scpupload\", \"ipfrom\", \"X.X.X.X\", \"ip\", undef, ...) called at /opt/bastion/bin/plugin/open/scp line 136
2021-03-01 09:31:38 +01:00
Stéphane Lesimple
b444dc027f chore: tests: support multiple unit-tests 2021-03-01 09:30:43 +01:00
Stéphane Lesimple
edb1b77dfc feat: auto-add hostname as comment in groupAddServer / selfAddPersonalAccesss
Implements a side suggestion of #60
2021-02-22 11:56:19 +01:00
Stéphane Lesimple
383f2a011c enh: guests: groupAddGuestAccess now supports setting a comment
If no comment is set, the comment is inherited from the group ACL,
as seen in groupListServers.

selfAddPersonalAccess now also return details
about the added server in the returned JSON.

Closes #18
Closes #17
2021-02-22 11:56:19 +01:00
Stéphane Lesimple
9216e2db1b enh: groupAddServer: augment the returned JSON with the added server details 2021-02-22 11:56:19 +01:00
Stéphane Lesimple
e760cf6142 feat: add groupGenerateEgressKey and groupDelEgressKey 2021-02-17 10:03:40 +01:00
Stéphane Lesimple
473439cc1c chore: fix test for GitHub actions
Signed-off-by: Stéphane Lesimple <stephane.lesimple+bastion@ovhcloud.com>
2021-02-13 16:09:36 +01:00
Stéphane Lesimple
5d36e820ca fix: admins no longer inherited superowner powers
Regression since rc1
2021-01-25 12:18:04 +01:00
Stéphane Lesimple
61538ff086 chore: tests: also update totalerrors while tests are running 2021-01-20 14:01:55 +01:00
Stéphane Lesimple
1378ba84f5 fix: re-introduce the ttyrecfile field
This field was mistakenly removed along with the ttyrecsize one
by mistake in a479810d83.

Add tests to ensure this can't break again.
2021-01-13 09:38:02 +01:00
Stéphane Lesimple
1676979913 feat: add PIV keys support and policy enforcement
A new global option 'ingressRequirePIV' was added, to enable or disable a
bastion-wide policy forcing everybody to use only PIV keys.
2021-01-12 12:05:06 +01:00
Stéphane Lesimple
920821f5d6
fix: tests: syslog-logged errors were not counted towards the total 2021-01-07 10:36:34 +00:00
Stéphane Lesimple
5228c863b0 chore: tests_all: use proper tempdir 2020-12-25 17:02:54 +01:00
Stéphane Lesimple
81db4b10bb feat: realms: use remote bastion MFA validation information for local policy enforcement 2020-12-25 17:02:54 +01:00
Stéphane Lesimple
16f42221ca
feat: add LC_BASTION_DETAILS envvar 2020-12-21 11:13:46 +00:00
Stéphane Lesimple
a204313af9
feat: accountModify: add --osh-only (closes #97) 2020-12-18 11:04:33 +00:00
Stéphane Lesimple
d6574221a3 fix: bastion.conf.dist & configuration.inc after #98 2020-12-17 19:52:10 +01:00
Stéphane Lesimple
3c5dddc06e
chore: fixes after review 2020-12-17 14:05:36 +00:00
Stéphane Lesimple
ef6efa6dc3
enh: config: better parsing and normalization
We now warn (to syslog) for invalid values where
we have to fallback to defaults, and for boolean
options, actual true/false JSON values are now
properly recognized. 0 and 1 will still always
be parsed correctly, to not break compatibility.
2020-12-16 08:17:38 +00:00
Stéphane Lesimple
f97b761b83
chore: speedup tests by ~20% 2020-12-14 08:57:43 +00:00
Stéphane Lesimple
39ddc4c462
fix: guests: get rid of ghost guest accesses in corner cases
Adding a guest access to a member of a group is now denied, to avoid having
dangling guest accesses when their membership is revoked. In effect, they
could no longer access the group servers, even as guest, because they no longer
had access to the group key, but their previous guest accesses were still
visible in groupListGuestAccesses, causing possible confusion.

We now also revoke all guest accesses of an account to a group, if any,
when it's being set as a member of this group, so that when/if the account
membership is revoked, we don't end up with the same ghost guest accesses as above.
2020-12-10 10:23:47 +00:00
Stéphane Lesimple
c68b696702
chore: shellcheck & perltidy 2020-12-08 14:42:31 +00:00
Stéphane Lesimple
dca45a44c5
chore: fix latest centos 8 release, add tests for last 3 minors 2020-12-08 14:27:13 +00:00
Stéphane Lesimple
7c26c2b721
fix: tests: adjust testcase max days after b604cd137f 2020-12-03 13:20:53 +00:00
Stéphane Lesimple
50c016be10
fix: sudogen: properly handle accounts & groups containing '.' 2020-12-03 13:20:53 +00:00
Thomas SOËTE
a4dc86cfde fix: Allow dot in group name as it is allowed in account
Fixes #61
2020-11-23 13:59:23 +00:00
Thomas SOËTE
2a51a78b54 fix: Enable perl-tidy.sh test
* Move to ubuntu-20.04 runner
* Remove check in dockers tests
2020-11-22 21:37:34 +00:00
Stéphane Lesimple
15cad00c27
fix: osh.pl: validate user and host format 2020-11-20 07:20:51 +00:00
Stéphane Lesimple
cb02fd2a33 fixes after review 2020-11-17 17:41:32 +01:00
Stéphane Lesimple
2605bdc73a fix: tests: fixes around to make it work under Linux and FreeBSD 2020-11-17 11:33:30 +01:00
Stéphane Lesimple
ec0d4256b8 enh: target_role.sh: tiny fixes 2020-11-17 11:32:27 +01:00
Stéphane Lesimple
5c72c92bdd
chore: fix typos everywhere 2020-11-05 17:36:17 +00:00
Thomas Soëte
63a209cfef
Upgrade fake-ttyrec version
v1.1.6.1 is required

Signed-off-by: Thomas SOËTE <github@alkorin.fr>
2020-10-25 18:59:46 +01:00
Stéphane Lesimple
386b20b71c
chore: add basic tests on push 2020-10-20 16:43:15 +00:00
Stéphane Lesimple
fde20136ef
Initial commit 2020-10-20 14:30:27 +00:00