iRulesLX
105 Topicsunable to verify the first certificate with node.js
I am trying to read a datagroup using node.js and am receiving the message "unable to verify the first certificate". I have confirmed the command manually with curl and it does return the datagroup as expected: curl -sk -uadmin:admin -v https://127.0.0.1/mgmt/tm/ltm/data-group/internal/~acc~dgroup result: …"records":[{"name":"test","data":"test"}] f5_data_group.js has the following var bigip = new iControl({ host: '127.0.0.1', proto: 'https', port: '443', username: 'admin', pass: 'admin', strict: 'false', debug: 'true' }); var dgPath = '/ltm/data-group/internal/~acc~dgroup'; exports.getDataGroup = function(callback) { bigip.list(dgPath, function(err, res) { console.log( 'bigip.list dgPath:',dgPath,'err:',err); callback(res); }); }; Console.log is giving the following message: plugin[/acc/f5_mfa_plugin.f5_mfa_extension] bigip.list dgPath: /ltm/data-group/internal/~acc~dgroup err: { [Error: unable to verify the first certificate] code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' } I assume it might have to do with using self signed certificate on the big-ip however strict is set to false above. Any suggestions? APM 12.1.23.3KViews0likes3CommentsIRULE DEVELOPMENT COURSE
Hi FOLKS , How good is the irule development course ? should I consider taking 3-day class training or there are other resource over internet or any book from F5 I should consider ? Also , is it worth deep diving with irule which uses TCL scripting as oppose to irule-LX which is java based ? I believe this is the roadway F5 now considering for future by using irule LX . Please advise ! Thanks1.5KViews0likes12CommentsNPM Package Installation Error
Hi everyone! I wanted to ask about an error which I have encountered. It has to something with file system being only read - only. I have shared the error below. Anyone kind of help will be highly appreciated. npm ERR! Linux 3.10.0-514.26.2.el7.ve.x86_64 npm ERR! argv "/usr/bin/node" "/usr/bin/.npm__" "install" "-g" "feo" "--save" npm ERR! node v6.9.1 npm ERR! npmv3.10.8 npm ERR! path /usr/lib/node_modules npm ERR! code EROFS npm ERR! errno -30 npm ERR! syscall access npm ERR! rofs EROFS: read-only file system, access '/usr/lib/node_modules' npm ERR! rofs This is most likely not a problem with npm itself npm ERR! rofs and is related to the file system being read-only. npm ERR! rofs npm ERR! rofs Often virtualized file systems, or other file systems npm ERR! rofs that don't support symlinks, give this error. npm ERR! Please include the following file with any support request: npm ERR!/var/ilx/workspaces/Common/ilxws_Demo/extensions/ilxex_Demo/npm-debug.log999Views0likes2CommentsHow to update data-group using iRules LX
I created the following code with iRules LX. The code does not work properly. The log is output up to "console.log('getDataGroup start');". Does anyone know how to check if icontrol is successfully connecting to BIG-IP? List() of iControl doesn't seem to work properly. iRule --------------------------------------------- when ACCESS_POLICY_AGENT_EVENT { switch [ACCESS::policy agent_id] { .... .... "add_user" { set ilx_handle [ILX::init "f5_mfa_plugin" "f5_mfa_extension"] set user [ACCESS::session data get session.logon.last.username] set sec [ACCESS::session data get session.custom.otp.secret] log local0.info "INFO: f5_mfa.tcl - user:$user secret:$sec" if {[catch {set result [ILX::call $ilx_handle -timeout 10000 addUser $user $sec]} result]} { log local0.error "ERROR: f5_mfa.tcl - Client - [IP::client_addr], ILX failure: $result" return } log local0.info "user:$result" } } } iRuleLX: index.js --------------------------------------------- var f5 = require('f5-nodejs'); var User = require('./f5_user').User; var ilx = new f5.ILXServer(); ilx.listen(); ilx.addMethod('addUser', function(req,res) { console.log("START: addMethod", req.params()[0], req.params()[1]); var user = new User(req.params()[0]); user.secret = req.params()[1]; user.add(function(response) { res.reply(response); }); }); iRuleLX: user.js --------------------------------------------- var dg = require('./f5_data_group'); exports.User = function(name) { var self = this; self.name = name; self.enrolled = false; self.secret = ""; this.methods = {}; /** * add a user to the data group * * @return {Boolean} user added */ this.add = function(callback){ console.log('user.add start'); if(typeof this.secret === undefined) { console.error('you have to set a secret before calling add'); callback(false); } console.log(self.name, self.secret); dg.put(self.name, self.secret, function(status) { if(status) { self.enrolled = true; } callback(true); }); }; }; iRuleLX: f5_data_group.js --------------------------------------------- var iControl = require('icontrol'); var util = require('util'); // set API connection and authentication var bigip = new iControl({ host: '127.0.0.1', proto: 'https', port: '443', username: 'admin', pass: 'admin', strict: 'true', debug: 'true' }); var dgPath = '/ltm/data-group/internal/~Common~token_keys'; var exports = module.exports = {}; //ignore self signed certificate process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; bigip.strict = false; /** * return dta group * * @param {Function} callback */ exports.getDataGroup = function(callback) { console.log('getDataGroup start'); bigip.list(dgPath, function(err, res) { callback(res); }); }; /** * add key:data pair to the data group * * @param {String} key * @param {String} data * @param {Function} callback */ exports.put = function (key, data, callback) { console.log('put data-group key:', key, 'data:', data); exports.getDataGroup(function(res) { // add new user to the object stack // make sure the data group isn't empty if (typeof res.records !== 'undefined') { // make sure user doesn't already exist var isset = false; for(var record in res.records) { if(res.records[record].name == key) { // user exists, update secret res.records[record].data = data; isset = true; break; } } if(!isset) { // user doesn't exist, add them res.records.push({"name": key, "data": data}); } } else { res.records = [{"name": key, "data": data}]; } // populate the arguments for the http post args = { data: { records: res.records }, header: { "Content-Type": "application/json" } }; bigip.modify(dgPath, args, function(err, res) { callback(data); }); }); };923Views0likes3CommentsIrule to divert traffic - Not working
Can someone please review my code? rule jiradivertingtraffic{ when HTTP_REQUEST { log local0. "Request: [HTTP::host]" log local0. "Request: [HTTP::uri]" log local0. "Request: [HTTP::path]" if { [string tolower [HTTP::host]] equals "jiratest.corp.chartercom.com" } { if {[string tolower [HTTP::uri]] contains "/rest"} { pool JIRA-test-pool } } else { if { [string tolower [HTTP::host]] not equals "jiratest.corp.chartercom.com" } { if { [string tolower [HTTP::path]] equals "/login.jsp"} { pool JIRA-test-pool } } else { pool JIRA-test-external-pool } } } }828Views0likes8CommentsiRule ReWrite - Inserting JSON Parameter into Request + Removing Same JSON Parameter from Response
Looking to leverage an iRule to Dynamically insert a JSON Parameter into an HTTP payload and then scrub it in the response back to the client. However, we want to inspect the Payload and only perform this action when a specific JSON Parameter value exsits. Example: When JSON Key/Value of "Animal": "Dog" exists, Dynamically insert new Parameter of "Color": "Brown". The server(pool member) would see this new parameter and act on it, but in the HTTP response to the client, the new parameter is not in the payload. Do iRules know how to handle and work with JSON specifically? Is an LX iRule going to be need to do this advanced rewrite? Thanks!811Views0likes4CommentsiRules LX for APM password reset
We are attempting to use APM as a Self-Service Password Reset resolution. I can modify Active Directory attributes than to this article https://devcentral.f5.com/s/articles/apm-cookbook-modify-ldap-attribute-values-using-iruleslx-21850 , however, has anyone used iRules LX to reset a password. I'll validate the user first with other methods but want to reset a forgotten password rather than the APM built-in Kerberos API reset with the current password to update to a new one. Thanks795Views1like1CommentiRulesLX: Invalid command name
I want to write an ILX solution that generates OTPs. This ILX is then called within a APM session profile and the OTP value is used throughout the authentication process. I have an irule agent in the access policy that calls an irule, who then calls ILX. ILX generates the OTP and, for now, replies back to TCL who simply outputs it in the LTM log file. Later, this will change and the script will set a session variable. However, the ILX::call throws an error: Rule /Common/otpgen_pl/otpgen <ACCESS_POLICY_AGENT_EVENT>: ILX failure: invalid command name "abc123" This is the TCL: when ACCESS_POLICY_AGENT_EVENT { set handle [ILX::init "otpgen_pl" "otpgen_ext"] if {[catch [ILX::call $handle "otpgen"] result]} { log local0.error"ILX failure: $result" return } log local0.error"OTP generated successfully: $result" } This is the node.js: var f5 = require('f5-nodejs'); var ilx = new f5.ILXServer(); ilx.addMethod('otpgen', function (req, res) { res.reply('abc123'); }); ilx.listen(); I don't get the error message, how is the return string an "invalid command"?Solved756Views0likes2Comments