-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4799 from mishaschwartz/v1.10.0.rc
v1.10.0.rc
- Loading branch information
Showing
545 changed files
with
16,052 additions
and
9,468 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ARG UBUNTU_VERSION | ||
|
||
FROM ubuntu:$UBUNTU_VERSION | ||
|
||
ARG SSH_USER | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update -qq && \ | ||
apt-get -yq dist-upgrade && \ | ||
apt-get install -yq --no-install-recommends openssh-server git sudo vim tzdata && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ | ||
truncate -s 0 /var/log/*log | ||
|
||
# Make temporary dir for ssh server (should not be necessary) | ||
RUN mkdir -p -m0755 /var/run/sshd | ||
|
||
# Set up git user | ||
RUN useradd -m -s /bin/bash $SSH_USER | ||
|
||
COPY ./entrypoint-ssh.sh entrypoint-ssh.sh | ||
|
||
COPY ./markus-git-shell.sh /usr/local/bin/markus-git-shell.sh | ||
RUN chown "$SSH_USER:$SSH_USER" /usr/local/bin/markus-git-shell.sh && \ | ||
chmod 700 /usr/local/bin/markus-git-shell.sh && \ | ||
echo "${SSH_USER} ALL=(root) NOPASSWD:/usr/bin/git-shell" | sudo EDITOR="tee -a" visudo | ||
|
||
# Disable root login | ||
RUN sed -i "s@#*PermitRootLogin.*@PermitRootLogin no@g" /etc/ssh/sshd_config | ||
|
||
EXPOSE 22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
AUTHORIZED_KEY_FILES=$(echo "${RELATIVE_URL_ROOTS}" | sed -E "s@([^:]+):?@/home/${SSH_USER}/.ssh\1/authorized_keys @g") | ||
|
||
if [[ -z "${AUTHORIZED_KEY_FILES}" ]]; then | ||
>&2 echo 'RELATIVE_URL_ROOTS is not set' | ||
exit 1 | ||
fi | ||
|
||
if grep -q AuthorizedKeysFile /etc/ssh/sshd_config; then | ||
sed -i "s@#*AuthorizedKeysFile.*@AuthorizedKeysFile ${AUTHORIZED_KEY_FILES}@g" /etc/ssh/sshd_config | ||
else | ||
echo "AuthorizedKeysFile ${AUTHORIZED_KEY_FILES}" >> /etc/ssh/sshd_config | ||
fi | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -eE -o functrace | ||
|
||
write_log() { | ||
echo "$(date): ${1}" >> "${HOME}/log/ssh.log" | ||
} | ||
|
||
failure() { | ||
write_log "UNEXPECTED ERROR: ${1}" | ||
} | ||
|
||
trap 'failure "$BASH_COMMAND"' ERR | ||
|
||
[[ -z ${LOGIN_USER} ]] && write_log 'ERROR: LOGIN_USER not set' && exit 1 | ||
|
||
GIT_ACCESS_FILE="${HOME}/.ssh/${RELATIVE_URL_ROOT}/.access" | ||
|
||
[[ ! -f ${GIT_ACCESS_FILE} ]] && write_log "ERROR: file does not exist: ${GIT_ACCESS_FILE}" && exit 1 | ||
|
||
AVAILABLE_REPOS=$(grep -P ",${LOGIN_USER}(?:,|\s*$)" "${GIT_ACCESS_FILE}" | cut -f1 -d,) | ||
REQUESTED_REPO_PATH=$(basename "$(echo "${SSH_ORIGINAL_COMMAND}" | cut -f2 -d' ')") | ||
REQUESTED_REPO="${REQUESTED_REPO_PATH%.*}" | ||
|
||
if grep -qP "^${REQUESTED_REPO%.*}|\*$" <(echo "${AVAILABLE_REPOS}"); then | ||
sudo /usr/bin/git-shell -c "${SSH_ORIGINAL_COMMAND}" | ||
write_log "SUCCESS: LOGIN_USER=${LOGIN_USER} RELATIVE_URL_ROOT=${RELATIVE_URL_ROOT}, cmd=${SSH_ORIGINAL_COMMAND}" | ||
else | ||
write_log "PERMISSION DENIED: LOGIN_USER=${LOGIN_USER}, RELATIVE_URL_ROOT=${RELATIVE_URL_ROOT}, cmd=${SSH_ORIGINAL_COMMAND}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
# git dir | ||
.git/ | ||
|
||
tmp/ | ||
public/ | ||
|
||
config/database.yml | ||
config/local_environment_override.rb | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!--- Provide a summary of your changes in the Pull Request Title above. --> | ||
<!--- If this is a work in progress (not yet ready to be merged), make this a draft pull request. --> | ||
|
||
## Motivation and Context | ||
<!--- Why is this pull request required? What problem does it solve? --> | ||
<!--- If it fixes an open issue, please link to the issue here. --> | ||
|
||
|
||
## Your Changes | ||
<!--- Describe your changes here. --> | ||
<!--- Include how your changes may affect other areas of the application, if relevant. --> | ||
**Description**: | ||
|
||
|
||
**Type of change** (select all that apply): | ||
<!--- Put an `x` in all the boxes that apply. --> | ||
<!--- Remove any lines that do not apply. --> | ||
|
||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to change) | ||
- [ ] Refactoring (internal change to codebase, without changing functionality) | ||
- [ ] Test update (change that modifies or updates tests only) | ||
- [ ] Other (please specify): | ||
|
||
|
||
## Testing | ||
<!--- Please describe in detail how you tested this pull request. --> | ||
<!--- This can include tests you added and manual testing through the web interface. --> | ||
|
||
|
||
## Questions and Comments (if applicable) | ||
<!-- Ask any questions you have for the maintainers of this project regarding this PR. --> | ||
<!-- Please describe the steps you have already taken to find the answer to your question. --> | ||
<!-- This will ensure that we can give you clear and relevant advice. --> | ||
<!-- If you have additional comments add them here as well. --> | ||
|
||
|
||
## Checklist | ||
|
||
- [ ] I have performed a self-review of my own code. | ||
- [ ] I have fixed any Hound bot comments. <!-- (check after opening pull request) --> | ||
- [ ] I have verified that the TravisCI tests have passed. <!-- (check after opening pull request) --> | ||
- [ ] I have reviewed the test coverage changes reported on Coveralls. <!-- (check after opening pull request) --> | ||
- [ ] I have added tests for my changes. <!-- (delete this checklist item if not applicable) --> | ||
- [ ] I have updated the Changelog.md file. <!-- (delete this checklist item if not applicable) --> | ||
- [ ] I have described any required documentation changes below. <!-- (delete this checklist item if not applicable) --> | ||
|
||
|
||
### Required documentation changes (if applicable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
--require rails_helper | ||
--color | ||
--format documentation | ||
--format Fuubar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.