title: Unlang write to file FreeRADIUS
body: <p>I know I might be facing an impossible mission. What I do want is radiusd to write down every mac received in an Acces-Request, for later on deny access to those MAC.</p>
  
  <p>I know the policies file is written in unlang, bad news are that radiusd does not have any write permissions on any of the conf files...</p>
  
  <p>Anyway, was anyone capable of WRITTING to a file in the POLICY PROCESSING of FreeRADIUS?</p>
  
  <p>What I want to achieve would be something like this:</p>
  
  <p><strong>raddb/sites-available/default</strong></p>
  
  <pre><code>authorize {
    rewrite_calling_station_id
    unauthorized_macs
    if(ok) {
      reject        
    }
    else {
      update control {
        Auth-Type := Accept
      }
      GET MAC FROM CALLIN_STATION_ID ATTRIBUTE
      WRITE THIS F***ING MAC TO unauthorized_macs FILE
   }
  </code></pre>
  
  <p>}  </p>
  
  <p>Thanks to Arran, I could solve this the following way:</p>
  
  <pre><code>authorize {
    rewrite_calling_station_id
    authMac
    if(ok) {
      reject
    }   
    else {
      linelog
      update control {
        Auth-Type := Accept
      }   
   }
  </code></pre>
  
  <p>} </p>
  
  <p>Where linelog is configured as follows:
  <strong>raddb/mods-enabled/linelog</strong></p>
  
  <pre><code>linelog {
      filename = /path/to/hell/authMac
      format = "%{Calling-Station-ID}"
    }
  </code></pre>