cupsFilePuts(fp, "(allow ipc-posix-shm)\n");
cupsFilePuts(fp, "(allow ipc-sysv-shm)\n");
cupsFilePuts(fp, "(allow mach-lookup)\n");
- cupsFilePrintf(fp,
- "(deny file-write* file-read-data file-read-metadata\n"
- " (regex"
- " #\"^%s$\"" /* RequestRoot */
- " #\"^%s/\"" /* RequestRoot/... */
- ")%s)\n",
- request, request, nodebug);
if (!RunUser)
cupsFilePrintf(fp,
"(deny file-write* file-read-data file-read-metadata\n"
"))\n",
request);
/* Read and write TempDir, CacheDir, and other common folders */
+ cupsFilePuts(fp,
+ "(allow file-write* file-read-data file-read-metadata\n"
+ " (regex"
+ " #\"^/private/var/db/\""
+ " #\"^/private/var/folders/\""
+ " #\"^/private/var/lib/\""
+ " #\"^/private/var/log/\""
+ " #\"^/private/var/mysql/\""
+ " #\"^/private/var/run/\""
+ " #\"^/private/var/spool/\""
+ " #\"^/Library/Application Support/\""
+ " #\"^/Library/Caches/\""
+ " #\"^/Library/Logs/\""
+ " #\"^/Library/Preferences/\""
+ " #\"^/Library/WebServer/\""
+ " #\"^/Users/Shared/\""
+ "))\n");
+ cupsFilePrintf(fp,
+ "(deny file-write*\n"
+ " (regex #\"^%s$\")%s)\n",
+ request, nodebug);
+ cupsFilePrintf(fp,
+ "(deny file-write* file-read-data file-read-metadata\n"
+ " (regex #\"^%s/\")%s)\n",
+ request, nodebug);
cupsFilePrintf(fp,
"(allow file-write* file-read-data file-read-metadata\n"
" (regex"
" #\"^%s/\"" /* TempDir/... */
" #\"^%s$\"" /* CacheDir */
" #\"^%s/\"" /* CacheDir/... */
- " #\"^/private/var/db/\""
- " #\"^/private/var/folders/\""
- " #\"^/private/var/run/\""
- " #\"^/Library/Application Support/\""
- " #\"^/Library/Caches/\""
- " #\"^/Library/Preferences/\""
- " #\"^/Users/Shared/\""
"))\n",
temp, temp, cache, cache);
/* Read common folders */
" #\"^/private$\""
" #\"^/private/etc$\""
" #\"^/private/etc/\""
+ " #\"^/private/tmp$\""
+ " #\"^/private/tmp/\""
" #\"^/private/var$\""
" #\"^/private/var/db$\""
" #\"^/private/var/folders$\""
+ " #\"^/private/var/lib$\""
+ " #\"^/private/var/log$\""
+ " #\"^/private/var/mysql$\""
+ " #\"^/private/var/run$\""
" #\"^/private/var/spool$\""
" #\"^/usr/bin$\"" /* /usr/bin */
" #\"^/usr/bin/\"" /* /usr/bin/... */
" #\"^/Library/Frameworks/\""
" #\"^/Library/Keychains$\""
" #\"^/Library/Keychains/\""
+ " #\"^/Library/Logs$\""
" #\"^/Library/Printers$\""
" #\"^/Library/Printers/\""
" #\"^/Library/Security$\""
" #\"^/Library/Security/\""
+ " #\"^/Library/WebServer$\""
" #\"^%s/Library$\"" /* RequestRoot/Library */
" #\"^%s/Library/\"" /* RequestRoot/Library/... */
" #\"^%s$\"" /* ServerBin */
" #\"^/Library/Printers/PPD Plugins/\""
")%s)\n", nodebug);
}
- /* Allow execution of child processes */
- cupsFilePuts(fp, "(allow process-fork)\n");
- cupsFilePrintf(fp,
- "(allow process-exec\n"
- " (regex"
- " #\"^/bin/\"" /* /bin/... */
- " #\"^/usr/bin/\"" /* /usr/bin/... */
- " #\"^/usr/libexec/cups/\"" /* /usr/libexec/cups/... */
- " #\"^/usr/libexec/fax/\"" /* /usr/libexec/fax/... */
- " #\"^/usr/sbin/\"" /* /usr/sbin/... */
- " #\"^%s/\"" /* ServerBin/... */
- " #\"^/Library/Printers/.*/\""
- " #\"^/System/Library/Frameworks/Python.framework/\""
- "))\n",
- bin);
+ /* Allow execution of child processes as long as the programs are not in a user directory */
+ cupsFilePuts(fp, "(allow process*)\n");
+ cupsFilePuts(fp, "(deny process-exec (regex #\"^/Users/\"))\n");
if (RunUser && getenv("CUPS_TESTROOT"))
{
/* Allow source directory access in "make test" environment */
" (literal \"/usr/sbin/sendmail\")\n"
" (with no-sandbox))\n");
}
+ /* Allow access to Bluetooth, USB, and notify_post. */
+ cupsFilePuts(fp, "(allow iokit*)\n");
+ cupsFilePuts(fp, "(allow distributed-notification-post)\n");
/* Allow outbound networking to local services */
cupsFilePuts(fp, "(allow network-outbound"
- "\n (regex #\"^/private/var/run/\")");
+ "\n (regex #\"^/private/var/run/\" #\"^/private/tmp/\")");
for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
lis;
lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
" (local udp \"*:*\")\n"
" (remote udp \"*:*\"))\n");
- /* Also allow access to Bluetooth, USB, device files, etc. */
- cupsFilePuts(fp, "(allow iokit*)\n");
+ /* Also allow access to device files... */
cupsFilePuts(fp, "(allow file-write* file-read-data file-read-metadata file-ioctl\n"
" (regex #\"^/dev/\"))\n");
- cupsFilePuts(fp, "(allow distributed-notification-post)\n");
}
else
{
- /* Only allow SNMP (UDP) off the machine... */
+ /* Only allow SNMP (UDP) and LPD (TCP) off the machine... */
cupsFilePuts(fp, ")\n");
cupsFilePuts(fp, "(allow network-outbound\n"
- " (remote udp \"*:161\"))\n");
+ " (remote udp \"*:161\")"
+ " (remote tcp \"*:515\"))\n");
cupsFilePuts(fp, "(allow network-inbound\n"
" (local udp \"localhost:*\"))\n");
- cupsFilePuts(fp, "(deny iokit* (with no-report))\n");
}
cupsFileClose(fp);