gvpe

package: gvpe

title: gvpe(5)

text:
# gvpe(5)

## NAME
GNU-VPE - Overview of the GNU Virtual Private Ethernet suite.

## DESCRIPTION
GVPE is a suite designed to provide a virtual private network for multiple nodes over an untrusted network. This document first gives an introduction to VPNs in general and then describes the specific implementation of GVPE.

### WHAT IS A VPN?
VPN is an acronym, it stands for:

Virtual

Virtual means that no physical network is created (of course), but a network is emulated by creating multiple tunnels between the member nodes by encapsulating and sending data over another transport network. Usually the emulated network is a normal IP or Ethernet, and the transport network is the Internet. However, using a VPN system like GVPE to connect nodes over other untrusted networks such as Wireless LAN is not uncommon.

Private

Private means that non-participating nodes cannot decode ("sniff)" nor inject ("spoof") packets. This means that nodes can be connected over untrusted networks such as the public Internet without fear of being eavesdropped while at the same time being able to trust data sent by other nodes. In the case of GVPE, even participating nodes cannot sniff packets send to other nodes or spoof packets as if sent from other nodes, so communications between any two nodes is private to those two nodes.

Network

Network means that more than two parties can participate in the network, so for instance it's possible to connect multiple branches of a company into a single network. Many so-called "VPN" solutions only create point-to-point tunnels, which in turn can be used to build larger networks. GVPE provides a true multi-point network in which any number of nodes (at least a few dozen in practise, the theoretical limit is 4095 nodes) can participate.

### GVPE DESIGN GOALS
SIMPLE DESIGN

Cipher, HMAC algorithms and other key parameters must be selected at compile time - this makes it possible to only link in algorithms you actually need. It also makes the crypto part of the source very transparent and easy to inspect, and last not least this makes it possible to hardcode the layout of all packets into the binary. GVPE goes a step further and internally reserves blocks of the same length for all packets, which virtually removes all possibilities of buffer overflows, as there is only a single type of buffer and it's always of fixed length.

EASY TO SETUP

A few lines of config (the config file is shared unmodified between all hosts) and generating an RSA key-pair on each node suffices to make it work.

MAC-BASED SECURITY

Since every host has it's own private key, other hosts cannot spoof traffic from this host. That makes it possible to filter packet by MAC address, e.g. to ensure that packets from a specific IP address come, in fact, from a specific host that is associated with that IP and not from another host.

## PROGRAMS
Gvpe comes with two programs: one daemon (gvpe) and one control program (gvpectrl).

gvpectrl

This program is used to generate the keys, check and give an overview of of the configuration and to control the daemon (restarting etc.).

gvpe

This is the daemon used to establish and maintain connections to the other network nodes. It should be run on the gateway of each VPN subnet.

## COMPILETIME CONFIGURATION
Please have a look at the gvpe.osdep(5) manpage for platform-specific information.

Gvpe hardcodes most encryption parameters. While this reduces flexibility, it makes the program much simpler and helps making buffer overflows impossible under most circumstances.

Here are a few recipes for compiling your gvpe, showing the extremes (fast, small, insecure OR slow, large, more secure), between which you should choose:

### AS LOW PACKET OVERHEAD AS POSSIBLE

```
   ./configure --enable-hmac-length=4 --enable-rand-length=0
```

Minimize the header overhead of VPN packets (the above will result in only 4 bytes of overhead over the raw ethernet frame). This is a insecure configuration because a HMAC length of 4 makes collision attacks almost trivial.

### MINIMIZE CPU TIME REQUIRED

```
   ./configure --enable-cipher=bf --enable-digest=md4
```

Use the fastest cipher and digest algorithms currently available in gvpe. MD4 has been broken and is quite insecure, though, so using another digest algorithm is recommended.

### MAXIMIZE SECURITY

```
   ./configure --enable-hmac-length=16 --enable-rand-length=12 --enable-digest=ripemd610
```

This uses a 16 byte HMAC checksum to authenticate packets (I guess 8-12 would also be pretty secure ;) and will additionally prefix each packet with 12 bytes of random data.

In general, remember that AES-128 seems to be as secure but faster than AES-192 or AES-256, more randomness helps against sniffing and a longer HMAC helps against spoofing. MD4 is a fast digest, SHA1, RIPEMD160, SHA256 are consecutively better, and Blowfish is a fast cipher (and also quite secure).

## HOW TO SET UP A SIMPLE VPN
In this section I will describe how to get a simple VPN consisting of three hosts up and running.

### STEP 1: configuration
First you have to create a daemon configuration file and put it into the configuration directory. This is usually /etc/gvpe, depending on how you configured gvpe, and can be overwritten using the -c command line switch.

Put the following lines into /etc/gvpe/gvpe.conf:

```
   udp-port = 50000 # the external port to listen on (configure your firewall)
   mtu = 1400       # minimum MTU of all outgoing interfaces on all hosts
   ifname = vpn0    # the local network device name
   node = first     # just a nickname
   hostname = first.example.net # the DNS name or IP address of the host
   node = second
   hostname = 133.55.82.9
   node = third
   hostname = third.example.net
```

The only other file necessary is the if-up script that initializes the virtual ethernet interface on the local host. Put the following lines into /etc/gvpe/if-up and make it executable (chmod 755 /etc/gvpe/if-up):

```
   #!/bin/sh
   ip link set $IFNAME address $MAC mtu $MTU up
   [ $NODENAME = first  ] && ip addr add 10.0.1.1 dev $IFNAME
   [ $NODENAME = second ] && ip addr add 10.0.2.1 dev $IFNAME
   [ $NODENAME = third  ] && ip addr add 10.0.3.1 dev $IFNAME
   ip route add 10.0.0.0/16 dev $IFNAME
```

This script will give each node a different IP address in the 10.0/16 network. The internal network (if gvpe runs on a router) should then be set to a subset of that network, e.g. 10.0.1.0/24 on node first, 10.0.2.0/24 on node second, and so on.

By enabling routing on the gateway host that runs gvpe all nodes will be able to reach the other nodes. You can, of course, also use proxy ARP or other means of pseudo-bridging, or (best) full routing - the choice is yours.

### STEP 2: create the RSA key pair for each node
Next you have to generate the RSA keys for the nodes. While you can set up GVPE so you can generate all keys on a single host and centrally distribute all keys, it is safer to generate the key for each node on the node, so that the secret/private key does not have to be copied over the network.

To do so, run the following command to generate a key pair:

```
   gvpectrl -c /etc/gvpe -g nodekey
```

This will create two files, nodekey and nodekey.privkey. The former should be copied to /etc/gvpe/pubkey/nodename on the host where your config file is (you will have to create the pubkey directory first):

```
   scp nodekey confighost:/etc/gvpe/pubkey/nodename
```

The private key nodekey.privkey should be moved to /etc/gvpe/hostkey:

```
   mkdir -p /etc/gvpe
   mv nodekey.privkey /etc/gvpe/hostkey
```

### STEP 3: distribute the config files to all nodes
Now distribute the config files and public keys to the other nodes.

The example uses rsync-over-ssh to copy the config file and all the public keys:

```
   rsync -avzessh /etc/gvpe first.example.net:/etc/. --exclude hostkey
   rsync -avzessh /etc/gvpe 133.55.82.9:/etc/.       --exclude hostkey
   rsync -avzessh /etc/gvpe third.example.net:/etc/. --exclude hostkey
```

You should now check the configuration by issuing the command gvpectrl -c /etc/gvpe -s on each node and verify it's output.

### STEP 4: starting gvpe
You should then start gvpe on each node by issuing a command like:

```
   gvpe -D -l info first # first is the nodename
```

This will make the gvpe daemon stay in foreground. You should then see "connection established" messages. If you don't see them check your firewall and routing (use tcpdump ;).

If this works you should check your networking setup by pinging various endpoints.

To make gvpe run more permanently you can either run it as a daemon (by starting it without the -D switch), or, much better, from your inittab or equivalent. I use a line like this on all my systems:

```
   t1:2345:respawn:/opt/gvpe/sbin/gvpe -D -L first >/dev/null 2>&1
```

### STEP 5: enjoy
... and play around. Sending a -HUP (gvpectrl -kHUP) to the daemon will make it try to connect to all other nodes again. If you run it from inittab gvpectrl -k (or simply killall gvpe) will kill the daemon, start it again, making it read it's configuration files again.

To run the GVPE daemon permanently from your SysV init, you can add it to your inittab, e.g.:

```
   t1:2345:respawn:/bin/sh -c "exec nice -n-20 /path/to/gvpe -D node >/var/log/gvpe.log 2>&1"
```

For systems using systemd, you can use a unit file similar to this one:

```
   [Unit]
   Description=gvpe
   After=network.target
   Before=remote-fs.target
   [Service]
   ExecStart=/path/to/gvpe -D node
   KillMode=process
   Restart=always
   [Install]
   WantedBy=multi-user.target
```

## SEE ALSO
gvpe.osdep(5) for OS-dependent information, gvpe.conf(5), gvpectrl(8), and for a description of the transports, protocol, and routing algorithm, gvpe.protocol(7).

The GVPE mailing list, at <http://lists.schmorp.de/>, or gvpe@lists.schmorp.de.

## AUTHOR
Marc Lehmann <gvpe@schmorp.de>

## COPYRIGHTS AND LICENSES
GVPE itself is distributed under the GENERAL PUBLIC LICENSE (see the file COPYING that should be part of your distribution).

In some configurations it uses modified versions of the tinc vpn suite, which is also available under the GENERAL PUBLIC LICENSE.


gvpe.conf

title: gvpe.conf(5)

text:
# gvpe.conf(5)

## NAME
gvpe.conf - configuration file for the GNU VPE daemon

## SYNOPSIS

```
   # global options for all nodes
   udp-port = 407
   mtu = 1492
   ifname = vpn0
   # first node is named branch1 and is at 1.2.3.4
   node = branch1
   hostname = 1.2.3.4
   # second node uses dns to resolve the address
   node = branch2
   hostname = www.example.net
   udp-port = 500       # this host uses a different udp-port
   # third node has no fixed ip address
   node = branch3
   connect = ondemand
```

## DESCRIPTION
The gvpe config file consists of a series of lines that contain variable = value pairs. Empty lines are ignored. Comments start with a # and extend to the end of the line. They can be used on their own lines, or after any directives. Whitespace is allowed around the = sign or after values, but not within the variable names or values themselves.

All settings are applied "in order", that is, later settings of the same variable overwrite earlier ones.

The only exceptions to the above are the following directives:

node nodename

Introduces a node section. The nodename is used to select the right configuration section and is the same string as is passed as an argument to the gvpe daemon. Multiple node statements with the same node name are supported and will be merged together.

global

This statement switches back to the global section, which is mainly useful if you want to include a second config file, e..g for local customisations. To do that, simply include this at the very end of your config file:

```
   global
   include local.conf

```

on nodename ...

on !nodename ...

You can prefix any configuration directive with on and a nodename. GVPE will will only "execute" it on the named node, or (if the nodename starts with !) on all nodes except the named one. Example: set the MTU to 1450 everywhere, loglevel to noise on branch1, and connect to ondemand everywhere but on branch2.

```
   mtu = 1450
   on branch1 loglevel = noise
   on !branch2 connect = ondemand

```

include relative-or-absolute-path

Reads the specified file (the path must not contain whitespace or = characters) and evaluate all config directives in it as if they were spelled out in place of the include directive. The path is a printf format string, that is, you must escape any % by doubling it, and you can have a single %s inside, which will be replaced by the current nodename.

Relative paths are interpreted relative to the GVPE config directory.

Example: include the file local.conf in the config directory on every node.

```
   include local.conf

```

Example: include a file conf/nodename.conf

```
   include conf/%s.conf

```

## ANATOMY OF A CONFIG FILE
Usually, a config file starts with a few global settings (like the UDP port to listen on), followed by node-specific sections that begin with a node = nickname line.

Every node that is part of the network must have a section that starts with node = nickname. The number and order of the nodes is important and must be the same on all nodes. It is not uncommon for node sections to be completely empty - if the default values are right.

Node-specific settings can be used at any time. If used before the first node section they will set the default values for all following nodes.

## CONFIG VARIABLES

### GLOBAL SETTINGS
Global settings will affect the behaviour of the running gvpe daemon, that is, they are in some sense node-specific (config files can set different values on different nodes using on), but will affect the behaviour of the gvpe daemon and all connections it creates.

chroot = path or /

Tells GVPE to chroot(2) to the specified path after reading all necessary files, binding to sockets and running the if-up script, but before running node-up or any other scripts. The special path / instructs GVPE to create (and remove) an empty temporary directory to use as new root. This is most secure, but makes it impossible to use any scripts other than the if-up one.

chuid = numerical-uid

chgid = numerical-gid

These two options tell GVPE to change to the given user and/or group id after reading all necessary files, binding to sockets and running the if-up script. Other scripts, such as node-up, are run with the new user id or group id.

chuser = username

Alternative to chuid and chgid: Sets both chuid and chgid to the user and (primary) group ids of the specified user (for example, nobody).

dns-forw-host = hostname/ip

The DNS server to forward DNS requests to for the DNS tunnel protocol (default: 127.0.0.1, changing it is highly recommended).

dns-forw-port = port-number

The port where the dns-forw-host is to be contacted (default: 53, which is fine in most cases).

dns-case-preserving = yes|true|on | no|false|off

Sets whether the DNS transport forwarding server preserves case (DNS servers have to, but some access systems are even more broken than others) (default: true). Normally, when the forwarding server changes the case of domain names then GVPE will automatically set this to false.

dns-max-outstanding = integer-number-of-requests

The maximum number of outstanding DNS transport requests (default: 100). GVPE will never issue more requests then the given limit without receiving replies. In heavily overloaded situations it might help to set this to a low number (e.g. 3 or even 1) to limit the number of parallel requests. The default should be working OK for most links.

dns-overlap-factor = float

The DNS transport uses the minimum request latency (min_latency) seen during a connection as it's timing base. This factor (default: 0.5, must be > 0) is multiplied by min_latency to get the maximum sending rate (= minimum send interval), i.e. a factor of 1 means that a new request might be generated every min_latency seconds, which means on average there should only ever be one outstanding request. A factor of 0.5 means that GVPE will send requests twice as often as the minimum latency measured. For congested or picky DNS forwarders you could use a value nearer to or exceeding 1.

The default should be working OK for most links.

dns-send-interval = send-interval-in-seconds

The minimum send interval (= maximum rate) that the DNS transport will use to send new DNS requests. GVPE will not exceed this rate even when the latency is very low. The default is 0.01, which means GVPE will not send more than 100 DNS requests per connection per second. For high-bandwidth links you could go lower, e.g. to 0.001 or so. For congested or rate-limited links, you might want to go higher, say 0.1, 0.2 or even higher. The default should be working OK for most links.

dns-timeout-factor = float

Factor to multiply the min_latency (see dns-overlap-factor) by to get request timeouts. The default of 8 means that the DNS transport will resend the request when no reply has been received for longer than eight times the minimum (= expected) latency, assuming the request or reply has been lost. For congested links a higher value might be necessary (e.g. 30). If the link is very stable lower values (e.g. 2) might work nicely. Values near or below 1 makes no sense whatsoever.

The default should be working OK for most links but will result in low throughput if packet loss is high.

if-up = relative-or-absolute-path

Sets the path of a script that should be called immediately after the network interface is initialized (but not necessarily up). The following environment variables are passed to it (the values are just examples). Variables that have the same value on all nodes:

CONFBASE=/etc/gvpe

The configuration base directory.

IFNAME=vpn0

The network interface to initialize.

IFTYPE=native # or tincd

IFSUBTYPE=linux # or freebsd, darwin etc..

The interface type (native or tincd) and the subtype (usually the OS name in lowercase) that this GVPE was configured for. Can be used to select the correct syntax to use for network-related commands.

MTU=1436

The MTU to set the interface to. You can use lower values (if done consistently on all nodes), but this is usually either inefficient or simply ineffective.

NODES=5

The number of nodes in this GVPE network.

Variables that are node-specific and with values pertaining to the node running this GVPE:

IFUPDATA=string

The value of the configuration directive if-up-data.

MAC=fe:fd:80:00:00:01

The MAC address the network interface has to use. Might be used to initialize interfaces on platforms where GVPE does not do this automatically. Please see the gvpe.osdep(5) man page for platform-specific information.

NODENAME=branch1

The nickname of the node.

NODEID=1

The numerical node ID of the node running this instance of GVPE. The first node mentioned in the config file gets ID 1, the second ID 2 and so on.

In addition, all node-specific variables (except NODEID) will be available with a postfix of _nodeid, which contains the value for that node, e.g. the MAC_1 variable contains the MAC address of node #1, while the NODENAME_22 variable contains the name of node #22.

Here is a simple if-up script:

```
   #!/bin/sh
   ip link set $IFNAME up
   [ $NODENAME = branch1 ] && ip addr add 10.0.0.1 dev $IFNAME
   [ $NODENAME = branch2 ] && ip addr add 10.1.0.1 dev $IFNAME
   ip route add 10.0.0.0/8 dev $IFNAME
```

More complicated examples (using routing to reduce ARP traffic) can be found in the etc/ subdirectory of the distribution.

ifname = devname

Sets the tun interface name to the given name. The default is OS-specific and most probably something like tun0.

ifpersist = yes|true|on | no|false|off

Should the tun/tap device be made persistent, that is, should the device stay up even when gvpe exits? Some versions of the tunnel device have problems sending packets when gvpe is restarted in persistent mode, so if the connections can be established but you cannot send packets from the local node, try to set this to off and do an ifconfig down on the device.

ip-proto = numerical-ip-protocol

Sets the protocol number to be used for the rawip protocol. This is a global option because all nodes must use the same protocol, and since there are no port numbers, you cannot easily run more than one gvpe instance using the same protocol, nor can you share the protocol with other programs. The default is 47 (GRE), which has a good chance of tunneling through firewalls (but note that gvpe's rawip protocol is not GRE compatible). Other common choices are 50 (IPSEC, ESP), 51 (IPSEC, AH), 4 (IPIP tunnels) or 98 (ENCAP, rfc1241).

Many versions of Linux seem to have a bug that causes them to reorder packets for some ip protocols (GRE, ESP) but not for others (AH), so choose wisely (that is, use 51, AH).

http-proxy-host = hostname/ip

The http-proxy-* family of options are only available if gvpe was compiled with the --enable-http-proxy option and enable tunneling of tcp connections through a http proxy server. http-proxy-host and http-proxy-port should specify the hostname and port number of the proxy server. See http-proxy-loginpw if your proxy requires authentication.

Please note that gvpe will still try to resolve all hostnames in the configuration file, so if you are behind a proxy without access to a DNS server better use numerical IP addresses.

To make best use of this option disable all protocols except TCP in your config file and make sure your routers (or all other nodes) are listening on a port that the proxy allows (443, https, is a common choice).

If you have a router, connecting to it will suffice. Otherwise TCP must be enabled on all nodes.

Example:

```
   http-proxy-host = proxy.example.com
   http-proxy-port = 3128       # 8080 is another common choice
   http-proxy-auth = schmorp:grumbeere

```

http-proxy-port = proxy-tcp-port

The port where your proxy server listens.

http-proxy-auth = login:password

The optional login and password used to authenticate to the proxy server, separated by a literal colon (:). Only basic authentication is currently supported.

keepalive = seconds

Sets the keepalive probe interval in seconds (default: 60). After this many seconds of inactivity the daemon will start to send keepalive probe every 3 seconds until it receives a reply from the other end. If no reply is received within 15 seconds, the peer is considered unreachable and the connection is closed.

loglevel = noise|trace|debug|info|notice|warn|error|critical

Set the logging level. Connection established messages are logged at level info, notable errors are logged with error. Default is info.

mtu = bytes

Sets the maximum MTU that should be used on outgoing packets (basically the MTU of the outgoing interface) The daemon will automatically calculate maximum overhead (e.g. UDP header size, encryption blocksize...) and pass this information to the if-up script. Recommended values are 1500 (ethernet), 1492 (pppoe), 1472 (pptp).

This value must be the minimum of the MTU values of all nodes.

nfmark = integer

This advanced option, when set to a nonzero value (default: 0), tries to set the netfilter mark (or fwmark) value on all sockets gvpe uses to send packets. This can be used to make gvpe use a different set of routing rules. For example, on GNU/Linux, the if-up could set nfmark to 1000 and then put all routing rules into table 99 and then use an ip rule to make gvpe traffic avoid that routing table, in effect routing normal traffic via gvpe and gvpe traffic via the normal system routing tables:

```
   ip rule add not fwmark 1000 lookup 99

```

node-up = relative-or-absolute-path

Sets a command (default: none) that should be called whenever a connection is established (even on rekeying operations). Note that node-up/down scripts will be run asynchronously, but execution is serialised, so there will only ever be one such script running. In addition to all the variables passed to if-up scripts, the following environment variables will be set (values are just examples):

DESTNODE=branch2

The name of the remote node.

DESTID=2

The node id of the remote node.

DESTSI=rawip/88.99.77.55:0

The "socket info" of the target node, protocol dependent but usually in the format protocol/ip:port.

DESTIP=188.13.66.8

The numerical IP address of the remote node (gvpe accepts connections from everywhere, as long as the other node can authenticate itself).

DESTPORT=655 # deprecated

The protocol port used by the other side, if applicable.

STATE=up

Node-up scripts get called with STATE=up, node-change scripts get called with STATE=change and node-down scripts get called with STATE=down.

Here is a nontrivial example that uses nsupdate to update the name => ip mapping in some DNS zone:

```
   #!/bin/sh
   {
     echo update delete $DESTNODE.lowttl.example.net. a
     echo update add $DESTNODE.lowttl.example.net. 1 in a $DESTIP
     echo
   } | nsupdate -d -k $CONFBASE:key.example.net.
```

node-change = relative-or-absolute-path

Same as node-change, but gets called whenever something about a connection changes (such as the source IP address).

node-down = relative-or-absolute-path

Same as node-up, but gets called whenever a connection is lost.

pid-file = path

The path to the pid file to check and create (default: LOCALSTATEDIR/run/gvpe.pid). The first %s is replaced by the nodename - any other use of % must be written as %%.

private-key = relative-path-to-key

Sets the path (relative to the config directory) to the private key (default: hostkey). This is a printf format string so every % must be doubled. A single %s is replaced by the hostname, so you could use paths like hostkeys/%s to be able to share the same config directory between nodes. Since only the private key file of the current node is used and the private key file should be kept secret per-node to avoid spoofing, it is not recommended to use this feature this way though.

rekey = seconds

Sets the rekeying interval in seconds (default: 3607). Connections are reestablished every rekey seconds, making them use a new encryption key.

seed-device = path

The random device used to initially and regularly seed the random number generator (default: /dev/urandom). Randomness is of paramount importance to the security of the algorithms used in gvpe. On program start and every seed-interval, gvpe will read 64 octets.

Setting this path to the empty string will disable this functionality completely (the underlying crypto library will likely look for entropy sources on it's own though, so not all is lost).

seed-interval = seconds

The number of seconds between reseeds of the random number generator (default: 3613). A value of 0 disables this regular reseeding.

serial = string

The configuration serial number. This can be any string up to 16 bytes length. Only when the serial matches on both sides of a connection will the connection succeed. This is not a security mechanism and eay to spoof, this mechanism exists to alert users that their config is outdated. It's recommended to specify this is a date string such as 2013-05-05 or 20121205084417.

The exact algorithm is as this: if a connection request is received form a node with an identical serial, then it succeeds normally.

If the remote serial is lower than the local serial, it is ignored.

If the remote serial is higher than the local serial, a warning message is logged.

### NODE SPECIFIC SETTINGS
The following settings are node-specific, that is, every node can have different settings, even within the same gvpe instance. Settings that are set before the first node section set the defaults, settings that are set within a node section only apply to the given node.

allow-direct = nodename

Allow direct connections to this node. See deny-direct for more info.

compress = yes|true|on | no|false|off

For the current node, this specified whether it will accept compressed packets, and for all other nodes, this specifies whether to try to compress data packets sent to this node (default: yes). Compression is really cheap even on slow computers, has no size overhead at all and will only be used when the other side supports compression, so enabling this is often a good idea.

connect = ondemand | never | always | disabled

Sets the connect mode (default: always). It can be always (always try to establish and keep a connection to the given node), never (never initiate a connection to the given host, but accept connections), ondemand (try to establish a connection when there are outstanding packets in the queue and take it down after the keepalive interval) or disabled (node is bad, don't talk to it). Routers will automatically be forced to always unless they are disabled, to ensure all nodes can talk to each other.

deny-direct = nodename | *

Deny direct connections to the specified node (or all nodes when * is given). Only one node can be specified, but you can use multiple allow-direct and deny-direct statements. This only makes sense in networks with routers, as routers are required for indirect connections. Sometimes, a node cannot reach some other nodes for reasons of network connectivity. For example, a node behind a firewall that only allows connections to/from a single other node in the network. In this case one should specify deny-direct = * and allow-direct = othernodename (the other node must be a router for this to work).

The algorithm to check whether a connection may be direct is as follows:

1. Other node mentioned in an allow-direct? If yes, allow the connection.

2. Other node mentioned in a deny-direct? If yes, deny direct connections.

3. Allow the connection.

That is, allow-direct takes precedence over deny-direct.

The check is done in both directions, i.e. both nodes must allow a direct connection before one is attempted, so you only need to specify connect limitations on one node.

dns-domain = domain-suffix

The DNS domain suffix that points to the DNS tunnel server for this node. The domain must point to a NS record that points to the dns-hostname, i.e.

```
   dns-domainname = tunnel.example.net
   dns-hostname   = tunnel-server.example.net

```

Corresponds to the following DNS entries in the example.net domain:

```
   tunnel.example.net.         NS tunnel-server.example.net.
   tunnel-server.example.net.  A  13.13.13.13

```

dns-hostname = hostname/ip

The address to bind the DNS tunnel socket to, similar to the hostname, but for the DNS tunnel protocol only. Default: 0.0.0.0, but that might change.

dns-port = port-number

The port to bind the DNS tunnel socket to. Must be 53 on DNS tunnel servers.

enable-dns = yes|true|on | no|false|off

See gvpe.protocol(7) for a description of the DNS transport protocol. Avoid this protocol if you can. Enable the DNS tunneling protocol on this node, either as server or as client. Support for this transport protocol is only available when gvpe was compiled using the --enable-dns option.

enable-icmp = yes|true|on | no|false|off

See gvpe.protocol(7) for a description of the ICMP transport protocol. Enable the ICMP transport using ICMP packets of type icmp-type on this node.

enable-rawip = yes|true|on | no|false|off

See gvpe.protocol(7) for a description of the RAW IP transport protocol. Enable the RAW IPv4 transport using the ip-proto protocol (default: no).

enable-tcp = yes|true|on | no|false|off

See gvpe.protocol(7) for a description of the TCP transport protocol. Enable the TCPv4 transport using the tcp-port port (default: no). Support for this transport protocol is only available when gvpe was compiled using the --enable-tcp option.

enable-udp = yes|true|on | no|false|off

See gvpe.protocol(7) for a description of the UDP transport protocol. Enable the UDPv4 transport using the udp-port port (default: no).

hostname = hostname | ip [can not be defaulted]

Forces the address of this node to be set to the given DNS hostname or IP address. It will be resolved before each connect request, so dyndns should work fine. If this setting is not specified and a router is available, then the router will be queried for the address of this node. Otherwise, the connection attempt will fail. Note that DNS resolving is done synchronously, pausing the daemon. If that is an issue you need to specify IP addresses.

icmp-type = integer

Sets the type value to be used for outgoing (and incoming) packets sent via the ICMP transport. The default is 0 (which is echo-reply, also known as "ping-reply"). Other useful values include 8 (echo-request, a.k.a. "ping") and 11 (time-exceeded), but any 8-bit value can be used.

if-up-data = value

The value specified using this directive will be passed to the if-up script in the environment variable IFUPDATA.

inherit-tos = yes|true|on | no|false|off

Whether to inherit the TOS settings of packets sent to the tunnel when sending packets to this node (default: yes). If set to yes then outgoing tunnel packets will have the same TOS setting as the packets sent to the tunnel device, which is usually what you want.

low-power = yes|true|on | no|false|off

If true, designates a node as a low-power node. Low-power nodes use larger timeouts and try to reduce cpu time. Other nodes talking to a low-power node will also use larger timeouts, and will use less aggressive optimisations, in the hope of reducing load. Security is not compromised. The typical low-power node would be a mobile phone, where wakeups and encryption can significantly increase power drain.

max-retry = positive-number

The maximum interval in seconds (default: 3600, one hour) between retries to establish a connection to this node. When a connection cannot be established, gvpe uses exponential back-off capped at this value. It's sometimes useful to set this to a much lower value (e.g. 120) on connections to routers that usually are stable but sometimes are down, to assure quick reconnections even after longer downtimes.

max-ttl = seconds

Expire packets that couldn't be sent after this many seconds (default: 60). Gvpe will normally queue packets for a node without an active connection, in the hope of establishing a connection soon. This value specifies the maximum lifetime a packet will stay in the queue, if a packet gets older, it will be thrown away.

max-queue = positive-number>=1

The maximum number of packets that will be queued (default: 512) for this node. If more packets are sent then earlier packets will be expired. See max-ttl, above.

router-priority = 0 | 1 | positive-number>=2

Sets the router priority of the given node (default: 0, disabled). If some node tries to connect to another node but it doesn't have a hostname, it asks a router node for it's IP address. The router node chosen is the one with the highest priority larger than 1 that is currently reachable. This is called a mediated connection, as the connection itself will still be direct, but it uses another node to mediate between the two nodes.

The value 0 disables routing, that means if the node receives a packet not for itself it will not forward it but instead drop it.

The special value 1 allows other hosts to route through the router host, but they will never route through it by default (i.e. the config file of another node needs to specify a router priority higher than one to choose such a node for routing).

The idea behind this is that some hosts can, if required, bump the router-priority setting to higher than 1 in their local config to route through specific hosts. If router-priority is 0, then routing will be refused, so 1 serves as a "enable, but do not use by default" switch.

Nodes with router-priority set to 2 or higher will always be forced to connect = always (unless they are disabled).

tcp-port = port-number

Similar to udp-port (default: 655), but sets the TCP port number.

udp-port = port-number

Sets the port number used by the UDP protocol (default: 655, not officially assigned by IANA!).

## CONFIG DIRECTORY LAYOUT
The default (or recommended) directory layout for the config directory is:

gvpe.conf

The config file.

if-up

The if-up script

node-up, node-down

If used the node up or node-down scripts.

hostkey

The (default path of the) private key of the current host.

pubkey/nodename

The public keys of the other nodes, one file per node.

## SEE ALSO
gvpe(5), gvpe(8), gvpectrl(8).

## AUTHOR
Marc Lehmann <gvpe@schmorp.de>

branch: sisyphus


gvpe.osdep

title: gvpe.osdep(5)

summary: os dependent information

text:
# gvpe.osdep(5)

## NAME
gvpe.osdep - os dependent information

## DESCRIPTION
This file tries to capture OS-dependent configuration or build issues, quirks and platform limitations, as known.

## TUN vs. TAP interface
Most operating systems nowadays support something called a tunnel-device, which makes it possible to divert IPv4 (and often other protocols, too) into a user space daemon like gvpe. This is being referred to as a TUN-device.

This is fine for point-to-point tunnels, but for a virtual ethernet, an additional ethernet header is needed. This functionality (called a TAP device here) is only provided by a subset of the configurations.

On platforms only supporting a TUN-device, gvpe will invoke it's magical ethernet emulation package, which currently only handles ARP requests for the IPv4 protocol (but more could be added, bu the tincd network drivers might need to be modified for this to work). This means that on those platforms, only IPv4 will be supported.

Also, since there is no way (currently) to tell gvpe which IP subnets are found on a specific host, you will either need to hardwire the MAC address for TUN-style hosts on all networks (and avoid ARP altogether, which is possible), or you need to send a packet from these hosts into the vpn network to tell gvpe the local interface address.

## Interface Initialisation
Unless otherwise notes, the network interface will be initialized with the expected MAC address and correct MTU value. With most interface drivers, this is done by running /sbin/ifconfig, so make sure that this command exists.

## Interface Types

### native/linux
TAP-device; already part of the kernel (only 2.4+ supported, but see tincd/linux). This is the configuration tested best, as gvpe is being developed on this platform.

ifname should be set to the name of the network device.

To hardwire ARP addresses, use iproute2 (arp can do it, too):

```
  MAC=fe:fd:80:00:00:$(printf "%02x" $NODEID)
  ip neighbour add 10.11.12.13 lladdr $MAC nud permanent dev $IFNAME
```

### tincd/linux
TAP-device; already part of the kernel (2.2 only). See native/linux for more info.

ifname should be set to the path of a tap device, e.g. /dev/tap0. The interface will be named accordingly.

### native/cygwin
TAP-device; The TAP device to be used must either be the CIPE driver (http://cipe-win32.sourceforge.net/), or (highly recommended) the newer TAP-Win32 driver bundled with openvpn (http://openvpn.sf.net/). Just download and run the openvpn installer. The only option you need to select is the TAP driver.

ifname should be set to the name of the device, found in the registry at (no kidding :):

```
      HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\<adapterid>\Connection\Name
```

The MAC address is dynamically being patched into packets and ARP-requests, so only IPv4 works with ARP on this platform.

### tincd/bsd
TAP-device, maybe; might work for many bsd variants.

This driver is a newer version of the tincd/*bsd drivers. It might provide a TAP device, or might not work at all. You might try this interface type first, and, if it doesn't work, try one of the OS-specific drivers.

### tincd/freebsd
TAP-device; part of the kernel (since 4.x, maybe earlier).

ifname should be set to the path of a tap device, e.g. /dev/tap0. The interface will be named accordingly.

These commands might be helpful examples:

```
  ifconfig $IFNAME 10.0.0.$NODEID
  route add -net 10.0.0.0 -netmask 255.255.255.0 -interface $IFNAME 10.0.0.$NODEID
```

### tincd/netbsd
TUN-device; The interface is a point-to-point device. To initialize it, you currently need to configure it as a point-to-point device, giving it an address on your vpn (the exact address doesn't matter), like this:

```
  ifconfig $IFNAME mtu $MTU up
  ifconfig $IFNAME 10.11.12.13 10.55.66.77
  route add -net 10.0.0.0 10.55.66.77 255.0.0.0
  ping -c1 10.55.66.77 # ping once to tell gvpe your gw ip
```

The ping is required to tell the ARP emulator inside GVPE the local IP address.

ifname should be set to the path of a tun device, e.g. /dev/tun0. The interface will be named accordingly.

### tincd/openbsd
TUN-device; already part of the kernel. See tincd/netbsd for more information.

### native/darwin
TAP-device;

The necessary kernel extension can be found here:

```
  http://www-user.rhrk.uni-kl.de/~nissler/tuntap/
```

There are two drivers, the one to use is the "tap" driver. It driver must be loaded before use, read the docs on how to install it as a startup item.

ifname should be set to the path of a tap device, e.g. /dev/tap0. The interface will be named accordingly.

These commands might be helpful examples:

```
  ifconfig $IFNAME 10.0.0.$NODEID
  route add -net 10.0.0.0 -interface $IFNAME 255.255.255.0
```

### tincd/darwin
TUN-device; See tincd/netbsd for more information. native/darwin is preferable.

The necessary kernel extension can be found here:

```
  http://chrisp.de/en/projects/tunnel.html
```

ifname should be set to the path of a tun device, e.g. /dev/tun0. The interface will be named accordingly.

The driver must be loaded before use:

```
  kmodload tunnel
```

### tincd/solaris
TUN-device; already part of the kernel(?), or available here:

```
  http://vtun.sourceforge.net/tun/
```

Some precompiled tun drivers might be available here:

```
  http://www.monkey.org/~dugsong/fragroute/
```

The interface MAC and MTU are NOT set up for you. Please try it out and send me an ifconfig command invocation that does that.

See tincd/netbsd for more information.

Completely untested so far.

### tincd/mingw
TAP-device; see native/cygwin for more information.

The setup is likely to be similar to native/cygwin.

Completely untested so far.

### tincd/raw_socket
TAP-device; purpose unknown and untested, probably binds itself on an existing ethernet device (given by ifname). It must be down prior to running the command, and GVPE will try to set it's MAC address and MTU to the "correct" values.

Completely untested so far.

### tincd/uml_socket
TAP-device; purpose unknown and untested, probably creates a UNIX datagram socket (path given by ifname) and reads and writes raw packets, so might be useful in other than UML contexts.

No network interface is created, and the MAC and MTU must be set as appropriate on the other side of the socket. GVPE will exit if the MAC address doesn't match what it expects.

Completely untested so far.

### tincd/cygwin
Known to be broken, use native/cygwin instead.

## SEE ALSO
gvpe(5).

## AUTHOR
Marc Lehmann <gvpe@schmorp.de>


hare-module

package: hare

title: hare-module(5)

text:
# hare-module(5)

## NAME
hare-module - Hare module layout

## DESCRIPTION
Hare modules are represented as directories in the filesystem. A directory is a valid Hare module if it contains at least one Hare source file (with the file extension .ha), or if it contains a file named README.

All files which end in .ha, .s, and .o are treated as inputs to the module, and are respectively treated as Hare sources, assembly sources, and objects to be linked into the final binary.

The list of files considered eligible may be filtered by build tags (see BUILD TAGS below). The format for the filename is name[tagset].ext, where the name is user-defined, the ext is either ha, s, or o, and a tagset (see BUILD TAGS) is optionally provided after the name. A file will only be included if all tags included (with +) in the tagset are present, and no tags excluded (with -) in the tagset are present.

Only one file for a given combination of name and ext will be selected for the build; the file selected is the one with the most tag specifiers. If there are two or more such files, the build driver will error out.

For example, if the following files are present in a directory:

- foo.ha

- bar.ha

- bar+linux.ha

- bar+plan9.ha

- baz+x86_64.s

- bat-x86_64.ha

If the build tags are +linux+x86_64, then the files which are included in the module are foo.ha, bar+linux.ha, and baz+x86_64.s. If the following files are added:

- meep+linux-libc.ha

- meep+linux+x86_64.ha

then the build driver will error out, unless +libc is added to the build tags.

Additionally, subdirectories in a module will be considered part of that module if their name consists only of a tagset, e.g. "+linux" or "-x86_64". A directory with only a name (but without a tagset, e.g. "example") is considered a submodule, and as such must be imported separately. For example, "foo::bar" refers to foo/bar/. If a directory name contains both a name and a tagset, the build driver will error out.

## DEPENDENCY RESOLUTION
The "use" directives in each Hare source file used as an input to hare-build(1), hare-run(1), or hare-test(1) are scanned and used to determine the dependencies for a program. This process is repeated for each dependency to obtain a complete dependency tree.

Dependencies are searched for by examining first the current working directory, then each component of the HAREPATH, which is a list of paths separated by colons. HAREPATH is obtained from the environment variable of the same name. If the environment variable is unset, a default value is used, which can be viewed with the hare version -v command. Typically, it is set to include the path to the standard library installed on the system, as well as a system-provided location for third-party modules installed via the system package manager.

hare-deps(1) may be used to print the dependency tree of a Hare module.

## BUILD TAGS
Build tags allow you to add constraints on what features or platforms are enabled for your build. A tag is a name, consisting of characters which aren't any of '+', '-', or '.', and a '+' or '-' prefix to signal inclusivity or exclusivity.

To add or remove build tags, use the -T flag. For example, -T +foo-bar will add the 'foo' tag and remove the 'bar' tag.

Some tags are enabled by default, enabling features for the host platform. You can view the default tagset by running hare version -v. To remove all default tags, use -T^.

## SEE ALSO
hare(1), hare-build(1), hare-run(1), hare-test(1)


haredoc

title: haredoc(5)

text:
# haredoc(5)

## NAME
haredoc - Hare documentation format

## DESCRIPTION
Hare documentation is written in a simple markup language. By default, haredoc(1) will display the documentation literally, without any additional formatting. Other tools may format Hare documentation into other formats.

Text may be written normally, broken into several lines to conform to the 80-column limit. To begin a new paragraph, insert an empty line.

References to other declarations and modules may be written in brackets, like this: [[os::stdout]]. References to modules should include a trailing :: in the identifier: [[os::exec::]].

A bulleted list can be started by opening a line with "-", optionally preceded by a space. Each line opened like this begins a new list item. To complete the list, insert an empty line.

Code samples may be used by starting a line with a single tab, optionally preceded by a space.

This markup language is extracted from Hare comments preceding exported symbols in your source code, and from a file named "README" in your module directory, if present.

## README
A file named "README" at the root directory of a Hare module is used as a summary of the entire module. It should start with a brief one-line summary of the module using the module's name (the last item in its identifier), a colon, a space, and a summary, as follows:

```
memio: memory-backed I/O functions
```

This may be followed by an empty line, then a long-form summary of the module using the documentation format described abovce.

## EXAMPLE

```
// Foos the bars. See also [[foobar]].
//
// If you instead want to bar the foos, use one of the functions in
// [[bar::foo::]].
//
// - First, the bars are obtained.
// - They are then fooed.
// - Finally, the result is returned.
//
//      let x = example();
//      assert(x == 0);
export fn example() int = 0;
```

## NOTES
It's expected that tools which parse documentation for the purpose of converting it into another format will perform additional processing to decouple the content from its original textual representation:

- Line breaks within a paragraph or list item should be ignored.

- Repeated whitespace outside of a code sample should be collapsed.

- Multiple code samples separated by empty lines should be collapsed into one code sample, so the empty lines are moved into the code sample itself.

hare::parse::doc:: in the standard library handles all of this processing for you.

Parsers are permitted (and encouraged) to error out on invalid input, such as a malformed or unterminated [[reference]].

## SEE ALSO
haredoc(1)


hasher-priv.conf

package: hasher-priv

title: hasher-priv.conf(5)

summary: configuration for the hasher\-privd service daemon

text:
# hasher-priv.conf(5)

## NAME
/etc/hasher-priv/ - configuration for the hasher-privd service daemon

## DESCRIPTION
/etc/hasher-priv/ is used to control various aspects of hasher-privd(8) behaviour.

hasher-priv(8) first loads systemwide configuration file /etc/hasher-priv/system, then it loads per-user configuration file /etc/hasher-priv/user.d/USER, and finally, if subconfig identifier NUMBER is specified, it loads per-user per-number subconfig file /etc/hasher-priv/user.d/USER:NUMBER.

## FORMAT
The format of each configuration file is very simple. Each line is either a comment or a directive. Comment lines start with a # character and are ignored. A directive line has the format:

option=value

It is not an error to put any space between the option, = and value. Both option and its value are case-insensitive.

Each setting has a compiled in default which may be modified in the configuration file.

## NUMERIC OPTIONS
Below is a list of numeric options. A numeric option must be set to a non negative integer.

umask

The value (octal number) that the umask for child process is set. Default: 022

nice

Add specified value to the nice value for child process. This value should not exceed OS limitation (19). Default: 8

nproc

Limit the number of available CPUs to the specified count. This is achieved by reducing the CPU affinity mask to a randomly shuffled set of nproc bits. The value should be greater or equal to 1. If the value exceeds the actual CPU count, it will not be applied. Default: (none)

rlimit_hard_cpu, rlimit_soft_cpu

Per-process CPU limit, in seconds. Default: (none)

rlimit_hard_fsize, rlimit_soft_fsize

Largest file that can be created, in bytes. Default: (none)

rlimit_hard_data, rlimit_soft_data

Maximum size of data segment, in bytes. Default: (none)

rlimit_hard_stack, rlimit_soft_stack

Maximum size of stack segment, in bytes. Default: (none)

rlimit_hard_core, rlimit_soft_core

Largest core file that can be created, in bytes. Default: (none)

rlimit_hard_rss, rlimit_soft_rss

Largest resident set size, in bytes. Default: (none)

rlimit_hard_nproc, rlimit_soft_nproc

Number of processes. Default: (none)

rlimit_hard_nofile, rlimit_soft_nofile

Number of open files. Default: (none)

rlimit_hard_memlock, rlimit_soft_memlock

Locked-in-memory address space. Default: (none)

rlimit_hard_as, rlimit_soft_as

Address space limit. Default: (none)

rlimit_hard_locks, rlimit_soft_locks

Maximum number of file locks. Default: (none)

wlimit_time_elapsed

This option limits total execution time, in seconds. Default: (none)

wlimit_time_idle

This option specifies idle time limit, in seconds. Idle time is a period when child process produces no output. Default: (none)

wlimit_bytes_written

This option limits amount of output generated by child process, in bytes. Default: (none)

## STRING OPTIONS
Below is a list of string options.

user1

This option specifies name of the first pseudouser. Default: (none)

user2

This option specifies name of the second pseudouser. Default: (none)

prefix

This option specifies colon-separated list of prefixes allowed for build chroot. It affects all hasher-privd(8) modes which accept chroot parameter. Hardcoded default: (none)

System default: ~:/tmp/.private

allowed_devices

This option specifies a comma-separated list of devices which are allowed to be specified to “hasher-priv chrootuid1” and “hasher-priv chrootuid2” commands using requested_mountpoints environment variable. Default: (none)

allowed_mountpoints

This option specifies a comma-separated list of mount points which are allowed to be specified to “hasher-priv chrootuid1” and “hasher-priv chrootuid2” commands using requested_mountpoints environment variable. Default: (none)

## FILES
/etc/hasher-priv/daemon.conf

service daemon configuration file

/etc/hasher-priv/system

systemwide hasher-priv configuration file

/etc/hasher-priv/user.d/USER

per-user hasher-priv configuration files

/etc/hasher-priv/user.d/USER:NUMBER

per-user per-number subconfig files

## AUTHOR
Written by Dmitry V. Levin <ldv@altlinux.org>

## REPORTING BUGS
Report bugs to http://bugzilla.altlinux.org/

## COPYRIGHT
Copyright © 2003-2022 Dmitry V. Levin <ldv@altlinux.org>

Copyright © 2019 Alexey Gladkov <legion@altlinux.org>

Copyright © 2022 Arseny Maslennikov <arseny@altlinux.org>

Copyright © 2022 Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>

All rights reserved.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO
hsh(1), hasher(7), hasher-priv(8), hasher-privd(8).


filetypes.conf

package: highlight

title: filetypes.conf(5)

text:
# filetypes.conf(5)

## NAME
filetypes.conf - the file type configuration of highlight

## DESCRIPTION
This config file contains filename extensions and shebang patterns which are mapped to highlight's syntax definitions.

If there is only one extension, just name the lang file accordingly and it will work (no entry needed in this file).

The filetype entries in gui_files/ext/fileopenfilter.conf should also be updated.

Extensions can be configured for multiple languages (see "asm", which is assigned to assembler and fasm).

The command line (CLI) and Qt GUI builds handle ambiguous assignments as follows:

- CLI: the first association listed here will be used

- GUI: a syntax selection prompt will be shown

If a filename has no extension by convention (ie. makefile), it may be added here nevertheless or be configured as "Shebang".

Location: The first filetypes.conf found in a highlight search directory wins.

It's easily possible to enhance highlight's database of programming languages and colour themes. See the README file for details.

## EXTENSION MAPPING EXAMPLE
{ Lang='purebasic', Extensions={'pb', 'pbi'} }

## SHEBANG MAPPING EXAMPLE
{ Lang='xml', Shebang=[[^\s*<\?xml\s+version='1.0'*?>\s*$]] }

## AUTHORS
Andre Simon <as@andre-simon.de>

## SEE ALSO
highlight(1) man page


hl

package: hl

title: hl(5)

text:
# hl(5)

## NAME
hl - Default configuration file for hl

## DESCRIPTION
/etc/default/hl is the default configuration file for the hl command.

Since version 1.57, the default configuration for hl is /etc/default/hl . This configuration file is common to all users.

But each user can define his own configurations in his own $HOME/.hl.cfg configuration file. Users' configurations have the precedence over default configurations. Their recognized syntax is :

- comment lines (beginning with a '#'),

- configuration definition (a name, eventually followed by spaces or tabs, and a ':'),

- configuration options for this configuration (a tab, followed by the options)

- an empty line acts as a separator between configurations

The format consists in a list of configuration definitions, each configuration consisting in :

- the configuration name at the beginning of the line, followed by a column

- a list of hl options with their optional argument.

A regular expression following a color option specifier MUST BE ENCLOSED IN SINGLE QUOTES.

Comments are allowed and begin with a '#' sign.

## EXAMPLE
Example 1 :

hl -ei -c '([0-9a-f]{2}:){5}[0-9a-f]{2}' This command colorizes a MAC address in cyan.

## FILES
Since version 1.57, the default configuration for hl is /etc/default/hl . This configuration file is common to all users.

But each user can define his own configurations in his own $HOME/.hl.cfg configuration file. Users' configurations have the precedence over default configurations. Their recognized syntax is :

- comment lines (beginning with a '#'),

- configuration definition (a name, eventually followed by spaces or tabs, and a ':'),

- configuration options for this configuration (a tab, followed by the options)

- an empty line acts as a separator between configurations

Example :

```
#
# Example of default configuration file
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cal            :

     -e

     -g  '[1-9][0-9][0-9][0-9]'

     -y  'January|February|March|April|May|June|July|August|September|October|November|December'

     -c  'Su|Mo|Tu|We|Th|Fr|Sa'

     -b  '[0-9]'
#    Red       : 95% => 100%
#    Yellow    : 80% =>  94%
#    Cyan      :  0% =>  49%
#    Green     : 50% =>  79% (everything else)
df             :

     -e

     -r  '<((100|9[5-9])%.*)'

     -y  '<((8[0-9]|9[0-4])%.*)'

     -c  '<[0-4][0-9]?%.*'

     -g  '<[0-9]+%.*'

     -b  '^Filesystem.*'
diff           :

     -e

     -y  '^<.*'

     -g  '^>.*'

     -c  '^([0-9]+(,[0-9]+)?[a-z][0-9]+(,[0-9]+)?)'
fdisk          :

     -e

     -b  'Device Boot.*'

     -3w 'Disk.*(/dev/sd.)'

     -2

     -c  '.*/dev/sda.*'

     -%c 'Disk /dev/sda'

     -.  '^$'

     -g  '.*/dev/sdb.*'

     -%g 'Disk /dev/sdb'

     -.  '^$'

     -y  '.*/dev/sdc.*'

     -%y 'Disk /dev/sdc'

     -.  '^$'

     -m  '.*/dev/sdd.*'

     -%m 'Disk /dev/sdd'

     -.  '^$'

     -b  '.*Device.*'

     -1G '.*/dev/sde.*'
free           :

     -e

     -2

     -R  'used'

     -G  'free'

     -b  'total.*'

     -1C 'Swap|Mem'

     -3r '^Swap: +[0-9]+ +([0-9]+)'

     -3g '^Swap: +[0-9]+ +[0-9]+ +([0-9]+)'

     -3m '^Mem: +[0-9]+ +([0-9]+)'

     -1g '^Mem: +[0-9]+ +[0-9]+ +([0-9]+)'

     -2B '^Mem: +([0-9]+)'

     -2B '^Swap: +([0-9]+)'
ifconfig       :

     -ei

     -3G 'inet addr:([0-9]{1,3}(.[0-9]{1,3}){3})'

     -2

     -m  '^((eth|(vir)?br|vnet)[0-9.]*:[0-9]+)>'

     -b  '^((eth|(vir)?br|vnet)[0-9.]*.[0-9]+)>'

     -c  '(([0-9a-f]{2}:){5}[0-9a-f]{2})'

     -3g '<(UP>|<RUNNING)>'

     -2g '(([0-9]{1,3}.){3}[0-9]{1,3}>)'

     -2y '(^(eth|(vir)?br|vnet)[0-9.:]*)>'

     -3m '[0-9a-f]{4}::[0-9a-f]{4}[0-9a-f]{4}:[0-9a-f]{4}:[0-9a-f]{4}'

     -2r ' ((errors|dropped|overruns):[^0][0-9]*)'
iostat  :

     -e

     -b  '^((Device|avg-cpu):.*)'
#    -g  '^(sda.*)'
#    -y  '^(sdb.*)'

     -c  ' (0.(0[1-9]|[1-9][0-9]))'

     -3c ' ([1-9][.0-9]*)'
IP             :

     --validate_IP
ip             :

     -e

     -3g '<((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))>'
iptables       :

     -e

     -G  'policy (ACCEPT)'

     -R  'policy (DROP|REJECT)'

     -3Y '<(INPUT|OUTPUT|FORWARD|POSTROUTING)>'

     -3y '<(fail2ban[-a-z]+)>'

     -2w '^Chain .+'

     -2

     -b  '#.*'

     -2b '^target>.*'

     -g  '.*ACCEPT.*'

     -r  '(.*(DROP|REJECT).*)'

     -m  'iptables.*-F.*'

     -w  '^iptables .*'
jigdo          :

     -e

     -2b 'DVD_jigdo.list'

     -2m '[^ ]*.tmp$'

     -3b '[^ ]*.tmpdir$'

     -3g '[^ ]*.iso$'

     -2y '[^ ]*.jigdo$'
ls_doc         :

     -e
	-r  '^-rw........*'

     -g  '^-r-........*'

     -m  '^d..........*.*'

     -y  '.*:$'
MAC            :

     -ei

     -3B '(([0-9a-f]{2}:){5}[0-9a-f]{2})'
man            :

     -e

     -2G '^([A-Z][A-Z0-9]*-8]) +.* +([A-Z][A-Z0-9]*-8])$'

     -2B '^[A-Z][A-Z ]*'

     -3y '^[ 	]+-[a-zA-Z0-9][ 	]'

     -R  '(red).*reverse video'

     -G  '(green).*reverse video'

     -Y  '(yellow).*reverse video'

     -B  '(blue).*reverse video'

     -M  '(magenta).*reverse video'

     -C  '(cyan).*reverse video'

     -W  '(white).*reverse video'

     -r  'red'

     -g  'green'

     -y  'yellow'

     -b  'blue'

     -m  'magenta'

     -c  'cyan'

     -w  'white'

     -3b '(Example .*):'
namei          :

     -e

     -3c '.* -> .*'

     -2b '^ *d .*'

     -3g '^ *- .*'

     -y  '^f: .*'

     -r  '^( *? .*|.* No such file or directory.*)'
netstat        :

     -ei

     -g  'ESTABLISHED'

     -1y 'LISTEN'

     -m  'TIME_WAIT'

     -g  '<((192.168.[0-9]{1,3}.[0-9]{1,3}))>'

     -b  '<((127.[01].[01].[01])|(0.0.0.0))>'

     -r  '<(([0-9]{1,3}.){3}[0-9]{1,3})>'
passwd         :

     -e

     -c  '^[^:]+'

     -m  '^[^:]+:([^:]+):'

     -y  '^[^:]+:[^:]+:([^:]+:[^:]+):'

     -c  '^([^:]*:){4}([^:]+)'

     -g  '^([^:]*:){5}([^:]+)'

     -y  '^([^:]*:){6}([^:]+)'
passwd_chk     :

     -e

     -G  '^([^:]+):.*(/bin/false)$'

     -R  '^([^:]+).*:(/bin/bash)$'

     --passwd
percent        :

     -e

     -r  '<(100|9[5-9])%'

     -y  '<(8[0-9]|9[0-4])%'

     -g  '<[0-9]+%'
ps_cpu         :

     -e

     -r  '((0[1-9]|[1-9][0-9]):[0-9]{2}:[0-9]{2} .*)'

     -y  '(00:(0[1-9]|[1-9][0-9]):[0-9]{2} .*)'

     -g  '00:00:[1-9][0-9] .*'

     -c  '00:00:0[1-9] .*'

     -b  '00:00:00 .*'
ps_cpu_time     :

     -e

     -3

     -r  '((0[1-9]|[1-9][0-9])(:[0-9]{2}){2} .*)'

     -y  '(00:(0[1-9]|[1-9][0-9]):[0-9]{2} .*)'

     -c  '(00:00:[1-9][0-9] .*)'
# Alias for ps_cpu_time :
ps              :

     --ps_cpu_time
rev_color_names :

     -R  'red'

     -G  'green'

     -Y  'yellow'

     -B  'blue'

     -M  'magenta'

     -C  'cyan'

     -W  'white'
samba          :

     -e

     -b  '=|^[ 	]*[;#].*'

     -g  '.*='

     -y  '=.*'

     -m  '[][]'

     -c  '
sep3           :

     -e

     -3r '([0-9]+)[0-9]{18}([ 	]|$)'

     -3m '([0-9]+)[0-9]{15}([ 	]|$)'

     -2c '([0-9]+)[0-9]{12}([ 	]|$)'

     -3y '([0-9]+)[0-9]{9}([ 	]|$)'

     -3g '([0-9]+)[0-9]{6}([ 	]|$)'

     -3c '([0-9]+)[0-9]{3}([ 	]|$)'

     -3b '[0-9]+([0-9]{3})([ 	]|$)'
services       :

     -e

     -g  '^ *+ ] .*' -m '^ *- ] .*' -r '^ * ] .*'
sh        :

     -e

     -b  '^#.*'

     -m  '(-zA-Z_][a-zA-Z_0-9]*|[0-9]|[*@#]))'

     -y  '"[^"]*"'

     -g  '^(([a-zA-Z_][a-zA-Z_0-9]*)|[{}])'

     -3c '(<(echo|for|do|done|while|shift|eval|set)>)'

     -2

     -%g '<do>'

     -.  '<done>'
show_disks     :

     -e

     -g  ' 2[0-9]°C |Hitachi [^ ]*| 2000..*GB,|krypton|/dev/sd'

     -y  ' 3[0-9]°C |/dev/hd'

     -r  'WDC [^ ]*|/dev/sdc'

     -b  'TOSHIBA [^ ]*|--+'

     -m  ' 500..*GB,|/dev/sdd'

     -c  'antares|styx|/dev/sda'
tcpdump        :

     -e

     -u

     -3

     -g  '^[^ ]+[ ]+[^ ]+[ ]+([^ ]+).'

     -r  '^[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+([^ ]+).'

     -2

     -y  '^[^ ]+[ ]+[^ ]+[ ]+[^ ]+.([^ .]+)'

     -y  '^[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+[ ]+[^ ]+.([^ :]+)'
validate_IP    :

     -e

     -g  '<((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))>'

     -r  '(([0-9]{1,3}.){3}[0-9]{1,3})'
virsh_list     :

     -e

     -c  '^ *Id.*|^--*'

     -3

     -g  '.*running*'

     -2

     -m  '.*shut off'

     -y  '.*paused'
w              :

     -e

     -b  '.*load average.*|^USER.*'

     -r  '^root .*'

     -c  ' /bin/bash'

     -y  ' /usr/bin/python'

     -g  '.+'
xxd            :

     -e

     -r  '(<0a)|(0a>)'

     -b  '^[^:]+'

     -g  '.{16}$'

     -c  '[[:xdigit:]]'
zabbix_netstat  :

     -e

     -2c '<(94.247.232.55|192.168.168.[23]|0.0.0.0)>:10050>'

     -3r '<([0-9]{1,3}(.[0-9]{1,3}){3}):10050>'

     -3g '<(10050)>.* ([^ ]+) *$'
hi_red         :

     -e

     -3

     -r  '.+'
hi_green       :

     -e

     -3

     -g  '.+'
hi_yellow      :

     -e

     -3

     -y  '.+'
hi_blue        :

     -e

     -3

     -b  '.+'
hi_magenta     :

     -e

     -3

     -m  '.+'
hi_cyan        :

     -e

     -3

     -c  '.+'
hi_white       :

     -e

     -3

     -w  '.+'
dim_red        :

     -e

     -1

     -r  '.+'
dim_green      :

     -e

     -1

     -g  '.+'
dim_yellow     :

     -e

     -1

     -y  '.+'
dim_blue       :

     -e

     -1

     -b  '.+'
dim_magenta    :

     -e

     -1

     -m  '.+'
dim_cyan       :

     -e

     -1

     -c  '.+'
dim_white      :

     -e

     -1

     -w  '.+'
red            :

     -e

     -2

     -r  '.+'
green          :

     -e

     -2

     -g  '.+'
yellow         :

     -e

     -2

     -y  '.+'
blue           :

     -e

     -2

     -b  '.+'
magenta        :

     -e

     -2

     -m  '.+'
cyan           :

     -e

     -2

     -c  '.+'
white          :

     -e

     -2

     -w  '.+'

```

## MAN PAGE VERSION
The version of this man page is 1.9. It is compatible with hl version 1.57 and upper.

## AUTHOR
The original version of this manual page was written by Martial Bornet <mbornet (.) pro (at) wanadoo (.) fr> for the GNU/Linux system.

The author also can be contacted with <man (.) flashnux (at) gmail (.) com>.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU GPL.


title: html2psrc(5)

text:
# html2psrc(5)

## NAME
html2psrc - configuration file format for html2ps(1)

## DESCRIPTION
Configuration files are used for layout control, resource information etc. Normally, there should always exist a global configuration file. In this file one typically specify things like: what image conversion packages are available on the system, the default paper size, the default text fonts and sizes, etc.

For Unix and Windows systems, the installation script 'install' can be used to automatically build a global configuration file with all necessary definitions, and install all files. The files replaced by the installation are saved. If you for some reason are not satisfied with the new version: execute the script 'backout' to reinstall your earlier version.

On other systems, you will have to manually create a global configuration file, and insert the name of this file into the html2ps script (close to the beginning, the line starting with "$globrc="). The configuration file should contain a package block, and perhaps paper and hyphenation blocks, described below.

Each user can then have a personal configuration file (by default $HOME/.html2psrc) that complements/overrides the definitions made in the global file. It is also possible to specify alternative files on the command line, using the -f option.

## FILE FORMAT
A configuration file can include other configuration files. This is done with:

@import "filename";

The rest of the configuration file consists of zero or more blocks. A block is given by a block name, followed by the block definition, as in:

BODY {

font-size: 12pt;

font-family: Helvetica;

text-align: justify

}

The block definition, enclosed by curly braces: { }, consists of key-value pairs and/or other blocks. A key-value pair consists of the key name followed by a colon, followed by the value. Blocks and key-value pairs are separated by semicolons. The semicolon may be omitted after a block.

Several blocks can share the same definition. The block names are then separated be commas, as in:

H2, H4, H6 { font-style: italic }

A comment in a configuration file starts with the characters "/*" and ends with "*/":

@html2ps {

seq-number: 1; /* Automatic numbering of headings */

}

Notations

Here are some definitions of terms used below:

Flag:

A value of either 0 (absence, inactive etc) or 1 (presence, active etc).

Absolute size:

A real number optionally followed by one of the following two-letter unit identifiers: cm (centimeters), mm (millimeters), in (inches), pt (points, 1pt = 1/72 inch), pc (picas, 1pc = 12pt). The default unit is centimeters.

Relative size:

A size relative to current fontsize. The default and currently only recognized unit is em. One em equals the size of the current font. The value should be given as a real number, optionally followed by 'em', as in '0.25em'.

Whitespace:

Any one of the characters: space, tab, newline, or carriage return.

CSS2 blocks

All blocks, except one: the @html2ps block, coincides with a subset of the Cascading Style Sheets, level 2 CSS2 Specification (http://www.w3.org/TR/REC-CSS2/). The following default settings for html2ps illustrate just about everything that currently can be used from the CSS2 specification:

BODY {

font-family: Times;

font-size: 11pt;

text-align: left;

background: white;

}

H1, H2, H3, H4, H5, H6 {

font-weight: bold;

margin-top: 0.8em;

margin-bottom: 0.5em;

}

H1 { font-size: 19pt }

H2 { font-size: 17pt }

H3 { font-size: 15pt }

H4 { font-size: 13pt }

H5 { font-size: 12pt }

H6 { font-size: 11pt }

P, OL, UL, DL, BLOCKQUOTE, PRE {

margin-top: 1em;

margin-bottom: 1em;

}

P {

line-height: 1.2em;

text-indent: 0;

}

OL, UL, DD { margin-left: 2em }

TT, KBD, PRE { font-family: Courier }

PRE { font-size: 9pt }

BLOCKQUOTE {

margin-left: 1em;

margin-right: 1em;

}

ADDRESS {

margin-top: 0.5em;

margin-bottom: 0.5em;

}

TABLE {

margin-top: 1.3em;

margin-bottom: 1em;

}

DIV.noprint { display: none }

DEL { text-decoration: line-through }

A:link, HR { color: black }

@page {

margin-left: 2.5cm;

margin-right: 2.5cm;

margin-top: 3cm;

margin-bottom: 3cm;

}

The program specific block @html2ps:

This block is used to specify parameters that are specific to html2ps, and not covered by CSS2. The @html2ps block has several sub-blocks and key-value pairs, these are described in this section.

The package block

This block is used to specify which program packages are installed on the system. Typically, this is done in the global configuration file. PerlMagick

A flag specifying whether the Perl module PerlMagick is installed or not. The default is 0.

ImageMagick

A flag specifying whether the ImageMagick package is installed or not. The default is 0.

pbmplus

A flag specifying whether the pbmplus package is installed or not. The default is 0.

netpbm

A flag specifying whether the netpbm package is installed or not. The default is 0.

djpeg

A flag specifying whether djpeg is installed or not. The default is 0.

Ghostscript

A flag specifying whether Ghostscript is installed or not. The default is 0.

TeX

A flag specifying whether the TeX package is installed or not. The default is 0.

dvips

A flag specifying whether dvips is installed or not. The default is 0.

libwww-perl

A flag specifying whether the Perl module library libwww-perl is installed or not. The default is 0.

geturl

When neither of the Perl packages for retrieving remote documents are available, it is possible to use some other program like wget or lynx. This value should be set to a command that retrieves a document with a complete MIME header, such as "wget -s -q -O-" or "lynx -source -mime_header".

check

The name of a program used for syntax checking HTML documents. No default, a good choice is weblint.

path

A colon separated list of directories where the executables from the program packages are. It is only necessary to include directories that are not in the PATH for a typical user.

The paper block

The paper size is defined in this block. The size can either be given as one of the recognized paper types or by giving explicit values for the paper height and width. As of version 1.0 beta2, one can also use the @page block in CSS2 for the paper size. The paper block is kept for backwards compatibility. Also, one can only specify explicit dimensions in @page, not any paper types by name. type

Paper type, possible choices are: A0, A1, A2, A3, A4,...,A10, B0, B1,...,B10, letter, legal, arche, archd, archc, archb, archa, flsa, flse, halfletter, 11x17, and ledger (this set of paper types is taken from Aladdin Ghostscript). The default is A4.

height

An absolute size specifying the paper height.

width

An absolute size specifying the paper width.

The option block

This block is used to set default values for the command line options. The key in the key-value pair is the option name, in either its long or short form. twoup

Two column (2-up) output. The default is one column per page.

base

Use URL as a base to expand relative references for in-line images. This is useful if you have downloaded a document to a local file. The URL should then be the URL of the original document.

check

Check the syntax of the HTML file (using an external syntax checker). The default is to not make a syntax check.

toc

Generate a table of contents (ToC). The value should be a string consisting of one of the letters 'f', 'h', or 't', optionally combined with the letter 'b':

b

The ToC will be printed first. This requires that Ghostscript is installed.

f

The ToC will be generated from the links in the converted document.

h

The ToC will be generated from headings and titles in the converted documents. Note that if the document author for some strange reason has chosen to use some other means to represent the headings than the HTML elements H1,...,H6, you are out of luck!

t

The ToC will be generated from links having the attribute rev=TOC in the converted document.

debug

Generate debugging information. You should always use this option when reporting problems with html2ps.

DSC

Generate DSC compliant PostScript. This requires Ghostscript and can take quite some time to do. Note that a PostScript file generated with this option cannot be used as input to html2ps for reformatting later.

encoding

The document encoding. Currently recognized values are ISO-8859-1, EUC-JP, SHIFT-JIS, and ISO-2022-JP (other EUC-xx encodings may also work). The default is ISO-8859-1.

rcfile

A colon separated list of configuration file names to use instead of the default personal configuration file $HOME/.html2psrc. Definitions made in one file override definitions in previous files (the last file in the list has highest precedence). An empty file name (as in ':file', 'file1::file3', or 'file:') will expand to the default personal file. The environment variable HTML2PSPATH is used to specify the directories where to search for these files. (Note: this is only supposed to be used on the command line, not in a configuration file.)

frame

Draw a frame around the text on each page. The default is to not draw a frame.

grayscale

Convert colour images to grayscale images. Note that the PostScript file will be smaller when the images are converted to grayscale. The default is to generate colour images.

help

Show usage information.

hyphenate

Hyphenate the text. This requires TeX hyphenation pattern files.

scaleimage

Scale in-line images with a factor num. The default is 1.

cookie

Enable cookie support, using a netscape formatted cookie file (requires libwww-perl).

language

Specifies the language of the document (overrides an eventual LANG attribute of the BODY element). The language should be given according to RFC1766 (ftp://ftp.nordu.net/rfc/rfc1766.txt) and ISO 639 (http://www.w3.org/WAI/ER/IG/ert/iso639.htm).

landscape

Generate code for printing in landscape mode. The default is portrait mode.

scalemath

Scale mathematical formulas with a factor num. The default is 1.

mainchapter

Specifies the start number for automatic numbering of headings (by setting the seq-number parameter), the default is 1.

number

Insert page numbers. The default is to not number the pages.

startno

Specifies the starting page number, the default is 1.

output

Write the PostScript code to file. The default is to write to standard output.

original

Use PostScript original images if they exist. For example, if a document contains an image figure.gif, and an encapsulated PostScript file named figure.ps exists in the same directory, that file will be use instead. This only work for documents read as local files. Note: if the PostScript file is large or contains bitmap images, this must be combined with the -D option. In HTML 4.0 this can be achieved in a much better way with:

<OBJECT data="figure.ps" type="application/postscript">

<OBJECT data="figure.gif" type="image/gif">

[Maybe some ASCII art for text browsers]

</OBJECT>

</OBJECT>

rootdir

When a document is read from a local file, this value specifies a base directory for resolving relative links starting with "/". Typically, this should be the directory where your web server's home page resides.

xref

Insert cross references at every link to within the set of converted documents.

scaledoc

Scale the entire document with a factor num. The default is 1.

style

This option complements/overrides definitions made in the configuration files. The string must follow the configuration file syntax. (Note: this is only supposed to be used on the command line, not in a configuration file.)

titlepage

Generate a title page. The default is to not generate one.

text

Text mode, ignore images. The default is to include the images.

underline

Underline text that constitutes a hypertext link. The default is to not underline.

colour

Produce colour output for text and background, when specified. The default is black text on white background (mnemonic: coloUr ;-).

version

Print information about the current version of html2ps.

web

Process a web of documents by recursively retrieve and convert documents that are referenced with hyperlinks. When dealing with remote documents it will of course be necessary to impose restrictions, to avoid downloading the entire web... The value should be a string consisting of one of the letters 'a', 'b', 'l', 'r', or 's', optionally combined with a combination of the letters 'p', 'L', and a positive integer:

a

Follow all links.

b

Follow only links to within the same directory, or below, as the start document.

l

Follow only links specified with "<LINK rel=NEXT>" in the document.

p

Prompt for each remote document. This mode will automatically be entered after the first 50 documents.

r

Follow only relative links.

s

Follow only links to within the same server as the start document.

L

With this option, the order in which the documents are processed will be: first all top level documents, then the documents linked to from these etc. For example, if the document A has links to B and C, and B has a link to D, the order will be A-B-C-D. By default, each document will be followed by the first document it links to etc; so the default order for the example is A-B-D-C.

\#

A positive integer giving the number of recursive levels. The default is 4 (when the option is present).

duplex

Generate postscript code for single or double sided printing. No default, valid values are:

0

Single sided.

1

Double sided.

2

Double sided, opposite page reversed (tumble mode).

The margin block

This block is used to specify page margins. The left, right, top and bottom margins, previously defined with this block, should now be defined using the @page construction from CSS2. middle

An absolute size for the distance between the columns when printing two columns per page, default is 2cm.

The xref block

At every hyperlink (to within the set of converted documents) it is possible to have a cross reference inserted. The xref block is used to control this function. text

This defines the cross reference text to be inserted; the symbol $N will expand to the page number, default is "[p $N]".

passes

The number of passes used to insert the cross references. Normally, only one pass is run. But since the insertion of the page numbers may effect the page breaks, it might for large documents with many links be necessary with more than one pass to get the cross references right. The default is 1.

The quote block

Language specific quotation marks are defined in this block. These quotation marks are used with the HTML 4.01 element Q for short quotations. Quotation marks are predefined for a few languages (English, Swedish, Danish, Norwegian (also Nynorsk and Bokmål), Finnish, Spanish, French, German and Italian). It is possible to define different quotation marks for quotes within quotes. A quotation mark is defined as a string, using the same encoding as the converted document (normally ISO-8859-1), and/or with character entities. Note that quotation mark characters for several languages are not included in ISO-8859-1, and their corresponding character entities were not been defined prior to HTML 4.0.

Quotation marks for a language can be defined explicitly in a sub-block of the quote block. One can also identify the set of quotation marks with another previously defined language, using a key-value pair. The sub-block/key name should equal the language code as defined in ISO 639. The language sub-block can have the following key-values:

open

The quote opening character(s).

close

The quote closing character(s). If undefined, it will equal open.

open2

The quote opening character(s) for quotes within quotes. If undefined, it will equal open.

close2

The quote closing character(s) for quotes within quotes. If undefined, it will equal close.

Example: English and Spanish use the same set of quotation marks - at least according to my book on typography. These (already known to html2ps) are defined with:

quote {

en {

open: "“";

close: "”";

open2: "`";

close2: "'";

}

es: en;

}

The toc block

When a table of contents (ToC) is generated from document headings and titles, the appearance is controlled by this block. heading

A string with HTML code specifying a heading used on the first ToC page.

level

The maximum heading level used for building the ToC. The default is 6, which means that all headings will generate ToC entries.

indent

The ToC entries are indented proportional to the corresponding heading level. This value specifies the size of the indentation. The default is 1em.

The titlepage block

When a title page is generated, its appearance is controlled by this block. content

A string with HTML code specifying a heading used on the title page, The default is "

<BIG>$T</BIG>

$[author]

".

margin-top

The size of the top margin on the title page, The default is 4cm.

The font block

Currently, html2ps recognizes the fonts: Times, New-Century-Schoolbook, Helvetica, Helvetica-Narrow, Palatino, Avantgarde, Bookman, and Courier. To add a new font (family), choose a name (consisting of letters, digits, hyphens, and underscores) for the font. Then define a sub-block to the font block, with the same name as the chosen font name. This block can contain two key-value pairs:

names

A string containing four PostScript font names, separated by whitespace, corresponding to the font styles normal, italic, bold, and bold-italic. If less than four names are given, the first is used for the missing names. Note that PostScript font names are case sensitive.

files

A string of four file names, separated by whitespace, for files containing font definitions for the four font styles as specified above.

Example: A font 'myfont' has its four font styles defined in local files. To use this font in all tables in the converted documents, one can use something like:

TABLE { font-family: myfont }

@html2ps {

font {

myfont {

names: "MyFont-Roman MyFont-Italic MyFont-Bold MyFont-BoldItalic";

files: "/x/y/myfr.pfa /x/y/myfi.pfa /x/y/myfb.pfa /x/y/myfbi.pfa";

}

}

}

The hyphenation block

Hyphenation pattern files for different languages are specified in sub-blocks within this block. The blocks names should equal the language code as defined in ISO 639. These language blocks can contain the following two key-values:

file

A hyphenation pattern file in TeX format for this language.

extfile

A file containing a list of hyphenation exceptions for this language. The exception file should contain words, separated by whitespaces, with hyphens inserted where hyphenation is allowed, as in: "in-fra-struc-ture white-space".

For example, for English (with language code 'en') one can have a block like:

en {

file: "/opt/tex/lib/macros/hyphen.tex";

extfile: "/opt/tdb/lib/html2ps/enhyphext";

}

The hyphenation block itself can furthermore have these key-values:

min

A positive integer defining the minimum number of letters a word must contain to make it a candidate for hyphenation. The default is 8.

start

A positive integer defining the minimum number of letters that must precede the hyphen when a word is hyphenated. The default is 4.

end

A positive integer defining the minimum number of letters that must follow the hyphen when a word is hyphenated. The default is 3.

The header block

This block is used to specify page headers. It is possible to define left, center, and right headers. Different headers for odd and even pages can be specified. Some symbols can be used that will expand to document title, author, date etc. See below. left

A left aligned header. If the alternate flag in this block is set to 1, this will be the right header on even pages.

center

A centered header.

right

A right aligned header. If the alternate flag in this block is set to 1, this will be the left header on even pages.

odd-left

A left aligned header on odd pages.

odd-center

A centered header on odd pages.

odd-right

A right aligned header on odd pages.

even-left

A left aligned header on even pages.

even-center

A centered header on even pages.

even-right

A right aligned header on even pages.

font-family

The font used for the header, default is Helvetica.

font-size

The font size for the header, default is 8pt.

font-style

The default is "normal".

font-weight

The default is "normal".

color

The header color, default is black.

alternate

A flag indicating whether the headers given by the left and right keys should change place on even pages. Typically used for double sided printing. The default is 1.

The footer block

This block is used to specify page footers. It is possible to define left, center, and right footers. Different footers for odd and even pages can be specified. Some symbols can be used that will expand to document title, author, date etc. See below. left

A left aligned footer. If the alternate flag in this block is set to 1, this will be the right footer on even pages.

center

A centered footer.

right

A right aligned footer. If the alternate flag in this block is set to 1, this will be the left footer on even pages.

odd-left

A left aligned footer on odd pages.

odd-center

A centered footer on odd pages.

odd-right

A right aligned footer on odd pages.

even-left

A left aligned footer on even pages.

even-center

A centered footer on even pages.

even-right

A right aligned footer on even pages.

font-family

The font used for the footer, default is Helvetica.

font-size

The font size for the footer, default is 8pt.

font-style

The default is "normal".

font-weight

The default is "normal".

color

The footer color, default is black.

alternate

A flag indicating whether the footers given by the left and right keys should change place on even pages. Typically used for double sided printing. The default is 1.

The frame block

The appearance of the optional frame (drawn on each page) is controlled by this block. width

The width of the frame, default is 0.6pt.

margin

The size of the frame margin, default is 0.5cm.

color

The colour of the frame, default is black.

The justify block

This block specifies the maximum amount of extra space inserted between words and letters when text justification is in effect. word

Maximum amount of extra space inserted between words. The default is 15pt.

letter

Maximum amount of extra space inserted between letters within words. The default is 0pt.

The draft block

It is possible to have some text written in a large font diagonally across each page. Typically this is a word, written in a very light colour, indicating that the document is a draft. text

The text to be printed, default is "DRAFT".

print

A flag specifying whether the draft text should be printed or not. If unspecified, the draft text is printed when the document head contains <META name="Status" content="Draft">.

dir

Specifies print direction, 0=downwards, 1=upwards.

font-family

The default is Helvetica.

font-style

The default is "normal".

font-weight

The default is "bold".

color

The default is "F0F0F0".

The colour block

The 16 standard colour names from HTML 4.01 (although their use in HTML elements are now deprecated) are recognized by html2ps. Use this block to extend this list of colours. This is done with key-value pairs, where the key is the colour name, and the value is the colour given as a hexadecimal RGB value, for example: "brown: A52A2A;".

Key-value pairs in the @html2ps block html2psrc

The name of the default personal configuration file. The default is $HOME/.html2psrc.

imgalt

Specifies which text should be written as a replacement for in-line images when the IMG element has no ALT attribute. The default is "[IMAGE]".

datefmt

The symbol $D can be used in page headers and footers to insert the current date/time; the value of the datefmt key specifies the format used. The syntax is the same as in the strftime(3) routine. The default is "%e %b %Y %R", which gives a date string like " 7 May 2010 13:22".

locale

The locale (language code) used for formating language dependent parts of the date/time in datefmt. If unspecified, the value is taken from environment variables, see setlocale(3). No default.

doc-sep

A string of HTML code that will be inserted between the documents when more than one are converted. The default is "", which will cause a page break. You may use (almost) any HTML code, for example "

" or "".

ball-radius

The radius, given as a relative size, of the balls used in unordered lists. The default is 0.25em.

numbstyle

Page numbering style, 0=arabic, 1=roman. The default is 0.

showurl

When this flag is set to 1, the URL for external links are shown within parentheses after the link. The default is 0.

seq-number

When this flag is set, the headings in the document will be sequentially numbered: H1 headings will be numbered 1, 2,..., H2 headings 1.1, 1.2, etc. The starting number for H1 can be changed using the -M (--mainchapter) option. The default is 0.

extrapage

A flag specifying whether an extra (empty) page should be printed, when necessary, to ensure that the title page, the table of contents, and the document itself will start on odd pages. This is typically desirable for double sided printing. The default is 1.

break-table

A flag specifying if a table should be broken across two pages when it does not fit on the current page, but it does on a page of its own. The default is 0 (avoid breaking tables when possible).

forms

This flag is used to specify whether FORM elements in the document should be processed or ignored. Some forms may be suitable for printing out and be filled out (with a pen), others are not. The default is 1.

textarea-data

When a TEXTAREA element contains prefilled data, the text will be used as labels if this flag is set, otherwise ignored. The default is 0.

page-break

Set this flag to 0 to suppress the normal behavior of generating page breaks from the comment  etc, as specified below. The default is 1.

expand-acronyms

A flag specifying whether acronyms, given by the ACRONYM element, should be expanded or not. The default is 0.

spoof

Some web servers return different documents depending on which user agent is used to retrieve the document. You can fool the web server that a certain browser is used, by setting this value to the identification used by the browser, such as "Mozilla/4.0". This only works if you are using one of the Perl packages to retrieve remote documents.

ssi

When this flag is set, some Server Side Includes will be processed when the document is read from a local file. Examples are


title: html2textrc(5)

text:
# html2textrc(5)

## NAME
html2textrc - formatting properties file for html2text(1)

## SYNOPSIS
Key [ = | : ] Value

## DESCRIPTION
The html2textrc(5) file defines a set of formatting properties used by the html2text(1) utility, that overrides the program's built-in formatting defaults. Each line of the html2textrc(5) file is either a formatting property or a comment.

Lines with a leading "#" or "!" (i.e. the first non-space character is a "#" or a "!") and blank lines (i.e. a line consisting only of white-space characters), are considered comments and ignored. Everything else is literary interpreted by the parser as a formatting property, where a string-type property value may also be empty (unsets default value). Both, the property key and the property value, may contain C-style escape sequences to mask meta characters.

A property definition line consists of:

(1)

Optional leading space,

(2)

the property key (a sequence of non-space characters except "=" and ":") as described below,

(3)

an optional space,

(4)

an optional "=" or ":",

(5)

optional space,

(6)

the property value as described below.

Everything up to the next newline is interpreted literary as the value of the specified element. Literary meant leading white-space must be quoted with backslashes (i.e. "\ "). Be aware not to include unwanted trailing white-space characters.

## OPTIONS
The following is the list of valid formatting properties, together with their default values. If the -style command line option of html2text(1) is used, different default values apply.

Curly braces indicate alternatives, e.g. {A B}C stands for AC or BC.

DOCUMENT.{vspace.{before after} indent.{left right}} = 0

Specifies how many blank lines are inserted before and after, and how many blank columns are inserted to the left and to the right of the formatted document. (Numeric.)

BODY.{vspace.{before after} indent.{left right}} = 0

Same for the document body. (Since the document body is currently the only document part that is rendered, it is virtually the same whether you specifiy DOCUMENT or BODY). (Numeric.)

{OL UL DIR MENU DL}.vspace.{before between after} = 0

Specifies how many blank lines are inserted before a list, between the individual list items, and after the list. (Numeric.)

{OL UL DIR MENU}.indents = 6

Specifies by how deep list items are indented. If an item bullet would not fit into the space created by the indentation, then the indentation is automatically increased such that the bullet fits in (relevant for relatively wide bullets, e.g. roman numbers). If N blank-separated integers are specified instead of one, then the first N-1 integers specify indentation for the first N-1 list nesting levels, while the last integer specifies the indentation for nesting levels N and higher. (Numeric.)

{UL DIR}.default_types = DISC CIRCLE SQUARE

Specifies the default list type (i.e. the bullet style), if the HTML list tag does not specify an explicit type. Legal values are NO_BULLET, DISC, SQUARE, CIRCLE, CUSTOM1, CUSTOM2 and CUSTOM3. If more than one value is specified, then the values apply for the respective list nesting levels (see indents). (Option.)

MENU.default_types = NO_BULLET

Same for <MENU>, but here the default is NO_BULLET. (Option.)

LI.{disc square circle custom1 custom2 custom3}_bullet = {* # o + - ~}

Specifies the strings used as list item bullets. (String.)

{DT DD}.{vspace.{before after} indent.{left right}} = 0

Specifies how many blank lines are inserted before and after, and how many blank columns are inserted to the left and to the right of each <DT> or <DD> element. (Numeric.)

HR.marker = =

Specifies the character to use for horizontal rules. (String.)

HR.{vspace.{before after} indent.{left right}} = 0

Specifies how many blank lines are inserted before and after, and how many blank columns are inserted to the left and to the right of the horizontal rule. (Numeric.)

{H1 H2 H3 H4 H5 H6}.prefix = {****** ***** **** *** ** *}

Specifies how headings are decorated with a prefix. (The default values have a trailing blank, e.g. "****** ".) (String.)

{H1 H2 H3 H4 H5 H6}.suffix = {****** ***** **** *** ** *}

Specifies how headings are decorated with a suffix. (The default values have a leading blank, e.g. "\ ******".) (String.)

{H1 H2 H3 H4 H5 H6}.vspace.{before after} = 0

Specifies how many blank lines are inserted before and after headings. (Numeric.)

{PRE P}.{vspace.{before after} indent.{left right}} = 0

Specifies how many blank lines are inserted before and after, and how many blank columns are inserted to the left and to the right of these items. (Numeric.)

{BLOCKQUOTE ADDRESS}.{vspace.{before after} indent.{left right}} = {0 0 5 5}

Specifies how many blank lines are inserted before and after, and how many blank columns are inserted to the left and to the right of these items. (Numeric.)

TABLE.vspace.{before after} = 0

Specifies how many blank lines are inserted before and after tables. (Numeric.)

{H1 H2 H3 H4 H5 H6}.attributes = BOLD

Specifies the cell attributes for headings. The value is a sequence of NONE, BOLD, UNDERLINE and STRIKETHROUGH. (Option.)

{TT I BIG SMALL SUB SUP DFN CODE SAMP KBD CITE}.attributes = NONE

Specifies the cell attributes for these text items. Legal values are: NONE, BOLD, UNDERLINE or STRIKETHROUGH. (Option.)

U.attributes = UNDERLINE

Same for <U> elements, but with a different default value. (Option.)

{B EM STRONG}.attributes = BOLD

Same for these elements, but with a different default value. (Option.)

STRIKE.attributes = STRIKETHROUGH

Same for <STRIKE> elements, but with a different default value. (Option.)

A.attributes.{internal_link external_link} = UNDERLINE

Specifies the cell attributes for links. A link is an <A> elemet that has an "HREF" attribute. An internal link is a link who's "HREF" attribute starts with a hash character (e.g. "<A href="#42">"). Legal values are again NONE, BOLD, UNDERLINE and STRIKETHROUGH. (Option.)

IMG.replace.{all noalt} = unset

Specifies the string used to replace all <IMG> elements, or those without an "ALT" attribute set. (String.)

IMG.alt.{prefix suffix} = {[ ]}

Specifies how the values (if any) of IMG elements' "ALT" attributes are marked. (String.)

## AUTHOR
Current maintainer and primary download location for html2text is:

Martin Bayer <mbayer@zedat.fu-berlin.de>

http://userpage.fu-berlin.de/~mbayer/tools/

## SEE ALSO
html2text(1)