# Modify Dataclass with iRule

**URL:** <https://community.f5.com/t/modify-dataclass-with-irule/40843>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [June 1, 2012, 3:18pm UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843 "2012-06-01T15:18:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![GavinW\_29074](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@GavinW\_29074](https://community.f5.com/u/GavinW_29074)\
**Post date:** [June 1, 2012, 3:18pm UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843/1 "2012-06-01T15:18:05Z")

</div>

Hi there,

I’ve been tasked with investigating if it’s possible to get an iRule to modify a dataclass on the F5’s…

The background is that we’ve implemented HTTP Basic authentication within some of our iRules which references a dataclass.

We’d prefer not to have to drop into the gui to add/delete/modify user entries in this dataclass, and instead have a VIP on the F5’s which serves an iRule which allows users to change their current password/add users/remove users/etc…

So is it possible to modify a dataclass from an iRule???

Cheers

Gavin

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [June 1, 2012, 3:42pm UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843/2 "2012-06-01T15:42:02Z")

</div>

Hi Gavin,

Natively, by design iRules can’t modify the config on disk. I guess you could use a sideband connection to make an iControl call. Or you could log a specially formatted message and use a user\_alert.conf script to make an iControl call to modify the data group.

But the best practice in my mind for would be to build a separate iControl app to do this.

Aaron

---

<div class="post-metadata">

**Author:** ![GavinW\_29074](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@GavinW\_29074](https://community.f5.com/u/GavinW_29074)\
**Post date:** [June 1, 2012, 3:45pm UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843/3 "2012-06-01T15:45:25Z")

</div>

Aaron

Cheers for the info…

Might explore the sideband stuff in a bit more detail…

iControl was guna be my next option, but it’s guna be a bit of a nightmare to make sure all the users have the right software etc to be able to run an iControl app, which is why I liked the simplicity of having the functionality hosted on the F5…

Will post back what I come up with…

Cheers

Gavin

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [June 1, 2012, 3:46pm UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843/4 "2012-06-01T15:46:35Z")

</div>

You could set up a web app that makes iControl calls to modify the data group to avoid any client compatibility issues.

Aaron

---

<div class="post-metadata">

**Author:** ![GavinW\_29074](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@GavinW\_29074](https://community.f5.com/u/GavinW_29074)\
**Post date:** [June 1, 2012, 3:48pm UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843/5 "2012-06-01T15:48:31Z")

</div>

That could be another option, with a virtual app server sat behind the F5’s…

Cheers

Gav

---

<div class="post-metadata">

**Author:** ![GavinW\_29074](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@GavinW\_29074](https://community.f5.com/u/GavinW_29074)\
**Post date:** [June 7, 2012, 8:35am UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843/6 "2012-06-07T08:35:27Z")

</div>

Ok, I’ve done a bit more digging around making an iControl call from within an iRule, and it looks like that’s a no-go, as the Sideband functionality doesn’t appear to support basic authentication…

So I’ve either got to get the iRule to call an intermediary system, or write a stand-alone iControl app…

More to follow 🙂

Cheers

Gav

---

<div class="post-metadata">

**Author:** ![Joel\_Moses](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@Joel\_Moses](https://community.f5.com/u/Joel_Moses)\
**Post date:** [June 8, 2012, 1:30am UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843/7 "2012-06-08T01:30:21Z")

</div>

GavinW: Well, that’s not ENTIRELY true. Think of a sideband connection as a total “clean slate”.

You can absolutely send Basic Auth via a sideband connection, you just need to manually construct and send the “Authorization” header to the server in the transaction -- in other words, don’t wait for the server to 401, just go ahead and send the header it wants, formatted properly. The Authorization header is basically the username and password joined with a colon, then base64 encoded. See here: [Basic access authentication - Wikipedia](http://en.wikipedia.org/wiki/Basic_access_authentication)

Pretty simple on the BigIP:

```tcl
set username "user"
set password "pass"
HTTP::header insert Authorization "Basic [b64encode "${username}:${password}]"

```

… or in the case of sideband, the header would just be another line of text you send out the socket. Cheers!

---

<div class="post-metadata">

**Author:** ![hoolio](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@hoolio](https://community.f5.com/u/hoolio)\
**Post date:** [June 8, 2012, 1:33am UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843/8 "2012-06-08T01:33:14Z")

</div>

You could also open a sideband connection to another virtual that has an HTTP profile and then use HTTP:: iRule commands to modify the requests.

Aaron

---

<div class="post-metadata">

**Author:** ![GavinW\_29074](https://avatars.discourse-cdn.com/v4/letter/g/a9a28c/32.png) [@GavinW\_29074](https://community.f5.com/u/GavinW_29074)\
**Post date:** [June 8, 2012, 11:53am UTC](https://community.f5.com/t/modify-dataclass-with-irule/40843/9 "2012-06-08T11:53:30Z")

</div>

Ahh, cheers for the heads up…

Will give it a go and see what I can do 🙂

Cheers

Gavin
