Commit Graph

220 Commits

Author SHA1 Message Date
Mike Frysinger b5775df441 prng: support getrandom & getentropy
If the C library supports these random functions, use them directly
instead of reading the /dev/urandom file.  This makes life easier on
platforms that don't have /dev/urandom (like WASM).
2026-02-27 19:55:52 -05:00
Eric Dorland 64ce9aad9a Drop the -pedantic flag from CXX_FLAGS
Abseil uses certain compiler extensions intentionally (see abseil/abseil-cpp#157) so it triggers multiple warnings enabled by -pedantic (-Wnullability-extension, -Wgcc-compat, -Wvariadic-macro-arguments-omitted at a minimum) as seen in #1373.
2026-02-27 16:38:09 -05:00
John Hood aa742478cb modernize configure.ac slightly 2023-07-30 16:53:06 -04:00
Alex Chernyakhovsky eee1a8cf41 Bump C++ version to C++17
Protobuf versions since 3.6.0 have long had a C++11 dependency; even
more recent versions have picked up an Abseil dependency bumping that
to C++14. Since it is now 2023, defaulting to C++17 is reasonable, so
remove the conditional C++ standards version check that mosh
previously had and replace it with an unconditional C++17 check.

This means that all future commits can use C++17 features. According
to https://en.cppreference.com/w/cpp/compiler_support/17 this means
that minimum effective compiler versions for mosh become:

gcc 7 (May 2017)
clang 5 (September 2017)

This, in turn, implies that future versions of mosh will no longer be
available for RHEL/CentOS 7 (June 2014).

Closes: #1267
2023-07-30 16:43:46 -04:00
Benjamin Barenblat bc73a26316 Bump version to 1.4.0 2022-10-26 21:18:11 -04:00
Benjamin Barenblat a08e682de6 Bump release candidate to 1.3.2.95rc2 2022-10-26 19:31:42 -04:00
Alex Chernyakhovsky f3665fb99b Switch 1.4.0-rc1 version to 1.3.2.95rc1
This helps to avoid problems when the 1.4.0 release is made and
distributions with version sort order think the rc sorts after
the non-suffixed version
2022-08-04 17:15:43 -04:00
Alex Chernyakhovsky fe72a3e084 Bump release candidate to 1.4.0-rc1 2022-08-03 21:42:26 -04:00
Alex Chernyakhovsky 7d2601d419 Tag mosh 1.4.0 Release Candidate 2022-08-03 14:13:43 -10:00
Alex Chernyakhovsky 6154bc04d9 Add -Wno-unused-parameter
Work around protocolbuffers/protobuf#10357 by disabling
-Wunused-parameter.
2022-08-03 13:44:57 -10:00
Alex Chernyakhovsky 581bd67c5a Fixes for distcheck 2022-07-05 16:56:46 -04:00
Benjamin Barenblat 13d73a6144 Put -lnettle back on the link line when using Nettle
bacc024083 inadvertently stopped
propagating `pkg-config --libs` output into the link line. This didn’t
affect OpenSSL (since configure.ac puts -lcrypto there manually) or
Apple Common Crypto (since it’s not a separate dylib), but it broke
Nettle builds. Fix Nettle builds by ensuring that `pkg-config --libs`
output actually makes it to the linker.
2022-06-27 13:03:10 -10:00
Benjamin Barenblat bacc024083 Go back to internal OCB implementation
After further discussion, the Mosh maintainers have decided to stick
with the internal OCB implementation for this release. Restore support
for using OpenSSL’s AES but internal OCB. To make this commit easy to
audit, restore the code exactly, including calls to AES functions that
are deprecated in OpenSSL 3; a future commit will update ocb_internal.cc
to use EVP instead of directly calling the AES primitives.

In anticipation of future changes, preserve support for OpenSSL’s
AES-OCB, but don’t compile it in. Add
--with-crypto-library=openssl-with-openssl-ocb and
--with-crypto-library=openssl-with-internal-ocb options to configure so
that developers can easily test Mosh using OpenSSL’s AES-OCB. These
options are intended only for testing, are undocumented, and are not
subject to any API stability guarantees.

Rework configure to look for all possible cryptography libraries first
and then dispatch on --with-crypto-library as appropriate.
2022-06-22 15:02:19 -10:00
Benjamin Barenblat a563093f16 Separate OpenSSL-based OCB implementation from others
Split src/crypto/ocb.cc into two files – one containing the AES-OCB
implementation backed by OpenSSL, and the other containing
implementations backed by Apple Common Crypto and Nettle. This paves the
way for a new OpenSSL implementation that uses OpenSSL 1.1’s OCB support
directly, rather than one that merely uses OpenSSL to provide the
underlying block cipher.

Remove support for rijndael-alg-fst.c and compiler-provided AES
intrinsics, since they’re not in use anymore. (Mosh can still use
hardware-accelerated AES if it’s available; it just now relies
exclusively on the underlying cryptography library to accelerate AES if
possible.)

Update the build system to conditionally compile in either
ocb_openssl.cc or ocb_internal.cc, depending on which cryptography
library you pass to ./configure.

To make this commit easy to audit, ocb_openssl.cc and ocb_internal.cc
are trivially diffable against ocb.cc (now deleted). Expected diffs
consist of a copyright notice update, a preprocessor check to ensure the
appropriate cryptography implementation has been selected, and deletions
to remove code that’s no longer in use. This does mean a substantial
amount of code is duplicated between ocb_openssl.cc and ocb_internal.cc;
however, ocb_openssl.cc should be completely replaced soon, so it won’t
be an issue in the long term.

Bug: https://github.com/mobile-shell/mosh/issues/1174
2022-06-06 16:30:41 -10:00
Alex Chernyakhovsky 0c6e034459 Add fuzzing infrastructure
This commit adds the --enable-fuzzing (and --enable-asan, to make
fuzzing more useful) options and a sample fuzzer for the terminal
parser. At this time only libfuzzer is supported. Future changes to
add AFL to get more fuzzing capability should be possible with the
addition of the afl_driver.cc from Chromium.
2022-05-30 20:23:21 -04:00
Alex Chernyakhovsky 70a02d1e83 Add support for generating coverage reports
This change adds autoconf/automake support for building all of mosh
with gcov, and generates an lcov html report. This allows seeing which
parts ofthe source tree have good test coverage, and which can be
shored up. Eventually, it would be good to hook this up to Github
Actions to be generated automatically.
2022-05-30 19:38:10 -04:00
Wolfgang E. Sanyer dbe419d0e0 Disable clang warning in order to mitigate protocolbuffers/protobuf#9181
Signed-off-by: Wolfgang E. Sanyer <WolfgangESanyer@gmail.com>
2022-02-04 11:08:30 -05:00
John Hood 12199114fe Move generated includes to their own directory to avoid conflicts.
Fixes #1051, mosh fails to build on case-insensitive filesystems.

XXX This isn't perfect because autoconf/automake drop several extra
files in the directory anyway.
2020-05-17 23:55:09 -04:00
Anders Kaseorg 0cc492dbae configure: Add test for whether protoc matches protobuf
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:21 -07:00
Anders Kaseorg feced5910c configure: Fix FD_ISSET test under -Werror
The uninitialized variable warning from T x; broke the test if the
user passed CXXFLAGS='-O2 -Wall -Werror'.  (Users shouldn’t do that;
our own --enable-compile-warnings=error option was unaffected.)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:21 -07:00
Anders Kaseorg 7c10080766 configure: Fix forkpty test code indentation
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:21 -07:00
Anders Kaseorg 8682f39fa5 configure: Remove unused tests
These tests only define HAVE_* macros that we never check.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:20 -07:00
Anders Kaseorg e009ba4e76 configure: Set language to C++ globally
As of commit dd941df19d, we no longer
build any plain C, except within AM_PROG_AR.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-02 22:42:20 -07:00
John Hood b1da700535 Fix Appveyor build.
Change the openssl-devel package to libssl-devel.  Cygwin still has an
"obsolete" (essentially virtual) package for openssl-devel, but it
doesn't seem to work properly on Appveyor's Cygwin install.

Protobuf >= 3.6.0 requires C++11, which I added support for last year.
But when I did that, I requested strict ANSI C++ compatibility, which
causes Cygwin/newlib's libc feature test macros to be set to disable
(at least) POSIX.1 extensions.  Let the Autoconf macro use its default
instead (prefer GNU/extended C++, accept anything).
2019-07-10 12:56:52 -04:00
Anders Kaseorg 335e3869b7 configure: Another flag for macOS distcheck: -Wno-error=nested-anon-types
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-06-12 22:51:08 -07:00
Anders Kaseorg f7a054c3e7 configure: Add --enable-static-LIBRARY options for selective static linking
Statically linking mosh-server with glibc isn’t a great idea for
various reasons (nsswitch modules, locale format incompatibilities).
But we can provide most of the benefits of static linking by allowing
specific library dependencies to be linked statically using -Bstatic
and -Bdynamic.  The full set is enabled by

    ./configure --enable-static-libraries

which is equivalent to

    ./configure --enable-static-libstdc++ --enable-static-libgcc \
      --enable-static-utempter --enable-static-zlib --enable-static-curses \
      --enable-static-crypto --enable-static-protobuf

and results in binaries whose only runtime library dependencies are
provided with libc:

    $ ldd src/frontend/mosh-server
            linux-vdso.so.1 (0x00007ffe0b377000)
            libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fa0d9970000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa0d97e3000)
            libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa0d97c2000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa0d95d8000)
            /lib64/ld-linux-x86-64.so.2 (0x00007fa0d9f6a000)

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-10 15:49:43 -08:00
Anders Kaseorg 6d30b18ccb configure.ac: Fix underquoted AC_HELP_STRING call
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-02-10 15:49:43 -08:00
John Hood 6fe7cde94d Require C++11 if protobuf version >= 3.6.0 is installed
This shouldn't require C++11 when not required.

