Skip to content

Commit d9b41fe

Browse files
committed
container repository
1 parent 620f38c commit d9b41fe

22 files changed

+646
-0
lines changed

.github/workflows/release.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
id-token: write
10+
contents: read
11+
packages: write
12+
actions: read
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-24.04
17+
strategy:
18+
matrix:
19+
container:
20+
- web-compat
21+
- bastion
22+
- phpldapadmin
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Build and push images
37+
uses: docker/build-push-action@v6
38+
with:
39+
context: "${{ matrix.container }}"
40+
tags: ghcr.io/hpcslab/${{ matrix.container }}:${{ github.sha }}
41+
push: true

bastion/.gitignore

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

bastion/Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM ubuntu:noble
2+
3+
RUN apt-get update && \
4+
apt-get install -y \
5+
iproute2 \
6+
iputils-ping \
7+
dnsutils \
8+
fish \
9+
neovim \
10+
openssh-server \
11+
libnss-ldapd \
12+
libpam-ldapd \
13+
ldap-utils \
14+
wget \
15+
netcat-openbsd \
16+
unzip \
17+
subversion \
18+
less
19+
20+
RUN wget https://github.com/namachan10777/whaleinit/releases/download/v0.0.4/whaleinit-$(uname -m)-linux-musl -O /whaleinit && \
21+
chmod 755 /whaleinit
22+
23+
COPY bastion.conf /etc/ssh/sshd_config.d/10-bastion.conf
24+
25+
RUN mkdir -p /local/home/rescue/.ssh
26+
RUN useradd -M -d /local/home/rescue -G sudo rescue
27+
28+
COPY authorized_keys_gen.sh .
29+
RUN bash authorized_keys_gen.sh && mv authorized_keys /local/home/rescue/.ssh/authorized_keys
30+
COPY ssh_host_keys_gen.sh /usr/local/bin/ssh_host_keys_gen.sh
31+
RUN chown -R rescue:rescue /local/home/rescue/.ssh
32+
RUN chmod 700 /local/home/rescue/.ssh && chmod 600 /local/home/rescue/.ssh/authorized_keys
33+
RUN mkdir -p /run/sshd
34+
RUN echo 'work' > /etc/hostname
35+
36+
COPY nsswitch.conf /etc/nsswitch.conf
37+
COPY nslcd.conf /etc/nslcd.conf
38+
39+
COPY whaleinit.toml /etc/whaleinit.toml
40+
41+
RUN rm /etc/ssh/ssh_host_*_key*
42+
43+
ENTRYPOINT [ "/whaleinit" ]

bastion/LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <https://unlicense.org>

bastion/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# bastion
2+
3+
`host`ネットワークモードで、docker volumeを使いSSH鍵が配置されているvolumeを`/home`にマウントしてください。
4+
5+
## Build
6+
7+
```sh
8+
./authorized_keys_gen.sh
9+
docker build -t hpcslab/bastion .
10+
```

bastion/authorized_keys_gen.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
ADMINS=(
6+
namachan10777 # mnakano
7+
onokatio # tmaruyama
8+
maetin0324 # rmaeda
9+
motorailgun # kourakata
10+
k5342 # ksugihara
11+
kotatsumuri # Shota Kawakami
12+
TomoYoshida-enthityDecalture # Tomo Yoshida
13+
TKSN0775 # Shunsuke Takeshima
14+
UNIQabes # Takato Abe
15+
shattori # Shingo Hattori
16+
)
17+
18+
touch authorized_keys
19+
truncate -s 0 authorized_keys
20+
21+
for admin in "${ADMINS[@]}"; do
22+
echo "genrate for $admin"
23+
curl "https://github.com/$admin.keys" >> authorized_keys
24+
done
25+
26+
echo "authorized_keys generated"

bastion/bastion.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
AddressFamily inet
2+
PasswordAuthentication no
3+
Port 10022
4+
5+
HostKey /etc/ssh/keys/rsa
6+
HostKey /etc/ssh/keys/ed25519
7+
HostKey /etc/ssh/keys/ecdsa

bastion/nslcd.conf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# /etc/nslcd.conf
2+
# nslcd configuration file. See nslcd.conf(5)
3+
# for details.
4+
5+
# The user and group nslcd should run as.
6+
uid nslcd
7+
gid nslcd
8+
9+
# The location at which the LDAP server(s) should be reachable.
10+
uri ldap://auth.lab.hpcs.cs.tsukuba.ac.jp:389
11+
12+
# The search base that will be used for all queries.
13+
base dc=hpcs,dc=cs,dc=tsukuba,dc=ac,dc=jp
14+
15+
# The LDAP protocol version to use.
16+
#ldap_version 3
17+
18+
# The DN to bind with for normal lookups.
19+
#binddn cn=annonymous,dc=example,dc=net
20+
#bindpw secret
21+
22+
# The DN used for password modifications by root.
23+
#rootpwmoddn cn=admin,dc=example,dc=com
24+
25+
# SSL options
26+
#ssl off
27+
#tls_reqcert never
28+
#tls_cacertfile /etc/ssl/certs/ca-certificates.crt
29+
30+
# The search scope.
31+
#scope sub

bastion/nsswitch.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
passwd: files systemd ldap
2+
group: files systemd ldap
3+
shadow: files systemd ldap
4+
gshadow: files systemd
5+
6+
hosts: files dns
7+
networks: files
8+
9+
protocols: db files
10+
services: db files
11+
ethers: db files
12+
rpc: db files
13+
14+
netgroup: nis

bastion/ssh_host_keys_gen.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -eux
4+
5+
mkdir -p /etc/ssh/keys
6+
7+
if [ ! -e /etc/ssh/keys/ecdsa ]; then
8+
ssh-keygen -t ecdsa -f /etc/ssh/keys/ecdsa -N ""
9+
fi
10+
11+
if [ ! -e /etc/ssh/keys/ed25519 ]; then
12+
ssh-keygen -t ed25519 -f /etc/ssh/keys/ed25519 -N ""
13+
fi
14+
15+
if [ ! -e /etc/ssh/keys/rsa ]; then
16+
ssh-keygen -t rsa -f /etc/ssh/keys/rsa -N ""
17+
fi

0 commit comments

Comments
 (0)