enigma-bbs/docs/admin/oputil.md

307 lines
11 KiB
Markdown
Raw Normal View History

2018-08-12 02:46:49 +00:00
---
layout: page
title: oputil
---
## The oputil CLI
ENiGMA½ comes with `oputil.js` henceforth known as `oputil`, a command line interface (CLI) tool for sysops to perform general system and user administration. You likely used oputil to do the initial ENiGMA configuration.
Let's look the main help output as per this writing:
```
2018-12-16 07:40:14 +00:00
usage: oputil.js [--version] [--help]
<command> [<arguments>]
2018-08-12 02:46:49 +00:00
Global arguments:
-c, --config PATH Specify config path (default is ./config/)
-n, --no-prompt Assume defaults (don't prompt for input where possible)
2018-08-12 02:46:49 +00:00
Commands:
user User management
config Configuration management
fb File base management
mb Message base management
2018-08-12 02:46:49 +00:00
```
2018-08-12 03:50:50 +00:00
Commands break up operations by groups:
2018-08-12 03:50:50 +00:00
| Command | Description |
|-----------|---------------|
| `user` | User management |
2018-11-23 18:05:51 +00:00
| `config` | System configuration and maintenance |
2018-08-12 03:50:50 +00:00
| `fb` | File base configuration and management |
| `mb` | Message base configuration and management |
Global arguments apply to most commands and actions:
* `--config`: Specify configuration directory if it is not the default of `./config/`.
* `--no-prompt`: Assume defaults and do not prompt when posisible.
Type `./oputil.js <command> --help` for additional help on a particular command. The following sections will describe them.
2018-08-12 02:46:49 +00:00
## User
2018-08-12 03:50:50 +00:00
The `user` command covers various user operations.
2018-08-12 02:46:49 +00:00
```
usage: oputil.js user <action> [<arguments>]
2018-08-12 02:46:49 +00:00
Actions:
info USERNAME Display information about a user
pw USERNAME PASSWORD Set a user's password
(passwd|password)
rm USERNAME Permanently removes user from system
(del|delete|remove)
rename USERNAME NEWNAME Rename a user
(mv)
2fa-otp USERNAME SPEC Enable 2FA/OTP for the user
(otp)
The system supports various implementations of Two Factor Authentication (2FA)
One Time Password (OTP) authentication.
Valid specs:
disable : Removes 2FA/OTP from the user
google : Google Authenticator
hotp : HMAC-Based One-Time Password Algorithm (RFC-4266)
totp : Time-Based One-Time Password Algorithm (RFC-6238)
activate USERNAME Set a user's status to "active"
deactivate USERNAME Set a user's status to "inactive"
disable USERNAME Set a user's status to "disabled"
lock USERNAME Set a user's status to "locked"
group USERNAME [+|-]GROUP Adds (+) or removes (-) user from a group
info arguments:
--security Include security information in output
2fa-otp arguments:
--qr-type TYPE Specify QR code type
Valid QR types:
ascii : Plain ASCII (default)
data : HTML data URL
img : HTML image tag
svg : SVG image
--out PATH Path to write QR code to. defaults to stdout
2018-08-12 02:46:49 +00:00
```
| Action | Description | Examples | Aliases |
|-----------|-------------------|---------------------------------------|-----------|
2018-12-16 07:38:49 +00:00
| `info` | Display user information| `./oputil.js user info joeuser` | N/A |
| `pw` | Set password | `./oputil.js user pw joeuser s3cr37` | `passwd`, `password` |
2018-08-12 02:46:49 +00:00
| `rm` | Removes user | `./oputil.js user del joeuser` | `remove`, `del`, `delete` |
2019-02-16 18:03:46 +00:00
| `rename` | Renames a user | `./oputil.js user rename joeuser joe` | `mv` |
| `2fa-otp` | Manage 2FA/OTP for a user | `./oputil.js user 2fa-otp joeuser googleAuth` | `otp`
2018-08-12 02:46:49 +00:00
| `activate` | Activates user | `./oputil.js user activate joeuser` | N/A |
| `deactivate` | Deactivates user | `./oputil.js user deactivate joeuser` | N/A |
| `disable` | Disables user (user will not be able to login) | `./oputil.js user disable joeuser` | N/A |
2018-11-23 18:05:51 +00:00
| `lock` | Locks the user account (prevents logins) | `./oputil.js user lock joeuser` | N/A |
2018-08-12 02:46:49 +00:00
| `group` | Modifies users group membership | Add to group: `./oputil.js user group joeuser +derp`<br/>Remove from group: `./oputil.js user group joeuser -derp` | N/A |
2018-08-12 03:50:50 +00:00
#### Manage 2FA/OTP
While `oputil.js` can be used to manage a user's 2FA/OTP, it is highly recommended to require users to opt-in themselves. See [Security](/docs/configuration/security.md) for details.
2018-08-12 03:50:50 +00:00
## Configuration
The `config` command allows sysops to perform various system configuration and maintenance tasks.
```
usage: oputil.js config <action> [<arguments>]
2018-08-12 03:50:50 +00:00
Actions:
new Generate a new / default configuration
2018-08-12 03:50:50 +00:00
cat Write current configuration to stdout
cat arguments:
--no-color Disable color
--no-comments Strip any comments
2018-08-12 03:50:50 +00:00
```
| Action | Description | Examples |
|-----------|-------------------|---------------------------------------|
| `new` | Generates a new/initial configuration | `./oputil.js config new` (follow the prompts) |
| `cat` | Pretty prints current `config.hjson` configuration to stdout. | `./oputil.js config cat` |
2018-08-12 03:50:50 +00:00
## File Base Management
The `fb` command provides a powerful file base management interface.
```
usage: oputil.js fb <action> [<arguments>]
Actions:
scan AREA_TAG[@STORAGE_TAG] Scan specified area
May contain optional GLOB as last parameter.
Example: ./oputil.js fb scan d0pew4r3z *.zip
info CRITERIA Display information about areas and/or files
mv SRC [SRC...] DST Move matching entry(s)
(move)
Source may be any of the following:
- Filename including '*' wildcards
- SHA-1
- File ID
- Area tag with optional @storageTag suffix
Destination is area tag with optional @storageTag suffix
rm SRC [SRC...] Remove entry(s) from the system
(del|delete|remove)
Source may be any of the following:
- Filename including '*' wildcards
- SHA-1
- File ID
- Area tag with optional @storageTag suffix
2018-08-12 03:50:50 +00:00
desc CRITERIA Updates an file base entry's description
2018-08-12 03:50:50 +00:00
Launches an external editor using $VISUAL, $EDITOR, or vim/notepad.
2018-08-12 03:50:50 +00:00
import-areas FILEGATE.ZXX Import file base areas using FileGate RAID type format
2018-08-12 03:50:50 +00:00
scan arguments:
--tags TAG1,TAG2,... Specify hashtag(s) to assign to discovered entries
2018-08-12 03:50:50 +00:00
--desc-file [PATH] Prefer file descriptions from supplied input file
2018-08-12 03:50:50 +00:00
If a file description can be found in the supplied input file, prefer that description
over other sources such related FILE_ID.DIZ. Path must point to a valid FILES.BBS or
DESCRIPT.ION file.
2018-08-12 03:50:50 +00:00
--update Attempt to update information for existing entries
--full-scan Perform a full scan (default is quick)
2018-08-12 03:50:50 +00:00
info arguments:
--show-desc Display short description, if any
2018-08-12 03:50:50 +00:00
remove arguments:
--phys-file Also remove underlying physical file
2018-12-05 02:39:00 +00:00
import-areas arguments:
--type TYPE Sets import areas type
2018-12-21 21:39:57 +00:00
Valid types are are "zxx" or "na".
--create-dirs Also create backing storage directories
General Information:
Generally an area tag can also include an optional storage tag. For example, the
area of 'bbswarez' stored using 'bbswarez_main': bbswarez@bbswarez_main
When performing an initial import of a large area or storage backing, --full-scan
is the best option. If re-scanning an area for updates a standard / quick scan is
generally good enough.
File ID's are those found in file.sqlite3.
2018-08-12 03:50:50 +00:00
```
#### Scan File Area
The `scan` action can (re)scan a file area for new entries as well as update (`--update`) existing entry records (description, etc.). When scanning, a valid area tag must be specified. Optionally, storage tag may also be supplied in order to scan a specific filesystem location using the `@the_storage_tag` syntax. If a [GLOB](http://man7.org/linux/man-pages/man7/glob.7.html) is supplied as the last argument, only file entries with filenames matching will be processed.
2018-09-11 20:41:46 +00:00
##### Examples
2018-11-23 18:05:51 +00:00
Performing a quick scan of a specific area's storage location ("retro_warez", "retro_warez_games) matching only *.zip extensions:
2018-12-05 02:39:00 +00:00
```bash
# note that we must quote the wildcard to prevent shell expansion
$ ./oputil.js fb scan --quick retro_warez@retro_warez_games "*.zip"`
2018-08-12 03:50:50 +00:00
```
Update all entries in the "artscene" area supplying the file tags "artscene", and "textmode".
2018-12-05 02:39:00 +00:00
```bash
2018-09-11 20:41:46 +00:00
$ ./oputil.js fb scan --update --quick --tags artscene,textmode artscene`
```
Scan "oldschoolbbs" area using the description file at "/path/to/DESCRIPT.ION":
```
$ ./oputil.js fb scan --desc-file /path/to/DESCRIPT.ION oldschoolbbs
```
#### Retrieve Information
The `info` action can retrieve information about an area or file entry(s).
##### Examples
Information about a particular area:
2018-12-05 02:39:00 +00:00
```bash
./oputil.js fb info retro_pc
2018-09-11 20:41:46 +00:00
areaTag: retro_pc
name: Retro PC
desc: Oldschool / retro PC
storageTag: retro_pc_tdc_1990 => /file_base/dos/tdc/1990
storageTag: retro_pc_tdc_1991 => /file_base/dos/tdc/1991
storageTag: retro_pc_tdc_1992 => /file_base/dos/tdc/1992
storageTag: retro_pc_tdc_1993 => /file_base/dos/tdc/1993
```
Perhaps we want to fetch some information about a file in which we know piece of the filename:
2018-12-05 02:39:00 +00:00
```bash
./oputil.js fb info "impulse*"
2018-09-11 20:41:46 +00:00
file_id: 143
sha_256: 547299301254ccd73eba4c0ec9cd6ab8c5929fbb655e72c4cc842f11332792d4
area_tag: impulse_project
storage_tag: impulse_project
path: /file_base/impulse_project/impulseproject01.tar.gz
hashTags: impulse.project,8bit.music,cid
uploaded: 2018-03-10T11:36:41-07:00
dl_count: 23
archive_type: application/gzip
byte_size: 114313
est_release_year: 2015
file_crc32: fc6655d
file_md5: 3455f74bbbf9539e69bd38f45e039a4e
file_sha1: 558fab3b49a8ac302486e023a3c2a86bd4e4b948
```
2018-12-05 02:39:00 +00:00
### Importing FileGate RAID Style Areas
2018-12-05 03:47:29 +00:00
Given a FileGate "RAID" style `FILEGATE.ZXX` file, one can import areas. This format also often comes in FTN-style info packs in the form of a `.NA` file i.e.: `FILEBONE.NA`.
2018-12-05 02:39:00 +00:00
#### Example
```bash
./oputil.js fb import-areas FILEGATE.ZXX --create-dirs
```
2018-12-05 03:47:29 +00:00
-or-
```bash
# fsxNet info packs contain a FSX_FILE.NA file
./oputil.js fb import-areas FSX_FILE.NA --create-dirs --type NA
```
2018-12-05 02:39:00 +00:00
The above command will process FILEGATE.ZXX creating areas and backing directories. Directories created are relative to the `fileBase.areaStoragePrefix` `config.hjson` setting.
## Message Base Management
The `mb` command provides various Message Base related tools:
```
usage: oputil.js mb <action> [<arguments>]
Actions:
areafix CMD1 CMD2 ... ADDR Sends an AreaFix NetMail
NetMail is sent to supplied address with the supplied command(s). Multi-part commands
such as "%COMPRESS ZIP" should be quoted.
import-areas PATH Import areas using FidoNet *.NA or AREAS.BBS file
import-areas arguments:
--conf CONF_TAG Conference tag in which to import areas
--network NETWORK Network name/key to associate FTN areas
--uplinks UL1,UL2,... One or more uplinks (comma separated)
--type TYPE Area import type
Valid types are "bbs" and "na"
```
| Action | Description | Examples |
|-----------|-------------------|---------------------------------------|
| `import-areas` | Imports areas using a FidoNet style *.NA or AREAS.BBS formatted file. Optionally maps areas to FTN networks. | `./oputil.js config import-areas /some/path/l33tnet.na` |
When using the `import-areas` action, you will be prompted for any missing additional arguments described in "import-areas args".