• Apple,  Swift

    Simple Swift Fuzzer

    Sometimes we want to test a function to see how… robust it is. This is a small example fuzzing function to input randomly generated characters that get passed to another function. It just uses randomBytes so much more logic could easily be added to constrain what’s being passed to whatever type it’s being passed to… but this satisfies my need. import Foundation func fuzz(function: () -> Void) { // Generate a random input to pass to the function we are fuzzing let input = Data(randomBytes: 1024) // Call the fuzzed function with the random input do { try function() } catch { print(error) } // Check the fuzzed function to…

  • Mac OS X,  Mac OS X Server,  Mac Security

    Configure The VPN Service In macOS Server 5.2

    macOS Server has long had a VPN service to allow client computers to connect to a network even when they’re out of the office. The server was once capable of running the two most commonly used VPN protocols: PPTP and L2TP. And while PPTP is still accessible via the command line, L2TP is now configured by default when you setup the server using the Server app. Setting Up The VPN Service In OS X Server To setup the VPN service, open the Server app and click on VPN in the Server app sidebar. The VPN Settings  screen has a number of options available, as seen here. The VPN Host Name field is used…

  • Mac OS X Server,  Mac Security

    Accessing macOS Server 5.2 Logs

    macOS Sierra (10.12) running the Server app has a lot of scripts used for enabling services, setting states, changing hostnames and the like. Once upon a time there was a script for macOS Server 5.2 called serversetup. It was a beautiful but too simplistic kind of script. Today, much of that logic has been moved out into more granular scripts, kept in /Applications/Server.app/Contents/ServerRoot/System/Library/ServerSetup, used by the server to perform all kinds of tasks. These scripts are, like a lot of other things in OS X Server. Some of these include the configuration of amavisd, docecot and alerts. These scripts can also be used for migrating services and data. Sometimes the scripts are in…

  • Mac OS X Server

    BCC all mail to an OS X Server to an Email address

    I’m pretty big on privacy. Actually, I don’t need much privacy; I’m an open book. But I try to be very respectful of the privacy of others. Still, there are certain valid circumstances to send all mail that goes to an OS X Server to an email address. Maybe you have an automation that picks up mail from support staff and files it into software for ticketing, maybe you have a legal hold. In many cases, it’s not my place to judge the validity of such requests; only to find ways to implement them. To bcc all mail to an OS X Server, first disable the feature from Postfix so you can…

  • Mac OS X Server

    Setting Up Wikis In OS X Server 5

    A wiki is a repository of dynamically created and managed content, or content created or edited by multiple users collaboratively. This article is about using the wiki service in OS X Server (the Apple Server app running on 10.10 and 10.11). I reference file services with WebDAV because it is a very nice integration piece that I think a lot of people will find pretty beneficial. To get started with the Wiki service, first turn it on. This one isn’t heavily dependent on host names (other than being able to access the server from a browser) or directory services (other than being able to authenticate users, but local accounts are perfectly…

  • Mac OS X Server,  Mac Security,  Mass Deployment

    OS X Server 5 Logs

    OS X running the Server app has a lot of scripts used for enabling services, setting states, changing hostnames and the like. Once upon a time there was a script for OS X Server called server setup. It was a beautiful but too simplistic kind of script. Today, much of that logic has been moved out into more granular scripts, kept in /Applications/Server.app/Contents/ServerRoot/System/Library/ServerSetup, used by the server to perform all kinds of tasks. These scripts are, like a lot of other things in OS X Server. Some of these include the configuration of amavisd, docecot and alerts. These scripts can also be used for migrating services and data. Sometimes the scripts…

  • Mac OS X Server

    Using the serverinfo Command in OS X Server 5

    OS X Server 5 (for El Capitan and Yosemite)  comes with the /usr/sbin/serverinfo command (introduced in Mountain Lion Server). The serverinfo command is useful when programmatically obtaining information about the very basic state of an Apple Server. The first option indicates whether the Server app has been downloaded from the app store, which is the –software option: serverinfo --software When used, this option reports the following if the Server.app can be found: This system has server software installed. Or if the software cannot be found, the following is indicated: This system does NOT have server software installed. The –productname option determines the name of the software app: serverinfo --productname If…

  • Mac OS X Server

    Manage The Adaptive Firewall Options In OS X Server 5

    OS X Server 5 (El Capitan 10.11 or Yosemite 10.10) has an adaptive firewall built in, or a firewall that controls incoming access based on clients attempting to abuse the server. The firewall automatically blocks incoming connections that it considers to be dangerous. For example, if a client attempts too many incorrect logins then a firewall rule restricts that user from attempting to communicate with the server for 15 minutes. If you’re troubleshooting and you accidentally tripped up one of these rules then it can be a bit frustrating. Which is why Apple gives us afctl, a tool that interacts with the adaptive firewall. The most basic task you can…

  • iPhone,  Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment

    Use Verbose Logging With Profile Manager

    Verbose logging can help you isolate a number of problems with Profile Manager. Turn on verbose logging by writing a debugOutput key with a value of 3 into /Library/Preferences/com.apple.ProfileManager.plist using the defaults command: defaults write /Library/Preferences/com.apple.ProfileManager debugOutput 3 Once set, restart the daemon using killall: killall -u _devicemgr To disable, just write the key with a blank value: defaults delete /Library/Preferences/com.apple.ProfileManager debugOutput Then restart the daemon again: killall -u _devicemgr