orapass

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 10 Imported by: 2

README

orapass

An Oracle password file parsing library and utility based on the .pgpass file available to PostgreSQL users, orapass searches a similarly formatted file for Oracle password information. The intent is to provide an alternative to hard-coding password information in scripts, applications, or config files. Keeping the Oracle password information in a separate file also lessens the chances of having password information showing up in source-code control systems.

The orapass file is a colon separated file consisting of one line per entry where each entry has five fields:

 host:port:database(SID):username:password

Each of the first four fields can be a case-insensitive literal value or "*" which acts as a match-anything-wildcard. Blank lines and lines that are commented out using the "#" character are ignored.

When parsing, the first matching line is used.

The location of the orapass file is defermined by first checking for the ORAPASSFILE environment variable. If there is no ORAPASSFILE environment variable or if the ORAPASSFILE does not point to a valid file then:

  • on Unix-like OSes, orapass looks for a $HOME/.orapass or $HOME/orapass file. Additionally the file must be chmod 600 or orapass will refuse to use it.

  • on Windows, orapass looks for a APPDATA/oracle/.orapass or APPDATA/oracle/orapass file.

Example

osql.sh is an example bash script that uses orapass to automate connecting to Oracle using sqlcl.

Documentation

Overview

Package orapass retrieves Oracle passwords from a PostgreSQL inspired .pgpass-like file so that they do not need to be hard-coded in scripts, applications, or config files.

The orapass file is a colon separated file consisting of one line per entry where each entry has five fields:

host:port:database(SID):username:password

Each of the first four fields can be a case-insensitive literal value or "*" which acts as a match-anything-wildcard. Blank and commented out lines are ignored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	Host        string
	Port        string
	DbName      string
	Username    string
	Password    string
	OrapassFile string

	Debug bool
	// contains filtered or unexported fields
}

Parser contains the fields for the orapass file

func (*Parser) GetPasswd

func (p *Parser) GetPasswd() (Parser, error)

GetPasswd retrieves the password for the specified (host, port, database, username).

Directories

Path Synopsis
Retrieves a database password for an Oracle user.
Retrieves a database password for an Oracle user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL