Compare commits
6
Commits
72c4d16448
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
773c70e5a8 | ||
|
|
2fcbee0b4d | ||
|
|
f325fcbeb5 | ||
|
|
a17b7ea9db | ||
|
|
d27ce151c5 | ||
|
|
1058f74a2f |
No files matched your search
+9
-1
@@ -18,4 +18,12 @@ yarn-error.log*
|
||||
requests.rest
|
||||
.prettierrc
|
||||
CSV_FILES/
|
||||
log/
|
||||
log/
|
||||
|
||||
|
||||
bin/output/cert.csr
|
||||
bin/output/cert.pem
|
||||
bin/output/priv.key
|
||||
bin/tmp/csrconfig.txt
|
||||
traefik/cert.pem
|
||||
traefik/key.pem
|
||||
@@ -0,0 +1,20 @@
|
||||
all:
|
||||
echo OK
|
||||
|
||||
deploy-traefik:
|
||||
ansible-playbook -i local-inventory --connection=local \
|
||||
--extra-vars config_dir=/etc/app-traefik \
|
||||
--extra-vars traefik_dashboard_hostname=traefik.ip.ngtech.home \
|
||||
deploy-traefik.yml
|
||||
|
||||
gen-cert:
|
||||
cd bin && bash gen-cert.sh
|
||||
|
||||
use-cert:
|
||||
cp -vf bin/output/cert.pem traefik/cert.pem
|
||||
cp -vf bin/output/priv.key traefik/key.pem
|
||||
|
||||
install-dependencies:
|
||||
|
||||
deploy-docker:
|
||||
ansible-playbook --connection=local -i local-inventory deploy-docker-ce.yml
|
||||
@@ -0,0 +1,36 @@
|
||||
FROM rockylinux/rockylinux:10
|
||||
|
||||
ENV container=docker
|
||||
|
||||
RUN dnf -y install epel-release \
|
||||
&& crb enable \
|
||||
&& dnf update -y \
|
||||
&& dnf install -y sudo \
|
||||
which \
|
||||
hostname \
|
||||
libyaml-devel \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-pyyaml \
|
||||
rsync \
|
||||
wget \
|
||||
curl \
|
||||
git \
|
||||
ruby \
|
||||
&& dnf clean all
|
||||
|
||||
RUN python3 -m pip install --no-cache-dir --upgrade pip \
|
||||
&& pip3 install --no-cache-dir ansible
|
||||
|
||||
RUN ansible-galaxy collection install community.general && \
|
||||
ansible-galaxy collection install ansible.posix && \
|
||||
ansible-galaxy collection install community.docker && \
|
||||
ansible-galaxy collection list
|
||||
|
||||
RUN mkdir -p /root/.ssh
|
||||
|
||||
# Disable requiretty.
|
||||
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
|
||||
|
||||
CMD ["ansible-playbook"]
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
collections:
|
||||
- community.general
|
||||
- ansible.posix
|
||||
- community.docker
|
||||
@@ -0,0 +1,32 @@
|
||||
FROM rockylinux:9
|
||||
|
||||
ENV container=docker
|
||||
|
||||
# Install requirements.
|
||||
RUN dnf -y install rpm dnf-plugins-core \
|
||||
&& dnf -y config-manager --set-enabled crb \
|
||||
&& dnf -y update \
|
||||
&& dnf -y install --allowerasing \
|
||||
epel-release \
|
||||
sudo \
|
||||
which \
|
||||
hostname \
|
||||
libyaml-devel \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-pyyaml \
|
||||
rsync \
|
||||
wget \
|
||||
curl \
|
||||
git \
|
||||
ruby ruby-devel \
|
||||
ruby bash bash-completion openssh sshpass nmap-ncat \
|
||||
nmap \
|
||||
&& dnf clean all
|
||||
|
||||
RUN python3 -m pip install --no-cache-dir --upgrade pip
|
||||
|
||||
|
||||
RUN mkdir -p /root/.ssh
|
||||
|
||||
CMD ["bash"]
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
STATE=$(head -1 vars/state)
|
||||
COUNTRY=$(head -1 vars/country)
|
||||
LOCALITY=$(head -1 vars/locality)
|
||||
ORGANIZATION=$(head -1 vars/organization)
|
||||
LOCALITRY=$(head -1 vars/locality)
|
||||
CN=$(head -1 vars/cn)
|
||||
DAYS=$(head -1 vars/days)
|
||||
|
||||
SUBJECT_ALTERNATIVES=$( python3 gen-subject-alternatives.py )
|
||||
|
||||
jinja2 templates/csrconfig.txt.j2 -D cn="${CN}" -D country="${COUNTRY}" -D state="${STATE}" -D locality="${LOCALITY}" \
|
||||
-D org="${ORGANIZATION}" -D subj_alternative="${SUBJECT_ALTERNATIVES}" > tmp/csrconfig.txt
|
||||
|
||||
|
||||
#generate the RSA private key
|
||||
openssl genpkey -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out output/priv.key
|
||||
|
||||
#Create the CSR
|
||||
openssl req -new -nodes -key output/priv.key -config tmp/csrconfig.txt -out output/cert.csr
|
||||
|
||||
# Generate the self-signed certificate
|
||||
openssl x509 -req -days ${DAYS} -in output/cert.csr -signkey output/priv.key -out output/cert.pem
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
def read_file(file_name):
|
||||
with open(file_name, 'r') as file:
|
||||
data = file.readlines()
|
||||
return [line.strip() for line in data if line.strip()]
|
||||
|
||||
def generate_san_config(ips, domains, emails):
|
||||
san_config = ""
|
||||
entries = []
|
||||
|
||||
for i, ip in enumerate(ips):
|
||||
entries.append(f"IP.{i} = {ip}")
|
||||
|
||||
for i, domain in enumerate(domains):
|
||||
entries.append(f"DNS.{i} = {domain}")
|
||||
|
||||
for i, email in enumerate(emails):
|
||||
entries.append(f"email.{i} = {email}")
|
||||
|
||||
san_config += "\n".join(entries)
|
||||
return san_config
|
||||
|
||||
def main():
|
||||
ip_file = "vars/ips"
|
||||
domain_file = "vars/domains"
|
||||
email_file = "vars/emails"
|
||||
|
||||
ips = read_file(ip_file)
|
||||
domains = read_file(domain_file)
|
||||
emails = read_file(email_file)
|
||||
|
||||
if not ips and not domains and not emails:
|
||||
return
|
||||
|
||||
san_config = generate_san_config(ips, domains, emails)
|
||||
|
||||
print(san_config)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
def read_file(file_name)
|
||||
File.readlines(file_name).map(&:strip).reject(&:empty?)
|
||||
end
|
||||
|
||||
def generate_san_config(ips, domains, emails)
|
||||
entries = []
|
||||
|
||||
ips.each_with_index do |ip, i|
|
||||
entries << "IP.#{i} = #{ip}"
|
||||
end
|
||||
|
||||
domains.each_with_index do |domain, i|
|
||||
entries << "DNS.#{i} = #{domain}"
|
||||
end
|
||||
|
||||
emails.each_with_index do |email, i|
|
||||
entries << "email.#{i} = #{email}"
|
||||
end
|
||||
|
||||
entries.join("\n")
|
||||
end
|
||||
|
||||
def main
|
||||
ip_file = "vars/ips"
|
||||
domain_file = "vars/domains"
|
||||
email_file = "vars/emails"
|
||||
|
||||
ips = read_file(ip_file)
|
||||
domains = read_file(domain_file)
|
||||
emails = read_file(email_file)
|
||||
|
||||
return if ips.empty? && domains.empty? && emails.empty?
|
||||
|
||||
san_config = generate_san_config(ips, domains, emails)
|
||||
|
||||
puts san_config
|
||||
end
|
||||
|
||||
if __FILE__ == $PROGRAM_NAME
|
||||
main
|
||||
end
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,20 @@
|
||||
[ req ]
|
||||
default_md = sha256
|
||||
prompt = no
|
||||
req_extensions = req_ext
|
||||
distinguished_name = req_distinguished_name
|
||||
|
||||
[ req_distinguished_name ]
|
||||
commonName = ###CN##
|
||||
countryName = ###COUNTRY###
|
||||
stateOrProvinceName = ###STATE###
|
||||
localityName = ###LOCALITY###
|
||||
organizationName = ###ORGANIZATION###
|
||||
|
||||
[ req_ext ]
|
||||
keyUsage=critical,digitalSignature,keyEncipherment
|
||||
extendedKeyUsage=critical,serverAuth,clientAuth
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[ alt_names ]
|
||||
###ALTERNATIVE_NAMES###
|
||||
@@ -0,0 +1,20 @@
|
||||
[ req ]
|
||||
default_md = sha256
|
||||
prompt = no
|
||||
req_extensions = req_ext
|
||||
distinguished_name = req_distinguished_name
|
||||
|
||||
[ req_distinguished_name ]
|
||||
commonName = {{ cn }}
|
||||
countryName = {{ country }}
|
||||
stateOrProvinceName = {{ state }}
|
||||
localityName = {{ locality }}
|
||||
organizationName = {{ org }}
|
||||
|
||||
[ req_ext ]
|
||||
keyUsage=critical,digitalSignature,keyEncipherment
|
||||
extendedKeyUsage=critical,serverAuth,clientAuth
|
||||
subjectAltName = @alt_names
|
||||
|
||||
[ alt_names ]
|
||||
{{ subj_alternative }}
|
||||
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
example.org
|
||||
@@ -0,0 +1 @@
|
||||
IL
|
||||
@@ -0,0 +1 @@
|
||||
3650
|
||||
@@ -0,0 +1,2 @@
|
||||
example.org
|
||||
*.example.org
|
||||
Whitespace-only changes.
@@ -0,0 +1,3 @@
|
||||
10.0.0.138
|
||||
192.168.0.1
|
||||
192.168.1.1
|
||||
@@ -0,0 +1 @@
|
||||
Karney Shomron
|
||||
@@ -0,0 +1 @@
|
||||
NgTech LTD
|
||||
@@ -0,0 +1 @@
|
||||
Center
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
ansible-playbook -i local-inventory --connection=local \
|
||||
--extra-vars config_dir=/etc/app-traefik \
|
||||
--extra-vars traefik_dashboard_hostname=traefik.ip.ngtech.home \
|
||||
deploy-traefik.yml
|
||||
@@ -0,0 +1,2 @@
|
||||
[local]
|
||||
127.0.0.1
|
||||
Reference in new issue
Block a user