Skip to content

Commit 0c620b1

Browse files
varunjain99Varun Jain
andauthored
Set up HasPolicyAccess (#27)
* prelim commit * tweak * updates * update * update * s3 account access block and linter --------- Co-authored-by: Varun Jain <varunjain@Varuns-MacBook-Pro-2.local>
1 parent dece17b commit 0c620b1

File tree

7 files changed

+431
-40
lines changed

7 files changed

+431
-40
lines changed

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@ WORKDIR /srv/cartography
44

55
ENV PATH=/venv/bin:$PATH
66
RUN apt-get update && \
7-
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3.8-dev python3-pip python3-setuptools openssl libssl-dev gcc pkg-config libffi-dev libxml2-dev libxmlsec1-dev curl && \
7+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential python3.8-dev python3-pip python3-setuptools openssl libssl-dev gcc pkg-config libffi-dev libxml2-dev libxmlsec1-dev curl && \
88
apt-get clean && \
99
rm -rf /var/lib/apt/lists/*
10-
COPY . /srv/cartography
10+
COPY ./test-requirements.txt /srv/cartography/test-requirements.txt
11+
COPY ./requirements.txt /srv/cartography/requirements.txt
1112

1213
# Installs pip supported by python3.8
1314
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.8 get-pip.py
1415

15-
RUN pip install -e . && \
16+
RUN pip install -r requirements.txt && \
1617
pip install -r test-requirements.txt
1718

19+
COPY . /srv/cartography
1820
RUN groupadd cartography && \
1921
useradd -s /bin/bash -d /home/cartography -m -g cartography cartography
2022

2123
USER cartography
24+
25+
RUN umask 0002

Dockerfile.dev

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM ubuntu:bionic
2+
3+
WORKDIR /srv/cartography
4+
5+
ENV PATH=/venv/bin:$PATH
6+
RUN apt-get update && \
7+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential python3.8-dev python3-pip python3-setuptools openssl libssl-dev gcc pkg-config libffi-dev libxml2-dev libxmlsec1-dev curl && \
8+
apt-get clean && \
9+
rm -rf /var/lib/apt/lists/*
10+
COPY ./test-requirements.txt /srv/cartography/test-requirements.txt
11+
COPY ./requirements.txt /srv/cartography/requirements.txt
12+
13+
# Installs pip supported by python3.8
14+
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.8 get-pip.py
15+
16+
RUN --mount=type=cache,target=/root/.cache \
17+
pip install -r requirements.txt && \
18+
pip install -r test-requirements.txt
19+
20+
COPY . /srv/cartography
21+
RUN groupadd cartography && \
22+
useradd -s /bin/bash -d /home/cartography -m -g cartography cartography
23+
24+
USER cartography
25+
26+
RUN umask 0002
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"statements": [
3+
{
4+
"query": "MATCH (:AWSAccount{id: $AWS_ID})-[:RESOURCE]->(n:S3AccountAccessBlock) WHERE n.lastupdated <> $UPDATE_TAG WITH n LIMIT $LIMIT_SIZE DETACH DELETE (n)",
5+
"iterative": true,
6+
"iterationsize": 100
7+
}
8+
],
9+
"name": "cleanup S3AccountAccessBlock"
10+
}

0 commit comments

Comments
 (0)