2021-04-01 11:01:47 +02:00
|
|
|
# A "Automated Password Generator"-clone
|
2021-04-01 10:53:51 +02:00
|
|
|
![Go workflow](https://github.com/wneessen/apg-go/actions/workflows/go.yml/badge.svg)
|
|
|
|
![CodeQL workflow](https://github.com/wneessen/apg-go/actions/workflows/codeql-analysis.yml/badge.svg)
|
|
|
|
|
|
|
|
_apg-go_ is a simple APG-like password generator written in Go. It tries to replicate the
|
2021-03-19 00:56:13 +01:00
|
|
|
functionality of the
|
|
|
|
"[Automated Password Generator](https://web.archive.org/web/20130313042424/http://www.adel.nursat.kz:80/apg)",
|
|
|
|
which hasn't been maintained since 2003. Since more and more Unix distributions are abondoning the tool, I was
|
|
|
|
looking for an alternative. FreeBSD for example recommends "security/makepasswd", which is written in Perl
|
2021-03-21 18:29:27 +01:00
|
|
|
but requires a lot of dependency packages and doesn't offer the feature-set/flexibility of APG.
|
2021-03-18 23:26:41 +01:00
|
|
|
|
2021-03-21 18:29:27 +01:00
|
|
|
Since FIPS-181 (pronouncable passwords) has been withdrawn in 2015, I didn't see any use in replicating that
|
2021-04-01 11:01:47 +02:00
|
|
|
feature. Therfore apg-go does not support pronouncable passwords.
|
2021-03-21 18:29:27 +01:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
### Binary releases
|
|
|
|
#### Linux/BSD/MacOS
|
|
|
|
* Download release
|
|
|
|
```sh
|
|
|
|
$ curl -LO https://github.com/wneessen/apg.go/releases/download/v<version>/apg-v<version>-<os>-<architecture>.tar.gz
|
|
|
|
$ curl -LO https://github.com/wneessen/apg.go/releases/download/v<version>/apg-v<version>-<os>-<architecture>.tar.gz.sha256
|
|
|
|
```
|
|
|
|
* Verify the checksum
|
|
|
|
```sh
|
|
|
|
$ sha256 apg-v<version>-<os>-<architecture>.tar.gz
|
|
|
|
$ cat apg-v<version>-<os>-<architecture>.tar.gz.sha256
|
|
|
|
```
|
|
|
|
**Make sure the checksum of the downloaded file and the checksum in the .sha256 match**
|
|
|
|
* Extract archive
|
|
|
|
```sh
|
|
|
|
$ tar xzf apg-v<version>-<os>-<architecture>.tar.gz
|
|
|
|
```
|
|
|
|
* Execute
|
|
|
|
```sh
|
|
|
|
$ ./apg
|
|
|
|
```
|
|
|
|
#### Windows
|
|
|
|
* Download release
|
|
|
|
```PowerShell
|
|
|
|
PS> Invoke-RestMethod -Uri https://github.com/wneessen/apg.go/releases/download/v<version>/apg-v<version>-windows-<architecture>.zip -OutFile apg-v<version>-windows-<architecure>.zip
|
|
|
|
PS> Invoke-RestMethod -Uri https://github.com/wneessen/apg.go/releases/download/v<version>/apg-v<version>-windows-<architecture>.zip.sha256 -OutFile apg-v<version>-windows-<architecure>.zip.sha256
|
|
|
|
```
|
|
|
|
* Verify the checksum
|
|
|
|
```PowerShell
|
|
|
|
PS> Get-FileHash apg-v<version>-windows-<architecture>.zip | Format-List
|
|
|
|
PS> type apg-v<version>-windows-<architecture>.zip.sha256
|
|
|
|
```
|
|
|
|
**Make sure the checksum of the downloaded file and the checksum in the .sha256 match**
|
|
|
|
* Extract archive
|
|
|
|
```PowerShell
|
|
|
|
PS> Expand-Archive -LiteralPath apg-v<version>-windows-<architecture>
|
|
|
|
```
|
|
|
|
* Execute
|
|
|
|
```PowerShell
|
|
|
|
PS> cd apg-v<version>-windows-<architecture>
|
|
|
|
PS> apg.exe
|
|
|
|
```
|
|
|
|
|
|
|
|
### Sources
|
|
|
|
* Download sources
|
|
|
|
```sh
|
|
|
|
$ curl -LO https://github.com/wneessen/apg.go/archive/refs/tags/v<version>.tar.gz
|
|
|
|
```
|
|
|
|
* Extract source
|
|
|
|
```sh
|
|
|
|
$ tar xzf v<version>.tar.gz
|
|
|
|
```
|
|
|
|
* Build binary
|
|
|
|
```sh
|
|
|
|
$ cd apg.go-<version>
|
|
|
|
$ go build -o apg ./...
|
|
|
|
```
|
|
|
|
* Execute the brand new binary
|
|
|
|
```sh
|
|
|
|
$ ./apg
|
|
|
|
```
|
2021-03-18 23:26:41 +01:00
|
|
|
|
2021-03-21 18:29:27 +01:00
|
|
|
### Systemwide installation
|
|
|
|
It is recommed to install apg in a directory of your ```$PATH``` environment. To do so run:
|
|
|
|
(In this example we use ```/usr/local/bin``` as system-wide binary path. YMMV)
|
2021-03-18 23:26:41 +01:00
|
|
|
```sh
|
|
|
|
$ sudo cp apg /usr/local/bin/apg
|
|
|
|
```
|
|
|
|
|
2021-03-21 18:29:27 +01:00
|
|
|
## CLI parameters
|
2021-03-18 23:26:41 +01:00
|
|
|
_apg.go_ replicates some of the parameters of the original APG. Some parameters are different though:
|
|
|
|
|
2021-03-21 18:29:27 +01:00
|
|
|
- ```-m <length>```: The minimum length of the password to be generated (Default: 20)
|
|
|
|
- ```-x <length>```: The maximum length of the password to be generated (Default: 20)
|
|
|
|
- ```-n <number of passwords>```: The amount of passwords to be generated (Default: 1)
|
|
|
|
- ```-E <list of characters>```: Do not use the specified characters in generated passwords
|
|
|
|
- ```-M <[LUNSHClunshc]>```: New style password parameters (upper-case enables, lower-case disables)
|
|
|
|
- ```-L```: Use lower-case characters in passwords (Default: on)
|
|
|
|
- ```-U```: Use upper-case characters in passwords (Default: on)
|
|
|
|
- ```-N```: Use numeric characters in passwords (Default: on)
|
|
|
|
- ```-S```: Use special characters in passwords (Default: off)
|
|
|
|
- ```-H```: Avoid ambiguous characters in passwords (i. e.: 1, l, I, o, O, 0) (Default: off)
|
|
|
|
- ```-C```: Generate complex passwords (implies -L -U -N -S and disables -H) (Default: off)
|
|
|
|
- ```-l```: Spell generated passwords (Default: off)
|
|
|
|
- ```-h```: Show a CLI help text
|
2021-03-30 19:48:26 +02:00
|
|
|
- ```-v```: Show the version number
|