mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Add installer build scripts and configuration
This commit is contained in:
parent
fb3a8582a2
commit
3420290ea9
22 changed files with 1377 additions and 7 deletions
11
installer/scripts/templates/conclusion.html
Normal file
11
installer/scripts/templates/conclusion.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="UTF-8"></head>
|
||||
<body>
|
||||
<h1>Installation Complete!</h1>
|
||||
<p>blablabla.</p>
|
||||
<p><strong>To uninstall:</strong></p>
|
||||
<pre>sudo bash "/Library/Application Support/AikidoSafety/uninstall.sh"</pre>
|
||||
<p>For support, visit: <a href="https://aikido.dev">aikido.dev</a></p>
|
||||
</body>
|
||||
</html>
|
||||
31
installer/scripts/templates/dev.aikido.safe-chain.plist
Normal file
31
installer/scripts/templates/dev.aikido.safe-chain.plist
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>dev.aikido.safe-chain</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/Library/Application Support/AikidoSafety/bin/node</string>
|
||||
<string>/Library/Application Support/AikidoSafety/agent/index.js</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<dict>
|
||||
<key>SuccessfulExit</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/var/log/aikido-safe-chain/stdout.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/var/log/aikido-safe-chain/stderr.log</string>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>NODE_ENV</key>
|
||||
<string>production</string>
|
||||
</dict>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/Library/Application Support/AikidoSafety/agent</string>
|
||||
</dict>
|
||||
</plist>
|
||||
21
installer/scripts/templates/distribution.xml
Normal file
21
installer/scripts/templates/distribution.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<installer-gui-script minSpecVersion="1">
|
||||
<title>Aikido Safe Chain</title>
|
||||
<organization>dev.aikido</organization>
|
||||
<domains enable_localSystem="true"/>
|
||||
<options customize="never" require-scripts="true" rootVolumeOnly="true" />
|
||||
<welcome file="welcome.html"/>
|
||||
<conclusion file="conclusion.html"/>
|
||||
<pkg-ref id="dev.aikido.safe-chain"/>
|
||||
<options customize="never" require-scripts="true"/>
|
||||
<choices-outline>
|
||||
<line choice="default">
|
||||
<line choice="dev.aikido.safe-chain"/>
|
||||
</line>
|
||||
</choices-outline>
|
||||
<choice id="default"/>
|
||||
<choice id="dev.aikido.safe-chain" visible="false">
|
||||
<pkg-ref id="dev.aikido.safe-chain"/>
|
||||
</choice>
|
||||
<pkg-ref id="dev.aikido.safe-chain" version="1.0.0" onConclusion="none">component.pkg</pkg-ref>
|
||||
</installer-gui-script>
|
||||
40
installer/scripts/templates/postinstall.sh
Normal file
40
installer/scripts/templates/postinstall.sh
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
INSTALL_DIR="/Library/Application Support/AikidoSafety"
|
||||
LAUNCHD_PLIST="/Library/LaunchDaemons/dev.aikido.safe-chain.plist"
|
||||
LOG_DIR="/var/log/aikido-safe-chain"
|
||||
|
||||
echo "Installing Aikido Safe Chain Agent..."
|
||||
|
||||
# Create log directory
|
||||
mkdir -p "$LOG_DIR"
|
||||
chmod 755 "$LOG_DIR"
|
||||
|
||||
# Install certificate to system keychain
|
||||
echo "Installing CA certificate to system keychain..."
|
||||
security add-trusted-cert -d -r trustRoot \
|
||||
-k /Library/Keychains/System.keychain \
|
||||
"$INSTALL_DIR/certs/ca-cert.pem" || true
|
||||
|
||||
# Configure system proxy
|
||||
echo "Configuring system proxy settings..."
|
||||
"$INSTALL_DIR/bin/node" "$INSTALL_DIR/agent/configure-proxy.js" --install || {
|
||||
echo "Warning: Failed to configure system proxy. You may need to configure manually."
|
||||
}
|
||||
|
||||
# Load and start the LaunchDaemon
|
||||
echo "Starting Aikido Safe Chain Agent..."
|
||||
launchctl load -w "$LAUNCHD_PLIST" || {
|
||||
echo "Warning: Failed to start agent. You may need to restart your computer."
|
||||
}
|
||||
|
||||
echo "Aikido Safe Chain Agent installed successfully!"
|
||||
echo ""
|
||||
echo "The agent is now running in the background and will protect"
|
||||
echo "all package installations on this system."
|
||||
echo ""
|
||||
echo "To uninstall, run:"
|
||||
echo " sudo bash '$INSTALL_DIR/uninstall.sh'"
|
||||
|
||||
exit 0
|
||||
12
installer/scripts/templates/preinstall.sh
Normal file
12
installer/scripts/templates/preinstall.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
LAUNCHD_PLIST="/Library/LaunchDaemons/dev.aikido.safe-chain.plist"
|
||||
|
||||
# Stop existing agent if running
|
||||
if [ -f "$LAUNCHD_PLIST" ]; then
|
||||
echo "Stopping existing Aikido Safe Chain Agent..."
|
||||
launchctl unload "$LAUNCHD_PLIST" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
39
installer/scripts/templates/uninstall.sh
Normal file
39
installer/scripts/templates/uninstall.sh
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
# Aikido Safe Chain Uninstaller
|
||||
|
||||
set -e
|
||||
|
||||
echo "Uninstalling Aikido Safe Chain Agent..."
|
||||
|
||||
INSTALL_DIR="/Library/Application Support/AikidoSafety"
|
||||
LAUNCHD_PLIST="/Library/LaunchDaemons/dev.aikido.safe-chain.plist"
|
||||
|
||||
# Stop and remove daemon
|
||||
if [ -f "$LAUNCHD_PLIST" ]; then
|
||||
echo "Stopping agent..."
|
||||
launchctl unload "$LAUNCHD_PLIST" 2>/dev/null || true
|
||||
rm "$LAUNCHD_PLIST"
|
||||
fi
|
||||
|
||||
# Remove certificate
|
||||
echo "Removing CA certificate..."
|
||||
security delete-certificate -c "Aikido Safe Chain CA" \
|
||||
/Library/Keychains/System.keychain 2>/dev/null || true
|
||||
|
||||
# Restore proxy settings
|
||||
if [ -f "$INSTALL_DIR/agent/configure-proxy.js" ]; then
|
||||
echo "Restoring proxy settings..."
|
||||
"$INSTALL_DIR/bin/node" "$INSTALL_DIR/agent/configure-proxy.js" --uninstall || {
|
||||
echo "Warning: Failed to restore proxy settings. You may need to restore manually."
|
||||
}
|
||||
fi
|
||||
|
||||
# Remove files
|
||||
echo "Removing files..."
|
||||
rm -rf "$INSTALL_DIR"
|
||||
rm -rf /var/log/aikido-safe-chain
|
||||
|
||||
echo ""
|
||||
echo "✅ Aikido Safe Chain has been uninstalled."
|
||||
echo ""
|
||||
echo "Your system proxy settings have been restored to their original state."
|
||||
14
installer/scripts/templates/welcome.html
Normal file
14
installer/scripts/templates/welcome.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><meta charset="UTF-8"></head>
|
||||
<body>
|
||||
<h1>Welcome to Aikido Safe Chain</h1>
|
||||
<p>blablabla</p>
|
||||
<p><strong>Note:</strong> This installer requires administrator privileges to:</p>
|
||||
<ul>
|
||||
<li>Install a trusted certificate in your system keychain</li>
|
||||
<li>Configure system-wide proxy settings</li>
|
||||
<li>Install a background service (LaunchDaemon)</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue