[ANN] FreeRADIUS officially webscale

Arran Cudbard-Bell a.cudbardb at freeradius.org
Sat Jun 7 01:33:37 CEST 2014


https://twitter.com/arr2036

twitter {
	oauth_consumer_key = ''
	oauth_consumer_secret = ''
	oauth_access_token = ''
	oauth_access_token_secret = ''
	api_uri = 'https://api.twitter.com/1.1/statuses/update.json'
}

server {
...

authorize {
	# Stage 1.0 - Generating the signature
	# Stage 1.1 - What are we tweeting about?
	update request {
		Tmp-String-0 := "User %{User-Name} connected to %{NAS-Identifier} #WatchingYou #NoPrivacy #FreeRADIUS #Winning"
	}

	# Stage 1.2 - Generate the nonce (base64 encoding of 32 bytes of random data)
	update request {
		Tmp-Octets-0  := "0x%{randstr:hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh}"
		Tmp-String-1  := "%{base64:&Tmp-Octets-0}"
		Tmp-Integer-0 := "%l"
	}

	# Stage 1.3 - Build the paramter string
	update request {
		Tmp-String-2 := "\
			oauth_consumer_key=%{urlquote:${twitter.oauth_consumer_key}}&\
			oauth_nonce=%{urlquote:%{Tmp-String-1}}&\
			oauth_signature_method=HMAC-SHA1&\
			oauth_timestamp=%{Tmp-Integer-0}&\
			oauth_token=%{urlquote:${twitter.oauth_access_token}}&\
			oauth_version=1.0&\
			status=%{urlquote:%{Tmp-String-0}}"
	}

	# Stage 1.4 - Create the signature base string
	update request {
		Tmp-String-3 := "POST&%{urlquote:${twitter.api_uri}}&%{urlquote:%{Tmp-String-2}}"
	}

	# Stage 1.5 - Create the signing key
	update request {
		Tmp-String-4 := "%{urlquote:${twitter.oauth_consumer_secret}}&%{urlquote:${twitter.oauth_access_token_secret}}"
	}

	# Stage 1.6 - Create the oAuth signature
	update request {
		Tmp-Octets-1 := "0x%{hmacsha1:&Tmp-String-3 &Tmp-String-4}"
	}
	update request {
		Tmp-String-5 := "%{base64:&Tmp-Octets-1}"
	}

	# Stage 2.0 - Building the request
	# Stage 2.1 - Adding the authorization header
	update control {
		REST-HTTP-Header := "Connection: close"
		REST-HTTP-Header += "\
			Authorization: OAuth \
			oauth_consumer_key=\"%{urlquote:${twitter.oauth_consumer_key}}\", \
			oauth_nonce=\"%{urlquote:%{Tmp-String-1}}\", \
			oauth_signature=\"%{urlquote:%{Tmp-String-5}}\", \
			oauth_signature_method=\"HMAC-SHA1\", \
			oauth_timestamp=\"%{Tmp-Integer-0}\", \
			oauth_token=\"%{urlquote:${twitter.oauth_access_token}}\", \
			oauth_version=\"1.0\""
	}

	# Stage 3.0 - Sending the request
	update request {
		Tmp-String-6 := "%{rest:POST ${twitter.api_uri} status=%{Tmp-String-0}}"
	}
}
}

v3.0.x HEAD only.

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS Development Team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 881 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20140607/e76124e9/attachment.pgp>


More information about the Freeradius-Users mailing list