Documentation ¶
Overview ¶
Packet to interpret the bits https://tools.ietf.org/html/rfc2865 https://tools.ietf.org/html/rfc2866
https://github.com/bronze1man/radius https://github.com/hoffoo/go-radius https://github.com/alouca/goradius
Simple Radius server inspired on net/http.
Index ¶
- func CHAPMatch(pass string, chapPass []byte, chapChallenge []byte) bool
- func DecodeFour(b []byte) uint32
- func DecodeIP(b []byte) net.IP
- func DecryptPassword(raw []byte, p *Packet) string
- func DefaultPacket(p *Packet, code PacketCode, msg string, verbose bool, logger *log.Logger) []byte
- func EncodeFour(in uint32) []byte
- func HandleFunc(code PacketCode, statusType int, handler func(io.Writer, *Packet))
- func Listen(addr string) (*net.UDPConn, error)
- func Serve(conn *net.UDPConn, secret string, cidrs []string, verbose bool, ...) error
- func ValidateAcctRequest(p *Packet) string
- func ValidateAuthRequest(p *Packet) string
- type Attr
- type AttrEncoder
- type AttributeType
- type Packet
- type PacketCode
- type VendorAttr
- type VendorAttrString
- type VendorHeader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CHAPMatch ¶
MD5(ID+secret+challenge)
The Response Value is the one-way hash calculated over a stream of octets consisting of the Identifier, followed by (concatenated with) the "secret", followed by (concatenated with) the Challenge Value. The length of the Response Value depends upon the hash algorithm used (16 octets for MD5). https://tools.ietf.org/html/rfc1994
func DecodeFour ¶
func DecryptPassword ¶
func DefaultPacket ¶
Create a simple response.
func EncodeFour ¶
func HandleFunc ¶
func HandleFunc(code PacketCode, statusType int, handler func(io.Writer, *Packet))
func ValidateAcctRequest ¶
Return non-empty string on error
func ValidateAuthRequest ¶
Types ¶
type Attr ¶
type Attr struct {
// contains filtered or unexported fields
}
func (Attr) Type ¶
func (a Attr) Type() AttributeType
type AttrEncoder ¶
type AttrEncoder interface { Encode() []byte Type() AttributeType Bytes() []byte Length() uint8 String() string }
func NewAttr ¶
func NewAttr(attrType AttributeType, bytes []byte, length uint8) AttrEncoder
type AttributeType ¶
type AttributeType uint8
const ( UserName AttributeType = iota //1 UserPassword AttributeType = iota //2 CHAPPassword AttributeType = iota //3 NASIPAddress AttributeType = iota //4 NASPort AttributeType = iota //5 ServiceType AttributeType = iota //6 FramedProtocol AttributeType = iota //7 FramedIPAddress AttributeType = iota //8 FramedIPNetmask AttributeType = iota //9 FramedRouting AttributeType = iota //10 FilterId AttributeType = iota //11 FramedMTU AttributeType = iota //12 FramedCompression AttributeType = iota //13 LoginIPHost AttributeType = iota //14 LoginService AttributeType = iota //15 LoginTCPPort AttributeType = iota //16 ReplyMessage AttributeType = iota //18 CallbackNumber AttributeType = iota //19 CallbackId AttributeType = iota //20 FramedRoute AttributeType = iota //22 FramedIPXNetwork AttributeType = iota //23 State AttributeType = iota //24 Class AttributeType = iota //25 VendorSpecific AttributeType = iota SessionTimeout AttributeType = iota IdleTimeout AttributeType = iota TerminationAction AttributeType = iota CalledStationId AttributeType = iota CallingStationId AttributeType = iota NASIdentifier AttributeType = iota ProxyState AttributeType = iota LoginLATService AttributeType = iota LoginLATNode AttributeType = iota LoginLATGroup AttributeType = iota FramedAppleTalkLink AttributeType = iota FramedAppleTalkNetwork AttributeType = iota FramedAppleTalkZone AttributeType = iota AcctStatusType AttributeType = iota AcctDelayTime AttributeType = iota AcctInputOctets AttributeType = iota AcctOutputOctets AttributeType = iota AcctSessionId AttributeType = iota AcctAuthentic AttributeType = iota AcctSessionTime AttributeType = iota AcctInputPackets AttributeType = iota AcctOutputPackets AttributeType = iota AcctTerminateCause AttributeType = iota AcctMultiSessionId AttributeType = iota AcctLinkCount AttributeType = iota AcctInputGigawords AttributeType = iota //52 AcctOutputGigawords AttributeType = iota Unassigned1 AttributeType = iota EventTimestamp AttributeType = iota EgressVLANID AttributeType = iota IngressFilters AttributeType = iota EgressVLANName AttributeType = iota UserPriorityTable AttributeType = iota //59 CHAPChallenge AttributeType = 60 NASPortType AttributeType = 61 PortLimit AttributeType = 62 LoginLATPort AttributeType = 63 //end rfc2865 rfc 2866 TunnelType AttributeType = iota TunnelMediumType AttributeType = iota TunnelClientEndpoint AttributeType = iota TunnelServerEndpoint AttributeType = iota AcctTunnelConnection AttributeType = iota TunnelPassword AttributeType = iota ARAPPassword AttributeType = iota ARAPFeatures AttributeType = iota ARAPZoneAccess AttributeType = iota ARAPSecurity AttributeType = iota ARAPSecurityData AttributeType = iota PasswordRetry AttributeType = iota Prompt AttributeType = iota ConnectInfo AttributeType = iota ConfigurationToken AttributeType = iota EAPMessage AttributeType = iota MessageAuthenticator AttributeType = iota TunnelPrivateGroupID AttributeType = iota TunnelAssignmentID AttributeType = iota TunnelPreference AttributeType = iota ARAPChallengeResponse AttributeType = iota AcctInterimInterval AttributeType = iota AcctTunnelPacketsLost AttributeType = iota NASPortId AttributeType = iota FramedPool AttributeType = iota CUI AttributeType = iota TunnelClientAuthID AttributeType = iota TunnelServerAuthID AttributeType = iota NASFilterRule AttributeType = iota Unassigned AttributeType = iota OriginatingLineInfo AttributeType = iota NASIPv6Address AttributeType = iota FramedInterfaceId AttributeType = iota FramedIPv6Prefix AttributeType = iota LoginIPv6Host AttributeType = iota FramedIPv6Route AttributeType = iota FramedIPv6Pool AttributeType = iota ErrorCause AttributeType = iota EAPKeyName AttributeType = iota DigestResponse AttributeType = iota DigestRealm AttributeType = iota DigestNonce AttributeType = iota DigestResponseAuth AttributeType = iota DigestNextnonce AttributeType = iota DigestMethod AttributeType = iota DigestURI AttributeType = iota DigestQop AttributeType = iota DigestAlgorithm AttributeType = iota DigestEntityBodyHash AttributeType = iota DigestCNonce AttributeType = iota DigestNonceCount AttributeType = iota DigestUsername AttributeType = iota DigestOpaque AttributeType = iota DigestAuthParam AttributeType = iota DigestAKAAuts AttributeType = iota DigestDomain AttributeType = iota DigestStale AttributeType = iota DigestHA1 AttributeType = iota SIPAOR AttributeType = iota DelegatedIPv6Prefix AttributeType = iota MIP6FeatureVector AttributeType = iota MIP6HomeLinkPrefix AttributeType = iota OperatorName AttributeType = iota LocationInformation AttributeType = iota LocationData AttributeType = iota BasicLocationPolicyRules AttributeType = iota ExtendedLocationPolicyRules AttributeType = iota LocationCapable AttributeType = iota RequestedLocationInfo AttributeType = iota FramedManagementProtocol AttributeType = iota ManagementTransportProtectio AttributeType = iota ManagementPolicyId AttributeType = iota ManagementPrivilegeLevel AttributeType = iota PKMSSCert AttributeType = iota PKMCACert AttributeType = iota PKMConfigSettings AttributeType = iota PKMCryptosuiteList AttributeType = iota PKMSAID AttributeType = iota PKMSADescriptor AttributeType = iota PKMAuthKey AttributeType = iota DSLiteTunnelName AttributeType = iota MobileNodeIdentifier AttributeType = iota ServiceSelection AttributeType = iota PMIP6HomeLMAIPv6Address AttributeType = iota PMIP6VisitedLMAIPv6Address AttributeType = iota PMIP6HomeLMAIPv4Address AttributeType = iota PMIP6VisitedLMAIPv4Address AttributeType = iota PMIP6HomeHNPrefix AttributeType = iota PMIP6VisitedHNPrefix AttributeType = iota PMIP6HomeInterfaceID AttributeType = iota PMIP6VisitedInterfaceID AttributeType = iota PMIP6HomeIPv4HoA AttributeType = iota PMIP6VisitedIPv4HoA AttributeType = iota PMIP6HomeDHCP4ServerAddress AttributeType = iota PMIP6VisitedDHCP4ServerAddre AttributeType = iota PMIP6HomeDHCP6ServerAddress AttributeType = iota PMIP6VisitedDHCP6ServerAddre AttributeType = iota UnassignedStart AttributeType = 161 UnassignedEnd AttributeType = 191 ExperimentalStart AttributeType = 192 ExperimentalEnd AttributeType = 223 ImplementationSpecificStart AttributeType = 224 ImplementationSpecificEnd AttributeType = 240 ReservedStart AttributeType = 241 ReservedEnd AttributeType = 254 )
func (AttributeType) String ¶
func (i AttributeType) String() string
type Packet ¶
type Packet struct { Code PacketCode Identifier uint8 Len uint16 Auth []byte // Request Authenticator Attrs []AttrEncoder // contains filtered or unexported fields }
func (*Packet) HasAttr ¶
func (p *Packet) HasAttr(key AttributeType) bool
If requested attribute exists
func (*Packet) Response ¶
func (p *Packet) Response(code PacketCode, attrs []AttrEncoder, verbose bool, logger *log.Logger) []byte
Create response packet
type PacketCode ¶
type PacketCode uint8
const ( AccessRequest PacketCode = 1 AccessAccept PacketCode = 2 AccessReject PacketCode = 3 AccountingRequest PacketCode = 4 AccountingResponse PacketCode = 5 AccessChallenge PacketCode = 11 StatusServer PacketCode = 12 //(experimental) StatusClient PacketCode = 13 //(experimental) Reserved PacketCode = 255 )
func (PacketCode) String ¶
func (i PacketCode) String() string
type VendorAttr ¶
type VendorAttr struct { Type AttributeType VendorId uint32 Values []VendorAttrString }
func (VendorAttr) Encode ¶
func (t VendorAttr) Encode() AttrEncoder
Convert VendorAttr to generic Attr
type VendorAttrString ¶
type VendorAttrString struct { Type vendor.AttributeType Value []byte }
type VendorHeader ¶
func VendorSpecificHeader ¶
func VendorSpecificHeader(b []byte) VendorHeader