+ Responder ao Tópico



  1. #1
    Sempre na luta Avatar de jacksonezidio
    Ingresso
    Jun 2008
    Localização
    São Paulo - SP
    Posts
    208
    Posts de Blog
    1

    Post Problema Mikrotik+freeradius+mysql

    Olá boa noite a todos, estou com um problema na implantação de um servidor freeradius+mysql em um servidor ubuntu.

    Nesse cenário estou usando pppoe+radius no servidor Mikrotik, mas quando faço a requisição da autenticação na máquina cliente, recebo erro de usuario ou senha inválidos ( no windows ), já olhei cada arquivo do freeradius e nao consegui resolver.. estou usando a versao 2.1.0 a qual veio diferente da versao anterior.

    Segue a saída dos logs:
    arquivo /var/log/freeradius/radius.log

    Sat Feb 27 20:53:48 2010 : Info: rlm_sql (sql): Attempting to connect to radius@localhost:/radius
    Sat Feb 27 20:53:48 2010 : Info: rlm_sql_mysql: Starting connect to MySQL server for #0
    Sat Feb 27 20:53:48 2010 : Info: rlm_sql_mysql: Starting connect to MySQL server for #1
    Sat Feb 27 20:53:48 2010 : Info: rlm_sql_mysql: Starting connect to MySQL server for #2
    Sat Feb 27 20:53:48 2010 : Info: rlm_sql_mysql: Starting connect to MySQL server for #3
    Sat Feb 27 20:53:48 2010 : Info: rlm_sql_mysql: Starting connect to MySQL server for #4
    Sat Feb 27 20:53:48 2010 : Info: Ready to process requests.
    Sat Feb 27 20:53:57 2010 : Info: rlm_radutmp: NAS mikrotik restarted (Accounting-On packet seen)
    Sat Feb 27 20:53:57 2010 : Error: rlm_radutmp: Error accessing file /var/log/freeradius/radutmp: No such file or directory
    Sat Feb 27 21:07:13 2010 : Info: Exiting normall

  2. #2
    Sempre na luta Avatar de jacksonezidio
    Ingresso
    Jun 2008
    Localização
    São Paulo - SP
    Posts
    208
    Posts de Blog
    1

    Padrão

    - cont.

    debug: freeradius -X

    FreeRADIUS Version 2.1.0, for host i486-pc-linux-gnu, built on Apr 30 2009 at 07:22:56
    Copyright (C) 1999-2008 The FreeRADIUS server project and contributors.
    There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
    PARTICULAR PURPOSE.
    You may redistribute copies of FreeRADIUS under the terms of the
    GNU General Public License v2.
    Starting - reading configuration files ...
    including configuration file /etc/freeradius/radiusd.conf
    including configuration file /etc/freeradius/proxy.conf
    including configuration file /etc/freeradius/clients.conf
    including files in directory /etc/freeradius/modules/
    including configuration file /etc/freeradius/modules/sradutmp
    including configuration file /etc/freeradius/modules/ldap
    including configuration file /etc/freeradius/modules/pap
    including configuration file /etc/freeradius/modules/radutmp
    including configuration file /etc/freeradius/modules/expr
    including configuration file /etc/freeradius/modules/mac2ip
    including configuration file /etc/freeradius/modules/wimax
    including configuration file /etc/freeradius/modules/digest
    including configuration file /etc/freeradius/modules/expiration
    including configuration file /etc/freeradius/modules/smbpasswd
    including configuration file /etc/freeradius/modules/unix
    including configuration file /etc/freeradius/modules/attr_filter
    including configuration file /etc/freeradius/modules/echo
    including configuration file /etc/freeradius/modules/realm
    including configuration file /etc/freeradius/modules/detail.example.com
    including configuration file /etc/freeradius/modules/passwd
    including configuration file /etc/freeradius/modules/pam
    including configuration file /etc/freeradius/modules/chap
    including configuration file /etc/freeradius/modules/mschap
    including configuration file /etc/freeradius/modules/sql_log
    including configuration file /etc/freeradius/modules/exec
    including configuration file /etc/freeradius/modules/acct_unique
    including configuration file /etc/freeradius/modules/counter
    including configuration file /etc/freeradius/modules/policy
    including configuration file /etc/freeradius/modules/linelog
    including configuration file /etc/freeradius/modules/krb5
    including configuration file /etc/freeradius/modules/mac2vlan
    including configuration file /etc/freeradius/modules/files
    including configuration file /etc/freeradius/modules/detail.log
    including configuration file /etc/freeradius/modules/etc_group
    including configuration file /etc/freeradius/modules/ippool
    including configuration file /etc/freeradius/modules/detail
    including configuration file /etc/freeradius/modules/attr_rewrite
    including configuration file /etc/freeradius/modules/preprocess
    including configuration file /etc/freeradius/modules/checkval
    including configuration file /etc/freeradius/modules/always
    including configuration file /etc/freeradius/modules/logintime
    including configuration file /etc/freeradius/modules/inner-eap
    including configuration file /etc/freeradius/eap.conf
    including configuration file /etc/freeradius/sql.conf
    including configuration file /etc/freeradius/sql/mysql/counter.conf
    including configuration file /etc/freeradius/policy.conf
    including files in directory /etc/freeradius/sites-enabled/
    including configuration file /etc/freeradius/sites-enabled/inner-tunnel
    including configuration file /etc/freeradius/sites-enabled/default
    including dictionary file /etc/freeradius/dictionary

  3. #3
    Sempre na luta Avatar de jacksonezidio
    Ingresso
    Jun 2008
    Localização
    São Paulo - SP
    Posts
    208
    Posts de Blog
    1

    Padrão

    - cont.

    main {
    prefix = "/usr"
    localstatedir = "/var"
    logdir = "/var/log/freeradius"
    libdir = "/usr/lib/freeradius"
    radacctdir = "/var/log/freeradius/radacct"
    hostname_lookups = no
    max_request_time = 30
    cleanup_delay = 5
    max_requests = 1024
    allow_core_dumps = no
    pidfile = "/var/run/freeradius/freeradius.pid"
    checkrad = "/usr/sbin/checkrad"
    debug_level = 0
    proxy_requests = yes
    log {
    stripped_names = no
    auth = no
    auth_badpass = no
    auth_goodpass = no
    }
    security {
    max_attributes = 200
    reject_delay = 1
    status_server = yes
    }
    }
    client localhost {
    ipaddr = 127.0.0.1
    require_message_authenticator = no
    secret = "testing123"
    nastype = "other"
    }
    client 192.168.1.100 {
    require_message_authenticator = no
    secret = "12345"
    shortname = "mikrotik"
    nastype = "other"
    }
    radiusd: #### Loading Realms and Home Servers ####
    proxy server {
    retry_delay = 5
    retry_count = 3
    default_fallback = no
    dead_time = 120
    wake_all_if_all_dead = no
    }
    home_server localhost {
    ipaddr = 127.0.0.1
    port = 1812
    type = "auth"
    secret = "testing123"
    response_window = 20
    max_outstanding = 65536
    zombie_period = 40
    status_check = "status-server"
    ping_interval = 30
    check_interval = 30
    num_answers_to_alive = 3
    num_pings_to_alive = 3
    revive_interval = 120
    status_check_timeout = 4
    }
    home_server_pool my_auth_failover {
    type = fail-over
    home_server = localhost
    }
    realm example.com {
    auth_pool = my_auth_failover
    }
    realm LOCAL {
    }
    radiusd: #### Instantiating modules ####
    instantiate {
    Module: Linked to module rlm_exec
    Module: Instantiating exec
    exec {
    wait = no
    input_pairs = "request"
    shell_escape = yes
    }
    Module: Linked to module rlm_expr
    Module: Instantiating expr
    Module: Linked to module rlm_expiration
    Module: Instantiating expiration
    expiration {
    reply-message = "Password Has Expired "
    }
    Module: Linked to module rlm_logintime
    Module: Instantiating logintime
    logintime {
    reply-message = "You are calling outside your allowed timespan "
    minimum-timeout = 60
    }
    }
    radiusd: #### Loading Virtual Servers ####
    server inner-tunnel {
    modules {
    Module: Checking authenticate {...} for more modules to load
    Module: Linked to module rlm_pap
    Module: Instantiating pap
    pap {
    encryption_scheme = "auto"
    auto_header = no
    }
    Module: Linked to module rlm_chap
    Module: Instantiating chap
    Module: Linked to module rlm_mschap
    Module: Instantiating mschap
    mschap {
    use_mppe = yes
    require_encryption = no
    require_strong = no
    with_ntdomain_hack = no
    }
    Module: Linked to module rlm_eap
    Module: Instantiating eap
    eap {
    default_eap_type = "md5"
    timer_expire = 60
    ignore_unknown_eap_types = no
    cisco_accounting_username_bug = no
    max_sessions = 2048
    }
    Module: Linked to sub-module rlm_eap_md5
    Module: Instantiating eap-md5
    Module: Linked to sub-module rlm_eap_leap
    Module: Instantiating eap-leap
    Module: Linked to sub-module rlm_eap_gtc
    Module: Instantiating eap-gtc
    gtc {
    challenge = "Password: "
    auth_type = "PAP"
    }
    Ignoring EAP-Type/tls because we do not have OpenSSL support.
    Ignoring EAP-Type/ttls because we do not have OpenSSL support.
    Ignoring EAP-Type/peap because we do not have OpenSSL support.
    Module: Linked to sub-module rlm_eap_mschapv2
    Module: Instantiating eap-mschapv2
    mschapv2 {
    with_ntdomain_hack = no
    }
    Module: Checking authorize {...} for more modules to load
    Module: Linked to module rlm_realm
    Module: Instantiating suffix
    realm suffix {
    format = "suffix"
    delimiter = "@"
    ignore_default = no
    ignore_null = no
    }
    Module: Linked to module rlm_sql
    Module: Instantiating sql
    sql {
    driver = "rlm_sql_mysql"
    server = "localhost"
    port = ""
    login = "radius"
    password = "radpass"
    radius_db = "radius"
    read_groups = yes
    sqltrace = no
    sqltracefile = "/var/log/freeradius/sqltrace.sql"
    readclients = no
    deletestalesessions = yes
    num_sql_socks = 5
    sql_user_name = ""
    default_user_profile = ""
    nas_query = "SELECT id,nasname,shortname,type,secret FROM nas"
    authorize_check_query = ""
    authorize_group_check_query = ""
    authorize_group_reply_query = ""
    accounting_onoff_query = ""
    accounting_update_query = ""
    accounting_update_query_alt = ""
    accounting_start_query = ""
    accounting_start_query_alt = ""
    accounting_stop_query = ""
    accounting_stop_query_alt = ""
    connect_failure_retry_delay = 60
    simul_count_query = ""
    simul_verify_query = ""
    postauth_query = ""
    safe-characters = "@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_: /"
    }
    rlm_sql (sql): Driver rlm_sql_mysql (module rlm_sql_mysql) loaded and linked
    rlm_sql (sql): Attempting to connect to radius@localhost:/radius
    rlm_sql (sql): starting 0
    rlm_sql (sql): Attempting to connect rlm_sql_mysql #0
    rlm_sql_mysql: Starting connect to MySQL server for #0
    rlm_sql (sql): Connected new DB handle, #0
    rlm_sql (sql): starting 1
    rlm_sql (sql): Attempting to connect rlm_sql_mysql #1
    rlm_sql_mysql: Starting connect to MySQL server for #1
    rlm_sql (sql): Connected new DB handle, #1
    rlm_sql (sql): starting 2
    rlm_sql (sql): Attempting to connect rlm_sql_mysql #2
    rlm_sql_mysql: Starting connect to MySQL server for #2
    rlm_sql (sql): Connected new DB handle, #2
    rlm_sql (sql): starting 3
    rlm_sql (sql): Attempting to connect rlm_sql_mysql #3
    rlm_sql_mysql: Starting connect to MySQL server for #3
    rlm_sql (sql): Connected new DB handle, #3
    rlm_sql (sql): starting 4
    rlm_sql (sql): Attempting to connect rlm_sql_mysql #4
    rlm_sql_mysql: Starting connect to MySQL server for #4
    rlm_sql (sql): Connected new DB handle, #4
    Module: Checking session {...} for more modules to load
    Module: Linked to module rlm_radutmp
    Module: Instantiating radutmp
    radutmp {
    filename = "/var/log/freeradius/radutmp"
    username = "%{User-Name}"
    case_sensitive = yes
    check_with_nas = yes
    perm = 384
    callerid = yes
    }
    Module: Checking post-proxy {...} for more modules to load
    Module: Checking post-auth {...} for more modules to load
    Module: Linked to module rlm_attr_filter
    Module: Instantiating attr_filter.access_reject
    attr_filter attr_filter.access_reject {
    attrsfile = "/etc/freeradius/attrs.access_reject"
    key = "%{User-Name}"
    }
    }
    }
    modules {
    Module: Checking authenticate {...} for more modules to load
    Module: Checking authorize {...} for more modules to load
    Module: Linked to module rlm_preprocess
    Module: Instantiating preprocess
    preprocess {
    huntgroups = "/etc/freeradius/huntgroups"
    hints = "/etc/freeradius/hints"
    with_ascend_hack = no
    ascend_channels_per_line = 23
    with_ntdomain_hack = no
    with_specialix_jetstream_hack = no
    with_cisco_vsa_hack = no
    with_alvarion_vsa_hack = no
    }
    Module: Checking preacct {...} for more modules to load
    Module: Checking accounting {...} for more modules to load
    Module: Linked to module rlm_detail
    Module: Instantiating detail
    detail {
    detailfile = "/var/log/freeradius/radacct/%{Client-IP-Address}/detail-%Y%m%d"
    header = "%t"
    detailperm = 384
    dirperm = 493
    locking = no
    log_packet_header = no
    }
    Module: Checking session {...} for more modules to load
    Module: Checking post-proxy {...} for more modules to load
    Module: Checking post-auth {...} for more modules to load
    }
    radiusd: #### Opening IP addresses and Ports ####
    listen {
    type = "auth"
    ipaddr = *
    port = 0
    }
    listen {
    type = "acct"
    ipaddr = *
    port = 0
    }
    Listening on authentication address * port 1812
    Listening on accounting address * port 1813
    Listening on proxy address * port 1814
    Ready to process requests.
    rad_recv: Access-Request packet from host 192.168.1.100 port 34058, id=9, length=184
    Service-Type = Framed-User
    Framed-Protocol = PPP
    NAS-Port = 6
    NAS-Port-Type = Ethernet
    User-Name = "fulano"
    Calling-Station-Id = "00:19:66:E4:5BF"
    Called-Station-Id = "pppoe"
    NAS-Port-Id = "ether1"
    MS-CHAP-Challenge = 0xdaf63c5ec2a86b3875fc5f7b87aa0bb7
    MS-CHAP2-Response = 0x01008a8f44bdf01790709a010845bd88540d00000000000000005325699ad25b15f86d907764b0b6591be71f3122d288f78a
    NAS-Identifier = "MikroTik"
    NAS-IP-Address = 192.168.1.100
    +- entering group authorize {...}
    ++[preprocess] returns ok
    ++[chap] returns noop
    [mschap] Found MS-CHAP attributes. Setting 'Auth-Type = mschap'
    ++[mschap] returns ok
    [suffix] No '@' in User-Name = "fulano", looking up realm NULL
    [suffix] No such realm "NULL"
    ++[suffix] returns noop
    [eap] No EAP-Message, not doing EAP
    ++[eap] returns noop
    rlm_sql (sql): Reserving sql socket id: 4
    expand: ->
    [sql] Error generating query; rejecting user
    rlm_sql (sql): Released sql socket id: 4
    ++[sql] returns fail
    Using Post-Auth-Type Reject
    +- entering group REJECT {...}
    expand: %{User-Name} -> fulano
    attr_filter: Matched entry DEFAULT at line 11
    ++[attr_filter.access_reject] returns updated
    Delaying reject of request 0 for 1 seconds
    Going to the next request
    Waking up in 0.9 seconds.
    Sending delayed reject for request 0
    Sending Access-Reject of id 9 to 192.168.1.100 port 34058
    Waking up in 4.9 seconds.
    Cleaning up request 0 ID 9 with timestamp +5
    Ready to process requests.

  4. #4
    Sempre na luta Avatar de jacksonezidio
    Ingresso
    Jun 2008
    Localização
    São Paulo - SP
    Posts
    208
    Posts de Blog
    1

    Padrão

    - cont.
    arquivo sql.conf

    # -*- text -*-
    ##
    ## sql.conf -- SQL modules
    ##
    ## $Id$
    ######################################################################
    #
    # Configuration for the SQL module
    #
    # The database schemas and queries are located in subdirectories:
    #
    # sql/DB/schema.sql Schema
    # sql/DB/dialup.conf Basic dialup (including policy) queries
    # sql/DB/counter.conf counter
    # sql/DB/ippool.conf IP Pools in SQL
    # sql/DB/ippool.sql schema for IP pools.
    #
    # Where "DB" is mysql, mssql, oracle, or postgresql.
    #
    sql {
    #
    # Set the database to one of:
    #
    # mysql, mssql, oracle, postgresql
    #
    database = "mysql"
    #
    # Which FreeRADIUS driver to use.
    #
    driver = "rlm_sql_${database}"
    # Connection info:
    server = "localhost"
    login = "radius"
    password = "radpass"
    # Database table configuration for everything except Oracle
    radius_db = "radius"
    # If you are using Oracle then use this instead
    # radius_db = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=your_sid)))"
    # If you want both stop and start records logged to the
    # same SQL table, leave this as is. If you want them in
    # different tables, put the start table in acct_table1
    # and stop table in acct_table2
    acct_table1 = "radacct"
    acct_table2 = "radacct"
    # Allow for storing data after authentication
    postauth_table = "radpostauth"
    authcheck_table = "radcheck"
    authreply_table = "radreply"
    groupcheck_table = "radgroupcheck"
    groupreply_table = "radgroupreply"
    # Table to keep group info
    # usergroup_table = "radusergroup"
    # If set to 'yes' (default) we read the group tables
    # If set to 'no' the user MUST have Fall-Through = Yes in the radreply table
    # read_groups = yes
    # Remove stale session if checkrad does not see a double login
    deletestalesessions = yes
    # Print all SQL statements when in debug mode (-x)
    sqltrace = no
    sqltracefile = ${logdir}/sqltrace.sql
    # number of sql connections to make to server
    num_sql_socks = 5
    # number of seconds to dely retrying on a failed database
    # connection (per_socket)
    connect_failure_retry_delay = 60
    # Set to 'yes' to read radius clients from the database ('nas' table)
    # Clients will ONLY be read on server startup. For performance
    # and security reasons, finding clients via SQL queries CANNOT
    # be done "live" while the server is running.
    #
    #readclients = yes
    # Table to keep radius client info
    nas_table = "nas"
    # Read driver-specific configuration
    # $INCLUDE sql/${database}/dialup.conf
    }

    ------------------------------------------------------------------------------------------


    Galera nao consigo autenticar alguem tem alguma sugestao?

  5. #5
    Sempre na luta Avatar de jacksonezidio
    Ingresso
    Jun 2008
    Localização
    São Paulo - SP
    Posts
    208
    Posts de Blog
    1

    Padrão

    e ai galera ninguem??

  6. #6

    Padrão

    Citação Postado originalmente por jacksonezidio Ver Post
    e ai galera ninguem??
    Vc já criou seu bd no mysql, configurou o sql.conf de acordo com os dados criando no mysql(pois parece esta default), configurou o radius.conf corretamente???

    Att.Juliano.

  7. #7

    Padrão

    Veja, muito simples e funcional:
    Citação Postado originalmente por Raniel; wiki MikroTIK

  8. #8
    Sempre na luta Avatar de jacksonezidio
    Ingresso
    Jun 2008
    Localização
    São Paulo - SP
    Posts
    208
    Posts de Blog
    1

    Padrão

    Citação Postado originalmente por netxtreme Ver Post
    Vc já criou seu bd no mysql, configurou o sql.conf de acordo com os dados criando no mysql(pois parece esta default), configurou o radius.conf corretamente???

    Att.Juliano.
    na versao 1.1.7 vai tranquilo, agora nessa versao 2.1.0 ta dando esse erro.. importei o schema do mysql da propria pasta do freeradius..

  9. #9
    Sempre na luta Avatar de jacksonezidio
    Ingresso
    Jun 2008
    Localização
    São Paulo - SP
    Posts
    208
    Posts de Blog
    1

    Padrão

    Citação Postado originalmente por Raniel Ver Post
    Veja, muito simples e funcional:
    Esse tutorial usa versao antiga do freeradius.

  10. #10

    Padrão

    Citação Postado originalmente por jacksonezidio Ver Post
    Esse tutorial usa versao antiga do freeradius.
    A um tempo atrás eu fiz um tutorial sobre o freeradius 2.x no Debian 5, segue o link abaixo.

    https://under-linux.org/f143/freerad...torial-131918/

    Talvez possa te ajudar

    Att.Juliano
    Ps. Se der certo poste a solução que você encontrou...
    Grande abrs.

  11. #11
    Sempre na luta Avatar de jacksonezidio
    Ingresso
    Jun 2008
    Localização
    São Paulo - SP
    Posts
    208
    Posts de Blog
    1

    Padrão

    Citação Postado originalmente por netxtreme Ver Post
    A um tempo atrás eu fiz um tutorial sobre o freeradius 2.x no Debian 5, segue o link abaixo.

    https://under-linux.org/f143/freerad...torial-131918/

    Talvez possa te ajudar

    Att.Juliano
    Ps. Se der certo poste a solução que você encontrou...
    Grande abrs.
    Agradeço vou refazer td aki pra ver oq acontece, depois posto aki o resultado vlw!