Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added admin features #64

Merged
merged 11 commits into from
Dec 26, 2019
Merged
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: 6 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@ jobs:
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Login to GitHub Docker Registry
- name: Login to Docker Registry
env:
DOCKER_USERNAME: ${{ secrets.GITHUB_DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_DOCKER_PASSWORD }}
run: echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin
- name: Build and push the Docker images
run: |
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
REF="${BRANCH_NAME:-master}"
OTHER_TAGS=""
REF="master"

if [[ ${GITHUB_REF} =~ ^refs\/tags\/v.*$ ]]
then
REF="${GITHUB_REF//refs\/tags\/}"
OTHER_TAGS="${OTHER_TAGS} -t ${GITHUB_REPOSITORY}:${REF} -t ${GITHUB_REPOSITORY}:latest"
OTHER_TAGS="${OTHER_TAGS} -t ${GITHUB_REPOSITORY}:latest"
fi

docker buildx build \
Expand All @@ -37,4 +39,5 @@ jobs:
--build-arg COMMIT=${GITHUB_SHA} \
--build-arg DATE=${DATE} \
-t ${GITHUB_REPOSITORY}:${GITHUB_SHA} \
-t ${GITHUB_REPOSITORY}:${REF} \
${OTHER_TAGS} .
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ archives:
files:
- LICENSE*
- README*
- keys/
- pubkeys/
- templates/
4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"-sish.bindrandom=false",
"-sish.tcpalias=true",
"-sish.proxyprotoenabled=false",
"-sish.logtoclient=true"
"-sish.logtoclient=true",
"-sish.adminenabled=true",
"-sish.serviceconsoleenabled=true"
]
}
]
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ FROM scratch
LABEL maintainer="Antonio Mika <[email protected]>"

WORKDIR /app
COPY --from=builder /go/bin/sish /app/sish

COPY --from=builder /tmp /tmp
COPY --from=builder /app/pubkeys /app/pubkeys
COPY --from=builder /app/templates /app/templates
COPY --from=builder /go/bin/sish /app/sish

ENTRYPOINT ["/app/sish"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ sh-3.2# ./sish -h
Usage of ./sish:
-sish.addr string
The address to listen for SSH connections (default "localhost:2222")
-sish.adminenabled
Whether or not to enable the admin console
-sish.admintoken string
The token to use for admin access (default "S3Cr3tP4$$W0rD")
-sish.appendusertosubdomain
Whether or not to append the user to the subdomain
-sish.auth
Whether or not to require auth on the SSH service
-sish.bannedcountries string
Expand Down Expand Up @@ -154,6 +160,10 @@ Usage of ./sish:
Whether or not to redirect the root domain (default true)
-sish.redirectrootlocation string
Where to redirect the root domain to (default "https://github.com/antoniomika/sish")
-sish.serviceconsoleenabled
Whether or not to enable the admin console for each service and send the info to users
-sish.serviceconsoletoken string
The token to use for service access. Auto generated if empty.
-sish.subdomainlen int
The length of the random subdomain to generate (default 3)
-sish.tcpalias
Expand Down
2 changes: 1 addition & 1 deletion channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func handleAlias(newChannel ssh.NewChannel, sshConn *SSHConnection, state *State
return
}

sshConn.Listeners.Store(conn.RemoteAddr(), nil)
sshConn.Listeners.Store(conn.RemoteAddr(), conn)

copyBoth(conn, connection)

Expand Down
Loading