Skip to content

Commit c7df4b9

Browse files
committed
Initial code commit
1 parent 973ffc0 commit c7df4b9

File tree

8 files changed

+825
-0
lines changed

8 files changed

+825
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

Cargo.lock

Lines changed: 204 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[package]
2+
name = "ssh-key-dir"
3+
repository = "https://github.com/coreos/ssh-key-dir"
4+
license = "Apache-2.0"
5+
edition = "2018"
6+
exclude = ["/.cci.jenkinsfile", "/.github", "/.gitignore", "/.travis.yml"]
7+
authors = [ "Benjamin Gilbert <[email protected]>" ]
8+
description = "AuthorizedKeysCommand wrapper to read ~/.ssh/authorized_keys.d"
9+
version = "0.0.1-alpha.0"
10+
11+
[package.metadata.release]
12+
sign-commit = true
13+
disable-push = true
14+
disable-publish = true
15+
pre-release-commit-message = "cargo: ssh-key-dir release {{version}}"
16+
post-release-commit-message = "cargo: development version bump"
17+
tag-message = "ssh-key-dir v{{version}}"
18+
19+
[[bin]]
20+
name = "ssh-key-dir"
21+
path = "src/main.rs"
22+
23+
[profile.release]
24+
lto = true
25+
26+
[dependencies]
27+
clap = { version = "2.33", default-features = false }
28+
error-chain = { version = "0.12", default-features = false }
29+
users = "0.10"
30+
31+
[dev-dependencies]
32+
tempfile = "3"

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
RELEASE ?= 0
2+
3+
ifeq ($(RELEASE),1)
4+
PROFILE ?= release
5+
CARGO_ARGS = --release
6+
else
7+
PROFILE ?= debug
8+
CARGO_ARGS =
9+
endif
10+
11+
.PHONY: all
12+
all:
13+
cargo build ${CARGO_ARGS}
14+
15+
.PHONY: install
16+
install: all
17+
install -D -t ${DESTDIR}/usr/libexec target/${PROFILE}/ssh-key-dir
18+
install -D -m 644 -t ${DESTDIR}/etc/ssh/sshd_config.d conf/40-ssh-key-dir.conf

conf/40-ssh-key-dir.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# sshd_config drop-in for /etc/ssh/sshd_config.d
2+
3+
# Use ssh-key-dir to read all SSH keys from ~/.ssh/authorized_keys.d
4+
AuthorizedKeysCommand /usr/libexec/ssh-key-dir %u
5+
6+
# ssh-key-dir needs to be able to seteuid to the target user
7+
AuthorizedKeysCommandUser root

src/errors.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2020 CoreOS, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use error_chain::error_chain;
16+
17+
error_chain! {
18+
foreign_links {
19+
Io(std::io::Error);
20+
}
21+
}

0 commit comments

Comments
 (0)