fix: missing service files for openssh and account
Signed-off-by: sisungo <[email protected]>
This commit is contained in:
1 parent
a814b7a70c
commit
2068a84ccf
6 files changed
+58
No files matched your search
@@ -14,6 +14,7 @@ builddep("libpam-dev @target")
|
||||
|
||||
|
||||
def build():
|
||||
os.environ["DEFAULT_LIBEXEC_DIR"] = get_prefix("account") + "/libexec"
|
||||
os.makedirs("build_config", exist_ok=True)
|
||||
shutil.copy2("../../init.json", "build_config/init.json")
|
||||
rust.build(["--features", "embed_init_file"])
|
||||
@@ -23,6 +24,8 @@ on_build(build)
|
||||
|
||||
|
||||
def pack(composer):
|
||||
composer.makedirs("share/services")
|
||||
composer.addfile("misc/accountd.airs", "share/services/accountd.airs")
|
||||
os.chdir(rust.artifacts_dir())
|
||||
composer.makedir("bin")
|
||||
composer.makedir("libexec")
|
||||
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "${ACTION}" = "remove" ] && exit 0
|
||||
|
||||
mkdir -p /var/empty
|
||||
|
||||
account info _sshd > /dev/null 2>&1 && exit
|
||||
account create-group \
|
||||
--fullname "OpenSSH Server PrivSep Group" \
|
||||
--description "Privilege seperation group for running the OpenSSH server." \
|
||||
--host-gid 22 \
|
||||
_sshd
|
||||
account create-user -d /var/empty -H \
|
||||
--fullname "OpenSSH Server PrivSep User" \
|
||||
--description "Privilege seperation user for running the OpenSSH server." \
|
||||
--host-uid 22 \
|
||||
--no-login \
|
||||
--groups _sshd \
|
||||
_sshd
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "${ACTION}" = "remove" ] && exit 0
|
||||
|
||||
[ -e /var/config/ssh/ssh_config ] && exit
|
||||
|
||||
mkdir -p /var/config/ssh
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "${ACTION}" = "remove" ] && exit 0
|
||||
|
||||
[ -e /var/config/ssh/ssh_host_ed25519_key ] && exit 0
|
||||
|
||||
ssh-keygen -A
|
||||
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
from lib import cpp
|
||||
from lib.make import *
|
||||
|
||||
@@ -38,12 +40,34 @@ def build():
|
||||
on_build(build)
|
||||
|
||||
|
||||
service_in = os.getcwd() + "/services/openssh-server.airs.in"
|
||||
def install_service(composer):
|
||||
composer.makedirs("share/services")
|
||||
with open(service_in) as fd:
|
||||
service = fd.read()
|
||||
service = service.replace("%PREFIX%", get_prefix("openssh"))
|
||||
with open("openssh-server.airs", "wt+") as fd:
|
||||
fd.write(service)
|
||||
composer.add("openssh-server.airs", "share/services/openssh-server.airs")
|
||||
|
||||
def patch_config():
|
||||
with open("var/config/ssh/sshd_config") as fd:
|
||||
sshd_config = fd.read()
|
||||
sshd_config = sshd_config.replace("#UsePAM no", "UsePAM yes")
|
||||
sshd_config = sshd_config.replace("#PrintMotd yes", "PrintMotd no")
|
||||
with open("var/config/ssh/sshd_config", "wt") as fd:
|
||||
fd.write(sshd_config)
|
||||
|
||||
def pack(composer):
|
||||
composer.add("bin")
|
||||
composer.add("libexec")
|
||||
composer.makedir("share")
|
||||
|
||||
patch_config()
|
||||
composer.add("var/config", "share/config")
|
||||
|
||||
install_service(composer)
|
||||
|
||||
def pack_docs(composer):
|
||||
composer.makedir("share")
|
||||
composer.add("share/man")
|
||||
@@ -55,9 +79,11 @@ dep("libz @same-arch")
|
||||
dep("libpam @same-arch")
|
||||
provide("ssh")
|
||||
provide("sshd")
|
||||
configure_script("configure/create-privsep")
|
||||
configure_script("configure/default-config")
|
||||
configure_script("configure/hostkeys")
|
||||
on_pack(pack)
|
||||
link("share/services/openssh-server.airs", "/share/services/sshd.airs")
|
||||
|
||||
package("openssh-docs")
|
||||
on_pack(pack_docs)
|
||||
@@ -0,0 +1,6 @@
|
||||
[service]
|
||||
display-name = "OpenSSH Server"
|
||||
description = "OpenSSH is the premier connectivity tool for remote login with the SSH protocol."
|
||||
|
||||
[exec]
|
||||
start = "%PREFIX%/bin/sshd -D"
|
||||
Reference in new issue
Block a user