Help with parsing regex in tripwire


 
Thread Tools Search this Thread
Operating Systems Solaris Help with parsing regex in tripwire
# 1  
Old 11-14-2014
Help with parsing regex in tripwire

We have regex that we use to parse compliance policies in tripwire. can you please help to correct the regex :

policy is "Verify That Exported File Systems Specify the ro (read-only) Option"

the regex is

Code:
^[#].*-o[\ \t]+(?!ro[\ \t]+|ro[=,]\S+|\S+,ro[=,]\S+|\S+,ro[\ \t]+).*$

this does not work. how do we fix it ?

the dfstab looks like this :

Code:
# cat /etc/dfs/dfstab

#       Place share(1M) commands here for automatic execution
#       on entering init state 3.
#
#       Issue the command 'svcadm enable network/nfs/server' to
#       run the NFS daemon processes and the share commands, after adding
#       the very first entry to this file.
#
#       share [-F fstype] [ -o options] [-d "<text>"] <pathname> [resource]
#       .e.g,
#       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2

# 2  
Old 11-14-2014
To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)



Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums
# 3  
Old 11-14-2014
reply

I apologize as i am new and needed help desperately as all my options are exhausted. Also those 4 different threads are different scenarios . i can combine them all at once if that is appropriate.
# 4  
Old 11-14-2014
Yes please. They're all nearly the same question and closely related, so the same topic.
# 5  
Old 11-14-2014
reply

reposting with all 4 questions in one :

I am trying to parse below regex's and it does not work with tripwire. can you please verify this and advise what should be changed to fix this :

1. policy - "Verify That Exported File Systems Specify the ro (read-only) Option" regex - ^[#].*-o[\ \t]+(?!ro[\ \t]+|ro[=,]\S+|\S+,ro[=,]\S+|\S+,ro[\ \t]+).*$

2. This test verifies that all exported file systems found in /etc/exports specify a fully qualified domain name containing "thcss.com" or a NIS netgroup. regex - ^[^#].*(?Smilie?:ro|rw|root)=|Smilie(?!\b(?:[a-z0-9]+(?:-[a-z0-9]+)*\.)+thecss\.com\b|@[a-z0-9]+)(?:\S+)

3. This test verifies that exported file systems do not have the "root=" option specified. regex - ^[^#].*-o[\ \t]+(?=root=\S+|\S+,root=\S+).*

4. Perform the following to determine if the system is configured as recommended: # grep -v '^#' /etc/dfs/dfstab | grep 'share' | grep -v '/usr/sbin/share' [there should be no output]

need help with regex on this.

the dfstab contains # and blank lines
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help with understanding this regex in a Perl script parsing a 'complex' string

Hi, I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies

2. Shell Programming and Scripting

Sendmail K command regex: adding exclusion/negative lookahead to regex -a@MATCH

I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works: LOCAL_CONFIG # Kcheckaddress regex -a@MATCH +<@+?\.++?\.(us|info|to|br|bid|cn|ru) LOCAL_RULESETS SLocal_check_mail # check address against various regex... (0 Replies)
Discussion started by: RobbieTheK
0 Replies

3. Shell Programming and Scripting

Perl, RegEx - Help me to understand the regex!

I am not a big expert in regex and have just little understanding of that language. Could you help me to understand the regular Perl expression: ^(?!if\b|else\b|while\b|)(?:+?\s+){1,6}(+\s*)\(*\) *?(?:^*;?+){0,10}\{ ------ This is regex to select functions from a C/C++ source and defined in... (2 Replies)
Discussion started by: alex_5161
2 Replies

4. Solaris

Help with parsing regex in tripwire for Solaris 10 dfstab FQDN

Help with parsing regex in tripwire: the rule is" This test verifies that all exported file systems found in /etc/exports specify a fully qualified domain name containing "thecss.com" or a NIS netgroup.." regex that does not work is : ... (1 Reply)
Discussion started by: bathija12
1 Replies

5. Solaris

Help with parsing regex in tripwire for Solaris 10 dfstab

Help with parsing regex in tripwire: the rule is" This test verifies that exported file systems do not have the "root=<host>" option specified." regex that does not work is : ^.*-o+(?=root=\S+|\S+,root=\S+).* the dfstab looks like this : # cat /etc/dfs/dfstab # Place... (1 Reply)
Discussion started by: bathija12
1 Replies

6. Shell Programming and Scripting

Parsing expect_out using regex in expect script

Hi, I am trying to write an expect script. Being a newbie in expect, maybee this is a silly doubt but i am stuck here. So essentially , i want the o/p of one router command to be captured . Its something like this Stats Input Rx : 1234 Input Bytes : 3456 My expect script looks ... (5 Replies)
Discussion started by: ashy_g
5 Replies

7. UNIX for Dummies Questions & Answers

read regex from ID file, print regex and line below from source file

I have a file of protein sequences with headers (my source file). Based on a list of IDs (which are included in some of the headers), I'd like to print out only the specified sequences, with only the ID as header. In other words, I'd like to search source.txt for the terms in IDs.txt, and print... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

8. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

9. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

10. Shell Programming and Scripting

Perl parsing compared to Ksh parsing

#! /usr/local/bin/perl -w $ip = "$ARGV"; $rw = "$ARGV"; $snmpg = "/usr/local/bin/snmpbulkget -v2c -Cn1 -Cn2 -Os -c $rw"; $snmpw = "/usr/local/bin/snmpwalk -Os -c $rw"; $syst=`$snmpg $ip system sysName sysObjectID`; sysDescr.0 = STRING: Cisco Internetwork Operating System Software... (1 Reply)
Discussion started by: popeye
1 Replies
Login or Register to Ask a Question