Skip to content

Commit e087483

Browse files
committed
v0.5.8 update
updated README bumped jsch and postgresql dependency versions build script override to generate two addons, one with a preset configuration and one without do not verify PostgreSQL host when connecting to localhost or 127.0.0.1 dynamically set version in Setup.sql improved error handling during archive resource extraction decorative improvements to front-end HTML and CSS more verbose logging when in debug mode sync only the latest cumulative update
1 parent 45b0199 commit e087483

30 files changed

+661
-220
lines changed

README.md

Lines changed: 329 additions & 2 deletions
Large diffs are not rendered by default.

config/BUILD_DETAILS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ update-api-9.0.002
2828
webserver-api-9.0.002
2929

3030
Packaged Dependencies:
31-
jsch-0.2.17-sources
32-
jsch-0.2.17
31+
jsch-0.2.21-sources
32+
jsch-0.2.21
3333
json-20240303-sources
3434
json-20240303
35-
postgresql-42.7.3-sources
36-
postgresql-42.7.3
35+
postgresql-42.7.4-sources
36+
postgresql-42.7.4

config/EXTERNAL_DEPS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
url:postgresql-42.7.3.jar:https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.3/postgresql-42.7.3.jar
2-
url:postgresql-42.7.3-sources.jar:https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.3/postgresql-42.7.3-sources.jar
3-
url:jsch-0.2.17.jar:https://repo1.maven.org/maven2/com/github/mwiede/jsch/0.2.17/jsch-0.2.17.jar
4-
url:jsch-0.2.17-sources.jar:https://repo1.maven.org/maven2/com/github/mwiede/jsch/0.2.17/jsch-0.2.17-sources.jar
1+
url:postgresql-42.7.4.jar:https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.4/postgresql-42.7.4.jar
2+
url:postgresql-42.7.4-sources.jar:https://repo1.maven.org/maven2/org/postgresql/postgresql/42.7.4/postgresql-42.7.4-sources.jar
3+
url:jsch-0.2.21.jar:https://repo1.maven.org/maven2/com/github/mwiede/jsch/0.2.21/jsch-0.2.21.jar
4+
url:jsch-0.2.21-sources.jar:https://repo1.maven.org/maven2/com/github/mwiede/jsch/0.2.21/jsch-0.2.21-sources.jar
55
url:json-20240303.jar:https://repo1.maven.org/maven2/org/json/json/20240303/json-20240303.jar
66
url:json-20240303-sources.jar:https://repo1.maven.org/maven2/org/json/json/20240303/json-20240303-sources.jar

ext/pack.bat

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
if /i "%*" EQU "--help" (
2+
echo PACK Packages all relevant files into newly created .addon and .jar archives.
3+
exit /b 0
4+
)
5+
if "%*" NEQ "" (
6+
echo Unexpected parameter.
7+
exit /b 1
8+
)
9+
echo Packing...
10+
rmdir /Q /S "%classes%" >nul 2>nul
11+
for /D %%i in ("%trackingClasses%\*") do robocopy /E "%%~fi" "%classes%" >nul 2>nul
12+
robocopy /E "%src%" "%classes%" /XF "*.java" >nul 2>nul
13+
copy /Y "%workspace%\LICENSE" "%root%\LICENSE" >nul 2>nul
14+
robocopy /MIR /MOVE "%lib%" "%workspace%\lib-sources" *-sources.jar >nul 2>nul
15+
"%JDKBin%\jar.exe" -c -M -f "%addonFile%" -C "%root%" .
16+
if %ERRORLEVEL% NEQ 0 (
17+
robocopy /E /MOVE "%workspace%\lib-sources" "%lib%" >nul 2>nul
18+
rmdir /Q /S "%workspace%\lib-sources" >nul 2>nul
19+
echo Packing unsuccessful.
20+
exit /b 1
21+
)
22+
del /F "%classes%\aces\webctrl\postgresql\resources\config.dat" >nul 2>nul
23+
del /F "%classes%\aces\webctrl\postgresql\resources\pgsslkey.pfx" >nul 2>nul
24+
del /F "%classes%\aces\webctrl\postgresql\resources\pgsslroot.cer" >nul 2>nul
25+
"%JDKBin%\jar.exe" -c -M -f "%workspace%\!name!-blank.addon" -C "%root%" .
26+
if %ERRORLEVEL% EQU 0 (
27+
robocopy /E /MOVE "%workspace%\lib-sources" "%lib%" >nul 2>nul
28+
rmdir /Q /S "%workspace%\lib-sources" >nul 2>nul
29+
echo Packing successful.
30+
exit /b 0
31+
) else (
32+
robocopy /E /MOVE "%workspace%\lib-sources" "%lib%" >nul 2>nul
33+
rmdir /Q /S "%workspace%\lib-sources" >nul 2>nul
34+
echo Packing unsuccessful.
35+
exit /b 1
36+
)

