some changes
parent
ce1c9fb6b6
commit
56ac5ffa80
Binary file not shown.
Binary file not shown.
|
|
@ -9,8 +9,8 @@ services:
|
||||||
- 993:993
|
- 993:993
|
||||||
volumes:
|
volumes:
|
||||||
- vmail:/srv/mail
|
- vmail:/srv/mail
|
||||||
- /opt/dovecot/config:/etc/dovecot
|
- ./dovecot/config:/etc/dovecot
|
||||||
- /opt/dovecot/passwd:/etc/dovecot/passwd
|
- ./dovecot/passwd:/etc/dovecot/passwd
|
||||||
|
|
||||||
roundcube:
|
roundcube:
|
||||||
image: roundcube/roundcubemail
|
image: roundcube/roundcubemail
|
||||||
|
|
@ -19,22 +19,21 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
environment:
|
environment:
|
||||||
- ROUNDCUBEMAIL_DEFAULT_HOST=180.1.1.164
|
- ROUNDCUBEMAIL_DEFAULT_HOST=dovecot
|
||||||
- ROUNDCUBEMAIL_DEFAULT_PORT=143
|
- ROUNDCUBEMAIL_DEFAULT_PORT=143
|
||||||
depends_on:
|
depends_on:
|
||||||
- dovecot
|
- dovecot
|
||||||
|
|
||||||
imapsync:
|
imapsync:
|
||||||
build:
|
build:
|
||||||
dockerfile: imapsync-dockerfile
|
dockerfile: ./dockerfile/imapsync-dockerfile
|
||||||
container_name: imapsync
|
container_name: imapsync
|
||||||
restart: always
|
restart: always
|
||||||
|
expose:
|
||||||
|
- 993
|
||||||
|
- 143
|
||||||
volumes:
|
volumes:
|
||||||
- /app/db:/root/IMAP-Sync/db
|
- ./db:/app/db
|
||||||
logging:
|
|
||||||
driver: journald
|
|
||||||
options:
|
|
||||||
tag: imapsync
|
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
@ -42,11 +41,13 @@ services:
|
||||||
|
|
||||||
streamlit:
|
streamlit:
|
||||||
build:
|
build:
|
||||||
dockerfile: streamlit-dockerfile
|
dockerfile: ./dockerfile/streamlit-dockerfile
|
||||||
container_name: streamlit
|
container_name: streamlit
|
||||||
restart: always
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 81:80
|
||||||
volumes:
|
volumes:
|
||||||
- /app/db:/root/IMAP-Sync/db
|
- ./db:/app/db
|
||||||
logging:
|
logging:
|
||||||
driver: journald
|
driver: journald
|
||||||
options:
|
options:
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,20 @@ FROM debian:latest
|
||||||
RUN apt update
|
RUN apt update
|
||||||
RUN apt upgrade -y
|
RUN apt upgrade -y
|
||||||
RUN apt install -y git make gcc
|
RUN apt install -y git make gcc
|
||||||
RUN apt install -y apt-file cpanminus libc6-dev libssl-dev python3 python3-pip
|
RUN apt install -y apt-file cpanminus libc6-dev libssl-dev python3 python3-pip python3-dotenv
|
||||||
RUN apt install -y libperl-dev zlib1g-dev libnet-ssleay-perl
|
RUN apt install -y libperl-dev zlib1g-dev libnet-ssleay-perl
|
||||||
RUN cpanm App::cpanminus Authen::NTLM CGI Compress::Zlib Crypt::OpenSSL::RSA Data::Dumper Data::Uniqid Dist::CheckConflicts Encode Encode::IMAPUTF7 File::Copy::Recursive File::Tail IO::Socket::INET IO::Socket::INET6 IO::Socket::SSL IO::Tee JSON JSON::WebToken LWP::UserAgent Mail::IMAPClient Module::ScanDeps PAR::Packer Pod::Usage Readonly Regexp::Common Sys::MemInfo Term::ReadKey Test::MockObject Test::More Test::Pod Unicode::String; exit 0
|
RUN cpanm App::cpanminus Authen::NTLM CGI Compress::Zlib Crypt::OpenSSL::RSA Data::Dumper Data::Uniqid Dist::CheckConflicts Encode Encode::IMAPUTF7 File::Copy::Recursive File::Tail IO::Socket::INET IO::Socket::INET6 IO::Socket::SSL IO::Tee JSON JSON::WebToken LWP::UserAgent Mail::IMAPClient Module::ScanDeps PAR::Packer Pod::Usage Readonly Regexp::Common Sys::MemInfo Term::ReadKey Test::MockObject Test::More Test::Pod Unicode::String; exit 0
|
||||||
RUN apt install -y libproc-processtable-perl python3-requests iputils-ping
|
RUN apt install -y libproc-processtable-perl python3-requests iputils-ping
|
||||||
WORKDIR /usr/local/src
|
WORKDIR /usr/local/src
|
||||||
RUN echo PWD
|
RUN echo PWD
|
||||||
RUN git clone https://github.com/imapsync/imapsync.git
|
RUN git clone https://github.com/imapsync/imapsync.git
|
||||||
RUN ./imapsync
|
WORKDIR ./imapsync
|
||||||
RUN make install
|
RUN make install
|
||||||
|
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
COPY ../python_scripte/imapsync.py .
|
COPY ../python_scripte/imapsync.py .
|
||||||
CMD ["/bin/bash"]
|
COPY ../python_scripte/.env .
|
||||||
|
ENTRYPOINT [ "python3", "/app/imapsync.py" ]
|
||||||
|
|
||||||
#RUN impasync-script
|
#RUN impasync-script
|
||||||
|
|
@ -11,13 +11,13 @@ RUN apt-get update && apt-get install -y \
|
||||||
git \
|
git \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY ../python_scripte/streamlit-app.py /app/
|
|
||||||
COPY ../python_scripte/requirements.txt /app/
|
|
||||||
|
|
||||||
RUN pip3 install -r /app/requirements.txt
|
RUN pip3 install -r /app/requirements.txt
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
COPY ../python_scripte/streamlit-app.py /app/
|
||||||
|
COPY ../python_scripte/requirements.txt /app/
|
||||||
|
|
||||||
HEALTHCHECK CMD curl --fail http://localhost:80/_stcore/health
|
HEALTHCHECK CMD curl --fail http://localhost:80/_stcore/health
|
||||||
|
|
||||||
ENTRYPOINT ["streamlit", "run", "/app/streamlit-app.py", "--server.port=80", "--server.address=0.0.0.0"]
|
ENTRYPOINT ["streamlit", "run", "/app/streamlit-app.py", "--server.port=80", "--server.address=0.0.0.0"]
|
||||||
|
|
@ -7,11 +7,12 @@ import smtplib
|
||||||
import os
|
import os
|
||||||
from email.message import EmailMessage
|
from email.message import EmailMessage
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
import time # Import time module for sleep functionality
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
# Define server details
|
# Define server details
|
||||||
host = "front"
|
host = "180.1.1.164"
|
||||||
port = 993
|
port = 993
|
||||||
|
|
||||||
# Function to send an email notification
|
# Function to send an email notification
|
||||||
|
|
@ -37,6 +38,9 @@ def send_email(subject, body, to_email):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Failed to send email: {e}")
|
print(f"Failed to send email: {e}")
|
||||||
|
|
||||||
|
# Start the infinite loop
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
# Check if mail server is active
|
# Check if mail server is active
|
||||||
try:
|
try:
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
@ -44,13 +48,15 @@ try:
|
||||||
result = sock.connect_ex((host, port))
|
result = sock.connect_ex((host, port))
|
||||||
if result != 0:
|
if result != 0:
|
||||||
print(f"Fehler beim Verbinden zu {host} auf Port {port}") # --- E-Mail senden
|
print(f"Fehler beim Verbinden zu {host} auf Port {port}") # --- E-Mail senden
|
||||||
|
send_email("Server Connection Error", f"Fehler beim Verbinden zu {host} auf Port {port}", os.getenv('TO_EMAIL'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Fehler beim Verbinden zu {host} auf Port {port}: {e}") # --- E-Mail senden
|
print(f"Fehler beim Verbinden zu {host} auf Port {port}: {e}") # --- E-Mail senden
|
||||||
|
send_email("Server Connection Error", f"Fehler beim Verbinden zu {host} auf Port {port}: {e}", os.getenv('TO_EMAIL'))
|
||||||
finally:
|
finally:
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
# Prepare SQLite database connection
|
# Prepare SQLite database connection
|
||||||
db_path = "imapsync_results.db"
|
db_path = "/app/db/imapsync_results.db"
|
||||||
conn = sqlite3.connect(db_path)
|
conn = sqlite3.connect(db_path)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
|
@ -85,7 +91,7 @@ if not users:
|
||||||
for user in users:
|
for user in users:
|
||||||
username, password, domain = user
|
username, password, domain = user
|
||||||
local_part = username.split('@')[0]
|
local_part = username.split('@')[0]
|
||||||
|
print(f"User: {username} running.")
|
||||||
# Command for imapsync
|
# Command for imapsync
|
||||||
command = [
|
command = [
|
||||||
"imapsync",
|
"imapsync",
|
||||||
|
|
@ -93,11 +99,12 @@ for user in users:
|
||||||
"--user1", username,
|
"--user1", username,
|
||||||
"--password1", password,
|
"--password1", password,
|
||||||
"--host2", "180.1.1.164",
|
"--host2", "180.1.1.164",
|
||||||
"--user2", "archiv@archiv.trendsetzer.eu",
|
"--user2", "archiv@trendsetzer.eu",
|
||||||
"--password2", "pass",
|
"--password2", "Ln0m2YQZd23H54L5tCiyjIBWLEn8mk36v7KauqS8QFGzu",
|
||||||
"--subfolder2", f"{local_part}",
|
"--subfolder2", f"{local_part}",
|
||||||
"--regextrans2", "s/^(.*)$/\\1/",
|
"--regextrans2", "s/^(.*)$/\\1/",
|
||||||
"--nolog"
|
"--log",
|
||||||
|
"--notls2"
|
||||||
]
|
]
|
||||||
|
|
||||||
# Run the command and capture the output
|
# Run the command and capture the output
|
||||||
|
|
@ -133,3 +140,10 @@ for user in users:
|
||||||
|
|
||||||
# Close database connection
|
# Close database connection
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"An error occurred during the loop execution: {e}")
|
||||||
|
|
||||||
|
# Sleep for 5 minutes before the next iteration
|
||||||
|
print("Sleep 5 minutes")
|
||||||
|
time.sleep(300)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ def main():
|
||||||
view_users = st.sidebar.button("View Users", key="view_users_button")
|
view_users = st.sidebar.button("View Users", key="view_users_button")
|
||||||
delete_user = st.sidebar.button("Delete User", key="delete_user_button")
|
delete_user = st.sidebar.button("Delete User", key="delete_user_button")
|
||||||
st.sidebar.markdown(
|
st.sidebar.markdown(
|
||||||
'<a href="http://180.1.1.164:8000" target="_blank"><button style="background-color: LightGray; color: black; border: none; padding: 8px 16px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer;">View Mails</button></a>',
|
'<a href="http://180.1.1.164" target="_blank"><button style="background-color: LightGray; color: black; border: none; padding: 8px 16px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer;">View Mails</button></a>',
|
||||||
unsafe_allow_html=True
|
unsafe_allow_html=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue