Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2017
670
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.78 KB | None | 0 0
  1. sudo apt-get update && sudo apt-get upgrade
  2. sudo apt-get install build-essential libnet-ldap-perl
  3. cd ~
  4. wget http://www.pro-bono-publico.de/projects/src/DEVEL.tar.bz2
  5. bzip2 -dc DEVEL.tar.bz2 | tar xvfp -
  6. cd PROJECTS
  7. sudo make
  8. sudo make install
  9. sudo mkdir /var/log/tac_plus
  10. sudo mkdir /var/log/tac_plus/access
  11. sudo mkdir /var/log/tac_plus/accounting
  12. sudo mkdir /var/log/tac_plus/authentication
  13.  
  14. stat --format '%a' /var/log/tac_plus
  15.  
  16. /usr/local/lib/mavis/mavis_tacplus_ldap.pl < /dev/null
  17. Default server type is 'tacacs_schema'. You *may* need to change that to 'generic' or 'microsoft'.
  18. LDAP_HOSTS not defined at /usr/local/lib/mavis/mavis_tacplus_ldap.pl line 277, <DATA> line 755.
  19.  
  20. cd /usr/local/etc
  21. sudo touch tac_plus.cfg
  22. sudo chmod 755 tac_plus.cfg
  23. sudo nano tac_plus.cfg
  24.  
  25. #!/usr/local/sbin/tac_plus
  26. id = spawnd {
  27. listen = { address = 0.0.0.0 port = 49 }
  28. #Uncomment the line below for IPv6 support
  29. #listen = { address = :: port = 49 }
  30. spawn = {
  31. instances min = 1
  32. instances max = 10
  33. }
  34. background = yes
  35. }
  36.  
  37. id = tac_plus {
  38. access log = /var/log/tac_plus/access/%Y/%m/access-%m-%d-%Y.txt
  39. accounting log = /var/log/tac_plus/accounting/%Y/%m/accounting-%m-%d-%Y.txt
  40. authentication log = /var/log/tac_plus/authentication/%Y/%m/authentication-%m-%d-%Y.txt
  41.  
  42. mavis module = external {
  43. setenv LDAP_SERVER_TYPE = "microsoft"
  44. #If you are using Microsoft Global Catalog with LDAP SSL
  45. #setenv LDAP_HOSTS = "ldaps://10.0.0.100:3269"
  46. #If you are using Microsoft Global Catalog with LDAP (non-SSL)
  47. setenv LDAP_HOSTS = "10.0.0.100:3268"
  48. setenv LDAP_BASE = "DC=domain,DC=name"
  49. setenv LDAP_SCOPE = sub
  50. setenv LDAP_FILTER = "(&(objectClass=user)(objectClass=person)(sAMAccountName=%s))"
  51. setenv LDAP_USER = "svc_tacplus@domain.name"
  52. setenv LDAP_PASSWD = "ServiceAccountPassword"
  53. #Setting UNLIMIT_AD_GROUP_MEMBERSHIP to 0 will cause a NACK response if the AD account is a member of more than one security group
  54. setenv UNLIMIT_AD_GROUP_MEMBERSHIP = 1
  55. #I'm not 100% sure what EXPAND_AD_GROUP_MEMBERSHIP does
  56. setenv EXPAND_AD_GROUP_MEMBERSHIP = 0
  57. #Clear default setting of tacplus for AD_GROUP_PREFIX
  58. setenv AD_GROUP_PREFIX = ""
  59. #Setting REQUIRE_TACACS_GROUP_PREFIX to 1 will cause a NACK response if the AD account is not a member of a security group with the required prefix
  60. setenv REQUIRE_TACACS_GROUP_PREFIX = 0
  61. #Set USE_TLS to 1 if you are using port 636 or 3269, set to 0 for port 389 or 3268
  62. setenv USE_TLS = 0
  63. exec = /usr/local/lib/mavis/mavis_tacplus_ldap.pl
  64. }
  65.  
  66. login backend = mavis
  67. user backend = mavis
  68. pap backend = mavis
  69.  
  70. host = world {
  71. #Allow any IPv4 device
  72. address = 0.0.0.0/0
  73.  
  74. #Uncomment the line below for IPv6 support
  75. #address = ::/0
  76.  
  77. #Uncomment the line below to inject a login prompt
  78. #prompt = "Put your custom welcome message here.n"
  79.  
  80. #Change this to your own secure TACACS+ key
  81. key = "cisco"
  82. }
  83.  
  84. #Example group that grants admin on Cisco IOS/XE/XR and NX-OS
  85. group = admin {
  86. #Permit all services by default
  87. default service = permit
  88.  
  89. #Users will need to re-enter their AD password for the enable password (feel free to customize this however you want)
  90. enable = login
  91.  
  92. service = shell {
  93. #Permit all commands
  94. default command = permit
  95.  
  96. #Permit all command attributes
  97. default attribute = permit
  98.  
  99. #Set privilege level to 15 on IOS/XE
  100. set priv-lvl = 15
  101.  
  102. #Uncomment the line below for NX-OS support
  103. #set shell:roles=""network-admin vdc-admin""
  104.  
  105. #Uncomment the line below for IOS XR support
  106. #set task = "#root-system"
  107. }
  108.  
  109.  
  110. }
  111.  
  112. #Example AD user mapping
  113. user = jsmith {
  114. password = mavis
  115. member = admin
  116. }
  117. }
  118.  
  119. /usr/local/sbin/tac_plus -P /usr/local/etc/tac_plus.cfg
  120.  
  121. /usr/local/bin/mavistest -d -1 /usr/local/etc/tac_plus.cfg tac_plus TACPLUS SomeUserName SomeUserPassword
  122.  
  123. {mavistest debug output omitted}
  124.  
  125. Input attribute-value-pairs:
  126. TYPE TACPLUS
  127. TIMESTAMP mavistest-2501-1509172787-0
  128. USER SomeUserName
  129. PASSWORD SomeUserPassword
  130. TACTYPE AUTH
  131.  
  132.  
  133. Output attribute-value-pairs:
  134. TYPE TACPLUS
  135. TIMESTAMP mavistest-2501-1509172787-0
  136. USER SomeUserName
  137. RESULT ACK
  138. PASSWORD SomeUserPassword
  139. SERIAL QrWVmlId0OZADDRU/hy/pw=
  140. DBPASSWORD SomeUserPassword
  141. TACMEMBER [List of Active Directory security groups]
  142. TACTYPE AUTH
  143.  
  144. cd /etc/init.d
  145. sudo cp ~/PROJECTS/tac_plus/extra/etc_init.d_tac_plus /etc/init.d/tac_plus
  146. sudo chmod 755 /etc/init.d/tac_plus
  147. sudo chown root:root /etc/init.d/tac_plus
  148. sudo update-rc.d tac_plus defaults
  149. sudo service tac_plus start
  150.  
  151. sudo netstat -tulpen
  152.  
  153. Active Internet connections (only servers)
  154. Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
  155. tcp 0 0 0.0.0.0:49 0.0.0.0:* LISTEN 0 25680 1911/tac_plus: 0 co
  156. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 16105 1023/sshd
  157. tcp6 0 0 :::22 :::* LISTEN 0 16113 1023/sshd
  158.  
  159. sudo nano /usr/local/etc/tac_plus.cfg
  160. sudo service tac_plus stop
  161. sudo service tac_plus start
  162.  
  163. sudo systemctl status tac_plus.service
  164. sudo journalctl -xe
  165. /usr/local/sbin/tac_plus -P /usr/local/etc/tac_plus.cfg
  166.  
  167. LDAP_SERVER_TYPE
  168. One of: generic tacacs_schema microsoft
  169. Default: tacacs_schema
  170.  
  171. LDAP_HOST
  172. Space-separated list of LDAP URLs or IP addresses or hostnames
  173. Examples: "ldap01 ldap02", "ldaps://ads01:636 ldaps://ads02:636"
  174.  
  175. LDAP_SCOPE
  176. LDAP search scope (base, one, sub)
  177. Default: sub
  178.  
  179. LDAP_BASE
  180. Base DN of your LDAP server
  181. Example: "dc=example,dc=com"
  182.  
  183. LDAP_FILTER
  184. LDAP search filter
  185. Defaults depend on LDAP_SERVER_TYPE:
  186. - generic: "(uid=%s)"
  187. - tacacs_schema: "(&(uid=%s)(objectClass=tacacsAccount))"
  188. - microsoft: "(&(objectclass=user)(sAMAccountName=%s))"
  189.  
  190. LDAP_FILTER_CHPW
  191. LDAP search filter for password changes
  192. Defaults depend on LDAP_SERVER_TYPE:
  193. - generic: "(uid=%s)"
  194. - tacacs_schema: "(&(uid=%s)(objectClass=tacacsAccount)(!(tacacsFlag=staticpasswd))"
  195. - microsoft: "(&(objectclass=user)(sAMAccountName=%s))"
  196.  
  197. LDAP_USER
  198. User to use for LDAP bind if server doesn't permit anonymous searches.
  199. Default: unset
  200.  
  201. LDAP_PASSWD
  202. Password for LDAP_USER
  203. Default: unset
  204.  
  205. AD_GROUP_PREFIX
  206. An AD group starting with this prefix will be used for tacacs group membership.
  207. Default: tacacs
  208.  
  209. REQUIRE_AD_GROUP_PREFIX
  210. If set, user needs to be in one of the AD_GROUP_PREFIX groups.
  211. Default: unset
  212.  
  213. UNLIMIT_AD_GROUP_MEMBERSHIP
  214. If unset, the number of groups a user can be member of is limited to one.
  215. Default: unset
  216.  
  217. EXPAND_AD_GROUP_MEMBERSHIP
  218. If set, AD group memberships will be expanded.
  219. Default: unset
  220.  
  221. USE_TLS
  222. If set, the server is required to support start_tls.
  223. Default: unset
  224.  
  225. FLAG_CHPW
  226. Permit password changes via this backend.
  227. Default: unset
  228.  
  229. FLAG_PWPOLICY
  230. Enforce a simplicistic password policy.
  231. Default: unset
  232.  
  233. FLAG_CACHE_CONNECTION
  234. Keep connection to LDAP server open.
  235. Default: unset
  236.  
  237. FLAG_FALLTHROUGH
  238. If LDAP search fails, try next module (if any).
  239. Default: unset
  240.  
  241. FLAG_USE_MEMBEROF
  242. Use the memberof attribute for determining group membership.
  243. Default: unset
  244.  
  245. FLAG_AUTHORIZE_ONLY
  246. Don't attempt to authenticate users.
  247.  
  248. ! Example Cisco IOS TACACS+ AAA configuration
  249. !
  250. ! Don't forget to change Vlan1 to either the VLAN or physical interface that can
  251. ! reach your tacplus server
  252. !
  253. ! Run "show aaa user all" to verify privilege level after you login
  254. !
  255. ! NOTE: It is highly recommended that you turn on service password encryption!
  256. ! Some IOS images contain bugs that prevent TACACS+ from working unless service
  257. ! password encryption is enabled!
  258.  
  259. aaa new-model
  260. aaa authentication login default group tacacs+ local
  261. aaa authentication enable default group tacacs+ enable
  262. aaa authorization config-commands
  263. aaa authorization commands 1 default group tacacs+ local if-authenticated
  264. aaa authorization commands 15 default group tacacs+ local if-authenticated
  265. aaa authorization exec default group tacacs+ local if-authenticated
  266. aaa accounting exec default start-stop group tacacs+
  267. aaa accounting commands 1 default start-stop group tacacs+
  268. aaa accounting commands 15 default start-stop group tacacs+
  269. service password-encryption
  270. ip tacacs source-interface Vlan1
  271. tacacs-server host IP_OF_TACPLUS_SERVER single-connection key 0 cisco
  272. tacacs-server directed-request
  273.  
  274. ! Sample Cisco ASA TACACS+ AAA configuration
  275. ! Don't forget to change (inside) to the interface that can reach your tacplus server
  276. ! Run "show curpriv" to verify privilege level after you login
  277. !
  278. ! NOTE: Please make sure the ASA IOS image you are running isn't exploitable
  279. !
  280. ! See Cisco Advisory ID: cisco-sa-20160210-asa-ike for more information
  281. ! See Cisco Bug IDs: CSCux29978, CSCux42019 for more information
  282. !
  283. ! Cisco TAC will provide a patched image to you free of charge even if you don't have a
  284. ! service contact! Open a Cisco TAC case with your ASA's serial number and include the
  285. ! advisory ID as proof of entitlement and they will provide the image file to you!
  286.  
  287. aaa-server tacplus protocol tacacs+
  288. aaa-server tacplus (inside) host IP_OF_TACPLUS_SERVER
  289. key cisco
  290. aaa authentication ssh console tacplus LOCAL
  291. aaa authentication serial console tacplus LOCAL
  292. aaa authentication enable console tacplus LOCAL
  293. aaa authentication http console tacplus LOCAL
  294. aaa accounting command tacplus
  295. aaa accounting ssh console tacplus
  296. aaa accounting enable console tacplus
  297.  
  298. ! Sample NX-OS aaa tac_plus configuration
  299. ! Don't forget to change the VRF to one that can reach your tacplus server
  300. ! Run "show user-account" to verify roles after you login successfully
  301.  
  302. tacacs-server directed-request
  303. tacacs-server host IP_OF_TACPLUS_SERVER key 0 "cisco"
  304.  
  305. aaa group server tacacs+ tacplus
  306. server IP_OF_TACPLUS_SERVER
  307. use-vrf default
  308.  
  309. aaa authentication login default group tacplus local
  310. aaa authentication login console group tacplus local
  311. aaa authorization config-commands default group tacplus local
  312. aaa authorization commands default group tacplus local
  313. aaa accounting default group tacplus
  314.  
  315. ! Example Cisco IOS XR TACACS+ AAA configuration (IOS XR formal syntax)
  316. ! Don't forget to change the interface/vrf to a pair that can reach your tacplus server
  317. ! Run "show user tasks" to verify task levels after you login
  318.  
  319. tacacs source-interface TenGigE0/0/2/0 vrf default
  320. tacacs-server host IP_OF_TACPLUS_SERVER port 49
  321. tacacs-server host IP_OF_TACPLUS_SERVER port 49 key 0 cisco
  322. tacacs-server host IP_OF_TACPLUS_SERVER port 49 single-connection
  323. aaa accounting exec default start-stop group tacacs+
  324. aaa accounting system default start-stop group tacacs+
  325. aaa accounting commands default start-stop group tacacs+
  326. aaa authorization exec default group tacacs+ local
  327. aaa authorization commands default group tacacs+
  328. aaa authentication login default group tacacs+ local
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement