Postern User Guide Eng
Postern User Guide Eng
Postern User Guide Eng
Rule
1.1 What are rules
Those who are familiar with firewalls and route tables must
know these two things are basically defined by rules you pass
to them. Take a firewall as example, it must explicitly know
which destination hosts are allowed, or which ports are
forbidden, in order to function properly. In the same way, a
router must know which next hop to send the current packet
based on the destination IP address.
3. Match all
For any domain names or IP addresses, the rule is considered
a match.
Eg: FINAL, DIRECT
This rule usually comes last in a rule set (hence the name).
That means when Postern has failed to find a rule for access
to a certain destination, this rule will be the final match.
For rules that use action 5 (Proxy Group), a proxy group name
must be defined along with the rule. Proxy groups are defined
by names.
Those of you who have dealt with route tables must know a
thing or two about ordering. A destination usually can match
more than one rule in a rule set. In such cases, the first
matched rule is used. An example is as blow:
[Rule]
DOMAIN-KEYWORD, google, DIRECT
DOMAIN-SUFFIX, google.com, REJECT
DOMAIN, www.google.com, Proxy
When your browser initiates a new connection to
www.google.com, all three rules may apply. And they are
telling Postern to do different things. In cases like this,
Postern always chooses the first rule that it finds is a
match. In this case, Postern lets your browser access
www.google.com directy.
Adding Rules
[Rule]
DOMAIN-SUFFIX, google.com, Proxy
DOMAIN-SUFFIX, twitter.com, Proxy
[Proxy]
Proxy = https, 192.168.1.1, 1080, username, password
[Rule]
DOMAIN-SUFFIX, google.com, Proxy
DOMAIN-SUFFIX, twitter.com, Proxy
Edit/Delete Rules
Inserting Rules
Long press an existing rule, a popup menu will show up. Click
‘Insert new rule before’, and a new rule will be inserted
before that one(After you complete editing and save it, of
course). Alternatively, click ‘Insert new rule after’, and a
new rule will be inserted after that one. Click ‘Delete’, the
selected rule will be deleted.
2. Proxy Server
Actually we have shown you how a proxy server is defined in
configuration file, in examples above. Proxy servers are
grouped together and defined in the [Proxy] section, as below.
[Proxy]
Proxy = shadowsocks, 11.22.33.44, 1080, aes-256-cfb, password
Proxy2 = ssh, 22.33.44.55, 22, username, password
5. Password
In conjunction with username to login to the server.
3. Proxy Group
You may have many rules in your rule set, many of which point
to the same proxy server. But somehow you would like different
proxy servers when you are at home and having WIFI and when
you are outside using carrier’s data service. But it’s much
trouble that you maintain two different configuration files,
or you manually change each rule when you switch between two
different networks. Here’s where proxy groups can play their
roles. A proxy group corresponds to a list of different
actions. When you change current selection of a proxy group,
all rules that use this proxy group will switch to that new
selection and use it as the new action.
An example is as below:
[Proxy]
Proxy_WIFI = SSH, 11.22.33.44, 22, username, password
Proxy_4G = Shadowsocks, 22.33.44.55, 8888,
aes-256-cfb,password
[Proxy Group]
ProxyG = select, Proxy_WIFI, Proxy_4G
[Rule]
DOMAIN-SUFFIX, google.com, ProxyG
DOMAIN-SUFFIX, twitter.com ProxyG
[Proxy]
Pseudo_REJECT = REJECT
Pseudo_DIRECT = DIRECT
MyProxy = https,1.2.3.4,443,username,password
[Proxy Group]
ProxyG = select, Pseudo_REJECT, Pseudo_DIRECT, MyProxy
[Rule]
DOMAIN,www.google.com,ProxyG
DOMAIN-SUFFIX, twitter, ProxyG
4. Import Configurations
You’ve seen many examples of configuration files. Your touch
screens and keyboard-less devices are usually not designed for
such complex configurations. Hence Postern defines its
configuration file and let you import them. After all, writing
down these configurations on a computer with a keyboard before
import them on your mobile device is much more convenient. A
configuration file is text-based and thus is easy to read and
propagate to your fellows.
https://github.com/postern-overwal/postern-stuff
[Rule]
GEOIP,CN,DIRECT
FINAL,MyProxy
There are two rules in total. The first one tells Postern to
use direct connection when it sees an access attempt to a
Chinese host. The other rule tells Postern to use proxy
‘MyProxy’ for all the rest of data.
[Proxy]
HK_Proxy=Shadowsocks,22.33.44.55, 8888,aes-256-cfb,password
US_Proxy=SSH,1.2.3.4,22,username,password
JP_Proxy=HTTPS,2.3.4.5,1080,username,password
GB_Proxy=SOCKS5,5.6.7.8,10080,username,password
[Rules]
GEOIP,HK,HK_Proxy
GEOIP,US,US_Proxy
GEOIP,JP,JP_Proxy
GEOIP,GB,GB_Proxy
ZA EG ZW LR KE GH NG TZ
MU ZM MG AO NA CI SD CM
MW GA ML BJ TD BW LY CV
RW CG UG MZ GM LS MA DZ
GN CD SZ BF SO SL NE CF
TG SS BI GQ SC SN MR DJ
RE TN YT ST GW KM ET ER
AU CN JP TH IN MY KR SG
TW HK PH VN NZ BD PK ID
NP PG TK KH MO MV AF NC
FJ MN WF MM LA LK BN AE
NR NL GU VU BT WS FM PF
TL TO GB MP TR US NU SB
KI PW NF BS BZ VG CA MH
FR IR SE AS KP NO TV IO
CK KY PR BB VC JM BM DE
TC VI DM AG PM MF GD AI
MQ GP CZ FI CH IT BE BL
LC KN MS ES LU AT IL IE
DO MX AR TT CO VE BO BR
CR CL UY PY CW HN PA SV
SX PE EC GY GT NI BQ AW
HT CU GF SR EU RU KZ PT
GR SA DK SY UA CY IQ RO
LB GE AZ PS LT OM RS IS
HU BG SI MD MK EE LI HR
PL BA LV JO KG IM AM YE
BY GI SK MT QA AL JE SM
KW ME TJ UZ BH GL VA FO
GG MC AD TM