This hack may not always detect when C++11 *is* required,
in which case a little autoconf tweaking may be needed
to get a good compile.
2018-08-02 19:09:21 -04:00
Tom Judge ab31b0f271 Add syslog logging of connections
Log connection change events to syslog in the auth log, logging the PID,
username and remote host.

Also log session begin and end.

Co-Authored-By: John Hood <cgull@glup.org>
2017-11-05 11:54:43 -05:00
Keith Winstein cf73e1f879 Update version to 1.3.2 (fixes Debian revision inversion) 2017-07-21 14:53:57 -07:00
John Hood dedb2c5b6f mosh 1.3.1 2017-07-20 17:45:41 -04:00
John Hood e054a86ecc mosh 1.3.1-rc3 2017-07-19 22:31:28 -04:00
John Hood b17c5795f7 Update to 1.3.1-rc2. 2017-05-19 19:29:34 -04:00
John Hood 561ac25d76 Version 1.3.1 rc1. Update changelogs. 2017-05-08 23:39:48 -04:00
Adrien Destugues aa74af9a34 Fix build on Haiku.
- Look for socket in libnetwork
- Look for forkpty in libbsd
2017-04-24 22:40:31 -04:00
John Hood c05793cb22 Bump version to 1.3.0 for release.
Signed-off-by: John Hood <cgull@glup.org>
2017-03-17 14:06:51 -04:00
Keith Winstein be023c5afc Bump version to 1.3.0~rc3 2017-03-03 02:22:35 -08:00
John Hood a092b0f7ca Mosh 1.3.0-rc2 release. 2017-01-05 00:14:48 -05:00
John Hood 9f59c69e40 1.3.0-rc0-- test build process 2016-12-21 21:26:53 -05:00
Anders Kaseorg 94027efc45 Make all commands properly support --help and --version
These should output to stdout and exit with status 0.  Passing
std-options to AM_INIT_AUTOMAKE causes ‘make installcheck’ (hence also
‘make distcheck’) to verify this.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2016-11-19 17:15:48 -05:00
john hood 11190526ad Fix Configure failure on FreeBSD with only base OpenSSL.
Search for OpenSSL libraries both with pkg-config and directly.

