Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions libssh2/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*.{c, h}]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
max_line_length = 80
2 changes: 2 additions & 0 deletions libssh2/.gitattribute
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
win32/msvcproj.head -crlf
win32/msvcproj.foot -crlf
27 changes: 27 additions & 0 deletions libssh2/.github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior.

A recipe or example code that reproduces the problem? A stack trace from a crash

**Expected behavior**
A clear and concise description of what you expected to happen.

**Version (please complete the following information):**
- OS and version: [e.g. iOS, macOS, Windows, Linux (distro)]
- libssh2 version: [e.g. 1.10.0]
- crypto backend: [OpenSSL, MbedTLS, Libgcrypt, LibreSSL, WinCNG, OS400, WolfSSL, None]

**Additional context**
Add any other context about the problem here.
13 changes: 13 additions & 0 deletions libssh2/.github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security Policy

See [SECURITY.md](https://github.com/libssh2/libssh2/blob/master/docs/SECURITY.md) for full details.

## Reporting a Vulnerability

If you have found or just suspect a security problem somewhere in libssh2,
email `libssh2-security@haxx.se` about it.

**Do not submit suspected security issues in the public bug tracker!**

We treat security issues with confidentiality until controlled and disclosed
responsibly.
17 changes: 17 additions & 0 deletions libssh2/.github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 120
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
67 changes: 67 additions & 0 deletions libssh2/.github/workflows/appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Copyright (c) 2021 Marc Hoersken
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

name: AppVeyor Docker Bridge

on:
workflow_dispatch:
inputs:
ssh_host:
required: true
ssh_port:
required: true
ssh_user:
required: true
ssh_forward:
required: true
ssh_hostkey:
required: true
ssh_privkey:
required: true

jobs:
daemon:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Setup SSH client configuration
run: |
cd ~
mkdir .ssh
chmod 0700 .ssh
echo "ServerAliveInterval 45" > .ssh/config
echo "Host ${{ github.event.inputs.ssh_host }}" >> .ssh/config
echo "${{ github.event.inputs.ssh_forward }}" | sed 's/,/\n/g' | sed 's/^/\tRemoteForward /g' >> .ssh/config
chmod 0600 .ssh/config
cat .ssh/config
echo "${{ github.event.inputs.ssh_host }} ${{ github.event.inputs.ssh_hostkey }}" | sed 's/,/\n${{ github.event.inputs.ssh_host }} /g' > .ssh/known_hosts
chmod 0600 .ssh/known_hosts
cat .ssh/known_hosts
echo "${{ github.event.inputs.ssh_privkey }}" | sed 's/,/\n/g' > .ssh/id_rsa
chmod 0600 .ssh/id_rsa

# we sleep explicitly to allow the remote system to kill the sleep process
- name: Connect to AppVeyor and sleep
run: |
ssh -v -p ${{ github.event.inputs.ssh_port }} ${{ github.event.inputs.ssh_user }}@${{ github.event.inputs.ssh_host }} sleep 1h
103 changes: 103 additions & 0 deletions libssh2/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
style-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check Style
run: ./ci/checksrc.sh
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
address_size: [64]
crypto_backend: [OpenSSL, Libgcrypt, mbedTLS]
build_shared_libs: [OFF, ON]
enable_zlib_compression: [OFF, ON]
b: [cmake]
include:
- compiler: gcc
address_size: 64
crypto_backend: OpenSSL
build_shared_libs: OFF
enable_zlib_compression: OFF
b: configure
- compiler: clang
address_size: 64
crypto_backend: OpenSSL
build_shared_libs: OFF
enable_zlib_compression: OFF
b: configure
env:
CC: ${{ matrix.compiler }}
CC_FOR_BUILD: ${{ matrix.compiler }}
CRYPTO_BACKEND: ${{ matrix.crypto_backend }}
BUILD_SHARED_LIBS: ${{ matrix.build_shared_libs }}
ENABLE_ZLIB_COMPRESSION: ${{ matrix.enable_zlib_compression }}
steps:
- uses: actions/checkout@v2
- name: Install 32 Bit Dependencies
if: ${{ matrix.address_size == 32 }}
run: |
sudo dpkg --add-architecture i386
sudo apt-get update -qq
sudo apt-get install -y gcc-multilib
sudo apt-get install -y libssl-dev:i386 libgcrypt20-dev:i386 zlib1g-dev:i386 build-essential gcc-multilib
sudo dpkg --purge --force-depends gcc-multilib
sudo dpkg --purge --force-depends libssl-dev
echo "TOOLCHAIN_OPTION=-DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-Linux-32.cmake" >> $GITHUB_ENV
- name: Install 64 Bit Dependencies
if: ${{ matrix.address_size == 64 }}
run: |
sudo apt-get install -y libssl-dev
sudo apt-get install -y libgcrypt-dev
- name: Install mbedTLS Dependencies
if: ${{ matrix.crypto_backend == 'mbedTLS' }}
run: |
MBEDTLSVER=mbedtls-2.7.0
curl -L https://github.com/ARMmbed/mbedtls/archive/$MBEDTLSVER.tar.gz | tar -xzf -
cd mbedtls-$MBEDTLSVER
cmake $TOOLCHAIN_OPTION -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DCMAKE_INSTALL_PREFIX:PATH=../usr .
make -j3 install
cd ..
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/usr/lib" >> $GITHUB_ENV
echo "TOOLCHAIN_OPTION=$TOOLCHAIN_OPTION -DCMAKE_PREFIX_PATH=$PWD/usr" >> $GITHUB_ENV
- name: Build with Configure
if: ${{ matrix.b == 'configure' }}
run: |
autoreconf -fi
./configure --enable-debug --enable-werror
make
make check
- name: Build with CMake
if: ${{ matrix.b == 'cmake' }}
run: |
mkdir bin
cd bin
cmake $TOOLCHAIN_OPTION -DCRYPTO_BACKEND=$CRYPTO_BACKEND -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -DENABLE_ZLIB_COMPRESSION=$ENABLE_ZLIB_COMPRESSION ..
cmake --build .
export OPENSSH_SERVER_IMAGE=ghcr.io/libssh2/ci_tests_openssh_server:$(git rev-parse --short=20 HEAD:../tests/openssh_server)
ctest -VV --output-on-failure
cmake --build . --target package
fuzzer:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
env:
CC: ${{ matrix.compiler }}
CC_FOR_BUILD: ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v2
- name: Run Fuzzer
run: GIT_REF=$GITHUB_REF ./ci/ossfuzz.sh
26 changes: 26 additions & 0 deletions libssh2/.github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CIFuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'libssh2'
dry-run: false
language: c
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'libssh2'
fuzz-seconds: 600
dry-run: false
language: c
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts
66 changes: 66 additions & 0 deletions libssh2/.github/workflows/openssh_server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright (c) 2022 Marc Hoersken
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

name: OpenSSH Server Docker Image

on:
push:
branches: [ master ]

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v1

- shell: bash
id: hash
run: echo "::set-output name=hash::$(git rev-parse --short=20 HEAD:tests/openssh_server)"

- shell: bash
id: poll
run: docker manifest inspect ghcr.io/${{ github.repository_owner }}/ci_tests_openssh_server:${{ steps.hash.outputs.hash }}
continue-on-error: true

- uses: docker/metadata-action@v3
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/ci_tests_openssh_server
tags: |
type=raw,value=${{ steps.hash.outputs.hash }}
if: ${{ steps.poll.outcome == 'failure' }}

- uses: docker/build-push-action@v2
with:
context: ./tests/openssh_server
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
if: ${{ steps.poll.outcome == 'failure' }}
38 changes: 38 additions & 0 deletions libssh2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.deps
.libs
*.lib
*.pdb
*.dll
*.exe
*.obj
.*.swp
Debug
Release
*.exp
Makefile
Makefile.in
aclocal.m4
autom4te.cache
compile
test-driver
config.guess
config.log
config.status
config.sub
configure
depcomp
libtool
ltmain.sh
missing
ssh2_sample
libssh2-*.tar.gz
install-sh
*.o
*.lo
*.la
mkinstalldirs
tags
libssh2.pc
TAGS
*~
.DS_Store
Loading