ext/sign.bat

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
if /i "%*" EQU "--help" (
2+
echo SIGN Signs the .addon archive.
3+
exit /b 0
4+
)
5+
if "%*" NEQ "" (
6+
echo Unexpected parameter.
7+
exit /b 1
8+
)
9+
if exist "%addonFile%" (
10+
echo Signing...
11+
"%JDKBin%\jarsigner.exe" -keystore "%keystore%" -storepass "!pass!" "%addonFile%" %alias% >nul
12+
if !ERRORLEVEL! EQU 0 (
13+
"%JDKBin%\jarsigner.exe" -keystore "%keystore%" -storepass "!pass!" "%workspace%\!name!-blank.addon" %alias% >nul
14+
if !ERRORLEVEL! EQU 0 (
15+
echo Signing successful.
16+
exit /b 0
17+
) else (
18+
echo Signing unsuccessful.
19+
exit /b 1
20+
)
21+
) else (
22+
echo Signing unsuccessful.
23+
exit /b 1
24+
)
25+
) else (
26+
echo Cannot sign because !name!.addon does not exist.
27+
exit /b 1
28+
)

resources/download_sql.png

5.83 KB
Loading

resources/postgresql_config.png

21.1 KB
Loading

resources/renew.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/bin/bash
2+
3+
# Crontab example:
4+
# 47 23 1 * * /bin/bash /data/ssl/renew.sh
5+
6+
# Decsriptive name for this server
7+
name='PostgreSQL Database Server'
8+
# Keystore password
9+
password='PASSWORD'
10+
# Recipient email addresses for notifications (comma-delimited)
11+
12+
# DNS name for your SSL certificate
13+
dns='postgresql.domain.com'
14+
# Distinguished name for your SSL certificate
15+
dname="CN=$dns, OU=IT, O=Automatic Controls Equipment Systems\, Inc., L=Fenton, ST=MO, C=US"
16+
# Working directory
17+
folder='/data/ssl/certbot'
18+
# Final server certificate
19+
pem_cert='/data/ssl/ssl_cert'
20+
# Final server private key
21+
pem_key='/data/ssl/ssl_key'
22+
23+
# Function to send an email
24+
function send_email(){
25+
msmtp -t <<EOF
26+
To: $recipients
27+
Subject: $1
28+
29+
$2
30+
EOF
31+
}
32+
33+
# Create working directory
34+
sudo rm -Rf "$folder"
35+
sudo mkdir "$folder"
36+
if ! cd "$folder"; then
37+
send_email "$name SSL Renewal Failure" 'Monthly certificate renewal script failed to locate SSL directory.'
38+
exit 1
39+
fi
40+
41+
# Generate a new key
42+
if ! sudo keytool -keystore store -storepass "$password" -genkeypair -alias server -keyalg RSA -sigalg SHA256withRSA -keysize 2048 -keypass "$password" -validity 365 -ext "san=dns:$dns" -dname "$dname"; then
43+
send_email "$name SSL Renewal Failure" 'Monthly certificate renewal script failed to create a new 2048 bit RSA key-pair.'
44+
exit 1
45+
fi
46+
47+
# Generate a certificate request
48+
if ! sudo keytool -keystore store -storepass "$password" -alias server -certreq -file 'request.csr'; then
49+
send_email "$name SSL Renewal Failure" 'Monthly certificate renewal script failed to generate CSR.'
50+
exit 1
51+
fi
52+
53+
# Open HTTP and HTTPS ports
54+
sudo ufw allow 80/tcp
55+
sudo ufw allow 443/tcp
56+
57+
# Use certbot to sign the certificate request
58+
sudo certbot certonly --standalone --csr "$folder/request.csr" --logs-dir "$folder/logs"
59+
err="$?"
60+
61+
# Close HTTP and HTTPS ports
62+
sudo ufw delete allow 80/tcp
63+
sudo ufw delete allow 443/tcp
64+
65+
# Handle certbot failure
66+
if [[ "$err" != '0' ]]; then
67+
sudo rm -f 'request.csr'
68+
sudo rm -f ./*.pem
69+
send_email "$name SSL Renewal Failure" "Monthly certificate renewal script failed: certbot encountered error. Please see '$folder/logs' for more details."
70+
exit 1
71+
fi
72+
73+
# Apply changes
74+
sudo mv -f "$(find "/data/ssl/certbot" -maxdepth 1 -name '*_chain.pem' | sort -n | tail -n 1)" "$pem_cert"
75+
sudo openssl pkcs12 -in store -passin "pass:$password" -nocerts -noenc | sudo openssl rsa -out "$pem_key"
76+
sudo chown postgres:postgres "$pem_key"
77+
sudo chown postgres:postgres "$pem_cert"
78+
sudo chmod 600 "$pem_key"
79+
sudo chmod 666 "$pem_cert"
80+
sudo systemctl reload postgresql
81+
82+
# Clean files
83+
cd ..
84+
sudo rm -Rf "$folder"

resources/sftp_config.png

25.3 KB
Loading

resources/test_sftp.png

5.51 KB
Loading

0 commit comments

Comments
 (0)