Fixes #763.
2016-11-19 15:02:06 -05:00
John Hood f728456898 Handle more warnings from protobuf on OS X compile 2016-10-29 20:48:48 -04:00
John Hood b0facb55c4 Test carefully for clock_gettime() and CLOCK_MONOTONIC 2016-09-29 01:10:23 -04:00
John Hood e494025b24 Work around "make distcheck" fail on OS X with protobuf 3.02. 2016-09-19 13:56:47 -04:00
John Hood 1077db41b6 Support OpenBSD 6.0 pledge() syscall for sandboxing. 2016-09-19 13:23:16 -04:00
john hood b7d081056b Fix CPPFLAGS handling possibly causing curses detection failure
This is an old, old bug.
2016-09-18 01:52:50 -04:00
John Hood 5f92a8a835 Bump version to 1.2.6.
Signed-off-by: John Hood <cgull@glup.org>
2016-07-30 21:36:55 -07:00
John Hood 05fe24d50d 1.2.5.95rc1 pre-release 2016-05-25 02:13:12 -04:00
john hood 70c62c5a94 #include <memory> for std::shared 2016-05-11 00:51:00 -04:00
john hood 9073983df3 crypto.cc: prefer bswap64() and ffs() if available.
Fixes #745.
2016-05-08 20:45:01 -04:00