Skip to content

Alpha version of SSHD support with wolfSSH#435

Merged
ejohnstown merged 48 commits intowolfSSL:masterfrom
JacobBarthelmeh:sshd
Aug 16, 2022
Merged

Alpha version of SSHD support with wolfSSH#435
ejohnstown merged 48 commits intowolfSSL:masterfrom
JacobBarthelmeh:sshd

Conversation

@JacobBarthelmeh
Copy link
Copy Markdown
Contributor

This adds the alpha version of SSHD support to wolfSSH. Enabled with --enable-sshd when compiling with autotools and off by default. The core features are implemented and some additional features are still in progress. Some testing has been completed but additional testing for a production ready version of the code is in progress, so far Linux/QNX OS's have been tested, OSX has been built but password support not yet completed.

Once built with --enable-sshd an example of running the SSHD daemon would be the following:

sudo ./apps/wolfsshd/wolfsshd -h <host key> -f <sshd_config file> -p 22222

To see a help menu use ./apps/wolfsshd/wolfsshd -h. The program can be run in the foreground using the option '-D'.

JacobBarthelmeh and others added 30 commits July 21, 2022 13:31
- Moved all wolfsshd source code into apps/wolfsshd/. Then future apps, e.g.
an ssh-keygen type utility, will get their own subdirectory under apps/.
- Rename wolfauth.(c|h) to auth.(c|h), rename wolfconfig.c to config.c.
- Add support for checking user public keys against an authorized keys file.
Doesn't support parsing options and comments in the key file, yet. Parsing
special tokens (e.g. %h) and absolute paths in the AuthorizedKeysFile string
are also not supported.
- Comment out currently unused USER_NODE code. Could be useful later on if
we integrate wolfsshd in an environment where the OS doesn't have its own
username service.
- Modify configure.ac to bring in libcrypt if wolfsshd is enabled.
- hostKeyFile and authKeysFile members of the config are now dynamically
allocated strings owned by the config.
- Break out sshd_config option handling into more modular functions.
- Move function declarations for WOLFSSHD_CONFIG from wolfsshd.h to a new
header, configuration.h. Change config.c to configuration.c. (using
"configuration" so as not to collide with autotools' config.h)
- Make the WOLFSSL_CONFIG* member of WOLFSSHD_AUTH const. At least at the
moment, it shouldn't be necessary for this member to be writable.
- Replace wolfSSHD_ConfigGetOption with functions to get specific members from
the config.
- Namespace all config functions with wolfSSHD_Config* and all auth functions
with wolfSSHD_Auth.
- Add const to function parameters, where possible.
- Remove wolfSSHD_ prefix from static functions. Just use PascalCase. These
don't need namespacing since they aren't visible outside their translation unit.
- Modify GetConfigInt to expect leading and trailing whitespace to have already
been removed. It will have been removed in the context this function is used in
configuration.c.
I wanted to be able to test ParseConfigLine directly, so I added some
preprocessor logic to expose this function (i.e. make it non-static) when
building test_configuration. I fixed a couple bugs discovered by this new
testing.
Specifying a port set `ret` to the port number instead of `WS_SUCCESS`
which meant that everything after parameter passing failed silently.
@JacobBarthelmeh JacobBarthelmeh self-assigned this Aug 5, 2022
LinuxJedi and others added 5 commits August 8, 2022 14:48
Includes single files or directories, only in POSIX for now.
When going into daemon mode on a POSIX system, use syslog
Check the prefix and postfix for a filename when a wildcard is used.
Comment thread configure.ac Outdated
Comment thread apps/wolfsshd/configuration.h Outdated
Comment thread apps/wolfsshd/configuration.c Outdated
Comment thread apps/wolfsshd/auth.c Outdated
Comment thread apps/wolfsshd/wolfsshd.c Outdated
Comment thread apps/wolfsshd/wolfsshd.c Outdated
@ejohnstown ejohnstown self-requested a review August 16, 2022 22:24
@ejohnstown ejohnstown merged commit 511a022 into wolfSSL:master Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants