Browse Source

init

master
Robin Thoni 6 years ago
commit
75fd9cb597

+ 5
- 0
.gitignore View File

@@ -0,0 +1,5 @@
1
+*.swp
2
+/data
3
+docker-compose.override.yml
4
+env_override*
5
+*.pyc

+ 32
- 0
docker-compose.yml View File

@@ -0,0 +1,32 @@
1
+version: '2'
2
+
3
+services:
4
+  #    postgresql:
5
+  #        build: ./postgresql
6
+  #        container_name: radius-postgresql
7
+  #        networks:
8
+  #            radius.internal.docker:
9
+  #                aliases:
10
+  #                    - postgresql.radius.internal.docker
11
+  #        volumes:
12
+  #            - ./data/postgresql/data:/var/lib/postgresql/data
13
+  #            - ./data/postgresql/backup:/var/lib/postgresql/backup
14
+  #        ports:
15
+  #            - "127.0.0.1:34020:5432"
16
+  #        env_file:
17
+  #            - env
18
+
19
+    freeradius:
20
+        build: ./freeradius
21
+        container_name: radius-freeradius
22
+        networks:
23
+            radius.internal.docker:
24
+                aliases:
25
+                    - freeradius.radius.internal.docker
26
+        ports:
27
+            - "0.0.0.0:1812:1812/udp"
28
+        env_file:
29
+            - env
30
+
31
+networks:
32
+    radius.internal.docker:

+ 19
- 0
env View File

@@ -0,0 +1,19 @@
1
+DHCP_TSIG_KEY_NAME=dhcpupdate
2
+DHCP_TSIG_KEY_ALGO=hmac-md5
3
+DHCP_TSIG_KEY_SECRET=Y2hhbmdlX2l0
4
+
5
+DHCP_DNS_MASTER=10.15.100.1
6
+DHCP_DNS_SERVER=10.15.100.1
7
+DHCP_TFTP_SERVER=10.15.100.1
8
+DHCP_ROUTERS=10.15.100.1
9
+
10
+DHCP_DOMAIN=example.com
11
+DHCP_SITE_DOMAIN=site.example.com
12
+DHCP_DYN_IPS_DOMAIN=dhcp.site.example.com
13
+DHCP_REV_DOMAIN=100.15.10.in-addr.arpa.
14
+
15
+DHCP_SUBNET=10.15.100.0
16
+DHCP_NETMASK=255.255.255.0
17
+DHCP_IP_FIRST=10.15.100.50
18
+DHCP_IP_LAST=10.15.100.250
19
+DHCP_BROADCAST=10.15.100.255

+ 35
- 0
freeradius/Dockerfile View File

@@ -0,0 +1,35 @@
1
+FROM robinthoni/debian-multiarch:jessie
2
+
3
+MAINTAINER Robin Thoni <robin@rthoni.com>
4
+
5
+ARG CONFIG_DIR=/etc/default/config-files/
6
+
7
+RUN apt-get update && apt-get -y install\
8
+        freeradius &&\
9
+        apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
10
+
11
+RUN rm -rf /var/log/*
12
+
13
+COPY ./vars-vars /etc/vars-vars
14
+
15
+COPY ./vars-files /etc/vars-files
16
+
17
+COPY ./common.sh /common.sh
18
+
19
+COPY ./run.sh /run.sh
20
+
21
+#RUN echo 'bob     Cleartext-Password := "hello"' >> /etc/freeradius/users
22
+
23
+#RUN echo "client 0.0.0.0 {\nnetmask 0\nsecret testing123\n}" >> /etc/freeradius/clients.conf
24
+
25
+RUN mkdir "${CONFIG_DIR}"
26
+
27
+COPY config/users "${CONFIG_DIR}"/users
28
+
29
+COPY config/clients.conf "${CONFIG_DIR}"/clients.conf
30
+
31
+#COPY dhcpd.conf "${CONFIG_DIR}"/dhcpd.conf
32
+
33
+EXPOSE 80
34
+
35
+CMD ["/run.sh"]

+ 41
- 0
freeradius/common.sh View File

@@ -0,0 +1,41 @@
1
+export CONFIG_DIR="/etc/default/config-files/"
2
+
3
+resolv_host()
4
+{
5
+  hostname="${1}"
6
+  ip=$(getent hosts "${hostname}" | cut -d' ' -f1)
7
+  echo "${ip}"
8
+}
9
+
10
+replace_var()
11
+{
12
+  file="${1}"
13
+  var="${2}"
14
+  sed -e "s?${var}?${!var}?g" -i "${file}"
15
+}
16
+
17
+replace_vars()
18
+{
19
+  file="${1}"
20
+  for var in $(cat /etc/vars-vars)
21
+  do
22
+    replace_var "${file}" "${var}"
23
+  done
24
+}
25
+
26
+replace_files()
27
+{
28
+  cat /etc/vars-files | while read line
29
+  do
30
+    filesrc="${CONFIG_DIR}$(echo "${line}" | awk '{print $1}')"
31
+    filedst=$(echo "${line}" | awk '{print $2}')
32
+    if [ -f "${filesrc}" ]
33
+    then
34
+      echo "Expanding file ${filesrc} to ${filedst}"
35
+      cp "${filesrc}" "${filedst}"
36
+      replace_vars "${filedst}"
37
+    else
38
+      echo "File ${filesrc} does not exist. Skipping."
39
+    fi
40
+  done
41
+}

+ 241
- 0
freeradius/config/clients.conf View File

@@ -0,0 +1,241 @@
1
+# -*- text -*-
2
+##
3
+## clients.conf -- client configuration directives
4
+##
5
+##  $Id: 729c15d3e84c6cdb54a5f3652d93a2d7f8725fd4 $
6
+
7
+#######################################################################
8
+#
9
+#  Define RADIUS clients (usually a NAS, Access Point, etc.).
10
+
11
+#
12
+#  Defines a RADIUS client.
13
+#
14
+#  '127.0.0.1' is another name for 'localhost'.  It is enabled by default,
15
+#  to allow testing of the server after an initial installation.  If you
16
+#  are not going to be permitting RADIUS queries from localhost, we suggest
17
+#  that you delete, or comment out, this entry.
18
+#
19
+#
20
+
21
+#
22
+#  Each client has a "short name" that is used to distinguish it from
23
+#  other clients.
24
+#
25
+#  In version 1.x, the string after the word "client" was the IP
26
+#  address of the client.  In 2.0, the IP address is configured via
27
+#  the "ipaddr" or "ipv6addr" fields.  For compatibility, the 1.x
28
+#  format is still accepted.
29
+#
30
+client localhost {
31
+  #  Allowed values are:
32
+  # dotted quad (1.2.3.4)
33
+  #       hostname    (radius.example.com)
34
+  ipaddr = 127.0.0.1
35
+
36
+  #  OR, you can use an IPv6 address, but not both
37
+  #  at the same time.
38
+# ipv6addr = :: # any.  ::1 == localhost
39
+
40
+  #
41
+  #  A note on DNS:  We STRONGLY recommend using IP addresses
42
+  #  rather than host names.  Using host names means that the
43
+  #  server will do DNS lookups when it starts, making it
44
+  #  dependent on DNS.  i.e. If anything goes wrong with DNS,
45
+  #  the server won't start!
46
+  #
47
+  #  The server also looks up the IP address from DNS once, and
48
+  #  only once, when it starts.  If the DNS record is later
49
+  #  updated, the server WILL NOT see that update.
50
+  #
51
+
52
+  #  One client definition can be applied to an entire network.
53
+  #  e.g. 127/8 should be defined with "ipaddr = 127.0.0.0" and
54
+  #  "netmask = 8"
55
+  #
56
+  #  If not specified, the default netmask is 32 (i.e. /32)
57
+  #
58
+  #  We do NOT recommend using anything other than 32.  There
59
+  #  are usually other, better ways to achieve the same goal.
60
+  #  Using netmasks of other than 32 can cause security issues.
61
+  #
62
+  #  You can specify overlapping networks (127/8 and 127.0/16)
63
+  #  In that case, the smallest possible network will be used
64
+  #  as the "best match" for the client.
65
+  #
66
+  #  Clients can also be defined dynamically at run time, based
67
+  #  on any criteria.  e.g. SQL lookups, keying off of NAS-Identifier,
68
+  #  etc.
69
+  #  See raddb/sites-available/dynamic-clients for details.
70
+  #
71
+
72
+# netmask = 32
73
+
74
+  #
75
+  #  The shared secret use to "encrypt" and "sign" packets between
76
+  #  the NAS and FreeRADIUS.  You MUST change this secret from the
77
+  #  default, otherwise it's not a secret any more!
78
+  #
79
+  #  The secret can be any string, up to 8k characters in length.
80
+  #
81
+  #  Control codes can be entered vi octal encoding,
82
+  # e.g. "\101\102" == "AB"
83
+  #  Quotation marks can be entered by escaping them,
84
+  # e.g. "foo\"bar"
85
+  #
86
+  #  A note on security:  The security of the RADIUS protocol
87
+  #  depends COMPLETELY on this secret!  We recommend using a
88
+  #  shared secret that is composed of:
89
+  #
90
+  # upper case letters
91
+  # lower case letters
92
+  # numbers
93
+  #
94
+  #  And is at LEAST 8 characters long, preferably 16 characters in
95
+  #  length.  The secret MUST be random, and should not be words,
96
+  #  phrase, or anything else that is recognizable.
97
+  #
98
+  #  The default secret below is only for testing, and should
99
+  #  not be used in any real environment.
100
+  #
101
+  secret    = testing123
102
+
103
+  #
104
+  #  Old-style clients do not send a Message-Authenticator
105
+  #  in an Access-Request.  RFC 5080 suggests that all clients
106
+  #  SHOULD include it in an Access-Request.  The configuration
107
+  #  item below allows the server to require it.  If a client
108
+  #  is required to include a Message-Authenticator and it does
109
+  #  not, then the packet will be silently discarded.
110
+  #
111
+  #  allowed values: yes, no
112
+  require_message_authenticator = no
113
+
114
+  #
115
+  #  The short name is used as an alias for the fully qualified
116
+  #  domain name, or the IP address.
117
+  #
118
+  #  It is accepted for compatibility with 1.x, but it is no
119
+  #  longer necessary in 2.0
120
+  #
121
+# shortname = localhost
122
+
123
+  #
124
+  # the following three fields are optional, but may be used by
125
+  # checkrad.pl for simultaneous use checks
126
+  #
127
+
128
+  #
129
+  # The nastype tells 'checkrad.pl' which NAS-specific method to
130
+  #  use to query the NAS for simultaneous use.
131
+  #
132
+  #  Permitted NAS types are:
133
+  #
134
+  # cisco
135
+  # computone
136
+  # livingston
137
+  # juniper
138
+  # max40xx
139
+  # multitech
140
+  # netserver
141
+  # pathras
142
+  # patton
143
+  # portslave
144
+  # tc
145
+  # usrhiper
146
+  # other   # for all other types
147
+
148
+  #
149
+  nastype     = other # localhost isn't usually a NAS...
150
+
151
+  #
152
+  #  The following two configurations are for future use.
153
+  #  The 'naspasswd' file is currently used to store the NAS
154
+  #  login name and password, which is used by checkrad.pl
155
+  #  when querying the NAS for simultaneous use.
156
+  #
157
+# login       = !root
158
+# password    = someadminpas
159
+
160
+  #
161
+  #  As of 2.0, clients can also be tied to a virtual server.
162
+  #  This is done by setting the "virtual_server" configuration
163
+  #  item, as in the example below.
164
+  #
165
+# virtual_server = home1
166
+
167
+  #
168
+  #  A pointer to the "home_server_pool" OR a "home_server"
169
+  #  section that contains the CoA configuration for this
170
+  #  client.  For an example of a coa home server or pool,
171
+  #  see raddb/sites-available/originate-coa
172
+# coa_server = coa
173
+}
174
+
175
+# IPv6 Client
176
+#client ::1 {
177
+# secret    = testing123
178
+# shortname = localhost
179
+#}
180
+#
181
+# All IPv6 Site-local clients
182
+#client fe80::/16 {
183
+# secret    = testing123
184
+# shortname = localhost
185
+#}
186
+
187
+#client some.host.org {
188
+# secret    = testing123
189
+# shortname = localhost
190
+#}
191
+
192
+#
193
+#  You can now specify one secret for a network of clients.
194
+#  When a client request comes in, the BEST match is chosen.
195
+#  i.e. The entry from the smallest possible network.
196
+#
197
+#client 192.168.0.0/24 {
198
+# secret    = testing123-1
199
+# shortname = private-network-1
200
+#}
201
+#
202
+#client 192.168.0.0/16 {
203
+# secret    = testing123-2
204
+# shortname = private-network-2
205
+#}
206
+
207
+
208
+#client 10.10.10.10 {
209
+# # secret and password are mapped through the "secrets" file.
210
+# secret      = testing123
211
+# shortname   = liv1
212
+#       # the following three fields are optional, but may be used by
213
+#       # checkrad.pl for simultaneous usage checks
214
+# nastype     = livingston
215
+# login       = !root
216
+# password    = someadminpas
217
+#}
218
+
219
+#######################################################################
220
+#
221
+#  Per-socket client lists.  The configuration entries are exactly
222
+#  the same as above, but they are nested inside of a section.
223
+#
224
+#  You can have as many per-socket client lists as you have "listen"
225
+#  sections, or you can re-use a list among multiple "listen" sections.
226
+#
227
+#  Un-comment this section, and edit a "listen" section to add:
228
+#  "clients = per_socket_clients".  That IP address/port combination
229
+#  will then accept ONLY the clients listed in this section.
230
+#
231
+#clients per_socket_clients {
232
+# client 192.168.3.4 {
233
+#   secret = testing123
234
+#        }
235
+#}
236
+
237
+client everyone {
238
+  ipaddr = 0.0.0.0
239
+  netmask = 0
240
+  secret = testing123
241
+}

+ 688
- 0
freeradius/config/eap.conf View File

@@ -0,0 +1,688 @@
1
+# -*- text -*-
2
+##
3
+##  eap.conf -- Configuration for EAP types (PEAP, TTLS, etc.)
4
+##
5
+##  $Id: 95bebe4d25ef13871fb201ba540ed008078dab07 $
6
+
7
+#######################################################################
8
+#
9
+#  Whatever you do, do NOT set 'Auth-Type := EAP'.  The server
10
+#  is smart enough to figure this out on its own.  The most
11
+#  common side effect of setting 'Auth-Type := EAP' is that the
12
+#  users then cannot use ANY other authentication method.
13
+#
14
+#  EAP types NOT listed here may be supported via the "eap2" module.
15
+#  See experimental.conf for documentation.
16
+#
17
+  eap {
18
+    #  Invoke the default supported EAP type when
19
+    #  EAP-Identity response is received.
20
+    #
21
+    #  The incoming EAP messages DO NOT specify which EAP
22
+    #  type they will be using, so it MUST be set here.
23
+    #
24
+    #  For now, only one default EAP type may be used at a time.
25
+    #
26
+    #  If the EAP-Type attribute is set by another module,
27
+    #  then that EAP type takes precedence over the
28
+    #  default type configured here.
29
+    #
30
+    default_eap_type = peap
31
+
32
+    #  A list is maintained to correlate EAP-Response
33
+    #  packets with EAP-Request packets.  After a
34
+    #  configurable length of time, entries in the list
35
+    #  expire, and are deleted.
36
+    #
37
+    timer_expire     = 60
38
+
39
+    #  There are many EAP types, but the server has support
40
+    #  for only a limited subset.  If the server receives
41
+    #  a request for an EAP type it does not support, then
42
+    #  it normally rejects the request.  By setting this
43
+    #  configuration to "yes", you can tell the server to
44
+    #  instead keep processing the request.  Another module
45
+    #  MUST then be configured to proxy the request to
46
+    #  another RADIUS server which supports that EAP type.
47
+    #
48
+    #  If another module is NOT configured to handle the
49
+    #  request, then the request will still end up being
50
+    #  rejected.
51
+    ignore_unknown_eap_types = no
52
+
53
+    # Cisco AP1230B firmware 12.2(13)JA1 has a bug.  When given
54
+    # a User-Name attribute in an Access-Accept, it copies one
55
+    # more byte than it should.
56
+    #
57
+    # We can work around it by configurably adding an extra
58
+    # zero byte.
59
+    cisco_accounting_username_bug = no
60
+
61
+    #
62
+    #  Help prevent DoS attacks by limiting the number of
63
+    #  sessions that the server is tracking.  For simplicity,
64
+    #  this is taken from the "max_requests" directive in
65
+    #  radiusd.conf.
66
+    max_sessions = ${max_requests}
67
+
68
+    # Supported EAP-types
69
+
70
+    #
71
+    #  We do NOT recommend using EAP-MD5 authentication
72
+    #  for wireless connections.  It is insecure, and does
73
+    #  not provide for dynamic WEP keys.
74
+    #
75
+    md5 {
76
+    }
77
+
78
+    # Cisco LEAP
79
+    #
80
+    #  We do not recommend using LEAP in new deployments.  See:
81
+    #  http://www.securiteam.com/tools/5TP012ACKE.html
82
+    #
83
+    #  Cisco LEAP uses the MS-CHAP algorithm (but not
84
+    #  the MS-CHAP attributes) to perform it's authentication.
85
+    #
86
+    #  As a result, LEAP *requires* access to the plain-text
87
+    #  User-Password, or the NT-Password attributes.
88
+    #  'System' authentication is impossible with LEAP.
89
+    #
90
+    leap {
91
+    }
92
+
93
+    #  Generic Token Card.
94
+    #
95
+    #  Currently, this is only permitted inside of EAP-TTLS,
96
+    #  or EAP-PEAP.  The module "challenges" the user with
97
+    #  text, and the response from the user is taken to be
98
+    #  the User-Password.
99
+    #
100
+    #  Proxying the tunneled EAP-GTC session is a bad idea,
101
+    #  the users password will go over the wire in plain-text,
102
+    #  for anyone to see.
103
+    #
104
+    gtc {
105
+      #  The default challenge, which many clients
106
+      #  ignore..
107
+      #challenge = "Password: "
108
+
109
+      #  The plain-text response which comes back
110
+      #  is put into a User-Password attribute,
111
+      #  and passed to another module for
112
+      #  authentication.  This allows the EAP-GTC
113
+      #  response to be checked against plain-text,
114
+      #  or crypt'd passwords.
115
+      #
116
+      #  If you say "Local" instead of "PAP", then
117
+      #  the module will look for a User-Password
118
+      #  configured for the request, and do the
119
+      #  authentication itself.
120
+      #
121
+      auth_type = PAP
122
+    }
123
+
124
+    ## EAP-TLS
125
+    #
126
+    #  See raddb/certs/README for additional comments
127
+    #  on certificates.
128
+    #
129
+    #  If OpenSSL was not found at the time the server was
130
+    #  built, the "tls", "ttls", and "peap" sections will
131
+    #  be ignored.
132
+    #
133
+    #  Otherwise, when the server first starts in debugging
134
+    #  mode, test certificates will be created.  See the
135
+    #  "make_cert_command" below for details, and the README
136
+    #  file in raddb/certs
137
+    #
138
+    #  These test certificates SHOULD NOT be used in a normal
139
+    #  deployment.  They are created only to make it easier
140
+    #  to install the server, and to perform some simple
141
+    #  tests with EAP-TLS, TTLS, or PEAP.
142
+    #
143
+    #  See also:
144
+    #
145
+    #  http://www.dslreports.com/forum/remark,9286052~mode=flat
146
+    #
147
+    #  Note that you should NOT use a globally known CA here!
148
+    #  e.g. using a Verisign cert as a "known CA" means that
149
+    #  ANYONE who has a certificate signed by them can
150
+    #  authenticate via EAP-TLS!  This is likely not what you want.
151
+    tls {
152
+      #
153
+      #  These is used to simplify later configurations.
154
+      #
155
+      certdir = ${confdir}/certs
156
+      cadir = ${confdir}/certs
157
+
158
+      private_key_password = whatever
159
+      private_key_file = ${certdir}/server.key
160
+
161
+      #  If Private key & Certificate are located in
162
+      #  the same file, then private_key_file &
163
+      #  certificate_file must contain the same file
164
+      #  name.
165
+      #
166
+      #  If CA_file (below) is not used, then the
167
+      #  certificate_file below MUST include not
168
+      #  only the server certificate, but ALSO all
169
+      #  of the CA certificates used to sign the
170
+      #  server certificate.
171
+      certificate_file = ${certdir}/server.pem
172
+
173
+      #  Trusted Root CA list
174
+      #
175
+      #  ALL of the CA's in this list will be trusted
176
+      #  to issue client certificates for authentication.
177
+      #
178
+      #  In general, you should use self-signed
179
+      #  certificates for 802.1x (EAP) authentication.
180
+      #  In that case, this CA file should contain
181
+      #  *one* CA certificate.
182
+      #
183
+      #  This parameter is used only for EAP-TLS,
184
+      #  when you issue client certificates.  If you do
185
+      #  not use client certificates, and you do not want
186
+      #  to permit EAP-TLS authentication, then delete
187
+      #  this configuration item.
188
+      CA_file = ${cadir}/ca.pem
189
+
190
+      #
191
+      #  For DH cipher suites to work, you have to
192
+      #  run OpenSSL to create the DH file first:
193
+      #
194
+      #   openssl dhparam -out certs/dh 1024
195
+      #
196
+      dh_file = ${certdir}/dh
197
+      random_file = /dev/urandom
198
+
199
+
200
+      #
201
+      #  This can never exceed the size of a RADIUS
202
+      #  packet (4096 bytes), and is preferably half
203
+      #  that, to accomodate other attributes in
204
+      #  RADIUS packet.  On most APs the MAX packet
205
+      #  length is configured between 1500 - 1600
206
+      #  In these cases, fragment size should be
207
+      #  1024 or less.
208
+      #
209
+    # fragment_size = 1024
210
+
211
+      #  include_length is a flag which is
212
+      #  by default set to yes If set to
213
+      #  yes, Total Length of the message is
214
+      #  included in EVERY packet we send.
215
+      #  If set to no, Total Length of the
216
+      #  message is included ONLY in the
217
+      #  First packet of a fragment series.
218
+      #
219
+    # include_length = yes
220
+
221
+      #  Check the Certificate Revocation List
222
+      #
223
+      #  1) Copy CA certificates and CRLs to same directory.
224
+      #  2) Execute 'c_rehash <CA certs&CRLs Directory>'.
225
+      #    'c_rehash' is OpenSSL's command.
226
+      #  3) uncomment the line below.
227
+      #  5) Restart radiusd
228
+    # check_crl = yes
229
+      CA_path = ${cadir}
230
+
231
+           #
232
+           #  If check_cert_issuer is set, the value will
233
+           #  be checked against the DN of the issuer in
234
+           #  the client certificate.  If the values do not
235
+           #  match, the cerficate verification will fail,
236
+           #  rejecting the user.
237
+           #
238
+           #  In 2.1.10 and later, this check can be done
239
+           #  more generally by checking the value of the
240
+           #  TLS-Client-Cert-Issuer attribute.  This check
241
+           #  can be done via any mechanism you choose.
242
+           #
243
+    #       check_cert_issuer = "/C=GB/ST=Berkshire/L=Newbury/O=My Company Ltd"
244
+
245
+           #
246
+           #  If check_cert_cn is set, the value will
247
+           #  be xlat'ed and checked against the CN
248
+           #  in the client certificate.  If the values
249
+           #  do not match, the certificate verification
250
+           #  will fail rejecting the user.
251
+           #
252
+           #  This check is done only if the previous
253
+           #  "check_cert_issuer" is not set, or if
254
+           #  the check succeeds.
255
+           #
256
+           #  In 2.1.10 and later, this check can be done
257
+           #  more generally by checking the value of the
258
+           #  TLS-Client-Cert-CN attribute.  This check
259
+           #  can be done via any mechanism you choose.
260
+           #
261
+    # check_cert_cn = %{User-Name}
262
+    #
263
+      # Set this option to specify the allowed
264
+      # TLS cipher suites.  The format is listed
265
+      # in "man 1 ciphers".
266
+      cipher_list = "DEFAULT"
267
+
268
+      #
269
+      # As part of checking a client certificate, the EAP-TLS
270
+      # sets some attributes such as TLS-Client-Cert-CN. This
271
+      # virtual server has access to these attributes, and can
272
+      # be used to accept or reject the request.
273
+      #
274
+    # virtual_server = check-eap-tls
275
+
276
+      # This command creates the initial "snake oil"
277
+      # certificates when the server is run as root,
278
+      # and via "radiusd -X".
279
+      #
280
+      # As of 2.1.11, it *also* checks the server
281
+      # certificate for validity, including expiration.
282
+      # This means that radiusd will refuse to start
283
+      # when the certificate has expired.  The alternative
284
+      # is to have the 802.1X clients refuse to connect
285
+      # when they discover the certificate has expired.
286
+      #
287
+      # Debugging client issues is hard, so it's better
288
+      # for the server to print out an error message,
289
+      # and refuse to start.
290
+      #
291
+      make_cert_command = "${certdir}/bootstrap"
292
+
293
+      #
294
+      #  Elliptical cryptography configuration
295
+      #
296
+      #  Only for OpenSSL >= 0.9.8.f
297
+      #
298
+      ecdh_curve = "prime256v1"
299
+
300
+      #
301
+      #  Session resumption / fast reauthentication
302
+      #  cache.
303
+      #
304
+      #  The cache contains the following information:
305
+      #
306
+      #  session Id - unique identifier, managed by SSL
307
+      #  User-Name  - from the Access-Accept
308
+      #  Stripped-User-Name - from the Access-Request
309
+      #  Cached-Session-Policy - from the Access-Accept
310
+      #
311
+      #  The "Cached-Session-Policy" is the name of a
312
+      #  policy which should be applied to the cached
313
+      #  session.  This policy can be used to assign
314
+      #  VLANs, IP addresses, etc.  It serves as a useful
315
+      #  way to re-apply the policy from the original
316
+      #  Access-Accept to the subsequent Access-Accept
317
+      #  for the cached session.
318
+      #
319
+      #  On session resumption, these attributes are
320
+      #  copied from the cache, and placed into the
321
+      #  reply list.
322
+      #
323
+      #  You probably also want "use_tunneled_reply = yes"
324
+      #  when using fast session resumption.
325
+      #
326
+      cache {
327
+            #
328
+            #  Enable it.  The default is "no".
329
+            #  Deleting the entire "cache" subsection
330
+            #  Also disables caching.
331
+            #
332
+            #  You can disallow resumption for a
333
+            #  particular user by adding the following
334
+            #  attribute to the control item list:
335
+            #
336
+            #   Allow-Session-Resumption = No
337
+            #
338
+            #  If "enable = no" below, you CANNOT
339
+            #  enable resumption for just one user
340
+            #  by setting the above attribute to "yes".
341
+            #
342
+            enable = no
343
+
344
+            #
345
+            #  Lifetime of the cached entries, in hours.
346
+            #  The sessions will be deleted after this
347
+            #  time.
348
+            #
349
+            lifetime = 24 # hours
350
+
351
+            #
352
+            #  The maximum number of entries in the
353
+            #  cache.  Set to "0" for "infinite".
354
+            #
355
+            #  This could be set to the number of users
356
+            #  who are logged in... which can be a LOT.
357
+            #
358
+            max_entries = 255
359
+      }
360
+
361
+      #
362
+      #  As of version 2.1.10, client certificates can be
363
+      #  validated via an external command.  This allows
364
+      #  dynamic CRLs or OCSP to be used.
365
+      #
366
+      #  This configuration is commented out in the
367
+      #  default configuration.  Uncomment it, and configure
368
+      #  the correct paths below to enable it.
369
+      #
370
+      verify {
371
+        #  A temporary directory where the client
372
+        #  certificates are stored.  This directory
373
+        #  MUST be owned by the UID of the server,
374
+        #  and MUST not be accessible by any other
375
+        #  users.  When the server starts, it will do
376
+        #  "chmod go-rwx" on the directory, for
377
+        #  security reasons.  The directory MUST
378
+        #  exist when the server starts.
379
+        #
380
+        #  You should also delete all of the files
381
+        #  in the directory when the server starts.
382
+    #         tmpdir = /tmp/radiusd
383
+
384
+        #  The command used to verify the client cert.
385
+        #  We recommend using the OpenSSL command-line
386
+        #  tool.
387
+        #
388
+        #  The ${..CA_path} text is a reference to
389
+        #  the CA_path variable defined above.
390
+        #
391
+        #  The %{TLS-Client-Cert-Filename} is the name
392
+        #  of the temporary file containing the cert
393
+        #  in PEM format.  This file is automatically
394
+        #  deleted by the server when the command
395
+        #  returns.
396
+    #       client = "/path/to/openssl verify -CApath ${..CA_path} %{TLS-Client-Cert-Filename}"
397
+      }
398
+
399
+      #
400
+      #  OCSP Configuration
401
+      #  Certificates can be verified against an OCSP
402
+      #  Responder. This makes it possible to immediately
403
+      #  revoke certificates without the distribution of
404
+      #  new Certificate Revokation Lists (CRLs).
405
+      #
406
+      ocsp {
407
+            #
408
+            #  Enable it.  The default is "no".
409
+            #  Deleting the entire "ocsp" subsection
410
+            #  Also disables ocsp checking
411
+            #
412
+            enable = no
413
+
414
+            #
415
+            #  The OCSP Responder URL can be automatically
416
+            #  extracted from the certificate in question.
417
+            #  To override the OCSP Responder URL set
418
+            #  "override_cert_url = yes". 
419
+            #
420
+            override_cert_url = yes
421
+
422
+            #
423
+            #  If the OCSP Responder address is not
424
+            #  extracted from the certificate, the
425
+            #  URL can be defined here.
426
+
427
+            #
428
+            #  Limitation: Currently the HTTP
429
+            #  Request is not sending the "Host: "
430
+            #  information to the web-server.  This
431
+            #  can be a problem if the OCSP
432
+            #  Responder is running as a vhost.
433
+            #
434
+            url = "http://127.0.0.1/ocsp/"
435
+
436
+            #
437
+            # If the OCSP Responder can not cope with nonce
438
+            # in the request, then it can be disabled here.
439
+            #
440
+            # For security reasons, disabling this option
441
+            # is not recommended as nonce protects against
442
+            # replay attacks.
443
+            #
444
+            # Note that Microsoft AD Certificate Services OCSP
445
+            # Responder does not enable nonce by default. It is
446
+            # more secure to enable nonce on the responder than
447
+            # to disable it in the query here.
448
+            # See http://technet.microsoft.com/en-us/library/cc770413%28WS.10%29.aspx
449
+            #
450
+            # use_nonce = yes
451
+
452
+            #
453
+            # Number of seconds before giving up waiting
454
+            # for OCSP response. 0 uses system default.
455
+            #
456
+            # timeout = 0
457
+
458
+            #
459
+            # Normally an error in querying the OCSP
460
+            # responder (no response from server, server did
461
+            # not understand the request, etc) will result in
462
+            # a validation failure.
463
+            #
464
+            # To treat these errors as 'soft' failures and
465
+            # still accept the certificate, enable this
466
+            # option.
467
+            # 
468
+            # Warning: this may enable clients with revoked
469
+            # certificates to connect if the OCSP responder
470
+            # is not available. Use with caution.
471
+            #
472
+            # softfail = no
473
+      }
474
+    }
475
+
476
+    #  The TTLS module implements the EAP-TTLS protocol,
477
+    #  which can be described as EAP inside of Diameter,
478
+    #  inside of TLS, inside of EAP, inside of RADIUS...
479
+    #
480
+    #  Surprisingly, it works quite well.
481
+    #
482
+    #  The TTLS module needs the TLS module to be installed
483
+    #  and configured, in order to use the TLS tunnel
484
+    #  inside of the EAP packet.  You will still need to
485
+    #  configure the TLS module, even if you do not want
486
+    #  to deploy EAP-TLS in your network.  Users will not
487
+    #  be able to request EAP-TLS, as it requires them to
488
+    #  have a client certificate.  EAP-TTLS does not
489
+    #  require a client certificate.
490
+    #
491
+    #  You can make TTLS require a client cert by setting
492
+    #
493
+    # EAP-TLS-Require-Client-Cert = Yes
494
+    #
495
+    #  in the control items for a request.
496
+    #
497
+    ttls {
498
+      #  The tunneled EAP session needs a default
499
+      #  EAP type which is separate from the one for
500
+      #  the non-tunneled EAP module.  Inside of the
501
+      #  TTLS tunnel, we recommend using EAP-MD5.
502
+      #  If the request does not contain an EAP
503
+      #  conversation, then this configuration entry
504
+      #  is ignored.
505
+      default_eap_type = md5
506
+
507
+      #  The tunneled authentication request does
508
+      #  not usually contain useful attributes
509
+      #  like 'Calling-Station-Id', etc.  These
510
+      #  attributes are outside of the tunnel,
511
+      #  and normally unavailable to the tunneled
512
+      #  authentication request.
513
+      #
514
+      #  By setting this configuration entry to
515
+      #  'yes', any attribute which NOT in the
516
+      #  tunneled authentication request, but
517
+      #  which IS available outside of the tunnel,
518
+      #  is copied to the tunneled request.
519
+      #
520
+      # allowed values: {no, yes}
521
+      copy_request_to_tunnel = no
522
+
523
+      #  The reply attributes sent to the NAS are
524
+      #  usually based on the name of the user
525
+      #  'outside' of the tunnel (usually
526
+      #  'anonymous').  If you want to send the
527
+      #  reply attributes based on the user name
528
+      #  inside of the tunnel, then set this
529
+      #  configuration entry to 'yes', and the reply
530
+      #  to the NAS will be taken from the reply to
531
+      #  the tunneled request.
532
+      #
533
+      # allowed values: {no, yes}
534
+      use_tunneled_reply = no
535
+
536
+      #
537
+      #  The inner tunneled request can be sent
538
+      #  through a virtual server constructed
539
+      #  specifically for this purpose.
540
+      #
541
+      #  If this entry is commented out, the inner
542
+      #  tunneled request will be sent through
543
+      #  the virtual server that processed the
544
+      #  outer requests.
545
+      #
546
+      virtual_server = "inner-tunnel"
547
+
548
+      #  This has the same meaning as the
549
+      #  same field in the "tls" module, above.
550
+      #  The default value here is "yes".
551
+    # include_length = yes
552
+    }
553
+
554
+    ##################################################
555
+    #
556
+    #  !!!!! WARNINGS for Windows compatibility  !!!!!
557
+    #
558
+    ##################################################
559
+    #
560
+    #  If you see the server send an Access-Challenge,
561
+    #  and the client never sends another Access-Request,
562
+    #  then
563
+    #
564
+    #   STOP!
565
+    #
566
+    #  The server certificate has to have special OID's
567
+    #  in it, or else the Microsoft clients will silently
568
+    #  fail.  See the "scripts/xpextensions" file for
569
+    #  details, and the following page:
570
+    #
571
+    # http://support.microsoft.com/kb/814394/en-us
572
+    #
573
+    #  For additional Windows XP SP2 issues, see:
574
+    #
575
+    # http://support.microsoft.com/kb/885453/en-us
576
+    #
577
+    #
578
+    #  If is still doesn't work, and you're using Samba,
579
+    #  you may be encountering a Samba bug.  See:
580
+    #
581
+    # https://bugzilla.samba.org/show_bug.cgi?id=6563
582
+    #
583
+    #  Note that we do not necessarily agree with their
584
+    #  explanation... but the fix does appear to work.
585
+    #
586
+    ##################################################
587
+
588
+    #
589
+    #  The tunneled EAP session needs a default EAP type
590
+    #  which is separate from the one for the non-tunneled
591
+    #  EAP module.  Inside of the TLS/PEAP tunnel, we
592
+    #  recommend using EAP-MS-CHAPv2.
593
+    #
594
+    #  The PEAP module needs the TLS module to be installed
595
+    #  and configured, in order to use the TLS tunnel
596
+    #  inside of the EAP packet.  You will still need to
597
+    #  configure the TLS module, even if you do not want
598
+    #  to deploy EAP-TLS in your network.  Users will not
599
+    #  be able to request EAP-TLS, as it requires them to
600
+    #  have a client certificate.  EAP-PEAP does not
601
+    #  require a client certificate.
602
+    #
603
+    #
604
+    #  You can make PEAP require a client cert by setting
605
+    #
606
+    # EAP-TLS-Require-Client-Cert = Yes
607
+    #
608
+    #  in the control items for a request.
609
+    #
610
+    peap {
611
+      #  The tunneled EAP session needs a default
612
+      #  EAP type which is separate from the one for
613
+      #  the non-tunneled EAP module.  Inside of the
614
+      #  PEAP tunnel, we recommend using MS-CHAPv2,
615
+      #  as that is the default type supported by
616
+      #  Windows clients.
617
+      default_eap_type = mschapv2
618
+
619
+      #  the PEAP module also has these configuration
620
+      #  items, which are the same as for TTLS.
621
+      copy_request_to_tunnel = no
622
+      use_tunneled_reply = no
623
+
624
+      #  When the tunneled session is proxied, the
625
+      #  home server may not understand EAP-MSCHAP-V2.
626
+      #  Set this entry to "no" to proxy the tunneled
627
+      #  EAP-MSCHAP-V2 as normal MSCHAPv2.
628
+    # proxy_tunneled_request_as_eap = yes
629
+
630
+      #
631
+      #  The inner tunneled request can be sent
632
+      #  through a virtual server constructed
633
+      #  specifically for this purpose.
634
+      #
635
+      #  If this entry is commented out, the inner
636
+      #  tunneled request will be sent through
637
+      #  the virtual server that processed the
638
+      #  outer requests.
639
+      #
640
+      virtual_server = "inner-tunnel"
641
+
642
+      # This option enables support for MS-SoH
643
+      # see doc/SoH.txt for more info.
644
+      # It is disabled by default.
645
+      #
646
+#     soh = yes
647
+
648
+      #
649
+      # The SoH reply will be turned into a request which
650
+      # can be sent to a specific virtual server:
651
+      #
652
+#     soh_virtual_server = "soh-server"
653
+    }
654
+
655
+    #
656
+    #  This takes no configuration.
657
+    #
658
+    #  Note that it is the EAP MS-CHAPv2 sub-module, not
659
+    #  the main 'mschap' module.
660
+    #
661
+    #  Note also that in order for this sub-module to work,
662
+    #  the main 'mschap' module MUST ALSO be configured.
663
+    #
664
+    #  This module is the *Microsoft* implementation of MS-CHAPv2
665
+    #  in EAP.  There is another (incompatible) implementation
666
+    #  of MS-CHAPv2 in EAP by Cisco, which FreeRADIUS does not
667
+    #  currently support.
668
+    #
669
+    mschapv2 {
670
+      #  Prior to version 2.1.11, the module never
671
+      #  sent the MS-CHAP-Error message to the
672
+      #  client.  This worked, but it had issues
673
+      #  when the cached password was wrong.  The
674
+      #  server *should* send "E=691 R=0" to the
675
+      #  client, which tells it to prompt the user
676
+      #  for a new password.
677
+      #
678
+      #  The default is to behave as in 2.1.10 and
679
+      #  earlier, which is known to work.  If you
680
+      #  set "send_error = yes", then the error
681
+      #  message will be sent back to the client.
682
+      #  This *may* help some clients work better,
683
+      #  but *may* also cause other clients to stop
684
+      #  working.
685
+      #
686
+#     send_error = no
687
+    }
688
+  }

+ 205
- 0
freeradius/config/users View File

@@ -0,0 +1,205 @@
1
+#
2
+# Please read the documentation file ../doc/processing_users_file,
3
+# or 'man 5 users' (after installing the server) for more information.
4
+#
5
+# This file contains authentication security and configuration
6
+# information for each user.  Accounting requests are NOT processed
7
+# through this file.  Instead, see 'acct_users', in this directory.
8
+#
9
+# The first field is the user's name and can be up to
10
+# 253 characters in length.  This is followed (on the same line) with
11
+# the list of authentication requirements for that user.  This can
12
+# include password, comm server name, comm server port number, protocol
13
+# type (perhaps set by the "hints" file), and huntgroup name (set by
14
+# the "huntgroups" file).
15
+#
16
+# If you are not sure why a particular reply is being sent by the
17
+# server, then run the server in debugging mode (radiusd -X), and
18
+# you will see which entries in this file are matched.
19
+#
20
+# When an authentication request is received from the comm server,
21
+# these values are tested. Only the first match is used unless the
22
+# "Fall-Through" variable is set to "Yes".
23
+#
24
+# A special user named "DEFAULT" matches on all usernames.
25
+# You can have several DEFAULT entries. All entries are processed
26
+# in the order they appear in this file. The first entry that
27
+# matches the login-request will stop processing unless you use
28
+# the Fall-Through variable.
29
+#
30
+# If you use the database support to turn this file into a .db or .dbm
31
+# file, the DEFAULT entries _have_ to be at the end of this file and
32
+# you can't have multiple entries for one username.
33
+#
34
+# Indented (with the tab character) lines following the first
35
+# line indicate the configuration values to be passed back to
36
+# the comm server to allow the initiation of a user session.
37
+# This can include things like the PPP configuration values
38
+# or the host to log the user onto.
39
+#
40
+# You can include another `users' file with `$INCLUDE users.other'
41
+#
42
+
43
+#
44
+# For a list of RADIUS attributes, and links to their definitions,
45
+# see:
46
+#
47
+# http://www.freeradius.org/rfc/attributes.html
48
+#
49
+
50
+#
51
+# Deny access for a specific user.  Note that this entry MUST
52
+# be before any other 'Auth-Type' attribute which results in the user
53
+# being authenticated.
54
+#
55
+# Note that there is NO 'Fall-Through' attribute, so the user will not
56
+# be given any additional resources.
57
+#
58
+#lameuser Auth-Type := Reject
59
+#   Reply-Message = "Your account has been disabled."
60
+
61
+#
62
+# Deny access for a group of users.
63
+#
64
+# Note that there is NO 'Fall-Through' attribute, so the user will not
65
+# be given any additional resources.
66
+#
67
+#DEFAULT  Group == "disabled", Auth-Type := Reject
68
+#   Reply-Message = "Your account has been disabled."
69
+#
70
+
71
+#
72
+# This is a complete entry for "steve". Note that there is no Fall-Through
73
+# entry so that no DEFAULT entry will be used, and the user will NOT
74
+# get any attributes in addition to the ones listed here.
75
+#
76
+#steve  Cleartext-Password := "testing"
77
+# Service-Type = Framed-User,
78
+# Framed-Protocol = PPP,
79
+# Framed-IP-Address = 172.16.3.33,
80
+# Framed-IP-Netmask = 255.255.255.0,
81
+# Framed-Routing = Broadcast-Listen,
82
+# Framed-Filter-Id = "std.ppp",
83
+# Framed-MTU = 1500,
84
+# Framed-Compression = Van-Jacobsen-TCP-IP
85
+
86
+#
87
+# This is an entry for a user with a space in their name.
88
+# Note the double quotes surrounding the name.
89
+#
90
+#"John Doe" Cleartext-Password := "hello"
91
+#   Reply-Message = "Hello, %{User-Name}"
92
+
93
+#
94
+# Dial user back and telnet to the default host for that port
95
+#
96
+#Deg  Cleartext-Password := "ge55ged"
97
+# Service-Type = Callback-Login-User,
98
+# Login-IP-Host = 0.0.0.0,
99
+# Callback-Number = "9,5551212",
100
+# Login-Service = Telnet,
101
+# Login-TCP-Port = Telnet
102
+
103
+#
104
+# Another complete entry. After the user "dialbk" has logged in, the
105
+# connection will be broken and the user will be dialed back after which
106
+# he will get a connection to the host "timeshare1".
107
+#
108
+#dialbk Cleartext-Password := "callme"
109
+# Service-Type = Callback-Login-User,
110
+# Login-IP-Host = timeshare1,
111
+# Login-Service = PortMaster,
112
+# Callback-Number = "9,1-800-555-1212"
113
+
114
+#
115
+# user "swilson" will only get a static IP number if he logs in with
116
+# a framed protocol on a terminal server in Alphen (see the huntgroups file).
117
+#
118
+# Note that by setting "Fall-Through", other attributes will be added from
119
+# the following DEFAULT entries
120
+#
121
+#swilson  Service-Type == Framed-User, Huntgroup-Name == "alphen"
122
+#   Framed-IP-Address = 192.168.1.65,
123
+#   Fall-Through = Yes
124
+
125
+#
126
+# If the user logs in as 'username.shell', then authenticate them
127
+# using the default method, give them shell access, and stop processing
128
+# the rest of the file.
129
+#
130
+#DEFAULT  Suffix == ".shell"
131
+#   Service-Type = Login-User,
132
+#   Login-Service = Telnet,
133
+#   Login-IP-Host = your.shell.machine
134
+
135
+
136
+#
137
+# The rest of this file contains the several DEFAULT entries.
138
+# DEFAULT entries match with all login names.
139
+# Note that DEFAULT entries can also Fall-Through (see first entry).
140
+# A name-value pair from a DEFAULT entry will _NEVER_ override
141
+# an already existing name-value pair.
142
+#
143
+
144
+#
145
+# Set up different IP address pools for the terminal servers.
146
+# Note that the "+" behind the IP address means that this is the "base"
147
+# IP address. The Port-Id (S0, S1 etc) will be added to it.
148
+#
149
+#DEFAULT  Service-Type == Framed-User, Huntgroup-Name == "alphen"
150
+#   Framed-IP-Address = 192.168.1.32+,
151
+#   Fall-Through = Yes
152
+
153
+#DEFAULT  Service-Type == Framed-User, Huntgroup-Name == "delft"
154
+#   Framed-IP-Address = 192.168.2.32+,
155
+#   Fall-Through = Yes
156
+
157
+#
158
+# Sample defaults for all framed connections.
159
+#
160
+#DEFAULT  Service-Type == Framed-User
161
+# Framed-IP-Address = 255.255.255.254,
162
+# Framed-MTU = 576,
163
+# Service-Type = Framed-User,
164
+# Fall-Through = Yes
165
+
166
+#
167
+# Default for PPP: dynamic IP address, PPP mode, VJ-compression.
168
+# NOTE: we do not use Hint = "PPP", since PPP might also be auto-detected
169
+# by the terminal server in which case there may not be a "P" suffix.
170
+# The terminal server sends "Framed-Protocol = PPP" for auto PPP.
171
+#
172
+DEFAULT Framed-Protocol == PPP
173
+  Framed-Protocol = PPP,
174
+  Framed-Compression = Van-Jacobson-TCP-IP
175
+
176
+#
177
+# Default for CSLIP: dynamic IP address, SLIP mode, VJ-compression.
178
+#
179
+DEFAULT Hint == "CSLIP"
180
+  Framed-Protocol = SLIP,
181
+  Framed-Compression = Van-Jacobson-TCP-IP
182
+
183
+#
184
+# Default for SLIP: dynamic IP address, SLIP mode.
185
+#
186
+DEFAULT Hint == "SLIP"
187
+  Framed-Protocol = SLIP
188
+
189
+#
190
+# Last default: rlogin to our main server.
191
+#
192
+#DEFAULT
193
+# Service-Type = Login-User,
194
+# Login-Service = Rlogin,
195
+# Login-IP-Host = shellbox.ispdomain.com
196
+
197
+# #
198
+# # Last default: shell on the local terminal server.
199
+# #
200
+# DEFAULT
201
+#   Service-Type = Administrative-User
202
+
203
+bob Cleartext-Password := "hello"
204
+
205
+# On no match, the user is denied access.

+ 7
- 0
freeradius/run.sh View File

@@ -0,0 +1,7 @@
1
+#! /usr/bin/env bash
2
+
3
+. /common.sh
4
+
5
+replace_files
6
+
7
+freeradius -X

+ 3
- 0
freeradius/vars-files View File

@@ -0,0 +1,3 @@
1
+users /etc/freeradius/users
2
+clients.conf /etc/freeradius/clients.conf
3
+eap.conf /etc.freeradius/eap.conf

+ 19
- 0
freeradius/vars-vars View File

@@ -0,0 +1,19 @@
1
+DHCP_TSIG_KEY_NAME
2
+DHCP_TSIG_KEY_ALGO
3
+DHCP_TSIG_KEY_SECRET
4
+
5
+DHCP_DNS_MASTER
6
+DHCP_DNS_SERVER
7
+DHCP_TFTP_SERVER
8
+DHCP_ROUTERS
9
+
10
+DHCP_DOMAIN
11
+DHCP_SITE_DOMAIN
12
+DHCP_DYN_IPS_DOMAIN
13
+DHCP_REV_DOMAIN
14
+
15
+DHCP_SUBNET
16
+DHCP_NETMASK
17
+DHCP_IP_FIRST
18
+DHCP_IP_LAST
19
+DHCP_BROADCAST

+ 7
- 0
update_vars.sh View File

@@ -0,0 +1,7 @@
1
+#! /usr/bin/env sh
2
+
3
+vars=$(cat env | cut -d= -f1)
4
+for docker in isc-dhcp tftpd apache
5
+do
6
+  echo "${vars}" > "./${docker}/vars-vars"
7
+done

Loading…
Cancel
Save