-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·32 lines (25 loc) · 877 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
ln -s ${PWD}/libnss_awsiam_go.so /lib/x86_64-linux-gnu/libnss_awsiam_go.so.2
ls -l /lib/x86_64-linux-gnu/
cat > "/etc/nss_awsiam_go.conf" <<'HERE'
AWS_ACCESS_KEY_ID=AKIAXXXXXXXXXXXX
AWS_SECRET_ACCESS_KEY=SECRET
AWS_ENDPOINT_OVERRIDES_IAM=http://127.0.0.1:9000
AWS_DEFAULT_REGION=us-east-1
NSS_AWSIAM_GO_DEBUG=1
HERE
nsswitch_conf='/etc/nsswitch.conf'
sed -i -e 's/^\(\(passwd\|group\|shadow\|initgroups\): .*\)$/\1 awsiam_go/' "${nsswitch_conf}"
if ! grep -q 'initgroups' "${nsswitch_conf}"; then
echo "initgroups: files awsiam_go" >> "${nsswitch_conf}"
fi
cat "${nsswitch_conf}"
"${GOPATH}/bin/aws-iam-emulator" -bind '127.0.0.1:9000' testfixture.yml &
emulator_pid=$!
getent passwd --service=awsiam_go
getent group --service=awsiam_go
id foo
getent passwd --service=awsiam_go foo
id bar
getent passwd --service=awsiam_go bar
kill -TERM "${emulator_pid}"