Socket
Socket
Sign inDemoInstall

apache-module-manager

Package Overview
Dependencies
40
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    apache-module-manager

A CLI tool for enabling/disabling Apache modules


Version published
Weekly downloads
4
Maintainers
1
Install size
10.8 MB
Created
Weekly downloads
 

Readme

Source

Apache Module Manager

npm package version Travis build status npm package downloads code style license

asciicast

A CLI tool for enabling/disabling Apache modules.

Installation

$ npm install --global apache-module-manager

Note

This will modify your Apache config file. It is your responsibility to make a backup. This has only been tested on macOS with the default Apache installation. Use at your own risk.

Usage

List/search for modules.

Options
LongShortDescription
--disabled-dOnly display disabled modules
--enabled-eOnly display enabled modules
--sort-sA comma separated list of columns to sort by (defaults to enabled,name,path)
Examples
# Display all modules
$ amm list
$ amm l

# Display modules that contain 'php'
$ amm list php

# Display all modules and sort them by their line number
$ amm list --sort line

# Display all currently enabled modules
$ amm list -e
Example Output
$ amm list -s line

ID  NAME                       PATH                                                ENABLED LINE
0   authn_file_module          libexec/apache2/mod_authn_file.so                   true    71
1   authn_dbm_module           libexec/apache2/mod_authn_dbm.so                    false   72
2   authn_anon_module          libexec/apache2/mod_authn_anon.so                   false   73
3   authn_dbd_module           libexec/apache2/mod_authn_dbd.so                    false   74
4   authn_socache_module       libexec/apache2/mod_authn_socache.so                false   75
5   authn_core_module          libexec/apache2/mod_authn_core.so                   true    76
6   authz_host_module          libexec/apache2/mod_authz_host.so                   true    77
7   authz_groupfile_module     libexec/apache2/mod_authz_groupfile.so              true    78
8   authz_user_module          libexec/apache2/mod_authz_user.so                   true    79
9   authz_dbm_module           libexec/apache2/mod_authz_dbm.so                    false   80
...

Enable a module. If multiple modules match the search term, a select prompt will be displayed allowing you to choose from the matches. The sudo prefix is required since the script modifies a system file.

Examples
$ sudo amm enable php
$ sudo amm e php
Example Output
$ sudo amm enable php

? Which module are you looking for? (Use arrow keys)
  php7_module libexec/apache2/libphp7.so
❯ php5_module /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so
? Enable php5_module (/usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so)? (Y/n)
✔ Changed line 180 to LoadModule php5_module /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so
? Restart Apache (/usr/sbin/apachectl restart)? (Y/n)

Disable a module. If multiple modules match the search term, a select prompt will be displayed allowing you to choose from the matches. The sudo prefix is required since the script modifies a system file.

Examples
$ sudo amm disable php
$ sudo amm d php
Example Output
$ sudo amm disable php

? Disable php5_module (/usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so)? (Y/n)
✔ Changed line 180 to #LoadModule php5_module /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so
? Restart Apache (/usr/sbin/apachectl restart)? (Y/n)

Disable a module and enable another one. If only one argument is given, the first argument will be used to search for both the module to disable and the module to enable. If multiple modules match a search term, a select prompt will be displayed allowing you to choose from the matches. The sudo prefix is required since the script modifies a system file.

Examples
$ sudo amm switch php5 php7
$ sudo amm s php
Example Output
$ sudo amm switch php

? Disable php5_module (/usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so)? (Y/n)
✔ Changed line 180 to #LoadModule php5_module /usr/local/opt/php@5.6/lib/httpd/modules/libphp5.so
? Enable php7_module (libexec/apache2/libphp7.so)? (Y/n)
✔ Changed line 176 to LoadModule php7_module libexec/apache2/libphp7.so
? Restart Apache (/usr/sbin/apachectl restart)? (Y/n)

Config File

By default, AMM will check if the file ~/.amm.json exists and load config options from it.

Default Config
{
  "apache_config": "/etc/apache2/httpd.conf",
  "apache_restart": "/usr/sbin/apachectl restart"
}

Global Options

These options can be used with any of the above commands:

LongShortDescription
--version-VDisplay current Apache Module Manager version
--apache-config-aPath to the Apache config file
--config-cPath to AMM config file
--help-hDisplay help information

Environment Variables

These environment variables can be used to change different config options:

VariableDescription
AMM_CONFIGPath to an AMM config file
AMM_APACHE_CONFIGPath to the Apache config file

TODO/Ideas

  • Automated testing
  • Better Linux support/testing
  • Support for multiple Apache config files (file traversing?)
  • Allow for multiple modules to be enabled/disabled at the same time
  • Automated Apache config file backups
  • Implement module so that AMM can be used by other packages
  • Implement add and remove commands to add/remove LoadModule lines from config

Frequently Asked Questions

Doesn't a2enmod/a2dismod do the same thing?

Currently, yes. I built this before I knew that a2enmod/a2dismod could be installed on macOS. However, AMM has a nicer interface and I would like to extend the functionality of it in the near future.

Don't you mean httpd instead of Apache?

Yes, however plenty of people refer to it as Apache and you know what I'm talking about.

License

MIT. See the license.md file for more info.

Keywords

FAQs

Last updated on 19 Apr 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc