containers: mock oauth container
Add a mock oauth container to simulate the openshift SSO offline_token
This commit is contained in:
parent
af9cca1b50
commit
44017890ca
3 changed files with 44 additions and 0 deletions
28
containers/fauxauth/fauxauth.py
Executable file
28
containers/fauxauth/fauxauth.py
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
import argparse, subprocess
|
||||
|
||||
def launch_server(address, port, certdir):
|
||||
cmd = [
|
||||
"/usr/libexec/osbuild-composer/osbuild-mock-openid-provider",
|
||||
"-a", str.join(":", [address, port]),
|
||||
"-rsaPubPem", f"{certdir}/client-crt.pem",
|
||||
"-rsaPem", f"{certdir}/client-key.pem",
|
||||
]
|
||||
print("Running oath server")
|
||||
return subprocess.run(
|
||||
cmd,
|
||||
cwd="/usr/libexec/osbuild-composer",
|
||||
stdin=subprocess.DEVNULL,
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-a", "--address", help="IP address for the server", type=str, default="localhost")
|
||||
parser.add_argument("-p", "--port", help="Port for the server", type=str, default="8080")
|
||||
parser.add_argument("-c", "--certdir", help="The location dir of the certs", type=str, default="/etc/osbuild-composer")
|
||||
args = parser.parse_args()
|
||||
launch_server(args.address, args.port, args.certdir)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
15
distribution/Dockerfile-fauxauth
Normal file
15
distribution/Dockerfile-fauxauth
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
FROM registry.access.redhat.com/ubi8/go-toolset:latest AS builder
|
||||
COPY . .
|
||||
ENV GOFLAGS=-mod=vendor
|
||||
RUN go install ./cmd/osbuild-mock-openid-provider/
|
||||
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
|
||||
RUN microdnf install python3
|
||||
RUN mkdir -p "/usr/libexec/osbuild-composer"
|
||||
RUN mkdir -p "/etc/osbuild-composer/"
|
||||
|
||||
COPY --from=builder /opt/app-root/src/go/bin/osbuild-mock-openid-provider /usr/libexec/osbuild-composer/
|
||||
COPY ./containers/fauxauth/fauxauth.py /opt/fauxauth.py
|
||||
|
||||
EXPOSE 8080 8080
|
||||
ENTRYPOINT "/opt/fauxauth.py"
|
||||
|
|
@ -4,6 +4,7 @@ ENV GOFLAGS=-mod=vendor
|
|||
RUN go install ./cmd/osbuild-worker
|
||||
|
||||
FROM fedora
|
||||
RUN dnf update -y && dnf upgrade -y
|
||||
RUN dnf install -y qemu-img osbuild osbuild-ostree
|
||||
RUN mkdir -p "/usr/libexec/osbuild-composer"
|
||||
RUN mkdir -p "/etc/osbuild-composer/"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue