Skip to content

Commit 7d8544e

Browse files
committed
add (BROKEN?) NTLM support
1 parent 76794c9 commit 7d8544e

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
#FROM public.ecr.aws/lambda/provided:al2023
22
## INSTALL POWERSHELL RUNTIME
33
FROM 978558897928.dkr.ecr.us-east-1.amazonaws.com/powershell-runtime:latest as runtime-files
4+
## Install gss-ntlmssp and related packages for NTLM authentication
5+
# FROM 978558897928.dkr.ecr.us-east-1.amazonaws.com/powershell-remoting-ntlm:latest as remoting-files
46
## INSTALL AWS SDK
57
FROM 978558897928.dkr.ecr.us-east-1.amazonaws.com/powershell-modules-aws-tools:latest as module-files
68

79
## Build final image
810
FROM public.ecr.aws/lambda/provided:al2023
911
## Copy PowerShell runtime files
1012
COPY --from=runtime-files . /
13+
## Copy NTLM auth files
14+
# COPY --from=remoting-files . /
1115
## Copy Module files
1216
COPY --from=module-files . /
1317
## Function files
1418
COPY /function/ /var/task
1519
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
1620
WORKDIR /var/task
1721
ENTRYPOINT [ "/var/runtime/bootstrap" ]
18-
CMD [ "examplehandler.ps1::handler" ]
22+
CMD [ "examplehandler.ps1::handler" ]
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# syntax=docker/dockerfile:1
2+
3+
# This image is based on the existing powershell-runtime image.
4+
# Set any of the arguments as needed in case you customized the image details.
5+
ARG REGISTRY=<account>.dkr.ecr.<region>.amazonaws.com
6+
ARG RUNTIME_IMAGE=${REGISTRY}/powershell-remoting
7+
ARG RUNTIME_TAG=latest
8+
ARG RUNTIME=${RUNTIME_IMAGE}:${RUNTIME_TAG}
9+
10+
FROM ${RUNTIME} as build
11+
12+
WORKDIR /tmp
13+
14+
# These build dependencies are documented here:
15+
# https://github.com/gssapi/gss-ntlmssp/blob/main/contrib/gssntlmssp.spec.in#L13
16+
RUN dnf install -y \
17+
autoconf automake docbook-style-xsl doxygen findutils krb5-devel \
18+
libtool libxml2 libxslt libunistring-devel m4 pkgconfig openssl-devel
19+
20+
# These build dependencies are also needed but not in the spec file.
21+
# It's easier to iterate on these packages when they are in their own RUN step.
22+
RUN dnf install -y rpm-build gettext-devel libwbclient-devel zlib-devel
23+
24+
# Build gssntlmssp
25+
RUN <<EOF
26+
git clone https://github.com/gssapi/gss-ntlmssp
27+
cd /tmp/gss-ntlmssp
28+
autoreconf -f -i
29+
./configure
30+
make rpms
31+
mkdir -p /tmp/gssntlmssp
32+
mv /tmp/gss-ntlmssp/rpmbuild/RPMS/x86_64/gssntlmssp-[0-9]*.x86_64.rpm /tmp/gssntlmssp/gssntlmssp.rpm
33+
rm -rf /tmp/gss-ntlmssp
34+
EOF
35+
36+
# Start a new build stage since we don't need all the build dependencies and intermediate build output.
37+
FROM ${RUNTIME} as target
38+
39+
# Get the final RPM we built out of the build stage.
40+
COPY --from=build /tmp/gssntlmssp /tmp/
41+
42+
# libwbclient is required to install the RPM, but it does not seem to declare it as a runtime dependency
43+
# so it won't be installed automatically.
44+
RUN dnf install -y libwbclient
45+
46+
# This RPM is quite small but it brings in around 45 other packages.
47+
RUN rpm --install /tmp/gssntlmssp.rpm

0 commit comments

Comments
 (0)