-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS: Option to skip TLS certificate creation for Safari #217
Merged
jsuchal
merged 5 commits into
slovensko-digital:main
from
solver-it-sro:macos-skip-cert-option
Aug 1, 2023
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,6 +167,7 @@ if [[ "$platform" == "mac" ]]; then | |
fi | ||
|
||
if [[ "$properties_mac_sign" == "1" ]]; then | ||
export JPACKAGE_MAC_SIGN="1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Toto tu ma byt na tvrdo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ano, jedine ine co by tam davalo zmysel je |
||
if [[ -z "$APPLE_DEVELOPER_IDENTITY" ]] || [[ -z "$APPLE_KEYCHAIN_PATH" ]]; then | ||
echo "Missing APPLE_DEVELOPER_IDENTITY or APPLE_KEYCHAIN_PATH env variable" | ||
exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/scripts/resources/mac-launcher/Resources/Scripts/cert-functions.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
function create_cert() { | ||
TLS_DIR="$HOME/Library/Application Support/Autogram/tls" | ||
|
||
osascript -e 'return display dialog "Teraz vygenerujeme Váš osobný SSL certifikát. Následne si od Vás inštalátor vyžiada heslo, aby certifikát mohol byť pridaný ako dôveryhodný pre spojenie so Safari." with icon caution' | ||
if [ $? -ne 0 ]; then | ||
return 0 | ||
fi | ||
|
||
mkdir -p "$TLS_DIR" | ||
|
||
# Create temp openssl configuration | ||
SSL_CONFIG_TMP=$(mktemp) | ||
echo "[ req ] | ||
req_extensions = v3_req | ||
x509_extensions = v3_req | ||
distinguished_name = dn | ||
prompt = no | ||
encrypt_key = no | ||
|
||
[ v3_req ] | ||
subjectAltName = @alt_names | ||
basicConstraints = CA:FALSE | ||
keyUsage = nonRepudiation, digitalSignature, keyEncipherment | ||
extendedKeyUsage = serverAuth | ||
|
||
certificatePolicies = 1.2.3.4 | ||
|
||
[dn] | ||
C=SK | ||
O=SSD | ||
CN=loopback.autogram.slovensko.digital | ||
|
||
[CA_default] | ||
copy_extension=copy | ||
|
||
[alt_names] | ||
DNS.1=loopback.autogram.slovensko.digital | ||
|
||
" >$SSL_CONFIG_TMP | ||
|
||
cat $SSL_CONFIG_TMP | ||
|
||
/usr/bin/openssl req -nodes -x509 -newkey rsa:4096 -keyout "$TLS_DIR/autogram-key.pem" -out "$TLS_DIR/autogram-cert.pem" -sha256 -days 365 -config $SSL_CONFIG_TMP | ||
|
||
/usr/bin/openssl pkcs12 -export -in "$TLS_DIR/autogram-cert.pem" -inkey "$TLS_DIR/autogram-key.pem" -out "$TLS_DIR/autogram-pkcs12-cert.p12" -name "autogram-pkcs12-cert" -passout pass: | ||
|
||
security -v add-trusted-cert -r trustRoot -p basic -p ssl -k $HOME/Library/Keychains/login.keychain-db "$TLS_DIR/autogram-cert.pem" | ||
|
||
# Cleanup openssl config | ||
rm $SSL_CONFIG_TMP | ||
} | ||
|
||
function remove_cert(){ | ||
TLS_DIR="$HOME/Library/Application Support/Autogram/tls" | ||
security delete-certificate -Z $(openssl x509 -in "$TLS_DIR/autogram-cert.pem" -outform DER | shasum -a 1 ) "$HOME/Library/Keychains/login.keychain-db" | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/scripts/resources/mac-launcher/Resources/Scripts/create-cert.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
source "$(dirname "$0")/cert-functions.sh"; | ||
|
||
create_cert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toto je nieco nove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toto je aby to faillo co najskor pred tym nez sa robi upload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a teda ide iba o comand vo vscode, ktory pouziva developer