29 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
ec0868baf6 feat: delegate authorized_keys file validation to sshcommand
Rather than try and validate this out of band, depend on sshcommand for performing any such checks on the file. There isn't any need for dokku to duplicate this when listing the contents of the file.
2025-02-22 01:42:07 -05:00
Jose Diaz-Gonzalez
18492ac83c feat: add json format support to ssh-keys:list 2020-12-20 04:15:53 -05:00
Jose Diaz-Gonzalez
13dd8aa224 feat: add ability to remove an ssh key by fingerprint
- add tests for ssh-keys:remove
- upgrade sshcommand
2020-12-20 04:15:53 -05:00
Jose Diaz-Gonzalez
c91a6d1a55 feat: add the ability to list ssh keys for a specific user
Also upgrade the version of sshcommand used within the vagrant vm
2020-04-04 02:23:38 -04:00
Jose Diaz-Gonzalez
aa6a651f1d tests: correct test issues 2020-02-10 02:54:31 -05:00
Jose Diaz-Gonzalez
e67b96780d refactor: unify command declaration across codebase 2020-02-10 01:40:30 -05:00
Jose Diaz-Gonzalez
ef7894fdfa refactor: standardize help generation 2020-02-10 00:37:00 -05:00
Jose Diaz-Gonzalez
1cb586b2e7 refactor: standardize command naming
This standardization makes it somewhat easier to read stacktraces as the command names are all uniform, so it will be slightly easier to scan trace output.
2020-02-09 22:41:39 -05:00
Jose Diaz-Gonzalez
3ca6245b00 fix: use 6 X to support running under busybox
mktemp from busybox requires that all templates end with XXXXXX.
2019-08-12 18:16:16 -04:00
Jose Diaz-Gonzalez
925c6c4c28 feat: inject the dokku PID into temporary files/directories
This will allow background processes to cleanup these files if they were unable to be cleaned up during a run of the dokku binary, as is the case for files copied by the docker binary when running in docker.
2019-08-12 17:56:17 -04:00
Tom Parker-Shemilt
a848d92823 Allow SSH keys with no ending newline (fixes #3590) 2019-06-12 22:16:02 +01:00
Jose Diaz-Gonzalez
1b92f4a97e chore: standardize how temporary files are named 2019-05-20 18:01:17 -07:00
Jose Diaz-Gonzalez
da4361583b fix: reverse quotes for variable expansion
Without reversing quotes, the variables are sometimes improperly expanded, resulting in files not being removed.
2019-05-20 17:56:50 -07:00
Jose Diaz-Gonzalez
dee0144c7c fix: add missing awk to get number of lines in key file 2019-05-12 19:08:55 -04:00
Jose Diaz-Gonzalez
6ca4813247 fix: invert check 2019-05-12 19:04:50 -04:00
Jose Diaz-Gonzalez
a717cb99a3 fix: correct shfmt and update error message 2019-05-12 19:04:50 -04:00
Jose Diaz-Gonzalez
6a5bbd63a3 refactor: always use a temp file for interacting with ssh keys
Rather than have stdin open everywhere, try to coerce input into a temporary file for later use.
2019-05-12 19:04:50 -04:00
Jose Diaz-Gonzalez
ca0b2937b9 refactor: fetch ssh key via argument before stdin
This allows the ssh-keys:add command to work in environments where there is no stdin/tty available, such as via server automation.
2019-05-12 19:04:50 -04:00
Jose Diaz-Gonzalez
86795ddacc tests: run mvdan/shfmt on test runs
While I do not agree with _every_ style change, this will force Dokku to have consistent formatting across all shell scripts, which is arguably a Good Thing™.

The command used to reprocess everything is:

```shell
shfmt -l -bn -ci -i 2 -w .
```
2019-01-07 01:25:55 -05:00
Jose Diaz-Gonzalez
7bbad9f074 fix: ensure the help output for nginx/ssh-keys renders correctly
Closes #2627

[ci skip]
2017-03-12 21:24:43 -06:00
Jose Diaz-Gonzalez
448b6e9ac1 refactor: alias ssh-keys:default to ssh-keys:help 2017-02-20 20:09:09 -07:00
Jose Diaz-Gonzalez
ab93fefd5b Merge pull request #2508 from OmarShehata/master
Add default functions for all commands
2017-01-13 22:37:29 -07:00
Omar Shehata
f2a4f61920 Added ssh-keys plugin default to list 2016-12-03 19:36:11 +00:00
Omar Shehata
010c89e810 Revert "Added ssh-keys default help function"
This reverts commit 74db5b9d3b.
2016-12-03 19:08:02 +00:00
Omar Shehata
74db5b9d3b Added ssh-keys default help function 2016-11-28 02:59:32 +00:00
Jose Diaz-Gonzalez
4e25639de4 Create the user's authorized_keys file if it does not exist
Closes #2469
2016-11-21 19:08:33 -07:00
Flavio Poletti
a2bacd8096 Patch GH #2446 "Adding a file with two ssh-key..."
This is a proposed change for addressing GH #2446 "Adding a file with
two ssh-keys can result in an error" (see
https://github.com/dokku/dokku/issues/2446).

The following checks are performed:

- validity of key contents when read from a file
- key contents only contains one single line/key
- authorized_keys file is ultimately valid

The last test is an extension over the previous implementation in that
all lines in the file are checked.

The commit also includes extensions to the relevant test file to
excercise the new checks. It also takes care to save and then restore
the authorized_keys file.
2016-10-16 16:32:16 +02:00
Justin Clark
2d0374ec52 ssh-keys updates based on feedback 2016-07-05 17:16:19 -07:00
Justin Clark
283ed52520 Add ssh-keys core plugin 2016-07-05 17:16:19 -07:00